-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
build: Move the help targets above the actual target
This makes the self-documentation easier to read.
- Loading branch information
Showing
1 changed file
with
37 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,7 +6,7 @@ | |
# By: ldulling <[email protected]> +#+ +:+ +#+ # | ||
# +#+#+#+#+#+ +#+ # | ||
# Created: 2023/12/23 03:22:46 by ldulling #+# #+# # | ||
# Updated: 2024/07/31 00:45:06 by ldulling ### ########.fr # | ||
# Updated: 2024/07/31 01:57:09 by ldulling ### ########.fr # | ||
# # | ||
# **************************************************************************** # | ||
|
||
|
@@ -136,9 +136,15 @@ PHONY_TARGETS += $(HELP_TARGETS) | |
.DEFAULT : | ||
$(MAKE) help | ||
|
||
.DEFAULT_GOAL := all | ||
|
||
|
||
# Compilation | ||
|
||
help-all : | ||
echo "Build the project." | ||
echo "This is the default target when no target is specified." | ||
|
||
all : | ||
if $(MAKE) --question build; then \ | ||
echo $(MSG_NO_CHNG); \ | ||
|
@@ -157,53 +163,56 @@ all : | |
fi; \ | ||
fi | ||
|
||
help-all : | ||
echo "Build the project." | ||
echo "This is the default target when no target is specified." | ||
|
||
|
||
fast : CFLAGS := $(CFLAGS_STD) $(CFLAGS_OPT) | ||
fast : re | ||
$(MAKE) clean | ||
|
||
help-fast : | ||
echo "Build the project with the following compiler optimization flags:" | ||
echo " $(CFLAGS_OPT)" | ||
|
||
fast : CFLAGS := $(CFLAGS_STD) $(CFLAGS_OPT) | ||
fast : re | ||
$(MAKE) clean | ||
|
||
run : all | ||
"./$(NAME)" | ||
|
||
help-run : | ||
echo "Build the project and run the executable." | ||
|
||
|
||
san : CFLAGS := $(CFLAGS_STD) $(CFLAGS_DBG) $(CFLAGS_SAN) | ||
san : re | ||
$(MAKE) clean | ||
run : all | ||
"./$(NAME)" | ||
|
||
|
||
help-san : | ||
echo "Rebuild the project with sanitizers enabled and run the executable." | ||
echo "The following sanitizers are enabled:" | ||
echo " $(CFLAGS_SAN)" | ||
|
||
san : CFLAGS := $(CFLAGS_STD) $(CFLAGS_DBG) $(CFLAGS_SAN) | ||
san : re | ||
$(MAKE) clean | ||
"./$(NAME)" | ||
|
||
val : all | ||
$(VALGRIND) $(VALGRINDFLAGS) "./$(NAME)" | ||
|
||
help-val : | ||
echo "Build the project and run the executable with valgrind." | ||
echo "The following valgrind flags are used:" | ||
echo "$(VALGRINDFLAGS)" | tr ' ' '\n' | sed 's/^/ /' | ||
|
||
val : all | ||
$(VALGRIND) $(VALGRINDFLAGS) "./$(NAME)" | ||
|
||
noenv : all | ||
env -i $(VALGRIND) $(VALGRINDFLAGS) "./$(NAME)" | ||
|
||
help-noenv : | ||
echo "Build and run the project with valgrind and with empty environment (env -i)." | ||
|
||
noenv : all | ||
env -i $(VALGRIND) $(VALGRINDFLAGS) "./$(NAME)" | ||
|
||
|
||
help-valfd : | ||
echo "Build and run the project with valgrind and file descriptor tracking." | ||
echo "The following valgrind flags are used:" | ||
echo "$(VALGRINDFLAGS)" | tr ' ' '\n' | sed 's/^/ /' | ||
echo "File descriptor specific flags:" | ||
echo "$(VALGRINDFDFLAGS)" | tr ' ' '\n' | sed 's/^/ /' | ||
|
||
valfd : all | ||
ifneq ($(TERMINAL),) | ||
|
@@ -215,13 +224,6 @@ else | |
$(VALGRIND) $(VALGRINDFLAGS) $(VALGRINDFDFLAGS) "./$(NAME)" | ||
endif | ||
|
||
help-valfd : | ||
echo "Build and run the project with valgrind and file descriptor tracking." | ||
echo "The following valgrind flags are used:" | ||
echo "$(VALGRINDFLAGS)" | tr ' ' '\n' | sed 's/^/ /' | ||
echo "File descriptor specific flags:" | ||
echo "$(VALGRINDFDFLAGS)" | tr ' ' '\n' | sed 's/^/ /' | ||
|
||
|
||
help : | ||
echo "Usage: make [target]" | ||
|
@@ -296,6 +298,9 @@ $(DEP_SUBDIRS) : | |
|
||
# Cleaning | ||
|
||
help-clean : | ||
echo "Remove build artifacts." | ||
|
||
clean : | ||
$(MAKE) clean -C $(LIBRARIES) | ||
rm -f $(OBJ) $(DEP) | ||
|
@@ -306,32 +311,29 @@ ifneq (,$(wildcard $(DEP_DIR))) | |
-find $(DEP_DIR) -type d -empty -delete | ||
endif | ||
|
||
help-clean : | ||
echo "Remove build artifacts." | ||
|
||
help-fclean : | ||
echo "Remove build artifacts and the executable." | ||
|
||
fclean : clean | ||
$(MAKE) fclean -C $(LIBRARIES) | ||
rm -f $(NAME) | ||
|
||
help-fclean : | ||
echo "Remove build artifacts and the executable." | ||
|
||
help-ffclean : | ||
echo "Remove build artifacts and the executable without checking for unknown files." | ||
|
||
ffclean : fclean | ||
rm -rf $(OBJ_DIR) $(DEP_DIR) | ||
|
||
help-ffclean : | ||
echo "Remove build artifacts and the executable without checking for unknown files." | ||
|
||
help-re : | ||
echo "Rebuild the project." | ||
|
||
re : | ||
$(MAKE) fclean | ||
$(MAKE) all | ||
|
||
help-re : | ||
echo "Rebuild the project." | ||
|
||
|
||
# Include dependency files | ||
|
||
|