-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
104 lines (66 loc) · 1.66 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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
SRC := src/
BIN := bin/
LIB := lib/
OBJ := obj/
DEP := .dep/
MAKEFLAGS += --no-print-directory \
--no-builtin-rules \
--no-builtin-variables
MAKEFILES_DIR = makefiles/
include $(MAKEFILES_DIR)Function.mk
include $(MAKEFILES_DIR)Command.mk
config-commands := tidy clean cleanall .depends
ifeq ($(filter $(config-commands), $(MAKECMDGOALS)),)
# There is no goal or there are only build commands
mode := build
else
# There is at least one config command
ifneq ($(filter-out $(config-commands), $(MAKECMDGOALS)),)
# There is at least one build command
mode := mixed
else
# There is no build command
mode := config
endif
endif
ifeq ($(mode),mixed)
%:
$(call cmd-make, $@)
.NOTPARALLEL:
else
# Phony rules
all: default
tidy:
$(call cmd-clean, "*~" ".#*" "#*")
clean:
$(call cmd-clean, $(OBJ) $(DEP) .depends)
cleanall:
$(call cmd-clean, $(OBJ) $(LIB) $(DEP) .depends $(BIN))
tags:
$(call cmd-tags, TAGS, $(filter %.c %.cc %.s %.h, $(call FIND, .)))
.PHONY: all tidy clean cleanall
MODULES :=
include $(MAKEFILES_DIR)Build.mk
# Recipe-only rules
$(OBJ)%.a:
$(call cmd-ar, $@, $^)
# Generic rules
$(OBJ)%.o: %.cc
$(call cmd-cxx, $@, $<, $(CFLAGS))
$(OBJ)%.test.o: %.test.cc
$(call cmd-cxx, $@, $<, $(CFLAGS_TEST))
.depends: .generate
$(call cmd-dep, $@, $(filter %.d, $^))
$(DEP)%.cc.d: %.cc
$(call cmd-depcxx, $@, $<, $(patsubst %.cc, $(OBJ)%.o, $<))
$(DEP)%.c.d: %.c
$(call cmd-depc, $@, $<, $(patsubst %.c, $(OBJ)%.o, $<))
$(DEP)%.S.d: %.S
$(call cmd-depas, $@, $<, $(patsubst %.S, $(OBJ)%.o, $<))
ifeq ($(mode),build)
-include .generate
-include .depends
endif
endif
.SUFFIXES:
.SECONDARY: