-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMakefile
57 lines (43 loc) · 1.1 KB
/
Makefile
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
ifeq (,$(wildcard config.mk))
$(shell cp config.mk.orig config.mk)
endif
include config.mk
src := $(wildcard src/*.c)
obj := $(src:.c=.o)
INCLUDES += -Iinclude
WARNINGS += -Wall -Wextra
CFLAGS += -Ofast ${INCLUDES} ${WARNINGS}
ifeq (${ASAN}, 1)
DEBUG = 1
CFLAGS += -fsanitize=address -fno-omit-frame-pointer
LDFLAGS += -fsanitize=address -fno-omit-frame-pointer
endif
ifeq (${DEBUG}, 1)
CFLAGS += -g -Og
else
CFLAGS += -DNDEBUG -flto -Ofast
LDFLAGS += -flto
CFLAGS += -fomit-frame-pointer -fno-stack-protector -fno-common -fstrict-aliasing
LDFLAGS += -fomit-frame-pointer -fno-stack-protector -fno-common
endif
ifeq (${COVERAGE}, 1)
CFLAGS += --coverage -O0
LDFLAGS += -ftest-coverage -fprofile-arcs
endif
all: mdr
mdr: ${obj}
${CC} ${obj} ${LDFLAGS} -o mdr
install: mdr
install mdr ${PREFIX}/bin
uninstall:
rm ${PREFIX}/bin/mdr
test: mdr
@MDR_MAIN="README.mdr:non_:tests/invalid_include.mdr" bash scripts/test.sh
@make mostly-clean
@bash scripts/test.sh
mostly-clean:
@rm -rf result
@rm -f tests/*.md tests/*.err
clean: mostly-clean
@rm -f ${obj} mdr $(src:.c=.gcda) $(src:.c=.gcno)
.SUFFIXES: .c .o