2 # (C) Copyright 2000-2006
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,
27 # Mac OS X / Darwin's C preprocessor is Apple specific. It
28 # generates numerous errors and warnings. We want to bypass it
29 # and use GNU C's cpp. To do this we pass the -traditional-cpp
30 # option to the compiler. Note that the -traditional-cpp flag
31 # DOES NOT have the same semantics as GNU C's flag, all it does
32 # is invoke the GNU preprocessor in stock ANSI/ISO C fashion.
34 # Apple's linker is similar, thanks to the new 2 stage linking
35 # multiple symbol definitions are treated as errors, hence the
36 # -multiply_defined suppress option to turn off this error.
42 ifeq ($(HOSTOS
)-$(HOSTARCH
),darwin-ppc
)
43 HOSTCFLAGS
+= -traditional-cpp
44 HOST_LDFLAGS
+= -multiply_defined suppress
46 HOSTCFLAGS
+= -pedantic
49 ifeq ($(HOSTOS
),cygwin
)
54 # toolchains targeting win32 generate .exe files
56 ifneq (,$(findstring WIN32
,$(shell $(HOSTCC
) -E
-dM
-xc
/dev
/null
)))
63 # Include this after HOSTOS HOSTARCH check
64 # so that we can act intelligently.
66 include $(TOPDIR
)/config.mk
68 # Generated executable files
69 BIN_FILES-
$(CONFIG_LCD_LOGO
) += bmp_logo
$(SFX
)
70 BIN_FILES-
$(CONFIG_VIDEO_LOGO
) += bmp_logo
$(SFX
)
71 BIN_FILES-
$(CONFIG_ENV_IS_EMBEDDED
) += envcrc
$(SFX
)
72 BIN_FILES-
$(CONFIG_ENV_IS_IN_DATAFLASH
) += envcrc
$(SFX
)
73 BIN_FILES-
$(CONFIG_ENV_IS_IN_EEPROM
) += envcrc
$(SFX
)
74 BIN_FILES-
$(CONFIG_ENV_IS_IN_FLASH
) += envcrc
$(SFX
)
75 BIN_FILES-
$(CONFIG_ENV_IS_IN_ONENAND
) += envcrc
$(SFX
)
76 BIN_FILES-
$(CONFIG_ENV_IS_IN_NAND
) += envcrc
$(SFX
)
77 BIN_FILES-
$(CONFIG_ENV_IS_IN_NVRAM
) += envcrc
$(SFX
)
78 BIN_FILES-
$(CONFIG_ENV_IS_IN_SPI_FLASH
) += envcrc
$(SFX
)
79 BIN_FILES-
$(CONFIG_CMD_NET
) += gen_eth_addr
$(SFX
)
80 BIN_FILES-
$(CONFIG_CMD_LOADS
) += img2srec
$(SFX
)
81 BIN_FILES-
$(CONFIG_INCA_IP
) += inca-swap-bytes
$(SFX
)
82 BIN_FILES-y
+= mkimage
$(SFX
)
83 BIN_FILES-
$(CONFIG_NETCONSOLE
) += ncb
$(SFX
)
84 BIN_FILES-
$(CONFIG_SHA1_CHECK_UB_IMG
) += ubsha1
$(SFX
)
86 # Source files which exist outside the tools directory
87 EXT_OBJ_FILES-y
+= common
/env_embedded.o
88 EXT_OBJ_FILES-y
+= common
/image.o
89 EXT_OBJ_FILES-y
+= lib_generic
/crc32.o
90 EXT_OBJ_FILES-y
+= lib_generic
/md5.o
91 EXT_OBJ_FILES-y
+= lib_generic
/sha1.o
93 # Source files located in the tools directory
94 OBJ_FILES-
$(CONFIG_LCD_LOGO
) += bmp_logo.o
95 OBJ_FILES-
$(CONFIG_VIDEO_LOGO
) += bmp_logo.o
96 OBJ_FILES-y
+= default_image.o
97 OBJ_FILES-
$(CONFIG_ENV_IS_EMBEDDED
) += envcrc.o
98 OBJ_FILES-y
+= fit_image.o
99 OBJ_FILES-
$(CONFIG_CMD_NET
) += gen_eth_addr.o
100 OBJ_FILES-
$(CONFIG_CMD_LOADS
) += img2srec.o
101 OBJ_FILES-
$(CONFIG_INCA_IP
) += inca-swap-bytes.o
102 OBJ_FILES-y
+= kwbimage.o
103 OBJ_FILES-y
+= mkimage.o
104 OBJ_FILES-
$(CONFIG_NETCONSOLE
) += ncb.o
105 OBJ_FILES-y
+= os_support.o
106 OBJ_FILES-
$(CONFIG_SHA1_CHECK_UB_IMG
) += ubsha1.o
108 # Don't build by default
110 #BIN_FILES-y += mpc86x_clk$(SFX)
111 #OBJ_FILES-y += mpc86x_clk.o
114 # Flattened device tree objects
115 LIBFDT_OBJ_FILES-y
+= fdt.o
116 LIBFDT_OBJ_FILES-y
+= fdt_ro.o
117 LIBFDT_OBJ_FILES-y
+= fdt_rw.o
118 LIBFDT_OBJ_FILES-y
+= fdt_strerror.o
119 LIBFDT_OBJ_FILES-y
+= fdt_wip.o
121 # Generated LCD/video logo
122 LOGO_H
= $(OBJTREE
)/include/bmp_logo.h
123 LOGO-
$(CONFIG_LCD_LOGO
) += $(LOGO_H
)
124 LOGO-
$(CONFIG_VIDEO_LOGO
) += $(LOGO_H
)
127 LOGO_BMP
= logos
/denx.bmp
129 ifeq ($(VENDOR
),atmel
)
130 LOGO_BMP
= logos
/atmel.bmp
132 ifeq ($(VENDOR
),ronetix
)
133 LOGO_BMP
= logos
/ronetix.bmp
136 # now $(obj) is defined
137 SRCS
+= $(addprefix $(SRCTREE
)/,$(EXT_OBJ_FILES-y
:.o
=.c
))
138 SRCS
+= $(addprefix $(SRCTREE
)/tools
/,$(OBJ_FILES-y
:.o
=.c
))
139 SRCS
+= $(addprefix $(SRCTREE
)/libfdt
/,$(LIBFDT_OBJ_FILES-y
:.o
=.c
))
140 BINS
:= $(addprefix $(obj
),$(sort $(BIN_FILES-y
)))
141 LIBFDT_OBJS
:= $(addprefix $(obj
),$(LIBFDT_OBJ_FILES-y
))
144 # Use native tools and options
145 # Define __KERNEL_STRICT_NAMES to prevent typedef overlaps
147 CPPFLAGS
= -idirafter
$(SRCTREE
)/include \
148 -idirafter
$(OBJTREE
)/include2 \
149 -idirafter
$(OBJTREE
)/include \
150 -I
$(SRCTREE
)/libfdt \
151 -I
$(SRCTREE
)/tools \
152 -DTEXT_BASE
=$(TEXT_BASE
) -DUSE_HOSTCC \
153 -D__KERNEL_STRICT_NAMES
154 CFLAGS
= $(HOSTCFLAGS
) $(CPPFLAGS
) -O
156 # No -pedantic switch to avoid libfdt compilation warnings
157 FIT_CFLAGS
= -Wall
$(CPPFLAGS
) -O
159 AFLAGS
= -D__ASSEMBLY__
$(CPPFLAGS
)
162 MAKEDEPEND
= makedepend
164 all: $(obj
).depend
$(BINS
) $(LOGO-y
) subdirs
166 $(obj
)bin2header
$(SFX
): $(obj
)bin2header.o
167 $(CC
) $(CFLAGS
) $(HOST_LDFLAGS
) -o
$@
$^
170 $(obj
)bmp_logo
$(SFX
): $(obj
)bmp_logo.o
171 $(CC
) $(CFLAGS
) $(HOST_LDFLAGS
) -o
$@
$^
174 $(obj
)envcrc
$(SFX
): $(obj
)crc32.o
$(obj
)env_embedded.o
$(obj
)envcrc.o
$(obj
)sha1.o
175 $(CC
) $(CFLAGS
) -o
$@
$^
177 $(obj
)gen_eth_addr
$(SFX
): $(obj
)gen_eth_addr.o
178 $(CC
) $(CFLAGS
) $(HOST_LDFLAGS
) -o
$@
$^
181 $(obj
)img2srec
$(SFX
): $(obj
)img2srec.o
182 $(CC
) $(CFLAGS
) $(HOST_LDFLAGS
) -o
$@
$^
185 $(obj
)inca-swap-bytes
$(SFX
): $(obj
)inca-swap-bytes.o
186 $(CC
) $(CFLAGS
) $(HOST_LDFLAGS
) -o
$@
$^
189 $(obj
)mkimage
$(SFX
): $(obj
)crc32.o \
190 $(obj
)default_image.o \
199 $(CC
) $(CFLAGS
) $(HOST_LDFLAGS
) -o
$@
$^
202 $(obj
)mpc86x_clk
$(SFX
): $(obj
)mpc86x_clk.o
203 $(CC
) $(CFLAGS
) $(HOST_LDFLAGS
) -o
$@
$^
206 $(obj
)ncb
$(SFX
): $(obj
)ncb.o
207 $(CC
) $(CFLAGS
) $(HOST_LDFLAGS
) -o
$@
$^
210 $(obj
)ubsha1
$(SFX
): $(obj
)os_support.o
$(obj
)sha1.o
$(obj
)ubsha1.o
211 $(CC
) $(CFLAGS
) -o
$@
$^
213 # Some files complain if compiled with -pedantic, use FIT_CFLAGS
214 $(obj
)default_image.o
: $(SRCTREE
)/tools
/default_image.c
215 $(CC
) -g
$(FIT_CFLAGS
) -c
-o
$@
$<
217 $(obj
)fit_image.o
: $(SRCTREE
)/tools
/fit_image.c
218 $(CC
) -g
$(FIT_CFLAGS
) -c
-o
$@
$<
220 $(obj
)image.o
: $(SRCTREE
)/common
/image.c
221 $(CC
) -g
$(FIT_CFLAGS
) -c
-o
$@
$<
223 $(obj
)kwbimage.o
: $(SRCTREE
)/tools
/kwbimage.c
224 $(CC
) -g
$(FIT_CFLAGS
) -c
-o
$@
$<
226 $(obj
)mkimage.o
: $(SRCTREE
)/tools
/mkimage.c
227 $(CC
) -g
$(FIT_CFLAGS
) -c
-o
$@
$<
229 $(obj
)os_support.o
: $(SRCTREE
)/tools
/os_support.c
230 $(CC
) -g
$(FIT_CFLAGS
) -c
-o
$@
$<
232 # Some of the tool objects need to be accessed from outside the tools directory
233 $(obj
)%.o
: $(SRCTREE
)/common
/%.c
234 $(CC
) -g
$(FIT_CFLAGS
) -c
-o
$@
$<
236 $(obj
)%.o
: $(SRCTREE
)/lib_generic
/%.c
237 $(CC
) -g
$(CFLAGS
) -c
-o
$@
$<
240 $(CC
) -g
$(FIT_CFLAGS
) -c
-o
$@
$<
243 ifeq ($(TOOLSUBDIRS
),)
246 @for
dir in
$(TOOLSUBDIRS
) ; do \
249 HOSTARCH
=$(HOSTARCH
) \
250 HOSTCFLAGS
="$(HOSTCFLAGS)" \
251 HOST_LDFLAGS
="$(HOST_LDFLAGS)" \
252 -C
$$dir || exit
1 ; \
256 $(LOGO_H
): $(obj
)bmp_logo
$(LOGO_BMP
)
257 $(obj
).
/bmp_logo
$(LOGO_BMP
) >$@
259 #########################################################################
261 # defines $(obj).depend target
262 include $(SRCTREE
)/rules.mk
264 sinclude
$(obj
).depend
266 #########################################################################