Makefile: massive improvements.

added messages about what the makefile is currently compiling
added new debug target for getting line nums with valgrind
heavily revamped help message
added @ infront of most target commands to prevent echoing commands
instead of specifying `-Ilib` in the actual command, prepend it to $CC_FLAGS
master
Drake 3 years ago
parent 66661b3846
commit a7c335c9a9
No known key found for this signature in database
GPG Key ID: 9B83455BD94F12A3

@ -6,18 +6,25 @@ ifndef CC_FLAGS
#guess we gotta define this if it no exist, but imagine not needing custom cxx flags
CC_FLAGS :=
endif
CC_FLAGS := -Ilib ${CC_FLAGS}
ifndef PROGS
PROGS := whoami arch ls pwd basename uname yes
endif
all:
mkdir -p bin
for prog in ${PROGS}; do ${CC} -o bin/$$prog -Ilib ${CC_FLAGS} src/$$prog.c; done
@mkdir -p bin
@for prog in ${PROGS}; do echo Building $$prog... && ${CC} -o bin/$$prog ${CC_FLAGS} src/$$prog.c; done
verbose:
mkdir -p bin
for prog in ${PROGS}; do ${CC} -v -o bin/$$prog ${CC_FLAGS} src/$$prog.c; done
@mkdir -p bin
@for prog in ${PROGS}; do echo Building $$prog... && ${CC} -v -o bin/$$prog ${CC_FLAGS} src/$$prog.c; done
debug:
@mkdir -p bin
@for prog in ${PROGS}; do echo Building $$prog... && ${CC} -g -O0 -v -o bin/$$prog ${CC_FLAGS} src/$$prog.c; done
clean:
@rm -rf bin
help:
@echo 'make' - Build normal version
@echo 'make verbose' - Build normal version with verbose compilation for debugging
@echo 'make help' - Display this help message
@echo "Drake's Epic Coreutils Makefile Help Page™"
@echo 'make' - build normal version.
@echo 'make debug' - build verbosly, and with \`-g -O0\` for the lowest amount of compiler optimization, so that valgrind and such can report line numbers, and have more information in general
@echo 'make verbose' - build normal version with verbose compilation for debugging.
@echo 'make clean' - removes binaries.
@echo 'make help' - display this help message.

Loading…
Cancel
Save