aboutsummaryrefslogtreecommitdiff
path: root/Rules.mak
diff options
context:
space:
mode:
authorBernhard Reutner-Fischer <rep.dot.nop@gmail.com>2006-03-09 09:03:37 +0000
committerBernhard Reutner-Fischer <rep.dot.nop@gmail.com>2006-03-09 09:03:37 +0000
commit07a79e75f502ebd41e5341aacc5de303d3ffaea0 (patch)
tree4b95f98bab0b298c5df171772b629d03400ef507 /Rules.mak
parent874af85d5eb08b65476f406f6a1e7edc127ac210 (diff)
downloadbusybox-w32-07a79e75f502ebd41e5341aacc5de303d3ffaea0.tar.gz
busybox-w32-07a79e75f502ebd41e5341aacc5de303d3ffaea0.tar.bz2
busybox-w32-07a79e75f502ebd41e5341aacc5de303d3ffaea0.zip
- backout using features which are not available with the previous stable
version of make (3.71.1).
Diffstat (limited to 'Rules.mak')
-rw-r--r--Rules.mak56
1 files changed, 32 insertions, 24 deletions
diff --git a/Rules.mak b/Rules.mak
index 51c9baeab..43a9ef1d2 100644
--- a/Rules.mak
+++ b/Rules.mak
@@ -71,6 +71,16 @@ HOSTCFLAGS= -Wall -Wstrict-prototypes -O2 -fomit-frame-pointer
71# Ensure consistent sort order, 'gcc -print-search-dirs' behavior, etc. 71# Ensure consistent sort order, 'gcc -print-search-dirs' behavior, etc.
72LC_ALL:= C 72LC_ALL:= C
73 73
74# initialize flags here
75CFLAGS:=
76CFLAGS_COMBINE:=
77CFLAGS_PIC:=
78LD_FLAGS:=
79LIB_LDFLAGS:=
80PROG_LDFLAGS:=
81PROG_CFLAGS:=
82OPTIMIZATIONS:=
83
74# If you want to add some simple compiler switches (like -march=i686), 84# If you want to add some simple compiler switches (like -march=i686),
75# especially from the command line, use this instead of CFLAGS directly. 85# especially from the command line, use this instead of CFLAGS directly.
76# For optimization overrides, it's better still to set OPTIMIZATIONS. 86# For optimization overrides, it's better still to set OPTIMIZATIONS.
@@ -94,7 +104,7 @@ CFLAGS_EXTRA=$(subst ",, $(strip $(EXTRA_CFLAGS_OPTIONS)))
94WARNINGS=-Wall -Wstrict-prototypes -Wshadow 104WARNINGS=-Wall -Wstrict-prototypes -Wshadow
95CFLAGS+=-I$(top_builddir)/include -I$(top_srcdir)/include 105CFLAGS+=-I$(top_builddir)/include -I$(top_srcdir)/include
96 106
97ARFLAGS=cruP 107ARFLAGS=cru
98 108
99 109
100 110
@@ -149,8 +159,8 @@ __TARGET_ARCH:=$(shell $(CC) -dumpmachine | sed -e s'/-.*//' \
149 ) 159 )
150endif 160endif
151 161
152$(call check_gcc,CFLAGS,-funsigned-char,) 162CFLAGS+=$(call check_gcc,CFLAGS,-funsigned-char,)
153$(call check_gcc,CFLAGS,-mmax-stack-frame=256,) 163CFLAGS+=$(call check_gcc,CFLAGS,-mmax-stack-frame=256,)
154 164
155#-------------------------------------------------------- 165#--------------------------------------------------------
156# Arch specific compiler optimization stuff should go here. 166# Arch specific compiler optimization stuff should go here.
@@ -158,51 +168,51 @@ $(call check_gcc,CFLAGS,-mmax-stack-frame=256,)
158# for OPTIMIZATIONS... 168# for OPTIMIZATIONS...
159 169
160# use '-Os' optimization if available, else use -O2 170# use '-Os' optimization if available, else use -O2
161$(call check_gcc,OPTIMIZATIONS,-Os,-O2) 171OPTIMIZATIONS+=$(call check_gcc,OPTIMIZATIONS,-Os,-O2)
162 172
163# gcc 2.95 exits with 0 for "unrecognized option" 173# gcc 2.95 exits with 0 for "unrecognized option"
164$(if $(call is_eq,$(CONFIG_BUILD_AT_ONCE),y),\ 174CFLAGS_COMBINE+=$(if $(call is_eq,$(CONFIG_BUILD_AT_ONCE),y),\
165 $(if $(call cc_ge,3,0),\ 175 $(if $(call cc_ge,3,0),\
166 $(call check_gcc,CFLAGS_COMBINE,--combine,))) 176 $(call check_gcc,CFLAGS_COMBINE,--combine,)))
167 177
168$(if $(call is_eq,$(CONFIG_BUILD_AT_ONCE),y),\ 178OPTIMIZATIONS+=$(if $(call is_eq,$(CONFIG_BUILD_AT_ONCE),y),\
169 $(call check_gcc,OPTIMIZATIONS,-funit-at-a-time,)) 179 $(call check_gcc,OPTIMIZATIONS,-funit-at-a-time,))
170 180
171# http://gcc.gnu.org/bugzilla/show_bug.cgi?id=25795 181# http://gcc.gnu.org/bugzilla/show_bug.cgi?id=25795
172#$(if $(call is_eq,$(CONFIG_BUILD_AT_ONCE),y),\ 182#PROG_CFLAGS+=$(if $(call is_eq,$(CONFIG_BUILD_AT_ONCE),y),\
173# $(call check_gcc,PROG_CFLAGS,-fwhole-program,)) 183# $(call check_gcc,PROG_CFLAGS,-fwhole-program,))
174 184
175$(call check_ld,LIB_LDFLAGS,--enable-new-dtags,) 185LIB_LDFLAGS+=$(call check_ld,LIB_LDFLAGS,--enable-new-dtags,)
176#$(call check_ld,LIB_LDFLAGS,--reduce-memory-overheads,) 186#LIB_LDFLAGS+=$(call check_ld,LIB_LDFLAGS,--reduce-memory-overheads,)
177#$(call check_ld,LIB_LDFLAGS,--as-needed,) 187#LIB_LDFLAGS+=$(call check_ld,LIB_LDFLAGS,--as-needed,)
178#$(call check_ld,LIB_LDFLAGS,--warn-shared-textrel,) 188#LIB_LDFLAGS+=$(call check_ld,LIB_LDFLAGS,--warn-shared-textrel,)
179 189
180$(call check_ld,PROG_LDFLAGS,--gc-sections,) 190PROG_LDFLAGS+=$(call check_ld,PROG_LDFLAGS,--gc-sections,)
181 191
182# Some nice architecture specific optimizations 192# Some nice architecture specific optimizations
183ifeq ($(__TARGET_ARCH),arm) 193ifeq ($(__TARGET_ARCH),arm)
184 OPTIMIZATIONS+=-fstrict-aliasing 194 OPTIMIZATIONS+=-fstrict-aliasing
185endif # arm 195endif # arm
186 196
187$(if $(call is_eq,$(__TARGET_ARCH),i386),\ 197OPTIMIZATIONS+=$(if $(call is_eq,$(__TARGET_ARCH),i386),\
188 $(call check_gcc,OPTIMIZATIONS,-march=i386,)) 198 $(call check_gcc,OPTIMIZATIONS,-march=i386,))
189 199
190# gcc-4.0 and older seem to benefit from these 200# gcc-4.0 and older seem to benefit from these
191$(if $(call cc_le,4,0),\ 201OPTIMIZATIONS+=$(if $(call cc_le,4,0),\
192 $(call check_gcc,OPTIMIZATIONS,-mpreferred-stack-boundary=2,)\ 202 $(call check_gcc,OPTIMIZATIONS,-mpreferred-stack-boundary=2,)\
193 $(call check_gcc,OPTIMIZATIONS,-falign-functions=1 -falign-jumps=1 -falign-loops=1,\ 203 $(call check_gcc,OPTIMIZATIONS,-falign-functions=1 -falign-jumps=1 -falign-loops=1,\
194 -malign-functions=0 -malign-jumps=0 -malign-loops=0)) 204 -malign-functions=0 -malign-jumps=0 -malign-loops=0))
195 205
196# gcc-4.1 and beyond seem to benefit from these 206# gcc-4.1 and beyond seem to benefit from these
197# turn off flags which hurt -Os 207# turn off flags which hurt -Os
198$(if $(call cc_ge,4,1),\ 208OPTIMIZATIONS+=$(if $(call cc_ge,4,1),\
199 $(call check_gcc,OPTIMIZATIONS,-fno-tree-loop-optimize,)\ 209 $(call check_gcc,OPTIMIZATIONS,-fno-tree-loop-optimize,)\
200 $(call check_gcc,OPTIMIZATIONS,-fno-tree-dominator-opts,)\ 210 $(call check_gcc,OPTIMIZATIONS,-fno-tree-dominator-opts,)\
201 $(call check_gcc,OPTIMIZATIONS,-fno-strength-reduce,)\ 211 $(call check_gcc,OPTIMIZATIONS,-fno-strength-reduce,)\
202\ 212\
203 $(call check_gcc,OPTIMIZATIONS,-fno-branch-count-reg,)) 213 $(call check_gcc,OPTIMIZATIONS,-fno-branch-count-reg,))
204 214
205$(call check_gcc,OPTIMIZATIONS,-fomit-frame-pointer,) 215OPTIMIZATIONS+=$(call check_gcc,OPTIMIZATIONS,-fomit-frame-pointer,)
206 216
207# 217#
208#-------------------------------------------------------- 218#--------------------------------------------------------
@@ -227,9 +237,7 @@ else
227 endif 237 endif
228endif 238endif
229 239
230$(if $(call is_eq,$(CONFIG_DEBUG),y),\ 240LDFLAGS+=$(if $(call is_eq,$(CONFIG_DEBUG),y),$(call check_ld,LDFLAGS,--warn-common,)$(call check_ld,LDFLAGS,--sort-common,))
231 $(call check_ld,LDFLAGS,--warn-common,),\
232 $(call check_ld,LDFLAGS,--warn-common,)$(call check_ld,LDFLAGS,--sort-common,))
233ifeq ($(CONFIG_DEBUG),y) 241ifeq ($(CONFIG_DEBUG),y)
234 CFLAGS +=$(WARNINGS) -g -D_GNU_SOURCE 242 CFLAGS +=$(WARNINGS) -g -D_GNU_SOURCE
235 STRIPCMD:=/bin/true -Not_stripping_since_we_are_debugging 243 STRIPCMD:=/bin/true -Not_stripping_since_we_are_debugging
@@ -237,14 +245,15 @@ else
237 CFLAGS+=$(WARNINGS) $(OPTIMIZATIONS) -D_GNU_SOURCE -DNDEBUG 245 CFLAGS+=$(WARNINGS) $(OPTIMIZATIONS) -D_GNU_SOURCE -DNDEBUG
238 STRIPCMD:=$(STRIP) -s --remove-section=.note --remove-section=.comment 246 STRIPCMD:=$(STRIP) -s --remove-section=.note --remove-section=.comment
239endif 247endif
240$(if $(call is_eq,$(CONFIG_STATIC),y),\ 248PROG_CFLAGS+=$(if $(call is_eq,$(CONFIG_STATIC),y),\
241 $(call check_gcc,PROG_CFLAGS,-static,)) 249 $(call check_gcc,PROG_CFLAGS,-static,))
242 250
243$(call check_gcc,CFLAGS_SHARED,-shared,) 251CFLAGS_SHARED+=$(call check_gcc,CFLAGS_SHARED,-shared,)
244LIB_CFLAGS+=$(CFLAGS_SHARED) 252LIB_CFLAGS+=$(CFLAGS_SHARED)
245 253
246$(if $(call is_eq,$(CONFIG_BUILD_LIBBUSYBOX),y),\ 254CFLAGS_PIC+=$(if $(call is_eq,$(CONFIG_BUILD_LIBBUSYBOX),y),\
247 $(call check_gcc,CFLAGS_PIC,-fPIC,)) 255 $(call check_gcc,CFLAGS_PIC,-fPIC,))
256LIB_CFLAGS+=$(CFLAGS_PIC)
248 257
249ifeq ($(CONFIG_SELINUX),y) 258ifeq ($(CONFIG_SELINUX),y)
250 LIBRARIES += -lselinux 259 LIBRARIES += -lselinux
@@ -379,12 +388,11 @@ ifdef rules-mak-rules
379.SUFFIXES: .c .S .o .os .om .osm .oS .so .a .s .i .E 388.SUFFIXES: .c .S .o .os .om .osm .oS .so .a .s .i .E
380 389
381# generic rules 390# generic rules
382%.o: %.c ; $(compile.c)
383%.os: %.c ; $(compile.c) $(CFLAGS_PIC)
384%.o: ; $(compile.c) 391%.o: ; $(compile.c)
385%.os: ; $(compile.c) $(CFLAGS_PIC) 392%.os: ; $(compile.c) $(CFLAGS_PIC)
386%.om: ; $(compile.m) 393%.om: ; $(compile.m)
387%.osm: ; $(compile.m) $(CFLAGS_PIC) 394%.osm: ; $(compile.m) $(CFLAGS_PIC)
395%.a: ; $(do_ar)
388 396
389endif # rules-mak-rules 397endif # rules-mak-rules
390 398