1 # 'There's more than one passage here,' he whispered with an effort: it seemed
2 # hard to make his breath give any sound. `It's as orc-like a place as ever
6 ### The build commands and verbosity
8 # If we are verbose, we will show commands prefixed by $(Q) (which acts as
9 # @ in the non-verbose mode), and we will show the "real" cmds instead of
10 # their quiet versions (which are used in the non-verbose mode).
11 # Inspired by the Linux kernel build system.
22 # Show the command (quiet or non-quiet version based on the assignment
23 # just above) and then execute it.
24 ncmd = $(if $($(quiet)cmd_$(1)),echo $($(quiet)cmd_$(1)) &&) $(cmd_$(1))
25 cmd = @$(if $($(quiet)cmd_$(1)),echo $($(quiet)cmd_$(1)) &&) $(cmd_$(1))
26 mcmd = @$(if $($(mquiet)cmd_$(1)),echo $($(mquiet)cmd_$(1)) &&) $(cmd_$(1))
28 quiet_cmd_compile = '[CC] $<'
29 masq_cmd_compile = $(COMPILE) -c $<
30 cmd_compile = $(COMPILE) -Wp,-MD,.deps/$(*F).pp -c $<
32 quiet_cmd_compilexx = '[CXX] $<'
33 masq_cmd_compilexx = $(COMPILEXX) -c $<
34 cmd_compilexx = $(COMPILEXX) -Wp,-MD,.deps/$(*F).pp -c $<
36 quiet_cmd_archive = '[AR] $@'
37 cmd_archive = $(AR) r $@ $^
39 quiet_cmd_link = '[LINK] $@'
40 cmd_link = $(LINK) -o $@ $^ $(LIBS) $(SYS_LIBS)
43 quiet_cmd_recmake = "[MAKE $$target] $$subdir"
44 cmd_recmake = $(MAKE) -C $$subdir $$target
48 ### Internal build rules
51 CFLAGS += $(CUSTOM_CFLAGS) $(XCFLAGS) $(INCLUDES) $(SYS_CFLAGS)
53 CXXFLAGS += $(CUSTOM_CXXFLAGS) $(XCFLAGS) $(INCLUDES) $(SYS_CXXFLAGS)
55 LDFLAGS += $(CUSTOM_LDFLAGS) $(XLDFLAGS) $(SYS_LDFLAGS)
56 COMPILE = $(CC) $(CFLAGS)
57 COMPILEXX = $(CXX) $(CXXFLAGS)
58 LINK = $(CC) $(LDFLAGS)
60 DEP_FILES_1 = $(foreach src,$(OBJS),.deps/$(src))
61 DEP_FILES = $(DEP_FILES_1:%.o=%.P)
63 DEPS_MAGIC := $(shell mkdir .deps > /dev/null 2>&1 || :)
71 @-cp .deps/$(*F).pp .deps/$(*F).P; \
72 tr ' ' '\012' < .deps/$(*F).pp \
73 | sed -e 's/^\\$$//' -e '/^$$/ d' -e '/:$$/ d' -e 's/$$/ :/' \
78 $(call mcmd,compilexx)
79 @-cp .deps/$(*F).pp .deps/$(*F).P; \
80 tr ' ' '\012' < .deps/$(*F).pp \
81 | sed -e 's/^\\$$//' -e '/^$$/ d' -e '/:$$/ d' -e 's/$$/ :/' \
91 .PHONY: all-recursive clean-recursive clean-profiles-recursive
92 all-recursive clean-recursive clean-profiled-recursive:
93 +@target=`echo $@ | sed s/-recursive//`; \
94 for subdir in $(SUBDIRS); do \
95 $(call ncmd,recmake) || exit 1; \