-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
42 lines (31 loc) · 1.69 KB
/
Makefile
File metadata and controls
42 lines (31 loc) · 1.69 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
.PHONY: clean distclean
APP = test-app
SRC = test/test.c src/error.c src/mem.c src/list.c src/tlv.c src/map.c src/dir.c src/version.c src/config.c src/cli.c
MISC = src/misc.h
# -fsanitize=address -pg
CFLAGS += -O0 -ggdb -Wall -Wextra -Werror -std=gnu99 -pipe -Wformat=2 -Wno-unused-result
CPPFLAGS += -Isrc -D__DEBUG__ -DMALLOC_CHECK_=1 -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -DGIT_COMMIT=\"$(shell git log | head -n1 | cut -f2 -d' ')\" -DBUILD_OS=\"$(shell grep PRETTY_NAME /etc/os-release | cut -d= -f2)\"
LIBS = -lpthread -lcurl
default: gcc
all: gcc clang
gcc:
@echo "#define ALL_CFLAGS \"$(strip $(subst \",\',"${CFLAGS} -Wrestrict "))\"" > ${MISC}
@echo "#define ALL_CPPFLAGS \"$(strip $(subst \",\',"${CPPFLAGS}"))\"" >> ${MISC}
@gcc ${CFLAGS} -Wrestrict ${CPPFLAGS} ${SRC} ${LIBS} -o ${APP}-gcc
-@echo -e "built ‘`echo -e ${SRC} | sed 's/ /’\n ‘/g'`’ → ‘${APP}-gcc’"
clang:
@echo "#define ALL_CFLAGS \"$(strip $(subst \",\',"${CFLAGS} "))\"" > ${MISC}
@echo "#define ALL_CPPFLAGS \"$(strip $(subst \",\',"${CPPFLAGS}"))\"" >> ${MISC}
@clang ${CFLAGS} ${CPPFLAGS} ${SRC} ${LIBS} -o ${APP}-clang
-@echo -e "built ‘`echo -e ${SRC} | sed 's/ /’\n ‘/g'`’ → ‘${APP}-clang’"
#extra:
# # -fanalyzer-verbosity=4
# @echo "#define ALL_CFLAGS \"$(strip $(subst \",\',"${CFLAGS} "))\"" > ${MISC}
# @echo "#define ALL_CPPFLAGS \"$(strip $(subst \",\',"${CPPFLAGS}"))\"" >> ${MISC}
# @${CC} -fanalyzer ${CFLAGS} ${CPPFLAGS} ${SRC} ${LIBS} -o ${APP}
# -@echo -e "built ‘`echo -e ${SRC} | sed 's/ /’\n ‘/g'`’ → ‘${APP}’"
clean:
@rm -fv ${MISC}
@rm -fv gmon.out
distclean: clean
@rm -fv ${APP}-gcc ${APP}-clang