-
Notifications
You must be signed in to change notification settings - Fork 1
/
test.mk
36 lines (28 loc) · 1.17 KB
/
test.mk
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
### WARNINGS ###
WARNINGS += -Wall -Wextra -Wshadow -Wundef -Wformat=2 -Wtrampolines -Wfloat-equal
WARNINGS += -Wbad-function-cast -Wstrict-prototypes -Wpacked
WARNINGS += -Wno-aggressive-loop-optimizations -Winit-self
WARNINGS += -Wmissing-format-attribute -Wunreachable-code
WARNINGS += -Wshift-overflow=2 -Wduplicated-cond -Wpointer-arith -Wwrite-strings
WARNINGS += -Wnested-externs -Wcast-align -Wredundant-decls
WARNINGS += -Werror=implicit-function-declaration -Wlogical-not-parentheses
WARNINGS += -Wlogical-op -Wold-style-definition -Wcast-qual -Wdouble-promotion
WARNINGS += -Wunsuffixed-float-constants -Wmissing-include-dirs -Wnormalized
WARNINGS += -Wdisabled-optimization -Wsuggest-attribute=const
STD = gnu11
CFLAGS = -std=$(STD) -D__DOXYGEN__=0
### INFORMATION FOR LINTING ###
PROJECT_ROOT = $(abspath .)
SRCDIRS += $(PROJECT_ROOT)/src
SRCFILES := $(filter-out $(SRCDIRS)/main.c,$(wildcard $(SRCDIRS)/*.c))
TESTDIR += $(PROJECT_ROOT)/tests
TESTFILES += $(wildcard $(TESTDIR)/*.c)
TESTBINS = $(patsubst %.c,%,$(TESTFILES))
.PHONY: $(TESTBINS)
test: WARNINGS =
test: $(TESTBINS)
$(TESTBINS):
@gcc $(CFLAGS) $(WARNINGS) $(SRCFILES) $@.c -o $@
$@
clean:
@rm $(TESTBINS)