From ac1d7c1535d2b2f82f0f6ac5323bca61f35811cd Mon Sep 17 00:00:00 2001 From: fedir Date: Sat, 3 May 2025 12:03:54 +0200 Subject: [PATCH] Renamed zenity-clone to icfs-dialogue and improved makefile --- Makefile | 36 +++++++++++++++++---- src/gui/Makefile | 34 +++++++++++-------- src/gui/{zenity-clone.c => icfs_dialogue.c} | 0 test/test.bash | 2 +- 4 files changed, 52 insertions(+), 20 deletions(-) rename src/gui/{zenity-clone.c => icfs_dialogue.c} (100%) diff --git a/Makefile b/Makefile index 81d59b5..0c8386f 100644 --- a/Makefile +++ b/Makefile @@ -2,9 +2,17 @@ SHELL=/bin/bash # configurable options -SOURCES_DIR := ./src -TESTS_DIR := ./tests -BUILD_DIR := ./build +ifndef ($(SOURCES_DIR)) + SOURCES_DIR := ./src +endif + +ifndef ($(TESTS_DIR)) + TESTS_DIR := ./tests +endif + +ifndef ($(BUILD_DIR)) + BUILD_DIR := ./build +endif CC := gcc CXX := g++ @@ -49,12 +57,18 @@ ifeq ($(TEST), 1) TARGETS += icfs_test endif +ifneq ($(DIALOGUE), 0) + TARGETS += $(BUILD_DIR)/icfs_dialogue +endif # build! default: $(TARGETS) -.PHONY: clean +.PHONY: clean icfs_test clean-icfs clean-icfs_dialogue + +$(BUILD_DIR)/icfs_dialogue: + make -C $(SOURCES_DIR)/gui TEST=$(TEST) DEBUG=$(shell realpath $(DEBUG)) SOURCES_DIR=$(shell realpath $(SOURCES_DIR)/gui) BUILD_DIR=$(shell realpath $(BUILD_DIR)) TESTS_DIR=$(shell realpath $(TESTS_DIR)) $(BUILD_DIR)/icfs: $(BUILD_DIR)/main.o $(BUILD_DIR)/fuse_operations.o $(BUILD_DIR)/sourcefs.o $(BUILD_DIR)/ui-socket.o $(BUILD_DIR)/temp_permissions_table.o $(BUILD_DIR)/perm_permissions_table.o $(CC) $(CFLAGS) $^ $(LDFLAGS) -o $(BUILD_DIR)/icfs @@ -83,6 +97,16 @@ $(BUILD_DIR)/temp_permissions_table.o: $(SOURCES_DIR)/temp_permissions_table.c $ $(BUILD_DIR)/perm_permissions_table.o: $(SOURCES_DIR)/perm_permissions_table.c $(SOURCES_DIR)/perm_permissions_table.h $(CC) $(CFLAGS) -c $< $(LDFLAGS) -o $@ +CLEAN_TARGETS=clean-icfs -clean: - rm $(BUILD_DIR)/*.o $(BUILD_DIR)/icfs* +ifneq ($(DIALOGUE), 0) + CLEAN_TARGETS += clean-icfs_dialogue +endif + +clean: $(CLEAN_TARGETS) + +clean-icfs: + rm $(BUILD_DIR)/*.o $(BUILD_DIR)/icfs + +clean-icfs_dialogue: + make -C $(SOURCES_DIR)/gui clean SOURCES_DIR=$(shell realpath $(SOURCES_DIR)/gui) BUILD_DIR=$(shell realpath $(BUILD_DIR)) TESTS_DIR=$(shell realpath $(TESTS_DIR)) diff --git a/src/gui/Makefile b/src/gui/Makefile index 107b266..953b125 100644 --- a/src/gui/Makefile +++ b/src/gui/Makefile @@ -2,9 +2,17 @@ SHELL=/bin/bash # configurable options -SOURCES_DIR := . -TESTS_DIR := . -BUILD_DIR := . +ifndef ($(SOURCES_DIR)) + SOURCES_DIR := . +endif + +ifndef ($(TESTS_DIR)) + TESTS_DIR := . +endif + +ifndef ($(BUILD_DIR)) + BUILD_DIR := . +endif CC := gcc CXX := g++ @@ -43,10 +51,10 @@ endif # set up targets -TARGETS := $(BUILD_DIR)/zenity +TARGETS := $(BUILD_DIR)/icfs_dialogue ifeq ($(TEST), 1) - TARGETS += zenity_test + TARGETS += icfs_dialogue_test endif @@ -54,16 +62,16 @@ endif default: $(TARGETS) -.PHONY: clean zenity_test +.PHONY: clean icfs_dialogue_test -zenity_test: $(BUILD_DIR)/zenity - ./zenity 666 cat /home/fedir Downloads +icfs_dialogue_test: $(BUILD_DIR)/icfs_dialogue + $(BUILD_DIR)/icfs_dialogue 666 cat /home/fedir /Downloads -$(BUILD_DIR)/zenity: $(BUILD_DIR)/zenity.o - $(CC) $(CFLAGS) $^ $(LDFLAGS) -o $(BUILD_DIR)/zenity +$(BUILD_DIR)/icfs_dialogue: $(BUILD_DIR)/icfs_dialogue.o + $(CC) $(CFLAGS) $^ $(LDFLAGS) -o $(BUILD_DIR)/icfs_dialogue -$(BUILD_DIR)/zenity.o: $(SOURCES_DIR)/zenity-clone.c - $(CC) $(CFLAGS) -c $< $(LDFLAGS) -o $(BUILD_DIR)/zenity.o +$(BUILD_DIR)/icfs_dialogue.o: $(SOURCES_DIR)/icfs_dialogue.c + $(CC) $(CFLAGS) -c $< $(LDFLAGS) -o $(BUILD_DIR)/icfs_dialogue.o clean: - rm $(BUILD_DIR)/*.o $(BUILD_DIR)/zenity + rm $(BUILD_DIR)/*.o $(BUILD_DIR)/icfs_dialogue diff --git a/src/gui/zenity-clone.c b/src/gui/icfs_dialogue.c similarity index 100% rename from src/gui/zenity-clone.c rename to src/gui/icfs_dialogue.c diff --git a/test/test.bash b/test/test.bash index eeb9782..14c20f1 100755 --- a/test/test.bash +++ b/test/test.bash @@ -28,7 +28,7 @@ if [[ $1 == "--setuid" ]]; then else echo "Database protection will not be tested due to the lack of setuid capabilites." echo "To test it, run this script with '--setuid'." - valgrind -s ../build/icfs -o default_permissions ./protected ./.pt.db & + valgrind --leak-check=full -s ../build/icfs -o default_permissions ./protected ./.pt.db & sleep 5 fi