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