Renamed zenity-clone to icfs-dialogue and improved makefile

This commit is contained in:
fedir 2025-05-03 12:03:54 +02:00
parent 112d514f59
commit ac1d7c1535
Signed by: fedir
GPG Key ID: C959EE85F0C9362C
4 changed files with 52 additions and 20 deletions

View File

@ -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))

View File

@ -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

View File

@ -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