new-dialogue #8

Merged
fedir merged 33 commits from new-dialogue into main 2025-05-06 18:10:44 +02:00
4 changed files with 52 additions and 20 deletions
Showing only changes of commit ac1d7c1535 - Show all commits

View File

@ -2,9 +2,17 @@ SHELL=/bin/bash
# configurable options # configurable options
SOURCES_DIR := ./src ifndef ($(SOURCES_DIR))
TESTS_DIR := ./tests SOURCES_DIR := ./src
BUILD_DIR := ./build endif
ifndef ($(TESTS_DIR))
TESTS_DIR := ./tests
endif
ifndef ($(BUILD_DIR))
BUILD_DIR := ./build
endif
CC := gcc CC := gcc
CXX := g++ CXX := g++
@ -49,12 +57,18 @@ ifeq ($(TEST), 1)
TARGETS += icfs_test TARGETS += icfs_test
endif endif
ifneq ($(DIALOGUE), 0)
TARGETS += $(BUILD_DIR)/icfs_dialogue
endif
# build! # build!
default: $(TARGETS) 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 $(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 $(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 $(BUILD_DIR)/perm_permissions_table.o: $(SOURCES_DIR)/perm_permissions_table.c $(SOURCES_DIR)/perm_permissions_table.h
$(CC) $(CFLAGS) -c $< $(LDFLAGS) -o $@ $(CC) $(CFLAGS) -c $< $(LDFLAGS) -o $@
CLEAN_TARGETS=clean-icfs
clean: ifneq ($(DIALOGUE), 0)
rm $(BUILD_DIR)/*.o $(BUILD_DIR)/icfs* 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 # configurable options
SOURCES_DIR := . ifndef ($(SOURCES_DIR))
TESTS_DIR := . SOURCES_DIR := .
BUILD_DIR := . endif
ifndef ($(TESTS_DIR))
TESTS_DIR := .
endif
ifndef ($(BUILD_DIR))
BUILD_DIR := .
endif
CC := gcc CC := gcc
CXX := g++ CXX := g++
@ -43,10 +51,10 @@ endif
# set up targets # set up targets
TARGETS := $(BUILD_DIR)/zenity TARGETS := $(BUILD_DIR)/icfs_dialogue
ifeq ($(TEST), 1) ifeq ($(TEST), 1)
TARGETS += zenity_test TARGETS += icfs_dialogue_test
endif endif
@ -54,16 +62,16 @@ endif
default: $(TARGETS) default: $(TARGETS)
.PHONY: clean zenity_test .PHONY: clean icfs_dialogue_test
zenity_test: $(BUILD_DIR)/zenity icfs_dialogue_test: $(BUILD_DIR)/icfs_dialogue
./zenity 666 cat /home/fedir Downloads $(BUILD_DIR)/icfs_dialogue 666 cat /home/fedir /Downloads
$(BUILD_DIR)/zenity: $(BUILD_DIR)/zenity.o $(BUILD_DIR)/icfs_dialogue: $(BUILD_DIR)/icfs_dialogue.o
$(CC) $(CFLAGS) $^ $(LDFLAGS) -o $(BUILD_DIR)/zenity $(CC) $(CFLAGS) $^ $(LDFLAGS) -o $(BUILD_DIR)/icfs_dialogue
$(BUILD_DIR)/zenity.o: $(SOURCES_DIR)/zenity-clone.c $(BUILD_DIR)/icfs_dialogue.o: $(SOURCES_DIR)/icfs_dialogue.c
$(CC) $(CFLAGS) -c $< $(LDFLAGS) -o $(BUILD_DIR)/zenity.o $(CC) $(CFLAGS) -c $< $(LDFLAGS) -o $(BUILD_DIR)/icfs_dialogue.o
clean: 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 else
echo "Database protection will not be tested due to the lack of setuid capabilites." echo "Database protection will not be tested due to the lack of setuid capabilites."
echo "To test it, run this script with '--setuid'." 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 sleep 5
fi fi