-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathMakefile
47 lines (32 loc) · 1.16 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
LINKLIBS=""
FNAME=jobflow
MAINFILE=$(FNAME).c
OUTFILE=$(FNAME).out
CFLAGS_OWN=-Wall -Wextra -std=c99 -D_GNU_SOURCE
CFLAGS_DBG=-g -O0
CFLAGS_OPT=-Os -s
CFLAGS_OPT_AGGRESSIVE=-O3 -s -flto -fwhole-program
TESTSRC=$(sort $(wildcard tests/*.c))
TESTS=$(TESTSRC:.c=.out)
-include config.mak
CFLAGS_RCB_OPT_AGGRESSIVE=$(DB_FLAGS) ${CFLAGS_OWN} ${CFLAGS_OPT_AGGRESSIVE} ${CFLAGS}
CFLAGS_RCB_OPT=$(DB_FLAGS) ${CFLAGS_OWN} ${CFLAGS_OPT} ${CFLAGS}
CFLAGS_RCB_DBG=$(DB_FLAGS) ${CFLAGS_OWN} ${CFLAGS_DBG} ${CFLAGS}
all: debug
optimized:
CFLAGS="${CFLAGS_RCB_OPT} -s" rcb2 $(RCBFLAGS) ${MAINFILE} $(LINKLIBS)
strip --remove-section .comment ${OUTFILE}
optimized-aggressive:
CFLAGS="${CFLAGS_RCB_OPT_AGGRESSIVE} -s" rcb2 $(RCBFLAGS) ${MAINFILE} $(LINKLIBS)
strip --remove-section .comment ${OUTFILE}
odebug:
CFLAGS="${CFLAGS_RCB_OPT} -g" rcb2 $(RCBFLAGS) ${MAINFILE} $(LINKLIBS)
debug-stripper.sh $(OUTFILE)
debug:
CFLAGS="${CFLAGS_RCB_DBG}" rcb2 $(RCBFLAGS) ${MAINFILE} $(LINKLIBS)
tests: $(TESTS)
tests/%.out: tests/%.c
CFLAGS="${CFLAGS_RCB_DBG}" rcb --force $(RCBFLAGS) $<
check: test.sh tests/stdin_printer.out
./test.sh
.PHONY: all optimized optimized-aggressive debug odebug