-
Notifications
You must be signed in to change notification settings - Fork 0
/
footer.mk
44 lines (41 loc) · 1.69 KB
/
footer.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
37
38
39
40
41
42
43
44
# Build description footer include
define RECIPES
__t := $(strip $1)
__odir := $(BUILD_DIR)/$(d)/$$(__t)
__tdir := $(BUILD_DIR)/$($(strip $1)_target_dir_$(d))
__qtgt := $$(__tdir)/$$(__t)
$$(__t)_pch_$(d) := $$($$(__t)_precompiled_$(d):%.hpp=%.hpp.pch)
$$(__t)_pch_$(d) := $$($$(__t)_pch_$(d):%=$(BUILD_DIR)/$(d)/$$(__t)/%)
$$(__t)_objects_$(d) := $$($$(__t)_sources_$(d):%.cpp=%.o)
$$(__t)_objects_$(d) := $$($$(__t)_objects_$(d):%.c=%.o)
$$(__t)_objects_$(d) := $$($$(__t)_objects_$(d):%=$(BUILD_DIR)/$(d)/$$(__t)/%)
$$(__t)_deps_$(d) := $$($$(__t)_sources_$(d):%.cpp=%.d)
$$(__t)_deps_$(d) := $$($$(__t)_deps_$(d):%.c=%.d)
$$(__t)_deps_$(d) += $$($$(__t)_precompiled_$(d):%.hpp=%.d)
$$(__t)_deps_$(d) := $$($$(__t)_deps_$(d):%=$(BUILD_DIR)/$(d)/$$(__t)/%)
$$(__odir) $$(__tdir)::
$(VERBOSE)mkdir -p $$@
$$(__qtgt): $$($$(__t)_objects_$(d)) | $$(__tdir)
$(CXX_LD_RECIPE)
$$(__qtgt): c_local_flags := $$($$(__t)_c_flags_$(d))
$$(__qtgt): cxx_local_flags := $$($$(__t)_cxx_flags_$(d))
$$(__qtgt): cxx_local_pch := $$($$(__t)_pch_$(d):%=-include-pch %)
$$(__qtgt): ld_local_flags := $$($$(__t)_ld_flags_$(d))
$$(__odir)/%.hpp.pch: $(d)/src/%.hpp
$(PCH_RECIPE)
$$(__odir)/%.o: $(d)/src/%.cpp | $$(__odir) $$($$(__t)_pch_$(d))
$(CXX_RECIPE)
$$(__odir)/%.o: $(d)/src/%.c | $$(__odir)
$(C_RECIPE)
-include $$($$(__t)_deps_$(d))
all_targets += $$(__qtgt)
all_objects += $$($$(__t)_objects_$(d))
all_deps += $$($$(__t)_deps_$(d))
all_headers += $$($$(__t)_pch_$(d))
endef
$(foreach product,$(products_$(d)), \
$(eval \
$(call RECIPES, $(product)))\
)
d := $(stack_$(sp))
sp := $(basename $(sp))