diff options
author | aldot <aldot@69ca8d6d-28ef-0310-b511-8ec308f3f277> | 2006-03-01 22:54:48 +0000 |
---|---|---|
committer | aldot <aldot@69ca8d6d-28ef-0310-b511-8ec308f3f277> | 2006-03-01 22:54:48 +0000 |
commit | 3e42de836e4e08c6226383f84de0f734f96c8697 (patch) | |
tree | 233c051da862595b6e473e832051708e2d9803cb /Rules.mak | |
parent | b7c6f4ee19e3b2a465d2ef8c1ec3e51e6572e7ff (diff) | |
download | busybox-w32-3e42de836e4e08c6226383f84de0f734f96c8697.tar.gz busybox-w32-3e42de836e4e08c6226383f84de0f734f96c8697.tar.bz2 busybox-w32-3e42de836e4e08c6226383f84de0f734f96c8697.zip |
- fixes parallel builds (make -j)
- use less resources for the buildsystem itself
git-svn-id: svn://busybox.net/trunk/busybox@14407 69ca8d6d-28ef-0310-b511-8ec308f3f277
Diffstat (limited to 'Rules.mak')
-rw-r--r-- | Rules.mak | 314 |
1 files changed, 198 insertions, 116 deletions
@@ -10,6 +10,12 @@ ifeq ($(filter $(noconfig_targets),$(MAKECMDGOALS)),) | |||
10 | -include $(top_builddir)/.config | 10 | -include $(top_builddir)/.config |
11 | endif | 11 | endif |
12 | 12 | ||
13 | ifeq ($(MAKELEVEL),0) | ||
14 | ifeq ($(HAVE_DOT_CONFIG),y) | ||
15 | rules-mak-rules:=0 | ||
16 | endif | ||
17 | endif | ||
18 | |||
13 | #-------------------------------------------------------- | 19 | #-------------------------------------------------------- |
14 | PROG := busybox | 20 | PROG := busybox |
15 | MAJOR_VERSION :=1 | 21 | MAJOR_VERSION :=1 |
@@ -30,8 +36,9 @@ BUILDTIME := $(shell TZ=UTC date -u "+%Y.%m.%d-%H:%M%z") | |||
30 | # If you are running a cross compiler, you will want to set 'CROSS' | 36 | # If you are running a cross compiler, you will want to set 'CROSS' |
31 | # to something more interesting... Target architecture is determined | 37 | # to something more interesting... Target architecture is determined |
32 | # by asking the CC compiler what arch it compiles things for, so unless | 38 | # by asking the CC compiler what arch it compiles things for, so unless |
33 | # your compiler is broken, you should not need to specify TARGET_ARCH | 39 | # your compiler is broken, you should not need to specify __TARGET_ARCH |
34 | CROSS =$(subst ",, $(strip $(CROSS_COMPILER_PREFIX))) | 40 | CROSS =$(subst ",, $(strip $(CROSS_COMPILER_PREFIX))) |
41 | #") | ||
35 | CC = $(CROSS)gcc | 42 | CC = $(CROSS)gcc |
36 | AR = $(CROSS)ar | 43 | AR = $(CROSS)ar |
37 | AS = $(CROSS)as | 44 | AS = $(CROSS)as |
@@ -39,16 +46,19 @@ LD = $(CROSS)ld | |||
39 | NM = $(CROSS)nm | 46 | NM = $(CROSS)nm |
40 | STRIP = $(CROSS)strip | 47 | STRIP = $(CROSS)strip |
41 | CPP = $(CC) -E | 48 | CPP = $(CC) -E |
42 | # MAKEFILES = $(top_builddir)/.config | 49 | SED ?= sed |
43 | RM = rm | 50 | AWK ?= awk |
44 | RM_F = $(RM) -f | 51 | |
45 | LN = ln | 52 | |
46 | LN_S = $(LN) -s | 53 | ifdef PACKAGE_BE_VERBOSE |
47 | MKDIR = mkdir | 54 | PACKAGE_BE_VERBOSE := $(shell echo $(PACKAGE_BE_VERBOSE) | $(SED) "s/[[:alpha:]]*//g") |
48 | MKDIR_P = $(MKDIR) -p | 55 | endif |
49 | MV = mv | ||
50 | CP = cp | ||
51 | 56 | ||
57 | # for make V=3 and above make $(shell) invocations verbose | ||
58 | ifeq ($(if $(strip $(PACKAGE_BE_VERBOSE)),$(shell test $(PACKAGE_BE_VERBOSE) -gt 2 ; echo $$?),1),0) | ||
59 | SHELL+=-x | ||
60 | MKDEP_ARGS:=-w | ||
61 | endif | ||
52 | 62 | ||
53 | # What OS are you compiling busybox for? This allows you to include | 63 | # What OS are you compiling busybox for? This allows you to include |
54 | # OS specific things, syscall overrides, etc. | 64 | # OS specific things, syscall overrides, etc. |
@@ -63,8 +73,9 @@ LC_ALL:= C | |||
63 | 73 | ||
64 | # If you want to add some simple compiler switches (like -march=i686), | 74 | # If you want to add some simple compiler switches (like -march=i686), |
65 | # especially from the command line, use this instead of CFLAGS directly. | 75 | # especially from the command line, use this instead of CFLAGS directly. |
66 | # For optimization overrides, it's better still to set OPTIMIZATION. | 76 | # For optimization overrides, it's better still to set OPTIMIZATIONS. |
67 | CFLAGS_EXTRA=$(subst ",, $(strip $(EXTRA_CFLAGS_OPTIONS))) | 77 | CFLAGS_EXTRA=$(subst ",, $(strip $(EXTRA_CFLAGS_OPTIONS))) |
78 | #") | ||
68 | 79 | ||
69 | # To compile vs some other alternative libc, you may need to use/adjust | 80 | # To compile vs some other alternative libc, you may need to use/adjust |
70 | # the following lines to meet your needs... | 81 | # the following lines to meet your needs... |
@@ -81,20 +92,50 @@ CFLAGS_EXTRA=$(subst ",, $(strip $(EXTRA_CFLAGS_OPTIONS))) | |||
81 | #GCCINCDIR:=$(shell gcc -print-search-dirs | sed -ne "s/install: \(.*\)/\1include/gp") | 92 | #GCCINCDIR:=$(shell gcc -print-search-dirs | sed -ne "s/install: \(.*\)/\1include/gp") |
82 | 93 | ||
83 | WARNINGS=-Wall -Wstrict-prototypes -Wshadow | 94 | WARNINGS=-Wall -Wstrict-prototypes -Wshadow |
84 | CFLAGS+=-I$(top_builddir)/include -I$(top_srcdir)/include -I$(srcdir) | 95 | CFLAGS+=-I$(top_builddir)/include -I$(top_srcdir)/include |
85 | 96 | ||
86 | ARFLAGS=cru | 97 | ARFLAGS=cru |
87 | 98 | ||
88 | 99 | ||
100 | |||
101 | # Get the CC MAJOR/MINOR version | ||
89 | # gcc centric. Perhaps fiddle with findstring gcc,$(CC) for the rest | 102 | # gcc centric. Perhaps fiddle with findstring gcc,$(CC) for the rest |
90 | # get the CC MAJOR/MINOR version | ||
91 | CC_MAJOR:=$(shell printf "%02d" $(shell echo __GNUC__ | $(CC) -E -xc - | tail -n 1)) | 103 | CC_MAJOR:=$(shell printf "%02d" $(shell echo __GNUC__ | $(CC) -E -xc - | tail -n 1)) |
92 | CC_MINOR:=$(shell printf "%02d" $(shell echo __GNUC_MINOR__ | $(CC) -E -xc - | tail -n 1)) | 104 | CC_MINOR:=$(shell printf "%02d" $(shell echo __GNUC_MINOR__ | $(CC) -E -xc - | tail -n 1)) |
93 | 105 | ||
106 | # Note: spaces are significant here! | ||
107 | # Check if CC version is equal to given MAJOR,MINOR. Returns empty if false. | ||
108 | define cc_eq | ||
109 | $(shell [ $(CC_MAJOR) -eq $(1) -a $(CC_MINOR) -eq $(2) ] && echo y) | ||
110 | endef | ||
111 | # Check if CC version is greater or equal than given MAJOR,MINOR | ||
112 | define cc_ge | ||
113 | $(shell [ $(CC_MAJOR) -ge $(1) -a $(CC_MINOR) -ge $(2) ] && echo y) | ||
114 | endef | ||
115 | # Check if CC version is less or equal than given MAJOR,MINOR | ||
116 | define cc_le | ||
117 | $(shell [ $(CC_MAJOR) -le $(1) -a $(CC_MINOR) -le $(2) ] && echo y) | ||
118 | endef | ||
119 | |||
120 | # Workaround bugs in make-3.80 for eval in conditionals | ||
121 | define is_eq | ||
122 | $(shell [ $(1) = $(2) ] 2> /dev/null && echo y) | ||
123 | endef | ||
124 | define is_neq | ||
125 | $(shell [ $(1) != $(2) ] 2> /dev/null && echo y) | ||
126 | endef | ||
127 | |||
94 | #-------------------------------------------------------- | 128 | #-------------------------------------------------------- |
95 | export VERSION BUILDTIME HOSTCC HOSTCFLAGS CROSS CC AR AS LD NM STRIP CPP | 129 | export VERSION BUILDTIME HOSTCC HOSTCFLAGS CROSS CC AR AS LD NM STRIP CPP |
96 | ifeq ($(strip $(TARGET_ARCH)),) | 130 | |
97 | TARGET_ARCH:=$(shell $(CC) -dumpmachine | sed -e s'/-.*//' \ | 131 | # TARGET_ARCH and TARGET_MACH will be passed verbatim to CC with recent |
132 | # versions of make, so we use __TARGET_ARCH here. | ||
133 | # Current builtin rules looks like that: | ||
134 | # COMPILE.s = $(AS) $(ASFLAGS) $(TARGET_MACH) | ||
135 | # COMPILE.c = $(CC) $(CFLAGS) $(CPPFLAGS) $(TARGET_ARCH) -c | ||
136 | |||
137 | ifeq ($(strip $(__TARGET_ARCH)),) | ||
138 | __TARGET_ARCH:=$(shell $(CC) -dumpmachine | sed -e s'/-.*//' \ | ||
98 | -e 's/i.86/i386/' \ | 139 | -e 's/i.86/i386/' \ |
99 | -e 's/sparc.*/sparc/' \ | 140 | -e 's/sparc.*/sparc/' \ |
100 | -e 's/arm.*/arm/g' \ | 141 | -e 's/arm.*/arm/g' \ |
@@ -108,70 +149,60 @@ TARGET_ARCH:=$(shell $(CC) -dumpmachine | sed -e s'/-.*//' \ | |||
108 | ) | 149 | ) |
109 | endif | 150 | endif |
110 | 151 | ||
111 | # A nifty macro to make testing gcc features easier | 152 | $(call check_gcc,CFLAGS,-funsigned-char,) |
112 | check_gcc=$(shell \ | 153 | $(call check_gcc,CFLAGS,-mmax-stack-frame=256,) |
113 | if [ "$(1)" != "" ]; then \ | ||
114 | if $(CC) $(1) -S -o /dev/null -xc /dev/null > /dev/null 2>&1; \ | ||
115 | then echo "$(1)"; else echo "$(2)"; fi \ | ||
116 | fi) | ||
117 | |||
118 | # A not very robust macro to check for available ld flags | ||
119 | check_ld=$(shell \ | ||
120 | if [ "x$(1)" != "x" ]; then \ | ||
121 | $(LD) --help | grep -q "\$(1)" && echo "-Wl,$(1)" ; \ | ||
122 | fi) | ||
123 | |||
124 | CFLAGS+=$(call check_gcc,-funsigned-char,) | ||
125 | |||
126 | CFLAGS+=$(call check_gcc,-mmax-stack-frame=256,) | ||
127 | 154 | ||
128 | #-------------------------------------------------------- | 155 | #-------------------------------------------------------- |
129 | # Arch specific compiler optimization stuff should go here. | 156 | # Arch specific compiler optimization stuff should go here. |
130 | # Unless you want to override the defaults, do not set anything | 157 | # Unless you want to override the defaults, do not set anything |
131 | # for OPTIMIZATION... | 158 | # for OPTIMIZATIONS... |
132 | 159 | ||
133 | # use '-Os' optimization if available, else use -O2 | 160 | # use '-Os' optimization if available, else use -O2 |
134 | OPTIMIZATION:=$(call check_gcc,-Os,-O2) | 161 | $(call check_gcc,OPTIMIZATIONS,-Os,-O2) |
135 | 162 | ||
136 | ifeq ($(CONFIG_BUILD_AT_ONCE),y) | ||
137 | # gcc 2.95 exits with 0 for "unrecognized option" | 163 | # gcc 2.95 exits with 0 for "unrecognized option" |
138 | ifeq ($(strip $(shell [ $(CC_MAJOR) -ge 3 ] ; echo $$?)),0) | 164 | $(if $(call is_eq,$(CONFIG_BUILD_AT_ONCE),y),\ |
139 | OPTIMIZATION+=$(call check_gcc,--combine,) | 165 | $(if $(call cc_ge,3,0),\ |
140 | endif | 166 | $(call check_gcc,CFLAGS_COMBINE,--combine,))) |
141 | OPTIMIZATION+=$(call check_gcc,-funit-at-a-time,) | ||
142 | PROG_CFLAGS+=$(call check_gcc,-fwhole-program,) | ||
143 | endif # CONFIG_BUILD_AT_ONCE | ||
144 | 167 | ||
145 | LIB_LDFLAGS:=$(call check_ld,--enable-new-dtags,) | 168 | $(if $(call is_eq,$(CONFIG_BUILD_AT_ONCE),y),\ |
146 | #LIB_LDFLAGS+=$(call check_ld,--reduce-memory-overheads,) | 169 | $(call check_gcc,OPTIMIZATIONS,-funit-at-a-time,)) |
147 | #LIB_LDFLAGS+=$(call check_ld,--as-needed,) | ||
148 | #LIB_LDFLAGS+=$(call check_ld,--warn-shared-textrel,) | ||
149 | 170 | ||
171 | # http://gcc.gnu.org/bugzilla/show_bug.cgi?id=25795 | ||
172 | #$(if $(call is_eq,$(CONFIG_BUILD_AT_ONCE),y),\ | ||
173 | # $(call check_gcc,PROG_CFLAGS,-fwhole-program,)) | ||
174 | |||
175 | $(call check_ld,LIB_LDFLAGS,--enable-new-dtags,) | ||
176 | #$(call check_ld,LIB_LDFLAGS,--reduce-memory-overheads,) | ||
177 | #$(call check_ld,LIB_LDFLAGS,--as-needed,) | ||
178 | #$(call check_ld,LIB_LDFLAGS,--warn-shared-textrel,) | ||
179 | |||
180 | $(call check_ld,PROG_LDFLAGS,--gc-sections,) | ||
150 | 181 | ||
151 | # Some nice architecture specific optimizations | 182 | # Some nice architecture specific optimizations |
152 | ifeq ($(strip $(TARGET_ARCH)),arm) | 183 | ifeq ($(__TARGET_ARCH),arm) |
153 | OPTIMIZATION+=-fstrict-aliasing | 184 | OPTIMIZATIONS+=-fstrict-aliasing |
154 | endif | 185 | endif # arm |
155 | ifeq ($(strip $(TARGET_ARCH)),i386) | 186 | |
156 | OPTIMIZATION+=$(call check_gcc,-march=i386,) | 187 | $(if $(call is_eq,$(__TARGET_ARCH),i386),\ |
188 | $(call check_gcc,OPTIMIZATIONS,-march=i386,)) | ||
189 | |||
157 | # gcc-4.0 and older seem to suffer from these | 190 | # gcc-4.0 and older seem to suffer from these |
158 | ifneq ($(strip $(shell [ $(CC_MAJOR) -ge 4 -a $(CC_MINOR) -ge 1 ] ; echo $$?)),0) | 191 | $(if $(call cc_le,4,0),\ |
159 | OPTIMIZATION+=$(call check_gcc,-mpreferred-stack-boundary=2,) | 192 | $(call check_gcc,OPTIMIZATIONS,-mpreferred-stack-boundary=2,)\ |
160 | OPTIMIZATION+=$(call check_gcc,-falign-functions=0 -falign-jumps=0 -falign-loops=0,\ | 193 | $(call check_gcc,OPTIMIZATIONS,-falign-functions=0 -falign-jumps=0 -falign-loops=0,\ |
161 | -malign-functions=0 -malign-jumps=0 -malign-loops=0) | 194 | -malign-functions=0 -malign-jumps=0 -malign-loops=0)) |
162 | endif # gcc-4.0 and older | ||
163 | 195 | ||
164 | # gcc-4.1 and beyond seem to benefit from these | 196 | # gcc-4.1 and beyond seem to benefit from these |
165 | ifeq ($(strip $(shell [ $(CC_MAJOR) -ge 4 -a $(CC_MINOR) -ge 1 ] ; echo $$?)),0) | 197 | # turn off flags which hurt -Os |
166 | # turn off flags which hurt -Os | 198 | $(if $(call cc_ge,4,1),\ |
167 | OPTIMIZATION+=$(call check_gcc,-fno-tree-loop-optimize,) | 199 | $(call check_gcc,OPTIMIZATIONS,-fno-tree-loop-optimize,)\ |
168 | OPTIMIZATION+=$(call check_gcc,-fno-tree-dominator-opts,) | 200 | $(call check_gcc,OPTIMIZATIONS,-fno-tree-dominator-opts,)\ |
169 | OPTIMIZATION+=$(call check_gcc,-fno-strength-reduce,) | 201 | $(call check_gcc,OPTIMIZATIONS,-fno-strength-reduce,)\ |
170 | 202 | \ | |
171 | OPTIMIZATION+=$(call check_gcc,-fno-branch-count-reg,) | 203 | $(call check_gcc,OPTIMIZATIONS,-fno-branch-count-reg,)) |
172 | endif # gcc-4.1 and beyond | 204 | |
173 | endif | 205 | $(call check_gcc,OPTIMIZATIONS,-fomit-frame-pointer,) |
174 | OPTIMIZATIONS:=$(OPTIMIZATION) $(call check_gcc,-fomit-frame-pointer,) | ||
175 | 206 | ||
176 | # | 207 | # |
177 | #-------------------------------------------------------- | 208 | #-------------------------------------------------------- |
@@ -182,40 +213,40 @@ OPTIMIZATIONS:=$(OPTIMIZATION) $(call check_gcc,-fomit-frame-pointer,) | |||
182 | # prone to casual user adjustment. | 213 | # prone to casual user adjustment. |
183 | # | 214 | # |
184 | 215 | ||
185 | ifeq ($(strip $(CONFIG_LFS)),y) | 216 | ifeq ($(CONFIG_LFS),y) |
186 | # For large file summit support | 217 | # For large file summit support |
187 | CFLAGS+=-D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 | 218 | CFLAGS+=-D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 |
188 | endif | 219 | endif |
189 | ifeq ($(strip $(CONFIG_DMALLOC)),y) | 220 | ifeq ($(CONFIG_DMALLOC),y) |
190 | # For testing mem leaks with dmalloc | 221 | # For testing mem leaks with dmalloc |
191 | CFLAGS+=-DDMALLOC | 222 | CFLAGS+=-DDMALLOC |
192 | LIBRARIES:=-ldmalloc | 223 | LIBRARIES:=-ldmalloc |
193 | else | 224 | else |
194 | ifeq ($(strip $(CONFIG_EFENCE)),y) | 225 | ifeq ($(CONFIG_EFENCE),y) |
195 | LIBRARIES:=-lefence | 226 | LIBRARIES:=-lefence |
196 | endif | 227 | endif |
197 | endif | 228 | endif |
198 | ifeq ($(strip $(CONFIG_DEBUG)),y) | 229 | |
230 | $(if $(call is_eq,$(CONFIG_DEBUG),y),\ | ||
231 | $(call check_ld,LDFLAGS,--warn-common,),\ | ||
232 | $(call check_ld,LDFLAGS,--warn-common,)$(call check_ld,LDFLAGS,--sort-common,)) | ||
233 | ifeq ($(CONFIG_DEBUG),y) | ||
199 | CFLAGS +=$(WARNINGS) -g -D_GNU_SOURCE | 234 | CFLAGS +=$(WARNINGS) -g -D_GNU_SOURCE |
200 | LDFLAGS += $(call check_ld,--warn-common,) | ||
201 | STRIPCMD:=/bin/true -Not_stripping_since_we_are_debugging | 235 | STRIPCMD:=/bin/true -Not_stripping_since_we_are_debugging |
202 | else | 236 | else |
203 | CFLAGS+=$(WARNINGS) $(OPTIMIZATIONS) -D_GNU_SOURCE -DNDEBUG | 237 | CFLAGS+=$(WARNINGS) $(OPTIMIZATIONS) -D_GNU_SOURCE -DNDEBUG |
204 | LDFLAGS += $(call check_ld,--warn-common,) | ||
205 | LDFLAGS += $(call check_ld,--sort-common,) | ||
206 | STRIPCMD:=$(STRIP) -s --remove-section=.note --remove-section=.comment | 238 | STRIPCMD:=$(STRIP) -s --remove-section=.note --remove-section=.comment |
207 | endif | 239 | endif |
208 | ifeq ($(strip $(CONFIG_STATIC)),y) | 240 | $(if $(call is_eq,$(CONFIG_STATIC),y),\ |
209 | PROG_CFLAGS += $(call check_gcc,-static,) | 241 | $(call check_gcc,PROG_CFLAGS,-static,)) |
210 | endif | 242 | |
211 | CFLAGS_SHARED += $(call check_gcc,-shared,) | 243 | $(call check_gcc,CFLAGS_SHARED,-shared,) |
212 | LIB_CFLAGS+=$(CFLAGS_SHARED) | 244 | LIB_CFLAGS+=$(CFLAGS_SHARED) |
213 | 245 | ||
214 | ifeq ($(strip $(CONFIG_BUILD_LIBBUSYBOX)),y) | 246 | $(if $(call is_eq,$(CONFIG_BUILD_LIBBUSYBOX),y),\ |
215 | CFLAGS_PIC:= $(call check_gcc,-fPIC,) | 247 | $(call check_gcc,CFLAGS_PIC,-fPIC,)) |
216 | endif | ||
217 | 248 | ||
218 | ifeq ($(strip $(CONFIG_SELINUX)),y) | 249 | ifeq ($(CONFIG_SELINUX),y) |
219 | LIBRARIES += -lselinux | 250 | LIBRARIES += -lselinux |
220 | endif | 251 | endif |
221 | 252 | ||
@@ -223,14 +254,6 @@ ifeq ($(strip $(PREFIX)),) | |||
223 | PREFIX:=`pwd`/_install | 254 | PREFIX:=`pwd`/_install |
224 | endif | 255 | endif |
225 | 256 | ||
226 | # Additional complications due to support for pristine source dir. | ||
227 | # Include files in the build directory should take precedence over | ||
228 | # the copy in top_srcdir, both during the compilation phase and the | ||
229 | # shell script that finds the list of object files. | ||
230 | # Work in progress by <ldoolitt@recycle.lbl.gov>. | ||
231 | |||
232 | |||
233 | OBJECTS:=$(APPLET_SOURCES:.c=.o) busybox.o usage.o applets.o | ||
234 | CFLAGS += $(CROSS_CFLAGS) | 257 | CFLAGS += $(CROSS_CFLAGS) |
235 | ifdef BB_INIT_SCRIPT | 258 | ifdef BB_INIT_SCRIPT |
236 | CFLAGS += -DINIT_SCRIPT='"$(BB_INIT_SCRIPT)"' | 259 | CFLAGS += -DINIT_SCRIPT='"$(BB_INIT_SCRIPT)"' |
@@ -252,59 +275,118 @@ ifeq ($(strip $(CONFIG_INSTALL_APPLET_DONT)),y) | |||
252 | INSTALL_OPTS= | 275 | INSTALL_OPTS= |
253 | endif | 276 | endif |
254 | 277 | ||
278 | |||
279 | #------------------------------------------------------------ | ||
280 | # object extensions | ||
281 | |||
282 | # object potentially used in shared object | ||
283 | ifeq ($(strip $(CONFIG_BUILD_LIBBUSYBOX)),y) | ||
284 | # single-object extension | ||
285 | os:=.os | ||
286 | # multi-object extension | ||
287 | om:=.osm | ||
288 | else | ||
289 | os:=.o | ||
290 | om:=.om | ||
291 | endif | ||
292 | |||
255 | #------------------------------------------------------------ | 293 | #------------------------------------------------------------ |
256 | # Make the output nice and tight | 294 | # Make the output nice and tight |
257 | MAKEFLAGS += --no-print-directory | 295 | |
296 | # for make V=2 and above, do print directory | ||
297 | ifneq ($(shell test -n "$(strip $(PACKAGE_BE_VERBOSE))" && test $(PACKAGE_BE_VERBOSE) -gt 1 ; echo $$?),0) | ||
298 | MAKEFLAGS += --no-print-directory | ||
299 | endif | ||
300 | |||
301 | export MAKEOVERRIDES | ||
258 | export MAKE_IS_SILENT=n | 302 | export MAKE_IS_SILENT=n |
259 | ifneq ($(findstring s,$(MAKEFLAGS)),) | 303 | ifneq ($(findstring s,$(MAKEFLAGS)),) |
260 | export MAKE_IS_SILENT=y | 304 | export MAKE_IS_SILENT=y |
261 | SECHO := @-false | ||
262 | DISP := sil | 305 | DISP := sil |
263 | Q := @ | 306 | Q := @ |
264 | else | 307 | else |
265 | ifneq ($(V)$(VERBOSE),) | 308 | ifneq ($(V)$(VERBOSE),) |
266 | SECHO := @-false | ||
267 | DISP := ver | 309 | DISP := ver |
268 | Q := | 310 | Q := |
269 | else | 311 | else |
270 | SECHO := @echo | ||
271 | DISP := pur | 312 | DISP := pur |
272 | Q := @ | 313 | Q := @ |
273 | endif | 314 | endif |
274 | endif | 315 | endif |
275 | 316 | ||
276 | show_objs = $(subst $(top_builddir)/,,$(subst ../,,$@)) | 317 | define show_objs |
277 | pur_disp_compile.c = echo " "CC $(show_objs) | 318 | $(subst $(top_builddir)/,,$(subst ../,,$@)) |
278 | pur_disp_compile.h = echo " "HOSTCC $(show_objs) | 319 | endef |
279 | pur_disp_strip = echo " "STRIP $(show_objs) | 320 | pur_disp_compile.c = @echo " "CC $(show_objs) ; |
280 | pur_disp_link = echo " "LINK $(show_objs) | 321 | pur_disp_compile.h = @echo " "HOSTCC $(show_objs) ; |
281 | pur_disp_ar = echo " "AR $(ARFLAGS) $(show_objs) | 322 | pur_disp_strip = @echo " "STRIP $(show_objs) ; |
282 | sil_disp_compile.c = true | 323 | pur_disp_link = @echo " "LINK $(show_objs) ; |
283 | sil_disp_compile.h = true | 324 | pur_disp_link.h = @echo " "HOSTLINK $(show_objs) ; |
284 | sil_disp_strip = true | 325 | pur_disp_ar = @echo " "AR $(ARFLAGS) $(show_objs) ; |
285 | sil_disp_link = true | 326 | pur_disp_gen = @echo " "GEN $@ ; |
286 | sil_disp_ar = true | 327 | pur_disp_doc = @echo " "DOC $(subst docs/,,$@) ; |
287 | ver_disp_compile.c = echo $(cmd_compile.c) | 328 | pur_disp_bin = @echo " "BIN $(show_objs) ; |
288 | ver_disp_compile.h = echo $(cmd_compile.h) | 329 | sil_disp_compile.c = @ |
289 | ver_disp_strip = echo $(cmd_strip) | 330 | sil_disp_compile.h = @ |
290 | ver_disp_link = echo $(cmd_link) | 331 | sil_disp_strip = @ |
291 | ver_disp_ar = echo $(cmd_ar) | 332 | sil_disp_link = @ |
333 | sil_disp_link.h = @ | ||
334 | sil_disp_ar = @ | ||
335 | sil_disp_gen = @ | ||
336 | sil_disp_doc = @ | ||
337 | sil_disp_bin = @ | ||
338 | ver_disp_compile.c = | ||
339 | ver_disp_compile.h = | ||
340 | ver_disp_strip = | ||
341 | ver_disp_link = | ||
342 | ver_disp_link.h = | ||
343 | ver_disp_ar = | ||
344 | ver_disp_gen = | ||
345 | ver_disp_doc = | ||
346 | ver_disp_bin = | ||
292 | disp_compile.c = $($(DISP)_disp_compile.c) | 347 | disp_compile.c = $($(DISP)_disp_compile.c) |
293 | disp_compile.h = $($(DISP)_disp_compile.h) | 348 | disp_compile.h = $($(DISP)_disp_compile.h) |
294 | disp_strip = $($(DISP)_disp_strip) | 349 | disp_strip = $($(DISP)_disp_strip) |
295 | disp_link = $($(DISP)_disp_link) | 350 | disp_link = $($(DISP)_disp_link) |
351 | disp_link.h = $($(DISP)_disp_link.h) | ||
296 | disp_ar = $($(DISP)_disp_ar) | 352 | disp_ar = $($(DISP)_disp_ar) |
297 | disp_gen = $(SECHO) " "GEN $@ ; true | 353 | disp_gen = $($(DISP)_disp_gen) |
298 | disp_doc = $(SECHO) " "DOC $(subst docs/,,$@) ; true | 354 | disp_doc = $($(DISP)_disp_doc) |
299 | cmd_compile.c = $(CC) $(CFLAGS) $(EXTRA_CFLAGS) -c -o $@ $< | 355 | disp_bin = $($(DISP)_disp_bin) |
356 | # CFLAGS-dir == $(CFLAGS-$(notdir $(@D))) | ||
357 | # CFLAGS-dir-file.o == $(CFLAGS-$(notdir $(@D))-$(notdir $(@F))) | ||
358 | # CFLAGS-dir-file.c == $(CFLAGS-$(notdir $(<D))-$(notdir $(<F))) | ||
359 | # all prerequesites == $(foreach fil,$^,$(CFLAGS-$(notdir $(patsubst %/$,%,$(dir $(fil))))-$(notdir $(fil)))) | ||
360 | cmd_compile.c = $(CC) $(CFLAGS) $(EXTRA_CFLAGS) -I$(srcdir) -c -o $@ $< \ | ||
361 | $(foreach f,$^,$(CFLAGS-$(notdir $(patsubst %/$,%,$(dir $(f))))-$(notdir $(f)))) \ | ||
362 | $(CFLAGS-$(notdir $(@D))-$(notdir $(@F))) \ | ||
363 | $(CFLAGS-$(notdir $(@D))) | ||
364 | cmd_compile.m = $(cmd_compile.c) -DL_$(patsubst %$(suffix $(notdir $@)),%,$(notdir $@)) | ||
300 | cmd_compile.h = $(HOSTCC) $(HOSTCFLAGS) -c -o $@ $< | 365 | cmd_compile.h = $(HOSTCC) $(HOSTCFLAGS) -c -o $@ $< |
301 | cmd_strip = $(STRIPCMD) $@ | 366 | cmd_strip = $(STRIPCMD) $@ |
302 | cmd_link = $(CC) $(CFLAGS) $(EXTRA_CFLAGS) $(LDFLAGS) | 367 | cmd_link = $(CC) $(CFLAGS) $(EXTRA_CFLAGS) -I$(srcdir) $(LDFLAGS) |
368 | cmd_link.h = $(HOSTCC) $(HOSTCFLAGS) $(HOST_LDFLAGS) $^ -o $@ | ||
303 | cmd_ar = $(AR) $(ARFLAGS) $@ $^ | 369 | cmd_ar = $(AR) $(ARFLAGS) $@ $^ |
304 | compile.c = @$(disp_compile.c) ; $(cmd_compile.c) | 370 | compile.c = $(disp_compile.c) $(cmd_compile.c) |
305 | compile.h = @$(disp_compile.h) ; $(cmd_compile.h) | 371 | compile.m = $(disp_compile.c) $(cmd_compile.m) |
306 | do_strip = @$(disp_strip) ; $(cmd_strip) | 372 | compile.h = $(disp_compile.h) $(cmd_compile.h) |
307 | do_link = @$(disp_link) ; $(cmd_link) | 373 | do_strip = $(disp_strip) $(cmd_strip) |
308 | do_ar = @$(disp_ar) ; $(cmd_ar) | 374 | do_link = $(disp_link) $(cmd_link) |
375 | do_link.h = $(disp_link.h) $(cmd_link.h) | ||
376 | do_ar = $(disp_ar) $(cmd_ar) | ||
377 | |||
378 | ifdef rules-mak-rules | ||
379 | .SUFFIXES: .c .S .o .os .om .osm .oS .so .a .s .i .E | ||
380 | |||
381 | # generic rules | ||
382 | %.o: %.c ; $(compile.c) | ||
383 | %.os: %.c ; $(compile.c) $(CFLAGS_PIC) | ||
384 | %.o: ; $(compile.c) | ||
385 | %.os: ; $(compile.c) $(CFLAGS_PIC) | ||
386 | %.om: ; $(compile.m) | ||
387 | %.osm: ; $(compile.m) $(CFLAGS_PIC) | ||
388 | |||
389 | endif # rules-mak-rules | ||
309 | 390 | ||
310 | .PHONY: dummy | 391 | .PHONY: dummy |
392 | |||