1 ### The build commands and verbosity
3 # If we are verbose, we will show commands prefixed by $(Q) (which acts as
4 # @ in the non-verbose mode), and we will show the "real" cmds instead of
5 # their quiet versions (which are used in the non-verbose mode).
6 # Inspired by the Linux kernel build system.
17 # Show the command (quiet or non-quiet version based on the assignment
18 # just above) and then execute it.
19 ncmd = $(if $($(quiet)cmd_$(1)),echo $($(quiet)cmd_$(1)) &&) $(cmd_$(1))
20 cmd = @$(if $($(quiet)cmd_$(1)),echo $($(quiet)cmd_$(1)) &&) $(cmd_$(1))
21 mcmd = @$(if $($(mquiet)cmd_$(1)),echo $($(mquiet)cmd_$(1)) &&) $(cmd_$(1))
23 quiet_cmd_compile = '[CC] $<'
24 masq_cmd_compile = $(COMPILE) -c $<
25 cmd_compile = $(COMPILE) -Wp,-MD,.deps/$(*F).pp -c $<
27 quiet_cmd_archive = '[AR] $@'
28 cmd_archive = $(AR) r $@ $^
30 quiet_cmd_link = '[LINK] $@'
31 cmd_link = $(CC) $(LDFLAGS) -o $@ $^ $(LIBS)
34 quiet_cmd_recmake = "[MAKE $$target] $$subdir"
35 cmd_recmake = $(MAKE) -C $$subdir $$target
39 ### Internal build rules
41 DEP_FILES_1 = $(foreach src,$(OBJS),.deps/$(src))
42 DEP_FILES = $(DEP_FILES_1:%.o=%.P)
44 DEPS_MAGIC := $(shell mkdir .deps > /dev/null 2>&1 || :)
52 @-cp .deps/$(*F).pp .deps/$(*F).P; \
53 tr ' ' '\012' < .deps/$(*F).pp \
54 | sed -e 's/^\\$$//' -e '/^$$/ d' -e '/:$$/ d' -e 's/$$/ :/' \
69 .PHONY: all-recursive install-recursive clean-recursive
70 all-recursive install-recursive clean-recursive:
71 @target=`echo $@ | sed s/-recursive//`; \
72 for subdir in $(SUBDIRS); do \
73 $(call ncmd,recmake) || exit 1; \
76 all: all-recursive all-l
77 install: install-recursive install-l
78 clean: clean-recursive clean-l