Ammend to static inline, for no gcc warning.
[pachi.git] / Makefile.lib
blob9150799b944e62eee9d7c17e2d2a415f854dc407
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
3 # there could be! '
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.
12 ifdef V
13         Q =
14         quiet =
15         mquiet = masq_
16 else
17         Q = @
18         quiet = quiet_
19         mquiet = quiet_
20 endif
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_archive = '[AR]   $@'
33       cmd_archive = $(AR) r $@ $^
35    quiet_cmd_link = '[LINK] $@'
36          cmd_link = $(LINK) -o $@ $^ $(LIBS)
38 # Recursive make
39 quiet_cmd_recmake = "[MAKE $$target]   $$subdir"
40       cmd_recmake = $(MAKE) -C $$subdir $$target
44 ### Internal build rules
46 unexport CFLAGS
47 CFLAGS += $(CUSTOM_CFLAGS) $(XCFLAGS) $(INCLUDES) $(SYS_CFLAGS)
48 COMPILE = $(CC) $(CFLAGS)
49 LINK = $(CC) $(LDFLAGS) $(XLDFLAGS)
51 DEP_FILES_1 = $(foreach src,$(OBJS),.deps/$(src))
52 DEP_FILES = $(DEP_FILES_1:%.o=%.P)
54 DEPS_MAGIC := $(shell mkdir .deps > /dev/null 2>&1 || :)
56 ifdef DEP_FILES
57 -include $(DEP_FILES)
58 endif
60 %.o: %.c
61         $(call mcmd,compile)
62         @-cp .deps/$(*F).pp .deps/$(*F).P; \
63                 tr ' ' '\012' < .deps/$(*F).pp \
64                         | sed -e 's/^\\$$//' -e '/^$$/ d' -e '/:$$/ d' -e 's/$$/ :/' \
65                         >> .deps/$(*F).P; \
66                 rm .deps/$(*F).pp
68 %.a:
69         $(call cmd,archive)
72 # Recursion:
74 .PHONY: all-recursive clean-recursive clean-profiles-recursive
75 all-recursive clean-recursive clean-profiled-recursive:
76         +@target=`echo $@ | sed s/-recursive//`; \
77         for subdir in $(SUBDIRS); do \
78                 $(call ncmd,recmake) || exit 1; \
79         done