From 6671f3b7eb8d9d1e27505a9368a710adff1a83c5 Mon Sep 17 00:00:00 2001 From: Lukas Dullinger <129603980+itislu@users.noreply.github.com> Date: Mon, 30 Sep 2024 15:46:57 +0200 Subject: [PATCH 1/4] build: Move usage guides to the end of the help msgs in Makefile --- Makefile | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/Makefile b/Makefile index ec86e17e..5742f3c0 100644 --- a/Makefile +++ b/Makefile @@ -329,8 +329,6 @@ ffclean : # ****************************** HELP TARGETS ******************************** # help : - echo "Usage: make [\\$(STY_UND)target\\$(STY_RES)] [MODE=\"<\\$(STY_UND)mode1\\$(STY_RES)> [\\$(STY_UND)mode2\\$(STY_RES)] [...]\"]" - echo echo "Targets:" echo " all Build the project (default target)" echo " run Build and run the project" @@ -353,6 +351,7 @@ help : echo "Environment Variables:" echo " MODE Build mode to combine multiple targets" echo + echo "Usage: make [\\$(STY_UND)target\\$(STY_RES)] [MODE=\"<\\$(STY_UND)mode1\\$(STY_RES)> [\\$(STY_UND)mode2\\$(STY_RES)] [...]\"]" help-all : echo "Build the project." @@ -378,12 +377,14 @@ help-san : help-val : echo "Build the project and run the executable with valgrind." + echo echo "The following valgrind flags are used:" echo "$(VALGRINDFLAGS)" | tr ' ' '\n' | sed 's/^/ /' help-valfd : echo "Build the project and run the executable with valgrind and file descriptor tracking." echo "A new terminal window is opened to avoid inheriting open file descriptors." + echo echo "The following valgrind flags are used:" echo "$(VALGRINDFLAGS)" | tr ' ' '\n' | sed 's/^/ /' echo "File descriptor specific flags:" @@ -408,21 +409,21 @@ help-ffclean : echo "Remove build artifacts and the executable without checking for unknown files." help-print : - echo "Usage: make print-<\\$(STY_UND)variable name\\$(STY_RES)>" - echo echo "Print the value of a Makefile variable by appending the variable name to print-..." echo "Useful for Makefile debugging." + echo + echo "Usage: make print-<\\$(STY_UND)variable name\\$(STY_RES)>" help-help : - echo "Usage: make help-<\\$(STY_UND)target\\$(STY_RES)> | make <\\$(STY_UND)target\\$(STY_RES)>-help" - echo echo "Display more information for a specific target by appending or prepending help." + echo + echo "Usage: make help-<\\$(STY_UND)target\\$(STY_RES)> | make <\\$(STY_UND)target\\$(STY_RES)>-help" help-MODE MODE-help: - echo "Usage: make <\\$(STY_UND)target\\$(STY_RES)> MODE=\"<\\$(STY_UND)mode1\\$(STY_RES)> [\\$(STY_UND)mode2\\$(STY_RES)] [...]\"" - echo echo "Build mode to combine with other targets." echo "Multiple modes can be combined by separating them with a space." + echo + echo "Usage: make <\\$(STY_UND)target\\$(STY_RES)> MODE=\"<\\$(STY_UND)mode1\\$(STY_RES)> [\\$(STY_UND)mode2\\$(STY_RES)] [...]\"" %-help: $(MAKE) help-$(subst -help,,$@) From 17a837a80848d6e07c6ed67eb74f08046f7aec59 Mon Sep 17 00:00:00 2001 From: Lukas Dullinger <129603980+itislu@users.noreply.github.com> Date: Wed, 2 Oct 2024 14:24:30 +0200 Subject: [PATCH 2/4] fix: Ensure path of suppression file in Makefile with builtin variable --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 5742f3c0..36e08573 100644 --- a/Makefile +++ b/Makefile @@ -79,7 +79,7 @@ VALGRINDFLAGS = --errors-for-leak-kinds=all \ --read-var-info=yes \ --show-error-list=yes \ --show-leak-kinds=all \ - --suppressions=./minishell.supp \ + --suppressions=$(CURDIR)/minishell.supp \ --trace-children=yes \ --trace-children-skip=$(subst $(SPACE),$(COMMA),$(ABSOLUTE_PATHS)) \ --track-origins=yes From a43cc2466c9fb07d5f8296d1298aa92b40900146 Mon Sep 17 00:00:00 2001 From: Lukas <129603980+itislu@users.noreply.github.com> Date: Fri, 4 Oct 2024 01:47:17 +0000 Subject: [PATCH 3/4] build: Allow additional flags to make --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 36e08573..1828a9e5 100644 --- a/Makefile +++ b/Makefile @@ -53,7 +53,7 @@ CPPFLAGS := $(addprefix -I,$(INC_DIR) $(LIB_INCLUDES)) DEPFLAGS = -M -MP -MF $@ -MT "$(OBJ_DIR)/$*.o $@" LDFLAGS := $(addprefix -L,$(LIBRARIES)) LDLIBS := $(addprefix -l,$(patsubst lib%,%,$(notdir $(LIBRARIES) $(LIBRARIES_EXT)))) -MAKEFLAGS := -j -s +MAKEFLAGS += -j -s # Macro definitions From 07b77ea380f16fb1d3c031da9b801aa90f88e5b9 Mon Sep 17 00:00:00 2001 From: Lukas <129603980+itislu@users.noreply.github.com> Date: Fri, 4 Oct 2024 01:50:07 +0000 Subject: [PATCH 4/4] build: Use automatic variables whenever possible --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 1828a9e5..c06cd504 100644 --- a/Makefile +++ b/Makefile @@ -275,7 +275,7 @@ waitforlib : lib # Executable linkage $(NAME) : $(LIBRARIES) $(OBJ) - $(CC) $(CFLAGS) $(LDFLAGS) $(OBJ) $(LDLIBS) -o $(NAME) + $(CC) $(CFLAGS) $(LDFLAGS) $(OBJ) $(LDLIBS) -o $@ # Source file compilation