3 # Wolfgang Denk, DENX Software Engineering, wd@denx.de.
5 # See file CREDITS for list of people who contributed to this
8 # This program is free software; you can redistribute it and/or
9 # modify it under the terms of the GNU General Public License as
10 # published by the Free Software Foundation; either version 2 of
11 # the License, or (at your option) any later version.
13 # This program is distributed in the hope that it will be useful,
14 # but WITHOUT ANY WARRANTY; without even the implied warranty of
15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 # GNU General Public License for more details.
18 # You should have received a copy of the GNU General Public License
19 # along with this program; if not, write to the Free Software
20 # Foundation, Inc., 59 Temple Place, Suite 330, Boston,
24 #########################################################################
31 # include architecture dependend rules
33 sinclude $(TOPDIR)/$(ARCH)_config.mk
36 # include CPU specific rules
38 sinclude $(TOPDIR)/cpu/$(CPU)/config.mk
41 # include SoC specific rules
43 sinclude $(TOPDIR)/cpu/$(CPU)/$(SOC)/config.mk
46 # include vendor/board specific rules
48 BOARDDIR = $(VENDOR)/$(BOARD)
54 sinclude $(TOPDIR)/board/$(BOARDDIR)/config.mk
57 #########################################################################
59 CONFIG_SHELL := $(shell if [ -x "$$BASH" ]; then echo $$BASH; \
60 else if [ -x /bin/bash ]; then echo /bin/bash; \
63 ifeq ($(HOSTOS)-$(HOSTARCH),darwin-ppc)
69 HOSTCFLAGS = -Wall -Wstrict-prototypes -O2 -fomit-frame-pointer
72 #########################################################################
74 # Include the make variables (CC, etc...)
75 AS = $(CROSS_COMPILE)as
76 LD = $(CROSS_COMPILE)ld
77 CC = $(CROSS_COMPILE)gcc
79 AR = $(CROSS_COMPILE)ar
80 NM = $(CROSS_COMPILE)nm
81 STRIP = $(CROSS_COMPILE)strip
82 OBJCOPY = $(CROSS_COMPILE)objcopy
83 OBJDUMP = $(CROSS_COMPILE)objdump
84 RANLIB = $(CROSS_COMPILE)RANLIB
86 .depend : CC = @$(CROSS_COMPILE)gcc
88 RELFLAGS = $(PLATFORM_RELFLAGS)
92 LDSCRIPT := $(TOPDIR)/board/$(BOARDDIR)/u-boot.lds
94 LDFLAGS += -Bstatic -T $(LDSCRIPT) -Ttext $(TEXT_BASE) $(PLATFORM_LDFLAGS)
96 ifdef COMPRESSED_UBOOT
97 ifndef LDSCRIPT_BOOTSTRAP
98 LDSCRIPT_BOOTSTRAP := $(TOPDIR)/board/$(BOARDDIR)/u-boot-bootstrap.lds
100 LDFLAGS_BOOTSTRAP := -Bstatic -T $(LDSCRIPT_BOOTSTRAP)
101 LDFLAGS_BOOTSTRAP += -Ttext $(BOOTSTRAP_TEXT_BASE) $(PLATFORM_LDFLAGS)
104 OBJCFLAGS += --gap-fill=0xff
106 gccincdir := $(shell $(CC) -print-file-name=include)
108 CPPFLAGS := $(DBGFLAGS) $(OPTFLAGS) $(RELFLAGS) \
109 -D__KERNEL__ -DTEXT_BASE=$(TEXT_BASE) \
110 -I$(TOPDIR)/include \
111 -fno-builtin -ffreestanding -nostdinc -isystem \
112 $(gccincdir) -pipe $(PLATFORM_CPPFLAGS)
114 CFLAGS := $(CPPFLAGS) -Wall -Wstrict-prototypes
116 ifdef COMPRESSED_UBOOT
117 CFLAGS += -DCOMPRESSED_UBOOT=1
120 ifeq ($(BUILD_OPTIMIZED),y)
121 CFLAGS += -Os -fno-reorder-functions -fno-delete-null-pointer-checks
122 CPPFLAGS += -Os -fno-reorder-functions -fno-delete-null-pointer-checks
126 AFLAGS := $(AFLAGS_DEBUG) -D__ASSEMBLY__ $(CPPFLAGS)
128 ifdef COMPRESSED_UBOOT
129 AFLAGS += -DCOMPRESSED_UBOOT=1
132 #########################################################################
134 export AFLAGS AR AS CC CFLAGS CONFIG_SHELL CPP CPPFLAGS CROSS_COMPILE HOSTCC \
135 HOSTCFLAGS HPATH LD MAKE NM OBJCOPY OBJDUMP PLATFORM_CPPFLAGS \
136 PLATFORM_RELFLAGS STRIP TEXT_BASE
146 #########################################################################
150 @echo [CPP] $(CURDIR)/$<
152 $(Q)$(CPP) $(AFLAGS) -o $@ $(CURDIR)/$<
156 @echo [CC] $(CURDIR)/$<
158 $(Q)$(CC) $(AFLAGS) -c -o $@ $(CURDIR)/$<
162 @echo [CC] $(CURDIR)/$<
164 $(Q)$(CC) $(CFLAGS) -c -o $@ $<
166 #########################################################################