forked from sysprog21/linux-list
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
67 lines (55 loc) · 1.3 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
58
59
60
61
62
63
64
65
66
67
GIT_HOOK := .git/hooks/applied
$(GIT_HOOK): scripts/install-git-hooks
@$<
@echo
.PHONY: all check clean
all: $(GIT_HOOK) check
.DEFAULT_GOAL := all
include common.mk
CFLAGS = -I./include
CFLAGS += -std=c99 -pedantic -Wall -W -Werror
TESTS = \
containerof \
list_entry \
list_init-explicit \
list_init-local \
list_init-global \
list_add \
list_add_tail \
list_del \
list_del_init \
list_first_entry \
list_last_entry \
list_is_singular \
list_for_each_safe \
list_for_each_entry_safe \
list_for_each \
list_for_each_entry \
list_move \
list_move_tail \
list_splice \
list_splice_tail \
list_splice_init \
list_splice_tail_init \
list_cut_position
TESTS := $(addprefix tests/,$(TESTS))
# dependency of source files
deps := $(TESTS:%:%.o.d)
TESTS_OK = $(TESTS:=.ok)
check: $(TESTS_OK)
$(TESTS_OK): %.ok: %
$(Q)$(PRINTF) "*** Validating $< ***\n"
$(Q)./$< && $(PRINTF) "\t$(PASS_COLOR)[ Verified ]$(NO_COLOR)\n"
@touch $@
# standard build rules
.SUFFIXES: .o .c
.c.o:
$(VECHO) " CC\t$@\n"
$(Q)$(CC) -o $@ $(CFLAGS) -c -MMD -MF [email protected] $<
$(TESTS): %: %.o
$(VECHO) " LD\t$@\n"
$(Q)$(CC) -o $@ $^ $(LDFLAGS)
clean:
$(VECHO) " Cleaning...\n"
$(Q)$(RM) $(TESTS) $(TESTS_OK) $(TESTS:=.o) $(TESTS:=.o.d)
-include $(deps)