aboutsummaryrefslogtreecommitdiff
path: root/Rules.mak
diff options
context:
space:
mode:
authoraldot <aldot@69ca8d6d-28ef-0310-b511-8ec308f3f277>2006-03-01 22:54:48 +0000
committeraldot <aldot@69ca8d6d-28ef-0310-b511-8ec308f3f277>2006-03-01 22:54:48 +0000
commit3e42de836e4e08c6226383f84de0f734f96c8697 (patch)
tree233c051da862595b6e473e832051708e2d9803cb /Rules.mak
parentb7c6f4ee19e3b2a465d2ef8c1ec3e51e6572e7ff (diff)
downloadbusybox-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.mak314
1 files changed, 198 insertions, 116 deletions
diff --git a/Rules.mak b/Rules.mak
index ab6e311c6..60812a57e 100644
--- a/Rules.mak
+++ b/Rules.mak
@@ -10,6 +10,12 @@ ifeq ($(filter $(noconfig_targets),$(MAKECMDGOALS)),)
10-include $(top_builddir)/.config 10-include $(top_builddir)/.config
11endif 11endif
12 12
13ifeq ($(MAKELEVEL),0)
14ifeq ($(HAVE_DOT_CONFIG),y)
15rules-mak-rules:=0
16endif
17endif
18
13#-------------------------------------------------------- 19#--------------------------------------------------------
14PROG := busybox 20PROG := busybox
15MAJOR_VERSION :=1 21MAJOR_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
34CROSS =$(subst ",, $(strip $(CROSS_COMPILER_PREFIX))) 40CROSS =$(subst ",, $(strip $(CROSS_COMPILER_PREFIX)))
41#")
35CC = $(CROSS)gcc 42CC = $(CROSS)gcc
36AR = $(CROSS)ar 43AR = $(CROSS)ar
37AS = $(CROSS)as 44AS = $(CROSS)as
@@ -39,16 +46,19 @@ LD = $(CROSS)ld
39NM = $(CROSS)nm 46NM = $(CROSS)nm
40STRIP = $(CROSS)strip 47STRIP = $(CROSS)strip
41CPP = $(CC) -E 48CPP = $(CC) -E
42# MAKEFILES = $(top_builddir)/.config 49SED ?= sed
43RM = rm 50AWK ?= awk
44RM_F = $(RM) -f 51
45LN = ln 52
46LN_S = $(LN) -s 53ifdef PACKAGE_BE_VERBOSE
47MKDIR = mkdir 54PACKAGE_BE_VERBOSE := $(shell echo $(PACKAGE_BE_VERBOSE) | $(SED) "s/[[:alpha:]]*//g")
48MKDIR_P = $(MKDIR) -p 55endif
49MV = mv
50CP = cp
51 56
57# for make V=3 and above make $(shell) invocations verbose
58ifeq ($(if $(strip $(PACKAGE_BE_VERBOSE)),$(shell test $(PACKAGE_BE_VERBOSE) -gt 2 ; echo $$?),1),0)
59 SHELL+=-x
60 MKDEP_ARGS:=-w
61endif
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.
67CFLAGS_EXTRA=$(subst ",, $(strip $(EXTRA_CFLAGS_OPTIONS))) 77CFLAGS_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
83WARNINGS=-Wall -Wstrict-prototypes -Wshadow 94WARNINGS=-Wall -Wstrict-prototypes -Wshadow
84CFLAGS+=-I$(top_builddir)/include -I$(top_srcdir)/include -I$(srcdir) 95CFLAGS+=-I$(top_builddir)/include -I$(top_srcdir)/include
85 96
86ARFLAGS=cru 97ARFLAGS=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
91CC_MAJOR:=$(shell printf "%02d" $(shell echo __GNUC__ | $(CC) -E -xc - | tail -n 1)) 103CC_MAJOR:=$(shell printf "%02d" $(shell echo __GNUC__ | $(CC) -E -xc - | tail -n 1))
92CC_MINOR:=$(shell printf "%02d" $(shell echo __GNUC_MINOR__ | $(CC) -E -xc - | tail -n 1)) 104CC_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.
108define cc_eq
109$(shell [ $(CC_MAJOR) -eq $(1) -a $(CC_MINOR) -eq $(2) ] && echo y)
110endef
111# Check if CC version is greater or equal than given MAJOR,MINOR
112define cc_ge
113$(shell [ $(CC_MAJOR) -ge $(1) -a $(CC_MINOR) -ge $(2) ] && echo y)
114endef
115# Check if CC version is less or equal than given MAJOR,MINOR
116define cc_le
117$(shell [ $(CC_MAJOR) -le $(1) -a $(CC_MINOR) -le $(2) ] && echo y)
118endef
119
120# Workaround bugs in make-3.80 for eval in conditionals
121define is_eq
122$(shell [ $(1) = $(2) ] 2> /dev/null && echo y)
123endef
124define is_neq
125$(shell [ $(1) != $(2) ] 2> /dev/null && echo y)
126endef
127
94#-------------------------------------------------------- 128#--------------------------------------------------------
95export VERSION BUILDTIME HOSTCC HOSTCFLAGS CROSS CC AR AS LD NM STRIP CPP 129export VERSION BUILDTIME HOSTCC HOSTCFLAGS CROSS CC AR AS LD NM STRIP CPP
96ifeq ($(strip $(TARGET_ARCH)),) 130
97TARGET_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
137ifeq ($(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 )
109endif 150endif
110 151
111# A nifty macro to make testing gcc features easier 152$(call check_gcc,CFLAGS,-funsigned-char,)
112check_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
119check_ld=$(shell \
120 if [ "x$(1)" != "x" ]; then \
121 $(LD) --help | grep -q "\$(1)" && echo "-Wl,$(1)" ; \
122 fi)
123
124CFLAGS+=$(call check_gcc,-funsigned-char,)
125
126CFLAGS+=$(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
134OPTIMIZATION:=$(call check_gcc,-Os,-O2) 161$(call check_gcc,OPTIMIZATIONS,-Os,-O2)
135 162
136ifeq ($(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"
138ifeq ($(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),\
140endif 166 $(call check_gcc,CFLAGS_COMBINE,--combine,)))
141OPTIMIZATION+=$(call check_gcc,-funit-at-a-time,)
142PROG_CFLAGS+=$(call check_gcc,-fwhole-program,)
143endif # CONFIG_BUILD_AT_ONCE
144 167
145LIB_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
152ifeq ($(strip $(TARGET_ARCH)),arm) 183ifeq ($(__TARGET_ARCH),arm)
153 OPTIMIZATION+=-fstrict-aliasing 184 OPTIMIZATIONS+=-fstrict-aliasing
154endif 185endif # arm
155ifeq ($(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
158ifneq ($(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))
162endif # 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
165ifeq ($(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,))
172endif # gcc-4.1 and beyond 204
173endif 205$(call check_gcc,OPTIMIZATIONS,-fomit-frame-pointer,)
174OPTIMIZATIONS:=$(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
185ifeq ($(strip $(CONFIG_LFS)),y) 216ifeq ($(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
188endif 219endif
189ifeq ($(strip $(CONFIG_DMALLOC)),y) 220ifeq ($(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
193else 224else
194 ifeq ($(strip $(CONFIG_EFENCE)),y) 225 ifeq ($(CONFIG_EFENCE),y)
195 LIBRARIES:=-lefence 226 LIBRARIES:=-lefence
196 endif 227 endif
197endif 228endif
198ifeq ($(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,))
233ifeq ($(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
202else 236else
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
207endif 239endif
208ifeq ($(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,))
210endif 242
211CFLAGS_SHARED += $(call check_gcc,-shared,) 243$(call check_gcc,CFLAGS_SHARED,-shared,)
212LIB_CFLAGS+=$(CFLAGS_SHARED) 244LIB_CFLAGS+=$(CFLAGS_SHARED)
213 245
214ifeq ($(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,))
216endif
217 248
218ifeq ($(strip $(CONFIG_SELINUX)),y) 249ifeq ($(CONFIG_SELINUX),y)
219 LIBRARIES += -lselinux 250 LIBRARIES += -lselinux
220endif 251endif
221 252
@@ -223,14 +254,6 @@ ifeq ($(strip $(PREFIX)),)
223 PREFIX:=`pwd`/_install 254 PREFIX:=`pwd`/_install
224endif 255endif
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
233OBJECTS:=$(APPLET_SOURCES:.c=.o) busybox.o usage.o applets.o
234CFLAGS += $(CROSS_CFLAGS) 257CFLAGS += $(CROSS_CFLAGS)
235ifdef BB_INIT_SCRIPT 258ifdef 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)
252INSTALL_OPTS= 275INSTALL_OPTS=
253endif 276endif
254 277
278
279#------------------------------------------------------------
280# object extensions
281
282# object potentially used in shared object
283ifeq ($(strip $(CONFIG_BUILD_LIBBUSYBOX)),y)
284# single-object extension
285os:=.os
286# multi-object extension
287om:=.osm
288else
289os:=.o
290om:=.om
291endif
292
255#------------------------------------------------------------ 293#------------------------------------------------------------
256# Make the output nice and tight 294# Make the output nice and tight
257MAKEFLAGS += --no-print-directory 295
296# for make V=2 and above, do print directory
297ifneq ($(shell test -n "$(strip $(PACKAGE_BE_VERBOSE))" && test $(PACKAGE_BE_VERBOSE) -gt 1 ; echo $$?),0)
298 MAKEFLAGS += --no-print-directory
299endif
300
301export MAKEOVERRIDES
258export MAKE_IS_SILENT=n 302export MAKE_IS_SILENT=n
259ifneq ($(findstring s,$(MAKEFLAGS)),) 303ifneq ($(findstring s,$(MAKEFLAGS)),)
260export MAKE_IS_SILENT=y 304export MAKE_IS_SILENT=y
261SECHO := @-false
262DISP := sil 305DISP := sil
263Q := @ 306Q := @
264else 307else
265ifneq ($(V)$(VERBOSE),) 308ifneq ($(V)$(VERBOSE),)
266SECHO := @-false
267DISP := ver 309DISP := ver
268Q := 310Q :=
269else 311else
270SECHO := @echo
271DISP := pur 312DISP := pur
272Q := @ 313Q := @
273endif 314endif
274endif 315endif
275 316
276show_objs = $(subst $(top_builddir)/,,$(subst ../,,$@)) 317define show_objs
277pur_disp_compile.c = echo " "CC $(show_objs) 318 $(subst $(top_builddir)/,,$(subst ../,,$@))
278pur_disp_compile.h = echo " "HOSTCC $(show_objs) 319endef
279pur_disp_strip = echo " "STRIP $(show_objs) 320pur_disp_compile.c = @echo " "CC $(show_objs) ;
280pur_disp_link = echo " "LINK $(show_objs) 321pur_disp_compile.h = @echo " "HOSTCC $(show_objs) ;
281pur_disp_ar = echo " "AR $(ARFLAGS) $(show_objs) 322pur_disp_strip = @echo " "STRIP $(show_objs) ;
282sil_disp_compile.c = true 323pur_disp_link = @echo " "LINK $(show_objs) ;
283sil_disp_compile.h = true 324pur_disp_link.h = @echo " "HOSTLINK $(show_objs) ;
284sil_disp_strip = true 325pur_disp_ar = @echo " "AR $(ARFLAGS) $(show_objs) ;
285sil_disp_link = true 326pur_disp_gen = @echo " "GEN $@ ;
286sil_disp_ar = true 327pur_disp_doc = @echo " "DOC $(subst docs/,,$@) ;
287ver_disp_compile.c = echo $(cmd_compile.c) 328pur_disp_bin = @echo " "BIN $(show_objs) ;
288ver_disp_compile.h = echo $(cmd_compile.h) 329sil_disp_compile.c = @
289ver_disp_strip = echo $(cmd_strip) 330sil_disp_compile.h = @
290ver_disp_link = echo $(cmd_link) 331sil_disp_strip = @
291ver_disp_ar = echo $(cmd_ar) 332sil_disp_link = @
333sil_disp_link.h = @
334sil_disp_ar = @
335sil_disp_gen = @
336sil_disp_doc = @
337sil_disp_bin = @
338ver_disp_compile.c =
339ver_disp_compile.h =
340ver_disp_strip =
341ver_disp_link =
342ver_disp_link.h =
343ver_disp_ar =
344ver_disp_gen =
345ver_disp_doc =
346ver_disp_bin =
292disp_compile.c = $($(DISP)_disp_compile.c) 347disp_compile.c = $($(DISP)_disp_compile.c)
293disp_compile.h = $($(DISP)_disp_compile.h) 348disp_compile.h = $($(DISP)_disp_compile.h)
294disp_strip = $($(DISP)_disp_strip) 349disp_strip = $($(DISP)_disp_strip)
295disp_link = $($(DISP)_disp_link) 350disp_link = $($(DISP)_disp_link)
351disp_link.h = $($(DISP)_disp_link.h)
296disp_ar = $($(DISP)_disp_ar) 352disp_ar = $($(DISP)_disp_ar)
297disp_gen = $(SECHO) " "GEN $@ ; true 353disp_gen = $($(DISP)_disp_gen)
298disp_doc = $(SECHO) " "DOC $(subst docs/,,$@) ; true 354disp_doc = $($(DISP)_disp_doc)
299cmd_compile.c = $(CC) $(CFLAGS) $(EXTRA_CFLAGS) -c -o $@ $< 355disp_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))))
360cmd_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)))
364cmd_compile.m = $(cmd_compile.c) -DL_$(patsubst %$(suffix $(notdir $@)),%,$(notdir $@))
300cmd_compile.h = $(HOSTCC) $(HOSTCFLAGS) -c -o $@ $< 365cmd_compile.h = $(HOSTCC) $(HOSTCFLAGS) -c -o $@ $<
301cmd_strip = $(STRIPCMD) $@ 366cmd_strip = $(STRIPCMD) $@
302cmd_link = $(CC) $(CFLAGS) $(EXTRA_CFLAGS) $(LDFLAGS) 367cmd_link = $(CC) $(CFLAGS) $(EXTRA_CFLAGS) -I$(srcdir) $(LDFLAGS)
368cmd_link.h = $(HOSTCC) $(HOSTCFLAGS) $(HOST_LDFLAGS) $^ -o $@
303cmd_ar = $(AR) $(ARFLAGS) $@ $^ 369cmd_ar = $(AR) $(ARFLAGS) $@ $^
304compile.c = @$(disp_compile.c) ; $(cmd_compile.c) 370compile.c = $(disp_compile.c) $(cmd_compile.c)
305compile.h = @$(disp_compile.h) ; $(cmd_compile.h) 371compile.m = $(disp_compile.c) $(cmd_compile.m)
306do_strip = @$(disp_strip) ; $(cmd_strip) 372compile.h = $(disp_compile.h) $(cmd_compile.h)
307do_link = @$(disp_link) ; $(cmd_link) 373do_strip = $(disp_strip) $(cmd_strip)
308do_ar = @$(disp_ar) ; $(cmd_ar) 374do_link = $(disp_link) $(cmd_link)
375do_link.h = $(disp_link.h) $(cmd_link.h)
376do_ar = $(disp_ar) $(cmd_ar)
377
378ifdef 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
389endif # rules-mak-rules
309 390
310.PHONY: dummy 391.PHONY: dummy
392