- Make the library addition system cleaner and scalable
- Add a progress bar during compilation
The generate.sh
script is a util script to init a project's directory. Start it in the folder where you want the project's folder wil be created and follow the instructions !
- You can choose the name of your executable with the variable
name
- You can choose your compiler in the variable
CC
- You can add some compilation flags (like
-l
flags to add standard libraries) in the variableCFLAGS
(The classic flags are managed in the options of the make command, see below)
- By default the Makefile compile with
-Wall -Wextra -Werror
- With
make [rule] noflag
, you can disable-Werror
- With
make [rule] debug
, you can add-g3
- With
make [rule] sanadd
, you can add-fsanitize=address
- With
make [rule] santhread
, you can add-fsanitize=thread
- If you don't specify a rule,
make noflag
is equal tomake all noflag
- All these flags are cumulativee (
make re noflag debug sanadd
is valid)
- Use
SRCS_EXTENSION
to define the file type of your sources (.c/.cpp/...) - Your main must be defined in the variable
MAIN
(If it is in the sources folder, calledSRCS_PATH
, you must add it like thissrcs/main.c
) - Add all other sources in
SRCS
(without the folder defined inSRCS_PATH
)
- Use
INCLUDE_DIRS
to select all the folders where your headers are located
- You can enable the use of certain libraries in the corresponding sections. For each:
[LIB]_DIR
is the directory where the Makefile of the library is located[LIB]_INCLUDE_DIR
is the directory where the headers' files of the library are located[LIB]_NAME
is the name of the library with her extension, normally.a
(she needs to be at the root of the[LIB]_DIR
folder)
$(NAME)
compile the executableall
call$(NAME)
clean
remove all compiled objectsfclean
callclean
and remove the executablere
callfclean
andall
fcleanlib
callfclean
and executefclean
rule in the libraries' foldersrelib
callfcleanlib
andall
run
callall
and launch the executable (You can precise some argument to give to the executable at launch inRUN_PARAM
)show
show some useful informations about the Makefile's variables