-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathMakefile
100 lines (70 loc) · 2.61 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
# ---------------------------------------------------------------- DEFAULT GOAL
.DEFAULT_GOAL := all
# -------------------------------------------------------------- VERBOSE OUTPUT
ifeq ("$(origin V)", "command line")
ENABLE_VERBOSE = $(V)
endif
ifndef ENABLE_VERBOSE
ENABLE_VERBOSE = 0
endif
ifeq ($(ENABLE_VERBOSE),1)
Q =
else
Q = @
endif
# ------------------------------------------------------------------ META RULES
# This must be included before any meta rules are used
include deps/metamake/Meta.mk
# --------------------------------------------------------- BUILD ARCHITECTURES
$(call BEGIN_DEFINE_ARCH, host_test, build/host_test)
PREFIX :=
CF := -O0 -g3 -Wall -Wextra -std=gnu11 -D_GNU_SOURCE=1
$(call END_DEFINE_ARCH)
$(call BEGIN_DEFINE_ARCH, host_c99, build/host_c99)
PREFIX :=
CF := -O2 -Wall -Wextra -std=c99
$(call END_DEFINE_ARCH)
$(call BEGIN_DEFINE_ARCH, host_c11, build/host_c11)
PREFIX :=
CF := -O2 -Wall -Wextra -std=c11
$(call END_DEFINE_ARCH)
# ------------------------------------------------------------- BUILD LIBRARIES
sched_SRC := $(call FIND_SOURCE_IN_DIR, src)
$(call BEGIN_UNIVERSAL_BUILD)
$(call IMPORT_DEPS, deps)
$(call ADD_C_INCLUDE, src)
$(call BUILD_SOURCE, $(sched_SRC))
$(call MAKE_LIBRARY, sched)
$(call EXPORT_SHALLOW_DEPS, sched)
# Build for all defined architectures, even if nothing depends on it
$(call APPEND_ALL_TARGET_VAR)
$(call END_UNIVERSAL_BUILD)
deps_SRC := $(call FIND_SOURCE_IN_DIR, deps)
$(call BEGIN_UNIVERSAL_BUILD)
$(call ADD_C_INCLUDE, deps)
CF := -Wno-unused-variable
$(call BUILD_SOURCE, $(deps_SRC))
$(call MAKE_LIBRARY, deps)
$(call EXPORT_SHALLOW_DEPS, deps)
$(call END_UNIVERSAL_BUILD)
# ----------------------------------------------------------- BUILD EXECUTABLES
sched_ut_SRC := test/sched_ut.c
$(call BEGIN_ARCH_BUILD, host_test)
$(call IMPORT_DEPS, sched deps)
$(call BUILD_SOURCE, $(sched_ut_SRC))
$(call CC_LINK, sched_ut)
# Always build
$(call APPEND_ALL_TARGET_VAR)
$(call END_ARCH_BUILD)
# ---------------------------------------------------------------- GLOBAL RULES
.PHONY: all
all: METAMAKE_ALL
@echo "===== All build finished ====="
.PHONY: clean
clean: METAMAKE_CLEAN
@echo "===== Clean finished ====="
.PHONY: help
help:
@echo "Available targets:"
@echo " all - Build all top level targets"
@echo " clean - Clean intermediate build files"