]>
Commit | Line | Data |
---|---|---|
dafc2dea ÆAB |
1 | ### Remove GNU make implicit rules |
2 | ||
3 | ## This speeds things up since we don't need to look for and stat() a | |
4 | ## "foo.c,v" every time a rule referring to "foo.c" is in play. See | |
5 | ## "make -p -f/dev/null | grep ^%::'". | |
6 | %:: %,v | |
7 | %:: RCS/%,v | |
8 | %:: RCS/% | |
9 | %:: s.% | |
10 | %:: SCCS/s.% | |
11 | ||
dad9cd7d ÆAB |
12 | ## Likewise delete default $(SUFFIXES). See: |
13 | ## | |
14 | ## info make --index-search=.SUFFIXES | |
15 | .SUFFIXES: | |
16 | ||
8df786d2 ÆAB |
17 | ### Flags affecting all rules |
18 | ||
19 | # A GNU make extension since gmake 3.72 (released in late 1994) to | |
20 | # remove the target of rules if commands in those rules fail. The | |
21 | # default is to only do that if make itself receives a signal. Affects | |
22 | # all targets, see: | |
23 | # | |
24 | # info make --index-search=.DELETE_ON_ERROR | |
25 | .DELETE_ON_ERROR: | |
fd15f8a5 ÆAB |
26 | |
27 | ### Global variables | |
28 | ||
29 | ## comma, empty, space: handy variables as these tokens are either | |
30 | ## special or can be hard to spot among other Makefile syntax. | |
31 | comma := , | |
32 | empty := | |
33 | space := $(empty) $(empty) | |
a9fda017 ÆAB |
34 | |
35 | ### Quieting | |
36 | ## common | |
37 | QUIET_SUBDIR0 = +$(MAKE) -C # space to separate -C and subdir | |
38 | QUIET_SUBDIR1 = | |
39 | ||
40 | ifneq ($(findstring w,$(MAKEFLAGS)),w) | |
41 | PRINT_DIR = --no-print-directory | |
42 | else # "make -w" | |
43 | NO_SUBDIR = : | |
44 | endif | |
45 | ||
46 | ifneq ($(findstring s,$(MAKEFLAGS)),s) | |
47 | ifndef V | |
48 | ## common | |
49 | QUIET_SUBDIR0 = +@subdir= | |
50 | QUIET_SUBDIR1 = ;$(NO_SUBDIR) echo ' ' SUBDIR $$subdir; \ | |
51 | $(MAKE) $(PRINT_DIR) -C $$subdir | |
52 | ||
53 | QUIET = @ | |
54 | QUIET_GEN = @echo ' ' GEN $@; | |
55 | ||
05b8b825 | 56 | QUIET_MKDIR_P_PARENT = @echo ' ' MKDIR -p $(@D); |
0b6d0bc9 | 57 | |
a9fda017 ÆAB |
58 | ## Used in "Makefile" |
59 | QUIET_CC = @echo ' ' CC $@; | |
60 | QUIET_AR = @echo ' ' AR $@; | |
61 | QUIET_LINK = @echo ' ' LINK $@; | |
62 | QUIET_BUILT_IN = @echo ' ' BUILTIN $@; | |
63 | QUIET_LNCP = @echo ' ' LN/CP $@; | |
64 | QUIET_XGETTEXT = @echo ' ' XGETTEXT $@; | |
b9832f7e | 65 | QUIET_MSGINIT = @echo ' ' MSGINIT $@; |
a9fda017 | 66 | QUIET_MSGFMT = @echo ' ' MSGFMT $@; |
fbb3d323 | 67 | QUIET_MSGMERGE = @echo ' ' MSGMERGE $@; |
a9fda017 ÆAB |
68 | QUIET_GCOV = @echo ' ' GCOV $@; |
69 | QUIET_SP = @echo ' ' SP $<; | |
70 | QUIET_HDR = @echo ' ' HDR $(<:hcc=h); | |
71 | QUIET_RC = @echo ' ' RC $@; | |
72 | QUIET_SPATCH = @echo ' ' SPATCH $<; | |
f7ff6597 | 73 | QUIET_SPATCH_T = @echo ' ' SPATCH TEST $(@:.build/%=%); |
a9fda017 ÆAB |
74 | |
75 | ## Used in "Documentation/Makefile" | |
76 | QUIET_ASCIIDOC = @echo ' ' ASCIIDOC $@; | |
77 | QUIET_XMLTO = @echo ' ' XMLTO $@; | |
78 | QUIET_DB2TEXI = @echo ' ' DB2TEXI $@; | |
79 | QUIET_MAKEINFO = @echo ' ' MAKEINFO $@; | |
80 | QUIET_DBLATEX = @echo ' ' DBLATEX $@; | |
81 | QUIET_XSLTPROC = @echo ' ' XSLTPROC $@; | |
82 | QUIET_GEN = @echo ' ' GEN $@; | |
83 | QUIET_STDERR = 2> /dev/null | |
84 | ||
85 | QUIET_LINT_GITLINK = @echo ' ' LINT GITLINK $<; | |
86 | QUIET_LINT_MANSEC = @echo ' ' LINT MAN SEC $<; | |
87 | QUIET_LINT_MANEND = @echo ' ' LINT MAN END $<; | |
88 | ||
89 | export V | |
90 | endif | |
91 | endif | |
0b6d0bc9 ÆAB |
92 | |
93 | ### Templates | |
94 | ||
95 | ## mkdir_p_parent: lazily "mkdir -p" the path needed for a $@ | |
96 | ## file. Uses $(wildcard) to avoid the "mkdir -p" if it's not | |
97 | ## needed. | |
98 | ## | |
99 | ## Is racy, but in a good way; we might redundantly (and safely) | |
100 | ## "mkdir -p" when running in parallel, but won't need to exhaustively create | |
101 | ## individual rules for "a" -> "prefix" -> "dir" -> "file" if given a | |
102 | ## "a/prefix/dir/file". This can instead be inserted at the start of | |
103 | ## the "a/prefix/dir/file" rule. | |
104 | define mkdir_p_parent_template | |
105 | $(if $(wildcard $(@D)),,$(QUIET_MKDIR_P_PARENT)$(shell mkdir -p $(@D))) | |
106 | endef |