aboutsummaryrefslogtreecommitdiff
path: root/Rules.mak
diff options
context:
space:
mode:
authoraldot <aldot@69ca8d6d-28ef-0310-b511-8ec308f3f277>2006-03-13 19:04:00 +0000
committeraldot <aldot@69ca8d6d-28ef-0310-b511-8ec308f3f277>2006-03-13 19:04:00 +0000
commit30d77f4b561efa82d87b1767281a687c72f78dc4 (patch)
tree49493696039b285aa751a5bc884fc70c9c85e878 /Rules.mak
parent12f32660d14e442e42ed667c106fec3a9db79856 (diff)
downloadbusybox-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.mak312
1 files changed, 109 insertions, 203 deletions
diff --git a/Rules.mak b/Rules.mak
index 031b41ee5..34c9be69e 100644
--- a/Rules.mak
+++ b/Rules.mak
@@ -10,10 +10,6 @@ ifeq ($(filter $(noconfig_targets),$(MAKECMDGOALS)),)
10-include $(top_builddir)/.config 10-include $(top_builddir)/.config
11endif 11endif
12 12
13ifeq ($(HAVE_DOT_CONFIG),y)
14rules-mak-rules:=0
15endif
16
17#-------------------------------------------------------- 13#--------------------------------------------------------
18PROG := busybox 14PROG := busybox
19MAJOR_VERSION :=1 15MAJOR_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
38CROSS =$(subst ",, $(strip $(CROSS_COMPILER_PREFIX))) 34CROSS =$(subst ",, $(strip $(CROSS_COMPILER_PREFIX)))
39#")
40CC = $(CROSS)gcc 35CC = $(CROSS)gcc
41AR = $(CROSS)ar 36AR = $(CROSS)ar
42AS = $(CROSS)as 37AS = $(CROSS)as
@@ -45,18 +40,7 @@ NM = $(CROSS)nm
45STRIP = $(CROSS)strip 40STRIP = $(CROSS)strip
46CPP = $(CC) -E 41CPP = $(CC) -E
47SED ?= sed 42SED ?= sed
48AWK ?= awk
49
50 43
51ifdef PACKAGE_BE_VERBOSE
52PACKAGE_BE_VERBOSE := $(shell echo $(PACKAGE_BE_VERBOSE) | $(SED) "s/[[:alpha:]]*//g")
53endif
54
55# for make V=3 and above make $(shell) invocations verbose
56ifeq ($(if $(strip $(PACKAGE_BE_VERBOSE)),$(shell test $(PACKAGE_BE_VERBOSE) -gt 2 ; echo $$?),1),0)
57 SHELL+=-x
58 MKDEP_ARGS:=-w
59endif
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.
70LC_ALL:= C 54LC_ALL:= C
71 55
72# initialize flags here
73CFLAGS:=
74CFLAGS_COMBINE:=
75CFLAGS_PIC:=
76LD_FLAGS:=
77LIB_LDFLAGS:=
78PROG_LDFLAGS:=
79PROG_CFLAGS:=
80OPTIMIZATIONS:=
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.
85CFLAGS_EXTRA=$(subst ",, $(strip $(EXTRA_CFLAGS_OPTIONS))) 59CFLAGS_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
102WARNINGS=-Wall -Wstrict-prototypes -Wshadow 75WARNINGS=-Wall -Wstrict-prototypes -Wshadow
103CFLAGS+=-I$(top_builddir)/include -I$(top_srcdir)/include 76CFLAGS+=-I$(top_builddir)/include -I$(top_srcdir)/include -I$(srcdir)
104 77
105ARFLAGS=cru 78ARFLAGS=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
111CC_MAJOR:=$(shell printf "%02d" $(shell echo __GNUC__ | $(CC) -E -xc - | tail -n 1)) 83CC_MAJOR:=$(shell printf "%02d" $(shell echo __GNUC__ | $(CC) -E -xc - | tail -n 1))
112CC_MINOR:=$(shell printf "%02d" $(shell echo __GNUC_MINOR__ | $(CC) -E -xc - | tail -n 1)) 84CC_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.
116define cc_eq
117$(shell [ $(CC_MAJOR) -eq $(1) -a $(CC_MINOR) -eq $(2) ] && echo y)
118endef
119# Check if CC version is greater or equal than given MAJOR,MINOR
120define cc_ge
121$(shell [ $(CC_MAJOR) -ge $(1) -a $(CC_MINOR) -ge $(2) ] && echo y)
122endef
123# Check if CC version is less or equal than given MAJOR,MINOR
124define cc_le
125$(shell [ $(CC_MAJOR) -le $(1) -a $(CC_MINOR) -le $(2) ] && echo y)
126endef
127
128# Workaround bugs in make-3.80 for eval in conditionals
129define is_eq
130$(shell [ $(1) = $(2) ] 2> /dev/null && echo y)
131endef
132define is_neq
133$(shell [ $(1) != $(2) ] 2> /dev/null && echo y)
134endef
135
136#-------------------------------------------------------- 86#--------------------------------------------------------
137export VERSION BUILDTIME HOSTCC HOSTCFLAGS CROSS CC AR AS LD NM STRIP CPP 87export VERSION BUILDTIME HOSTCC HOSTCFLAGS CROSS CC AR AS LD NM STRIP CPP
138 88ifeq ($(strip $(TARGET_ARCH)),)
139# TARGET_ARCH and TARGET_MACH will be passed verbatim to CC with recent 89TARGET_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
145ifeq ($(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 )
158endif 101endif
159 102
160CFLAGS+=$(call check_gcc,CFLAGS,-funsigned-char,) 103# A nifty macro to make testing gcc features easier
161CFLAGS+=$(call check_gcc,CFLAGS,-mmax-stack-frame=256,) 104check_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
111check_ld=$(shell \
112 if [ "x$(1)" != "x" ]; then \
113 $(LD) --help | grep -q "\$(1)" && echo "-Wl,$(1)" ; \
114 fi)
115
116CFLAGS+=$(call check_gcc,-funsigned-char,)
117
118CFLAGS+=$(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
169OPTIMIZATIONS+=$(call check_gcc,OPTIMIZATIONS,-Os,-O2) 126OPTIMIZATION:=$(call check_gcc,-Os,-O2)
170 127
128ifeq ($(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"
172CFLAGS_COMBINE+=$(if $(call is_eq,$(CONFIG_BUILD_AT_ONCE),y),\ 130ifeq ($(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,))) 132endif
175 133OPTIMIZATION+=$(call check_gcc,-funit-at-a-time,)
176OPTIMIZATIONS+=$(if $(call is_eq,$(CONFIG_BUILD_AT_ONCE),y),\ 134PROG_CFLAGS+=$(call check_gcc,-fwhole-program,)
177 $(call check_gcc,OPTIMIZATIONS,-funit-at-a-time,)) 135endif # 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
183LIB_LDFLAGS+=$(call check_ld,LIB_LDFLAGS,--enable-new-dtags,) 137LIB_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
188PROG_LDFLAGS+=$(call check_ld,PROG_LDFLAGS,--gc-sections,)
189 142
190# Some nice architecture specific optimizations 143# Some nice architecture specific optimizations
191ifeq ($(__TARGET_ARCH),arm) 144ifeq ($(strip $(TARGET_ARCH)),arm)
192 OPTIMIZATIONS+=-fstrict-aliasing 145 OPTIMIZATION+=-fstrict-aliasing
193endif # arm 146endif
194 147ifeq ($(strip $(TARGET_ARCH)),i386)
195OPTIMIZATIONS+=$(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
199OPTIMIZATIONS+=$(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 157ifeq ($(strip $(shell [ $(CC_MAJOR) -ge 4 -a $(CC_MINOR) -ge 1 ] ; echo $$?)),0)
206OPTIMIZATIONS+=$(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 164endif # gcc-4.1 and beyond
213OPTIMIZATIONS+=$(call check_gcc,OPTIMIZATIONS,-fomit-frame-pointer,) 165endif
166OPTIMIZATIONS:=$(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
224ifeq ($(CONFIG_LFS),y) 177ifeq ($(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
227endif 180endif
228ifeq ($(CONFIG_DMALLOC),y) 181ifeq ($(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
232else 185else
233 ifeq ($(CONFIG_EFENCE),y) 186 ifeq ($(strip $(CONFIG_EFENCE)),y)
234 LIBRARIES:=-lefence 187 LIBRARIES:=-lefence
235 endif 188 endif
236endif 189endif
237 190ifeq ($(strip $(CONFIG_DEBUG)),y)
238LDFLAGS+=$(if $(call is_eq,$(CONFIG_DEBUG),y),$(call check_ld,LDFLAGS,--warn-common,)$(call check_ld,LDFLAGS,--sort-common,))
239ifeq ($(CONFIG_DEBUG),y)
240 CFLAGS +=$(WARNINGS) -g -D_GNU_SOURCE 191 CFLAGS +=$(WARNINGS) -g -D_GNU_SOURCE
192 LDFLAGS += $(call check_ld,--warn-common,)
241else 193else
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,)
243endif 197endif
244ifeq ($(CONFIG_STRIP_BINARIES),y) 198ifeq ($(CONFIG_STRIP_BINARIES),y)
245 STRIPCMD:=$(STRIP) -s --remove-section=.note --remove-section=.comment 199 STRIPCMD:=$(STRIP) -s --remove-section=.note --remove-section=.comment
246else 200else
247 STRIPCMD:=/bin/true -Not_stripping_since_we_are_debugging 201 STRIPCMD:=/bin/true -Not_stripping_since_we_are_debugging
248endif 202endif
249PROG_CFLAGS+=$(if $(call is_eq,$(CONFIG_STATIC),y),\ 203ifeq ($(strip $(CONFIG_STATIC)),y)
250 $(call check_gcc,PROG_CFLAGS,-static,)) 204 PROG_CFLAGS += $(call check_gcc,-static,)
251 205endif
252CFLAGS_SHARED+=$(call check_gcc,CFLAGS_SHARED,-shared,) 206CFLAGS_SHARED += $(call check_gcc,-shared,)
253LIB_CFLAGS+=$(CFLAGS_SHARED) 207LIB_CFLAGS+=$(CFLAGS_SHARED)
254 208
255CFLAGS_PIC+=$(if $(call is_eq,$(CONFIG_BUILD_LIBBUSYBOX),y),\ 209ifeq ($(strip $(CONFIG_BUILD_LIBBUSYBOX)),y)
256 $(call check_gcc,CFLAGS_PIC,-fPIC,)) 210 CFLAGS_PIC:= $(call check_gcc,-fPIC,)
257LIB_CFLAGS+=$(CFLAGS_PIC) 211 LIB_CFLAGS+=$(CFLAGS_PIC)
212endif
213
258 214
259ifeq ($(CONFIG_SELINUX),y) 215ifeq ($(strip $(CONFIG_SELINUX)),y)
260 LIBRARIES += -lselinux 216 LIBRARIES += -lselinux
261endif 217endif
262 218
@@ -264,6 +220,14 @@ ifeq ($(strip $(PREFIX)),)
264 PREFIX:=`pwd`/_install 220 PREFIX:=`pwd`/_install
265endif 221endif
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
230OBJECTS:=$(APPLET_SOURCES:.c=.o) busybox.o usage.o applets.o
267CFLAGS += $(CROSS_CFLAGS) 231CFLAGS += $(CROSS_CFLAGS)
268ifdef BB_INIT_SCRIPT 232ifdef 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)
285INSTALL_OPTS= 249INSTALL_OPTS=
286endif 250endif
287 251
288
289#------------------------------------------------------------
290# object extensions
291
292# object potentially used in shared object
293ifeq ($(strip $(CONFIG_BUILD_LIBBUSYBOX)),y)
294# single-object extension
295os:=.os
296# multi-object extension
297om:=.osm
298else
299os:=.o
300om:=.om
301endif
302
303#------------------------------------------------------------ 252#------------------------------------------------------------
304# Make the output nice and tight 253# Make the output nice and tight
305 254MAKEFLAGS += --no-print-directory
306# for make V=2 and above, do print directory
307ifneq ($(shell test -n "$(strip $(PACKAGE_BE_VERBOSE))" && test $(PACKAGE_BE_VERBOSE) -gt 1 ; echo $$?),0)
308 MAKEFLAGS += --no-print-directory
309endif
310
311export MAKEOVERRIDES
312export MAKE_IS_SILENT=n 255export MAKE_IS_SILENT=n
313ifneq ($(findstring s,$(MAKEFLAGS)),) 256ifneq ($(findstring s,$(MAKEFLAGS)),)
314export MAKE_IS_SILENT=y 257export MAKE_IS_SILENT=y
258SECHO := @-false
315DISP := sil 259DISP := sil
316Q := @ 260Q := @
317else 261else
318ifneq ($(V)$(VERBOSE),) 262ifneq ($(V)$(VERBOSE),)
263SECHO := @-false
319DISP := ver 264DISP := ver
320Q := 265Q :=
321else 266else
267SECHO := @echo
322DISP := pur 268DISP := pur
323Q := @ 269Q := @
324endif 270endif
325endif 271endif
326 272
327define show_objs 273show_objs = $(subst $(top_builddir)/,,$(subst ../,,$@))
328 $(subst $(top_builddir)/,,$(subst ../,,$@)) 274pur_disp_compile.c = echo " "CC $(show_objs)
329endef 275pur_disp_compile.h = echo " "HOSTCC $(show_objs)
330pur_disp_compile.c = @echo " "CC $(show_objs) ; 276pur_disp_strip = echo " "STRIP $(show_objs)
331pur_disp_compile.h = @echo " "HOSTCC $(show_objs) ; 277pur_disp_link = echo " "LINK $(show_objs)
332pur_disp_strip = @echo " "STRIP $(show_objs) ; 278pur_disp_ar = echo " "AR $(ARFLAGS) $(show_objs)
333pur_disp_link = @echo " "LINK $(show_objs) ; 279sil_disp_compile.c = true
334pur_disp_link.h = @echo " "HOSTLINK $(show_objs) ; 280sil_disp_compile.h = true
335pur_disp_ar = @echo " "AR $(ARFLAGS) $(show_objs) ; 281sil_disp_strip = true
336pur_disp_gen = @echo " "GEN $@ ; 282sil_disp_link = true
337pur_disp_doc = @echo " "DOC $(subst docs/,,$@) ; 283sil_disp_ar = true
338pur_disp_bin = @echo " "BIN $(show_objs) ; 284ver_disp_compile.c = echo $(cmd_compile.c)
339sil_disp_compile.c = @ 285ver_disp_compile.h = echo $(cmd_compile.h)
340sil_disp_compile.h = @ 286ver_disp_strip = echo $(cmd_strip)
341sil_disp_strip = @ 287ver_disp_link = echo $(cmd_link)
342sil_disp_link = @ 288ver_disp_ar = echo $(cmd_ar)
343sil_disp_link.h = @
344sil_disp_ar = @
345sil_disp_gen = @
346sil_disp_doc = @
347sil_disp_bin = @
348ver_disp_compile.c =
349ver_disp_compile.h =
350ver_disp_strip =
351ver_disp_link =
352ver_disp_link.h =
353ver_disp_ar =
354ver_disp_gen =
355ver_disp_doc =
356ver_disp_bin =
357disp_compile.c = $($(DISP)_disp_compile.c) 289disp_compile.c = $($(DISP)_disp_compile.c)
358disp_compile.h = $($(DISP)_disp_compile.h) 290disp_compile.h = $($(DISP)_disp_compile.h)
359disp_strip = $($(DISP)_disp_strip) 291disp_strip = $($(DISP)_disp_strip)
360disp_link = $($(DISP)_disp_link) 292disp_link = $($(DISP)_disp_link)
361disp_link.h = $($(DISP)_disp_link.h)
362disp_ar = $($(DISP)_disp_ar) 293disp_ar = $($(DISP)_disp_ar)
363disp_gen = $($(DISP)_disp_gen) 294disp_gen = $(SECHO) " "GEN $@ ; true
364disp_doc = $($(DISP)_disp_doc) 295disp_doc = $(SECHO) " "DOC $(subst docs/,,$@) ; true
365disp_bin = $($(DISP)_disp_bin) 296cmd_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))))
370cmd_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)))
374cmd_compile.m = $(cmd_compile.c) -DL_$(patsubst %$(suffix $(notdir $@)),%,$(notdir $@))
375cmd_compile.h = $(HOSTCC) $(HOSTCFLAGS) -c -o $@ $< 297cmd_compile.h = $(HOSTCC) $(HOSTCFLAGS) -c -o $@ $<
376cmd_strip = $(STRIPCMD) $@ 298cmd_strip = $(STRIPCMD) $@
377cmd_link = $(CC) $(CFLAGS) $(EXTRA_CFLAGS) -I$(srcdir) $(LDFLAGS) 299cmd_link = $(CC) $(CFLAGS) $(EXTRA_CFLAGS) $(LDFLAGS)
378cmd_link.h = $(HOSTCC) $(HOSTCFLAGS) $(HOST_LDFLAGS) $^ -o $@
379cmd_ar = $(AR) $(ARFLAGS) $@ $^ 300cmd_ar = $(AR) $(ARFLAGS) $@ $^
380compile.c = $(disp_compile.c) $(cmd_compile.c) 301compile.c = @$(disp_compile.c) ; $(cmd_compile.c)
381compile.m = $(disp_compile.c) $(cmd_compile.m) 302compile.h = @$(disp_compile.h) ; $(cmd_compile.h)
382compile.h = $(disp_compile.h) $(cmd_compile.h) 303do_strip = @$(disp_strip) ; $(cmd_strip)
383do_strip = $(disp_strip) $(cmd_strip) 304do_link = @$(disp_link) ; $(cmd_link)
384do_link = $(disp_link) $(cmd_link) 305do_ar = @$(disp_ar) ; $(cmd_ar)
385do_link.h = $(disp_link.h) $(cmd_link.h)
386do_ar = $(disp_ar) $(cmd_ar)
387
388ifdef 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
398endif # rules-mak-rules
399 306
400.PHONY: dummy 307.PHONY: dummy
401