selfatari_cousin(): Suggest counter-captures
[pachi/peepo.git] / Makefile.lib
blob38e9e841b62201b2888ffccc11078989d729db7e
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) $(SYS_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 unexport LDFLAGS
49 LDFLAGS += $(CUSTOM_LDFLAGS) $(XLDFLAGS) $(SYS_LDFLAGS)
50 COMPILE = $(CC) $(CFLAGS)
51 LINK = $(CC) $(LDFLAGS)
53 DEP_FILES_1 = $(foreach src,$(OBJS),.deps/$(src))
54 DEP_FILES = $(DEP_FILES_1:%.o=%.P)
56 DEPS_MAGIC := $(shell mkdir .deps > /dev/null 2>&1 || :)
58 ifdef DEP_FILES
59 -include $(DEP_FILES)
60 endif
62 %.o: %.c
63         $(call mcmd,compile)
64         @-cp .deps/$(*F).pp .deps/$(*F).P; \
65                 tr ' ' '\012' < .deps/$(*F).pp \
66                         | sed -e 's/^\\$$//' -e '/^$$/ d' -e '/:$$/ d' -e 's/$$/ :/' \
67                         >> .deps/$(*F).P; \
68                 rm .deps/$(*F).pp
70 %.a:
71         $(call cmd,archive)
74 # Recursion:
76 .PHONY: all-recursive clean-recursive clean-profiles-recursive
77 all-recursive clean-recursive clean-profiled-recursive:
78         +@target=`echo $@ | sed s/-recursive//`; \
79         for subdir in $(SUBDIRS); do \
80                 $(call ncmd,recmake) || exit 1; \
81         done