Blame view
config.mk
10.7 KB
e22117437 Initial revision |
1 |
# |
f93286397 Add support for a... |
2 |
# (C) Copyright 2000-2006 |
e22117437 Initial revision |
3 4 5 6 7 8 9 10 11 12 13 14 |
# Wolfgang Denk, DENX Software Engineering, wd@denx.de. # # See file CREDITS for list of people who contributed to this # project. # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License as # published by the Free Software Foundation; either version 2 of # the License, or (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of |
844f07d8a Coding Style (whi... |
15 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
e22117437 Initial revision |
16 17 18 19 20 21 22 23 24 |
# GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, # MA 02111-1307 USA # ######################################################################### |
97b24d3d5 common: Add symbo... |
25 |
include $(TOPDIR)/helper.mk |
f93286397 Add support for a... |
26 |
ifeq ($(CURDIR),$(SRCTREE)) |
511d0c72b Coding style cleanup |
27 |
dir := |
f93286397 Add support for a... |
28 29 30 |
else dir := $(subst $(SRCTREE)/,,$(CURDIR)) endif |
c8f9c302c Extend build-syst... |
31 32 33 34 35 |
ifneq ($(OBJTREE),$(SRCTREE)) # Create object files for SPL in a separate directory ifeq ($(CONFIG_SPL_BUILD),y) obj := $(if $(dir),$(SPLTREE)/$(dir)/,$(SPLTREE)/) else |
f93286397 Add support for a... |
36 |
obj := $(if $(dir),$(OBJTREE)/$(dir)/,$(OBJTREE)/) |
c8f9c302c Extend build-syst... |
37 |
endif |
f93286397 Add support for a... |
38 39 40 41 |
src := $(if $(dir),$(SRCTREE)/$(dir)/,$(SRCTREE)/) $(shell mkdir -p $(obj)) else |
c8f9c302c Extend build-syst... |
42 43 44 45 46 47 |
# Create object files for SPL in a separate directory ifeq ($(CONFIG_SPL_BUILD),y) obj := $(if $(dir),$(SPLTREE)/$(dir)/,$(SPLTREE)/) $(shell mkdir -p $(obj)) else |
f93286397 Add support for a... |
48 |
obj := |
c8f9c302c Extend build-syst... |
49 |
endif |
f93286397 Add support for a... |
50 51 |
src := endif |
592c5cabe Patch by Murray J... |
52 53 54 55 |
# clean the slate ... PLATFORM_RELFLAGS = PLATFORM_CPPFLAGS = PLATFORM_LDFLAGS = |
e22117437 Initial revision |
56 |
######################################################################### |
d984fed06 makefiles: fixes ... |
57 58 59 60 61 62 63 |
HOSTCFLAGS = -Wall -Wstrict-prototypes -O2 -fomit-frame-pointer \ $(HOSTCPPFLAGS) HOSTSTRIP = strip # # Mac OS X / Darwin's C preprocessor is Apple specific. It # generates numerous errors and warnings. We want to bypass it |
844f07d8a Coding Style (whi... |
64 |
# and use GNU C's cpp. To do this we pass the -traditional-cpp |
d984fed06 makefiles: fixes ... |
65 66 67 68 69 70 71 72 |
# option to the compiler. Note that the -traditional-cpp flag # DOES NOT have the same semantics as GNU C's flag, all it does # is invoke the GNU preprocessor in stock ANSI/ISO C fashion. # # Apple's linker is similar, thanks to the new 2 stage linking # multiple symbol definitions are treated as errors, hence the # -multiply_defined suppress option to turn off this error. # |
4cda43789 build system: tre... |
73 |
ifeq ($(HOSTOS),darwin) |
c7da8c19b config.mk: use di... |
74 75 76 |
# get major and minor product version (e.g. '10' and '6' for Snow Leopard) DARWIN_MAJOR_VERSION = $(shell sw_vers -productVersion | cut -f 1 -d '.') DARWIN_MINOR_VERSION = $(shell sw_vers -productVersion | cut -f 2 -d '.') |
f534c7cdc config.mk: avoid ... |
77 78 |
os_x_before = $(shell if [ $(DARWIN_MAJOR_VERSION) -le $(1) -a \ $(DARWIN_MINOR_VERSION) -le $(2) ] ; then echo "$(3)"; else echo "$(4)"; fi ;) |
c7da8c19b config.mk: use di... |
79 80 |
# Snow Leopards build environment has no longer restrictions as described above |
f534c7cdc config.mk: avoid ... |
81 82 83 |
HOSTCC = $(call os_x_before, 10, 5, "cc", "gcc") HOSTCFLAGS += $(call os_x_before, 10, 4, "-traditional-cpp") HOSTLDFLAGS += $(call os_x_before, 10, 5, "-multiply_defined suppress") |
e22117437 Initial revision |
84 85 86 |
else HOSTCC = gcc endif |
d984fed06 makefiles: fixes ... |
87 88 89 90 91 92 93 94 95 96 97 |
ifeq ($(HOSTOS),cygwin) HOSTCFLAGS += -ansi endif # We build some files with extra pedantic flags to try to minimize things # that won't build on some weird host compiler -- though there are lots of # exceptions for files that aren't complaint. HOSTCFLAGS_NOPED = $(filter-out -pedantic,$(HOSTCFLAGS)) HOSTCFLAGS += -pedantic |
e22117437 Initial revision |
98 99 |
######################################################################### |
1820d4c73 Make sure only su... |
100 |
# |
19a695f84 tools, config.mk:... |
101 |
# Option checker, gcc version (courtesy linux kernel) to ensure |
1820d4c73 Make sure only su... |
102 103 |
# only supported compiler options are used # |
b6a467d73 config.mk: use me... |
104 |
CC_OPTIONS_CACHE_FILE := $(OBJTREE)/include/generated/cc_options.mk |
6f4acc179 config.mk: Make c... |
105 |
CC_TEST_OFILE := $(OBJTREE)/include/generated/cc_test_file.o |
b6a467d73 config.mk: use me... |
106 107 |
-include $(CC_OPTIONS_CACHE_FILE) |
6f4acc179 config.mk: Make c... |
108 109 |
cc-option-sys = $(shell mkdir -p $(dir $(CC_TEST_OFILE)); \ if $(CC) $(CFLAGS) $(1) -S -xc /dev/null -o $(CC_TEST_OFILE) \ |
b6a467d73 config.mk: use me... |
110 111 112 113 114 115 116 117 118 119 |
> /dev/null 2>&1; then \ echo 'CC_OPTIONS += $(strip $1)' >> $(CC_OPTIONS_CACHE_FILE); \ echo "$(1)"; fi) ifeq ($(CONFIG_CC_OPT_CACHE_DISABLE),y) cc-option = $(strip $(if $(call cc-option-sys,$1),$1,$2)) else cc-option = $(strip $(if $(findstring $1,$(CC_OPTIONS)),$1,\ $(if $(call cc-option-sys,$1),$1,$2))) endif |
e22117437 Initial revision |
120 |
|
19a695f84 tools, config.mk:... |
121 122 123 |
# cc-version # Usage gcc-ver := $(call cc-version) cc-version = $(shell $(SHELL) $(SRCTREE)/tools/gcc-version.sh $(CC)) |
2051ff345 tools, config.mk:... |
124 |
binutils-version = $(shell $(SHELL) $(SRCTREE)/tools/binutils-version.sh $(AS)) |
19a695f84 tools, config.mk:... |
125 |
|
e22117437 Initial revision |
126 127 128 129 |
# # Include the make variables (CC, etc...) # AS = $(CROSS_COMPILE)as |
7cb714a57 config: Always us... |
130 131 132 133 |
# Always use GNU ld LD = $(shell if $(CROSS_COMPILE)ld.bfd -v > /dev/null 2>&1; \ then echo "$(CROSS_COMPILE)ld.bfd"; else echo "$(CROSS_COMPILE)ld"; fi;) |
e22117437 Initial revision |
134 135 136 137 |
CC = $(CROSS_COMPILE)gcc CPP = $(CC) -E AR = $(CROSS_COMPILE)ar NM = $(CROSS_COMPILE)nm |
94a91e248 generate u-boot.l... |
138 |
LDR = $(CROSS_COMPILE)ldr |
e22117437 Initial revision |
139 140 141 142 |
STRIP = $(CROSS_COMPILE)strip OBJCOPY = $(CROSS_COMPILE)objcopy OBJDUMP = $(CROSS_COMPILE)objdump RANLIB = $(CROSS_COMPILE)RANLIB |
bbb0b128c fdt: Add support ... |
143 |
DTC = dtc |
4ab64933e add check infrast... |
144 |
CHECK = sparse |
e22117437 Initial revision |
145 |
|
c4e5f52a5 config.mk: use co... |
146 147 148 149 |
######################################################################### # Load generated board configuration sinclude $(OBJTREE)/include/autoconf.mk |
5e987ddf8 Top config.mk: ad... |
150 |
sinclude $(OBJTREE)/include/config.mk |
c4e5f52a5 config.mk: use co... |
151 |
|
03b7004dd Create CPUDIR var... |
152 153 |
# Some architecture config.mk files need to know what CPUDIR is set to, # so calculate CPUDIR before including ARCH/SOC/CPU config.mk files. |
8d1f26820 ppc: Move cpu/$CP... |
154 155 156 157 158 159 |
# Check if arch/$ARCH/cpu/$CPU exists, otherwise assume arch/$ARCH/cpu contains # CPU-specific code. CPUDIR=arch/$(ARCH)/cpu/$(CPU) ifneq ($(SRCTREE)/$(CPUDIR),$(wildcard $(SRCTREE)/$(CPUDIR))) CPUDIR=arch/$(ARCH)/cpu endif |
03b7004dd Create CPUDIR var... |
160 |
|
ea0364f1b Move lib_$ARCH di... |
161 |
sinclude $(TOPDIR)/arch/$(ARCH)/config.mk # include architecture dependend rules |
03b7004dd Create CPUDIR var... |
162 |
sinclude $(TOPDIR)/$(CPUDIR)/config.mk # include CPU specific rules |
c4e5f52a5 config.mk: use co... |
163 |
ifdef SOC |
03b7004dd Create CPUDIR var... |
164 |
sinclude $(TOPDIR)/$(CPUDIR)/$(SOC)/config.mk # include SoC specific rules |
c4e5f52a5 config.mk: use co... |
165 166 167 168 169 170 171 172 173 174 175 |
endif ifdef VENDOR BOARDDIR = $(VENDOR)/$(BOARD) else BOARDDIR = $(BOARD) endif ifdef BOARD sinclude $(TOPDIR)/board/$(BOARDDIR)/config.mk # include board specific rules endif ######################################################################### |
5968adc41 build: force migr... |
176 177 178 |
# We don't actually use $(ARFLAGS) anywhere anymore, so catch people # who are porting old code to latest mainline but not updating $(AR). ARFLAGS = $(error update your Makefile to use cmd_link_o_target and not AR) |
e22117437 Initial revision |
179 |
RELFLAGS= $(PLATFORM_RELFLAGS) |
9acb626fc Add MCF5282 suppo... |
180 |
DBGFLAGS= -g # -DDEBUG |
e22117437 Initial revision |
181 |
OPTFLAGS= -Os #-fomit-frame-pointer |
83b7e2a7f Handle most LDSCR... |
182 |
|
6dd652fa4 Patches by Murray... |
183 |
OBJCFLAGS += --gap-fill=0xff |
e22117437 Initial revision |
184 |
|
b783edaee * Header file cle... |
185 |
gccincdir := $(shell $(CC) -print-file-name=include) |
e22117437 Initial revision |
186 |
CPPFLAGS := $(DBGFLAGS) $(OPTFLAGS) $(RELFLAGS) \ |
c1f5805a9 serial: Compile d... |
187 |
-D__KERNEL__ |
c8f9c302c Extend build-syst... |
188 189 190 191 192 193 |
# Enable garbage collection of un-used sections for SPL ifeq ($(CONFIG_SPL_BUILD),y) CPPFLAGS += -ffunction-sections -fdata-sections LDFLAGS_FINAL += --gc-sections endif |
14d0a02a1 Rename TEXT_BASE ... |
194 195 |
ifneq ($(CONFIG_SYS_TEXT_BASE),) CPPFLAGS += -DCONFIG_SYS_TEXT_BASE=$(CONFIG_SYS_TEXT_BASE) |
161b2af4d Only use TEXT_BAS... |
196 |
endif |
f93286397 Add support for a... |
197 |
|
c8f9c302c Extend build-syst... |
198 199 200 |
ifneq ($(CONFIG_SPL_TEXT_BASE),) CPPFLAGS += -DCONFIG_SPL_TEXT_BASE=$(CONFIG_SPL_TEXT_BASE) endif |
94aebe6cc Makefile: Add u-b... |
201 202 203 |
ifneq ($(CONFIG_SPL_PAD_TO),) CPPFLAGS += -DCONFIG_SPL_PAD_TO=$(CONFIG_SPL_PAD_TO) endif |
c8f9c302c Extend build-syst... |
204 205 206 |
ifeq ($(CONFIG_SPL_BUILD),y) CPPFLAGS += -DCONFIG_SPL_BUILD endif |
6c97a20d0 ppc/85xx: Introdu... |
207 208 209 |
ifneq ($(RESET_VECTOR_ADDRESS),) CPPFLAGS += -DRESET_VECTOR_ADDRESS=$(RESET_VECTOR_ADDRESS) endif |
f93286397 Add support for a... |
210 211 212 213 214 |
ifneq ($(OBJTREE),$(SRCTREE)) CPPFLAGS += -I$(OBJTREE)/include2 -I$(OBJTREE)/include endif CPPFLAGS += -I$(TOPDIR)/include |
53677ef18 Big white-space c... |
215 |
CPPFLAGS += -fno-builtin -ffreestanding -nostdinc \ |
f93286397 Add support for a... |
216 |
-isystem $(gccincdir) -pipe $(PLATFORM_CPPFLAGS) |
e22117437 Initial revision |
217 218 219 220 221 222 223 |
ifdef BUILD_TAG CFLAGS := $(CPPFLAGS) -Wall -Wstrict-prototypes \ -DBUILD_TAG='"$(BUILD_TAG)"' else CFLAGS := $(CPPFLAGS) -Wall -Wstrict-prototypes endif |
cca4e4aec Reduce build times |
224 225 |
CFLAGS_SSP := $(call cc-option,-fno-stack-protector) CFLAGS += $(CFLAGS_SSP) |
6262e4e74 disable security ... |
226 227 |
# Some toolchains enable security related warning flags by default, # but they don't make much sense in the u-boot world, so disable them. |
cca4e4aec Reduce build times |
228 229 230 |
CFLAGS_WARN := $(call cc-option,-Wno-format-nonliteral) \ $(call cc-option,-Wno-format-security) CFLAGS += $(CFLAGS_WARN) |
28eab0d77 Conditionally add... |
231 |
|
4a30f1e87 config.mk: Check ... |
232 233 234 |
# Report stack usage if supported CFLAGS_STACK := $(call cc-option,-fstack-usage) CFLAGS += $(CFLAGS_STACK) |
e11887a77 Don't pass any de... |
235 236 237 |
# $(CPPFLAGS) sets -g, which causes gcc to pass a suitable -g<format> # option to the assembler. AFLAGS_DEBUG := |
b62fa913d Fix gcc 3.4.x AFL... |
238 |
|
483a0cf80 Fixes for gcc 3.4... |
239 240 241 242 243 |
# turn jbsr into jsr for m68k ifeq ($(ARCH),m68k) ifeq ($(findstring 3.4,$(shell $(CC) --version)),3.4) AFLAGS_DEBUG := -Wa,-gstabs,-S endif |
483a0cf80 Fixes for gcc 3.4... |
244 |
endif |
b62fa913d Fix gcc 3.4.x AFL... |
245 |
|
e22117437 Initial revision |
246 |
AFLAGS := $(AFLAGS_DEBUG) -D__ASSEMBLY__ $(CPPFLAGS) |
8aba9dcee Divides variable ... |
247 |
LDFLAGS += $(PLATFORM_LDFLAGS) |
6dc1eceb9 Introduce a new l... |
248 |
LDFLAGS_FINAL += -Bstatic |
8aba9dcee Divides variable ... |
249 |
|
6dc1eceb9 Introduce a new l... |
250 |
LDFLAGS_u-boot += -T $(obj)u-boot.lds $(LDFLAGS_FINAL) |
14d0a02a1 Rename TEXT_BASE ... |
251 |
ifneq ($(CONFIG_SYS_TEXT_BASE),) |
8aba9dcee Divides variable ... |
252 |
LDFLAGS_u-boot += -Ttext $(CONFIG_SYS_TEXT_BASE) |
161b2af4d Only use TEXT_BAS... |
253 |
endif |
e22117437 Initial revision |
254 |
|
c8f9c302c Extend build-syst... |
255 256 257 258 |
LDFLAGS_u-boot-spl += -T $(obj)u-boot-spl.lds $(LDFLAGS_FINAL) ifneq ($(CONFIG_SPL_TEXT_BASE),) LDFLAGS_u-boot-spl += -Ttext $(CONFIG_SPL_TEXT_BASE) endif |
4ab64933e add check infrast... |
259 260 261 |
# Linus' kernel sanity checking tool CHECKFLAGS := -D__linux__ -Dlinux -D__STDC__ -Dunix -D__unix__ \ -Wbitwise -Wno-return-void -D__CHECK_ENDIAN__ $(CF) |
e22117437 Initial revision |
262 263 264 265 266 267 268 269 270 |
# Location of a usable BFD library, where we define "usable" as # "built for ${HOST}, supports ${TARGET}". Sensible values are # - When cross-compiling: the root of the cross-environment # - Linux/ppc (native): /usr # - NetBSD/ppc (native): you lose ... (must extract these from the # binutils build directory, plus the native and U-Boot include # files don't like each other) # # So far, this is used only by tools/gdb/Makefile. |
4cda43789 build system: tre... |
271 |
ifeq ($(HOSTOS),darwin) |
e22117437 Initial revision |
272 273 |
BFD_ROOT_DIR = /usr/local/tools else |
ea909b760 * Added support f... |
274 275 276 277 |
ifeq ($(HOSTARCH),$(ARCH)) # native BFD_ROOT_DIR = /usr else |
e22117437 Initial revision |
278 279 |
#BFD_ROOT_DIR = /LinuxPPC/CDK # Linux/i386 #BFD_ROOT_DIR = /usr/pkg/cross # NetBSD/i386 |
e22117437 Initial revision |
280 281 |
BFD_ROOT_DIR = /opt/powerpc endif |
ea909b760 * Added support f... |
282 |
endif |
e22117437 Initial revision |
283 284 |
######################################################################### |
d984fed06 makefiles: fixes ... |
285 |
export HOSTCC HOSTCFLAGS HOSTLDFLAGS PEDCFLAGS HOSTSTRIP CROSS_COMPILE \ |
434c51a5e Remove unneeded C... |
286 |
AS LD CC CPP AR NM STRIP OBJCOPY OBJDUMP MAKE |
14d0a02a1 Rename TEXT_BASE ... |
287 |
export CONFIG_SYS_TEXT_BASE PLATFORM_CPPFLAGS PLATFORM_RELFLAGS CPPFLAGS CFLAGS AFLAGS |
e22117437 Initial revision |
288 289 |
######################################################################### |
5ec5529b8 allow boards to c... |
290 |
# Allow boards to use custom optimize flags on a per dir/file basis |
89f39e177 Change directory-... |
291 |
BCURDIR = $(subst $(SRCTREE)/,,$(CURDIR:$(obj)%=%)) |
326a69452 config.mk: unify ... |
292 293 |
ALL_AFLAGS = $(AFLAGS) $(AFLAGS_$(BCURDIR)/$(@F)) $(AFLAGS_$(BCURDIR)) ALL_CFLAGS = $(CFLAGS) $(CFLAGS_$(BCURDIR)/$(@F)) $(CFLAGS_$(BCURDIR)) |
475088430 Adjust dependency... |
294 295 296 297 298 299 300 |
EXTRA_CPPFLAGS = $(CPPFLAGS_$(BCURDIR)/$(@F)) $(CPPFLAGS_$(BCURDIR)) ALL_CFLAGS += $(EXTRA_CPPFLAGS) # The _DEP version uses the $< file target (for dependency generation) # See rules.mk EXTRA_CPPFLAGS_DEP = $(CPPFLAGS_$(BCURDIR)/$(addsuffix .o,$(basename $<))) \ $(CPPFLAGS_$(BCURDIR)) |
f93286397 Add support for a... |
301 |
$(obj)%.s: %.S |
326a69452 config.mk: unify ... |
302 |
$(CPP) $(ALL_AFLAGS) -o $@ $< |
f93286397 Add support for a... |
303 |
$(obj)%.o: %.S |
326a69452 config.mk: unify ... |
304 |
$(CC) $(ALL_AFLAGS) -o $@ $< -c |
f93286397 Add support for a... |
305 |
$(obj)%.o: %.c |
4ab64933e add check infrast... |
306 307 308 |
ifneq ($(CHECKSRC),0) $(CHECK) $(CHECKFLAGS) $(ALL_CFLAGS) $< endif |
326a69452 config.mk: unify ... |
309 |
$(CC) $(ALL_CFLAGS) -o $@ $< -c |
31f30c9eb add %.c->%.i and ... |
310 |
$(obj)%.i: %.c |
326a69452 config.mk: unify ... |
311 |
$(CPP) $(ALL_CFLAGS) -o $@ $< -c |
31f30c9eb add %.c->%.i and ... |
312 |
$(obj)%.s: %.c |
326a69452 config.mk: unify ... |
313 |
$(CC) $(ALL_CFLAGS) -o $@ $< -c -S |
f93286397 Add support for a... |
314 |
|
e22117437 Initial revision |
315 |
######################################################################### |
6d8962e81 Switch from archi... |
316 317 318 |
# If the list of objects to link is empty, just create an empty built-in.o cmd_link_o_target = $(if $(strip $1),\ |
8aba9dcee Divides variable ... |
319 |
$(LD) $(LDFLAGS) -r -o $@ $1,\ |
844f07d8a Coding Style (whi... |
320 |
rm -f $@; $(AR) rcs $@ ) |
6d8962e81 Switch from archi... |
321 322 |
######################################################################### |