]> git.kernelconcepts.de Git - karo-tx-uboot.git/blob - tools/Makefile
update the EB+MCF-EV123 board support
[karo-tx-uboot.git] / tools / Makefile
1 #
2 # (C) Copyright 2000-2006
3 # Wolfgang Denk, DENX Software Engineering, wd@denx.de.
4 #
5 # See file CREDITS for list of people who contributed to this
6 # project.
7 #
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.
12 #
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.
17 #
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,
21 # MA 02111-1307 USA
22 #
23
24 TOOLSUBDIRS =
25
26 #
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.
33 #
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.
37 #
38
39 HOSTCFLAGS = -Wall
40 HOST_LDFLAGS =
41
42 ifeq ($(HOSTOS)-$(HOSTARCH),darwin-ppc)
43 HOSTCFLAGS += -traditional-cpp
44 HOST_LDFLAGS += -multiply_defined suppress
45 else
46 HOSTCFLAGS += -pedantic
47 endif
48
49 ifeq ($(HOSTOS),cygwin)
50 HOSTCFLAGS += -ansi
51 endif
52
53 #
54 # toolchains targeting win32 generate .exe files
55 #
56 ifneq (,$(findstring WIN32 ,$(shell $(HOSTCC) -E -dM -xc /dev/null)))
57 SFX = .exe
58 else
59 SFX =
60 endif
61
62 #
63 # Include this after HOSTOS HOSTARCH check
64 # so that we can act intelligently.
65 #
66 include $(TOPDIR)/config.mk
67
68 # Generated executable files
69 BIN_FILES-$(CONFIG_CMD_LOADS) += img2srec$(SFX)
70 BIN_FILES-y += mkimage$(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_SHA1_CHECK_UB_IMG) += ubsha1$(SFX)
80 BIN_FILES-$(CONFIG_CMD_NET) += gen_eth_addr$(SFX)
81 BIN_FILES-$(CONFIG_LCD_LOGO) += bmp_logo$(SFX)
82 BIN_FILES-$(CONFIG_VIDEO_LOGO) += bmp_logo$(SFX)
83 BIN_FILES-$(CONFIG_INCA_IP) += inca-swap-bytes$(SFX)
84 BIN_FILES-$(CONFIG_NETCONSOLE) += ncb$(SFX)
85
86 # Source files which exist outside the tools directory
87 EXT_OBJ_FILES-y += common/env_embedded.o
88 EXT_OBJ_FILES-y += lib_generic/crc32.o
89 EXT_OBJ_FILES-y += lib_generic/md5.o
90 EXT_OBJ_FILES-y += lib_generic/sha1.o
91 EXT_OBJ_FILES-y += common/image.o
92
93 # Source files located in the tools directory
94 OBJ_FILES-$(CONFIG_CMD_LOADS) += img2srec.o
95 OBJ_FILES-y += mkimage.o
96 OBJ_FILES-$(CONFIG_ENV_IS_EMBEDDED) += envcrc.o
97 OBJ_FILES-$(CONFIG_SHA1_CHECK_UB_IMG) += ubsha1.o
98 OBJ_FILES-$(CONFIG_CMD_NET) += gen_eth_addr.o
99 OBJ_FILES-$(CONFIG_LCD_LOGO) += bmp_logo.o
100 OBJ_FILES-$(CONFIG_VIDEO_LOGO) += bmp_logo.o
101 OBJ_FILES-$(CONFIG_INCA_IP) += inca-swap-bytes.o
102 OBJ_FILES-$(CONFIG_NETCONSOLE) += ncb.o
103 OBJ_FILES-y += os_support.o
104
105 # Don't build by default
106 #ifeq ($(ARCH),ppc)
107 #BIN_FILES-y += mpc86x_clk$(SFX)
108 #OBJ_FILES-y += mpc86x_clk.o
109 #endif
110
111 # Flattened device tree objects
112 LIBFDT_OBJ_FILES-y += fdt.o
113 LIBFDT_OBJ_FILES-y += fdt_ro.o
114 LIBFDT_OBJ_FILES-y += fdt_rw.o
115 LIBFDT_OBJ_FILES-y += fdt_strerror.o
116 LIBFDT_OBJ_FILES-y += fdt_wip.o
117
118 # Generated LCD/video logo
119 LOGO_H = $(OBJTREE)/include/bmp_logo.h
120 LOGO-$(CONFIG_LCD_LOGO) += $(LOGO_H)
121 LOGO-$(CONFIG_VIDEO_LOGO) += $(LOGO_H)
122
123 ifeq ($(LOGO_BMP),)
124 LOGO_BMP= logos/denx.bmp
125 endif
126 ifeq ($(VENDOR),atmel)
127 LOGO_BMP= logos/atmel.bmp
128 endif
129 ifeq ($(VENDOR),ronetix)
130 LOGO_BMP= logos/ronetix.bmp
131 endif
132
133 # now $(obj) is defined
134 SRCS    += $(addprefix $(SRCTREE)/,$(EXT_OBJ_FILES-y:.o=.c))
135 SRCS    += $(addprefix $(SRCTREE)/tools/,$(OBJ_FILES-y:.o=.c))
136 SRCS    += $(addprefix $(SRCTREE)/libfdt/,$(LIBFDT_OBJ_FILES-y:.o=.c))
137 BINS    := $(addprefix $(obj),$(sort $(BIN_FILES-y)))
138 LIBFDT_OBJS     := $(addprefix $(obj),$(LIBFDT_OBJ_FILES-y))
139
140 #
141 # Use native tools and options
142 # Define __KERNEL_STRICT_NAMES to prevent typedef overlaps
143 #
144 CPPFLAGS   = -idirafter $(SRCTREE)/include \
145                 -idirafter $(OBJTREE)/include2 \
146                 -idirafter $(OBJTREE)/include \
147                 -I $(SRCTREE)/libfdt \
148                 -I $(SRCTREE)/tools \
149                 -DTEXT_BASE=$(TEXT_BASE) -DUSE_HOSTCC \
150                 -D__KERNEL_STRICT_NAMES
151 CFLAGS     = $(HOSTCFLAGS) $(CPPFLAGS) -O
152
153 # No -pedantic switch to avoid libfdt compilation warnings
154 FIT_CFLAGS = -Wall $(CPPFLAGS) -O
155
156 AFLAGS     = -D__ASSEMBLY__ $(CPPFLAGS)
157 CC         = $(HOSTCC)
158 STRIP      = $(HOSTSTRIP)
159 MAKEDEPEND = makedepend
160
161 all:    $(obj).depend $(BINS) $(LOGO-y) subdirs
162
163 $(obj)envcrc$(SFX):     $(obj)envcrc.o $(obj)crc32.o $(obj)env_embedded.o $(obj)sha1.o
164         $(CC) $(CFLAGS) -o $@ $^
165
166 $(obj)ubsha1$(SFX):     $(obj)ubsha1.o $(obj)sha1.o $(obj)os_support.o
167         $(CC) $(CFLAGS) -o $@ $^
168
169 $(obj)img2srec$(SFX):   $(obj)img2srec.o
170         $(CC) $(CFLAGS) $(HOST_LDFLAGS) -o $@ $^
171         $(STRIP) $@
172
173 $(obj)mkimage$(SFX):    $(obj)mkimage.o $(obj)crc32.o $(obj)image.o $(obj)md5.o \
174                         $(obj)sha1.o $(LIBFDT_OBJS) $(obj)os_support.o
175         $(CC) $(CFLAGS) $(HOST_LDFLAGS) -o $@ $^
176         $(STRIP) $@
177
178 $(obj)ncb$(SFX):        $(obj)ncb.o
179         $(CC) $(CFLAGS) $(HOST_LDFLAGS) -o $@ $^
180         $(STRIP) $@
181
182 $(obj)gen_eth_addr$(SFX):       $(obj)gen_eth_addr.o
183         $(CC) $(CFLAGS) $(HOST_LDFLAGS) -o $@ $^
184         $(STRIP) $@
185
186 $(obj)bmp_logo$(SFX):   $(obj)bmp_logo.o
187         $(CC) $(CFLAGS) $(HOST_LDFLAGS) -o $@ $^
188         $(STRIP) $@
189
190 $(obj)inca-swap-bytes$(SFX):    $(obj)inca-swap-bytes.o
191         $(CC) $(CFLAGS) $(HOST_LDFLAGS) -o $@ $^
192         $(STRIP) $@
193
194 $(obj)mpc86x_clk$(SFX): $(obj)mpc86x_clk.o
195         $(CC) $(CFLAGS) $(HOST_LDFLAGS) -o $@ $^
196         $(STRIP) $@
197
198 $(obj)bin2header$(SFX): $(obj)bin2header.o
199         $(CC) $(CFLAGS) $(HOST_LDFLAGS) -o $@ $^
200         $(STRIP) $@
201
202 # Some files complain if compiled with -pedantic, use FIT_CFLAGS
203 $(obj)image.o: $(SRCTREE)/common/image.c
204         $(CC) -g $(FIT_CFLAGS) -c -o $@ $<
205
206 $(obj)mkimage.o: $(SRCTREE)/tools/mkimage.c
207         $(CC) -g $(FIT_CFLAGS) -c -o $@ $<
208
209 $(obj)os_support.o: $(SRCTREE)/tools/os_support.c
210         $(CC) -g $(FIT_CFLAGS) -c -o $@ $<
211
212 # Some of the tool objects need to be accessed from outside the tools directory
213 $(obj)%.o: $(SRCTREE)/common/%.c
214         $(CC) -g $(FIT_CFLAGS) -c -o $@ $<
215
216 $(obj)%.o: $(SRCTREE)/lib_generic/%.c
217         $(CC) -g $(CFLAGS) -c -o $@ $<
218
219 $(LIBFDT_OBJS):
220         $(CC) -g $(FIT_CFLAGS) -c -o $@ $<
221
222 subdirs:
223 ifeq ($(TOOLSUBDIRS),)
224         @:
225 else
226         @for dir in $(TOOLSUBDIRS) ; do \
227             $(MAKE) \
228                 HOSTOS=$(HOSTOS) \
229                 HOSTARCH=$(HOSTARCH) \
230                 HOSTCFLAGS="$(HOSTCFLAGS)" \
231                 HOST_LDFLAGS="$(HOST_LDFLAGS)" \
232                 -C $$dir || exit 1 ; \
233         done
234 endif
235
236 $(LOGO_H):      $(obj)bmp_logo $(LOGO_BMP)
237         $(obj)./bmp_logo $(LOGO_BMP) >$@
238
239 #########################################################################
240
241 # defines $(obj).depend target
242 include $(SRCTREE)/rules.mk
243
244 sinclude $(obj).depend
245
246 #########################################################################