makefile (1374B)
1 # make 2 # make build 3 # (sudo) make install 4 # make format 5 # make clean 6 # make uninstall 7 8 ## C compiler 9 CC=gcc # much faster compilation than gcc 10 COMPILER_FLAGS=#-Wall -Wextra -Wconversion -Wdouble-promotion -Wno-unused-parameter -Wno-unused-function -Wno-sign-conversion -fsanitize=undefined # -g3 11 # exclude: -fsanitize-trap, because I'm using an old version of gcc and couldn't bother getting a new one. 12 ## ^ from <https://nullprogram.com/blog/2023/04/29/> 13 ## <https://news.ycombinator.com/item?id=35758898> 14 15 ## Debugging options 16 DEBUG=-g#-g 17 18 ## Main file 19 SRC=./src/mumble.c 20 MPC=./src/mpc/mpc.c 21 22 ## Dependencies 23 DEPS_PC=libeditline #libedit: an older version 24 # ^ libm, which doesn't have files which pkg-config can find, grr. 25 DEBUG= #'-g' 26 27 INCS=`pkg-config --cflags ${DEPS_PC}` 28 LIBS_PC=`pkg-config --libs ${DEPS_PC}` 29 LIBS_DIRECT=-lm 30 LIBS=$(LIBS_DIRECT) $(LIBS_PC) 31 # $(CC) $(DEBUG) $(INCS) $(PLUGS) $(SRC) -o rose $(LIBS) $(ADBLOCK) 32 33 ## Formatter 34 STYLE_BLUEPRINT=webkit 35 FORMATTER=clang-format -i -style=$(STYLE_BLUEPRINT) 36 37 build: $(SRC) 38 $(CC) $(COMPILER_FLAGS) $(INCS) $(SRC) $(MPC) -o mumble $(LIBS) $(DEBUG) 39 40 format: $(SRC) 41 $(FORMATTER) $(SRC) 42 43 debug: 44 gcc -I/usr/include/editline ./src/mumble.c ./src/mpc/mpc.c -o mumble -lm -leditline -g 45 valgrind --tool=memcheck --leak-check=yes --show-leak-kinds=all ./mumble 46 # valgrind --tool=memcheck --leak-check=yes ./mumble