-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
46 lines (36 loc) · 1.09 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
.PHONY: all clean code-cov feez-test
export ROOT ?= $(shell pwd)
export SRC ?= $(ROOT)/src
export TESTS ?= $(ROOT)/t
export CINCLUDE ?= $(ROOT)/include
export MK ?= $(ROOT)/mk
export CINCLUDEFILES := $(wildcard $(INCLUDE)/*.h)
export BUILD ?= $(ROOT)/build
export CFLAGS = -O0 -ggdb -Wall -Wextra -Werror -Wno-sign-compare
# Targets:
export COOKIE := $(BUILD)/libcookie.a
export CHECKER := $(BUILD)/checker
# Sources:
export COOKIESRC := $(SRC)/cookie.c
export CHECKERSRC := $(SRC)/checker.c
$(shell mkdir -p $(BUILD))
ifdef dump
export DUMP := $(shell realpath $(dump))
$(shell mkdir -p $(DUMP))
endif
# - - - - - - - - - - - - - - - - - - - -
all: $(CHECKER)
clean:
@rm -rfv $(BUILD)
@find -name '*.o' -exec rm -fv {} \+
@find -name '*.gcno' -exec rm -fv {} \+
@find -name '*.gcda' -exec rm -fv {} \+
@find -name '*.gcov' -exec rm -fv {} \+
@find -name gmon.out -exec rm -fv {} \+
code-cov:
@$(MAKE) --no-print-directory -C $(TESTS) code-cov
# - - - - - - - - - - - - - - - - - - - -
include $(MK)/compile.mk
include $(MK)/cookie.mk
$(CHECKER): $(CHECKERSRC:%.c=%.o) $(COOKIE)
gcc $(CFLAGS) -o $@ $^