]>
Commit | Line | Data |
---|---|---|
efee1709 | 1 | # |
f9328639 | 2 | # (C) Copyright 2000-2006 |
efee1709 WD |
3 | # Wolfgang Denk, DENX Software Engineering, [email protected]. |
4 | # | |
1a459660 | 5 | # SPDX-License-Identifier: GPL-2.0+ |
efee1709 WD |
6 | # |
7 | ||
30ff8918 | 8 | TOOLSUBDIRS = kernel-doc |
efee1709 | 9 | |
a98ae78f FR |
10 | # |
11 | # Include this after HOSTOS HOSTARCH check | |
12 | # so that we can act intelligently. | |
13 | # | |
14 | include $(TOPDIR)/config.mk | |
15 | ||
efee1709 | 16 | # |
2f8d396b | 17 | # toolchains targeting win32 generate .exe files |
efee1709 | 18 | # |
2f8d396b | 19 | ifneq (,$(findstring WIN32 ,$(shell $(HOSTCC) -E -dM -xc /dev/null))) |
efee1709 WD |
20 | SFX = .exe |
21 | else | |
22 | SFX = | |
23 | endif | |
24 | ||
c7c0d542 MF |
25 | # Enable all the config-independent tools |
26 | ifneq ($(HOST_TOOLS_ALL),) | |
27 | CONFIG_LCD_LOGO = y | |
570d7d50 | 28 | CONFIG_CMD_LOADS = y |
c7c0d542 | 29 | CONFIG_CMD_NET = y |
60b74bde | 30 | CONFIG_XWAY_SWAP_BYTES = y |
c7c0d542 MF |
31 | CONFIG_NETCONSOLE = y |
32 | CONFIG_SHA1_CHECK_UB_IMG = y | |
33 | endif | |
34 | ||
2ad6e27d MF |
35 | # Merge all the different vars for envcrc into one |
36 | ENVCRC-$(CONFIG_ENV_IS_EMBEDDED) = y | |
37 | ENVCRC-$(CONFIG_ENV_IS_IN_DATAFLASH) = y | |
38 | ENVCRC-$(CONFIG_ENV_IS_IN_EEPROM) = y | |
39 | ENVCRC-$(CONFIG_ENV_IS_IN_FLASH) = y | |
40 | ENVCRC-$(CONFIG_ENV_IS_IN_ONENAND) = y | |
41 | ENVCRC-$(CONFIG_ENV_IS_IN_NAND) = y | |
42 | ENVCRC-$(CONFIG_ENV_IS_IN_NVRAM) = y | |
43 | ENVCRC-$(CONFIG_ENV_IS_IN_SPI_FLASH) = y | |
44 | CONFIG_BUILD_ENVCRC ?= $(ENVCRC-y) | |
45 | ||
ee3584a5 | 46 | # Generated executable files |
14821d7d PW |
47 | BIN_FILES-$(CONFIG_LCD_LOGO) += bmp_logo$(SFX) |
48 | BIN_FILES-$(CONFIG_VIDEO_LOGO) += bmp_logo$(SFX) | |
2ad6e27d | 49 | BIN_FILES-$(CONFIG_BUILD_ENVCRC) += envcrc$(SFX) |
123c48a2 | 50 | BIN_FILES-$(CONFIG_CMD_NET) += gen_eth_addr$(SFX) |
14821d7d | 51 | BIN_FILES-$(CONFIG_CMD_LOADS) += img2srec$(SFX) |
60b74bde | 52 | BIN_FILES-$(CONFIG_XWAY_SWAP_BYTES) += xway-swap-bytes$(SFX) |
a6337e6f | 53 | BIN_FILES-y += mkenvimage$(SFX) |
14821d7d | 54 | BIN_FILES-y += mkimage$(SFX) |
81e35203 | 55 | BIN_FILES-$(CONFIG_SMDK5250) += mksmdk5250spl$(SFX) |
deb0757c | 56 | BIN_FILES-$(CONFIG_MX23) += mxsboot$(SFX) |
f29f7e02 | 57 | BIN_FILES-$(CONFIG_MX28) += mxsboot$(SFX) |
1cd300de | 58 | BIN_FILES-$(CONFIG_NETCONSOLE) += ncb$(SFX) |
14821d7d | 59 | BIN_FILES-$(CONFIG_SHA1_CHECK_UB_IMG) += ubsha1$(SFX) |
d131ad68 | 60 | BIN_FILES-$(CONFIG_KIRKWOOD) += kwboot$(SFX) |
6c887b2a | 61 | BIN_FILES-y += proftool(SFX) |
ee3584a5 | 62 | |
fb8b33c1 | 63 | # Source files which exist outside the tools directory |
2ad6e27d | 64 | EXT_OBJ_FILES-$(CONFIG_BUILD_ENVCRC) += common/env_embedded.o |
14821d7d | 65 | EXT_OBJ_FILES-y += common/image.o |
53fbb7e8 | 66 | EXT_OBJ_FILES-$(CONFIG_FIT) += common/image-fit.o |
3e569a6b | 67 | EXT_OBJ_FILES-y += common/image-sig.o |
78acc472 PT |
68 | EXT_OBJ_FILES-y += lib/crc32.o |
69 | EXT_OBJ_FILES-y += lib/md5.o | |
70 | EXT_OBJ_FILES-y += lib/sha1.o | |
ee3584a5 PT |
71 | |
72 | # Source files located in the tools directory | |
335ffe7e PT |
73 | OBJ_FILES-$(CONFIG_LCD_LOGO) += bmp_logo.o |
74 | OBJ_FILES-$(CONFIG_VIDEO_LOGO) += bmp_logo.o | |
d984fed0 | 75 | NOPED_OBJ_FILES-y += default_image.o |
6c887b2a | 76 | NOPED_OBJ_FILES-y += proftool.o |
2ad6e27d | 77 | OBJ_FILES-$(CONFIG_BUILD_ENVCRC) += envcrc.o |
d984fed0 | 78 | NOPED_OBJ_FILES-y += fit_image.o |
14821d7d PW |
79 | OBJ_FILES-$(CONFIG_CMD_NET) += gen_eth_addr.o |
80 | OBJ_FILES-$(CONFIG_CMD_LOADS) += img2srec.o | |
60b74bde | 81 | OBJ_FILES-$(CONFIG_XWAY_SWAP_BYTES) += xway-swap-bytes.o |
4962e38e | 82 | NOPED_OBJ_FILES-y += aisimage.o |
d984fed0 | 83 | NOPED_OBJ_FILES-y += kwbimage.o |
5d898a00 | 84 | NOPED_OBJ_FILES-y += pblimage.o |
8edcde5e | 85 | NOPED_OBJ_FILES-y += imximage.o |
604f23dd | 86 | NOPED_OBJ_FILES-y += image-host.o |
3decb14a | 87 | NOPED_OBJ_FILES-y += omapimage.o |
a6337e6f | 88 | NOPED_OBJ_FILES-y += mkenvimage.o |
d984fed0 | 89 | NOPED_OBJ_FILES-y += mkimage.o |
81e35203 | 90 | OBJ_FILES-$(CONFIG_SMDK5250) += mkexynosspl.o |
deb0757c | 91 | OBJ_FILES-$(CONFIG_MX23) += mxsboot.o |
f29f7e02 | 92 | OBJ_FILES-$(CONFIG_MX28) += mxsboot.o |
1cd300de | 93 | OBJ_FILES-$(CONFIG_NETCONSOLE) += ncb.o |
d984fed0 | 94 | NOPED_OBJ_FILES-y += os_support.o |
14821d7d | 95 | OBJ_FILES-$(CONFIG_SHA1_CHECK_UB_IMG) += ubsha1.o |
7816f2cf | 96 | NOPED_OBJ_FILES-y += ublimage.o |
d131ad68 | 97 | OBJ_FILES-$(CONFIG_KIRKWOOD) += kwboot.o |
ee3584a5 PT |
98 | |
99 | # Don't build by default | |
100 | #ifeq ($(ARCH),ppc) | |
101 | #BIN_FILES-y += mpc86x_clk$(SFX) | |
102 | #OBJ_FILES-y += mpc86x_clk.o | |
103 | #endif | |
104 | ||
105 | # Flattened device tree objects | |
106 | LIBFDT_OBJ_FILES-y += fdt.o | |
107 | LIBFDT_OBJ_FILES-y += fdt_ro.o | |
108 | LIBFDT_OBJ_FILES-y += fdt_rw.o | |
109 | LIBFDT_OBJ_FILES-y += fdt_strerror.o | |
110 | LIBFDT_OBJ_FILES-y += fdt_wip.o | |
111 | ||
19c402af | 112 | # RSA objects |
29ce737d | 113 | RSA_OBJ_FILES-$(CONFIG_FIT_SIGNATURE) += rsa-sign.o |
19c402af | 114 | |
335ffe7e | 115 | # Generated LCD/video logo |
ee3584a5 | 116 | LOGO_H = $(OBJTREE)/include/bmp_logo.h |
c270730f | 117 | LOGO_DATA_H = $(OBJTREE)/include/bmp_logo_data.h |
335ffe7e | 118 | LOGO-$(CONFIG_LCD_LOGO) += $(LOGO_H) |
c270730f | 119 | LOGO-$(CONFIG_LCD_LOGO) += $(LOGO_DATA_H) |
335ffe7e | 120 | LOGO-$(CONFIG_VIDEO_LOGO) += $(LOGO_H) |
c270730f | 121 | LOGO-$(CONFIG_VIDEO_LOGO) += $(LOGO_DATA_H) |
ee3584a5 | 122 | |
96903dae | 123 | # Generic logo |
ee3584a5 PT |
124 | ifeq ($(LOGO_BMP),) |
125 | LOGO_BMP= logos/denx.bmp | |
96903dae OS |
126 | |
127 | # Use board logo and fallback to vendor | |
128 | ifneq ($(wildcard logos/$(BOARD).bmp),) | |
129 | LOGO_BMP= logos/$(BOARD).bmp | |
130 | else | |
131 | ifneq ($(wildcard logos/$(VENDOR).bmp),) | |
132 | LOGO_BMP= logos/$(VENDOR).bmp | |
ee3584a5 | 133 | endif |
348de314 | 134 | endif |
ee3584a5 | 135 | |
96903dae OS |
136 | endif # !LOGO_BMP |
137 | ||
f9328639 | 138 | # now $(obj) is defined |
d984fed0 SW |
139 | HOSTSRCS += $(addprefix $(SRCTREE)/,$(EXT_OBJ_FILES-y:.o=.c)) |
140 | HOSTSRCS += $(addprefix $(SRCTREE)/tools/,$(OBJ_FILES-y:.o=.c)) | |
0de71d50 | 141 | HOSTSRCS += $(addprefix $(SRCTREE)/lib/libfdt/,$(LIBFDT_OBJ_FILES-y:.o=.c)) |
19c402af | 142 | HOSTSRCS += $(addprefix $(SRCTREE)/lib/rsa/,$(RSA_OBJ_FILES-y:.o=.c)) |
afcbce07 | 143 | BINS := $(addprefix $(obj),$(sort $(BIN_FILES-y))) |
ee3584a5 | 144 | LIBFDT_OBJS := $(addprefix $(obj),$(LIBFDT_OBJ_FILES-y)) |
19c402af | 145 | RSA_OBJS := $(addprefix $(obj),$(RSA_OBJ_FILES-y)) |
f9328639 | 146 | |
3e569a6b SG |
147 | # We cannot check CONFIG_FIT_SIGNATURE here since it is not set on the host |
148 | FIT_SIG_OBJ_FILES := image-sig.o | |
149 | FIT_SIG_OBJS := $(addprefix $(obj),$(FIT_SIG_OBJ_FILES)) | |
150 | ||
d984fed0 SW |
151 | HOSTOBJS := $(addprefix $(obj),$(OBJ_FILES-y)) |
152 | NOPEDOBJS := $(addprefix $(obj),$(NOPED_OBJ_FILES-y)) | |
153 | ||
efee1709 WD |
154 | # |
155 | # Use native tools and options | |
2f8d396b | 156 | # Define __KERNEL_STRICT_NAMES to prevent typedef overlaps |
efee1709 | 157 | # |
669dfc2e SG |
158 | HOSTCPPFLAGS = -include $(SRCTREE)/include/libfdt_env.h \ |
159 | -idirafter $(SRCTREE)/include \ | |
f9328639 MB |
160 | -idirafter $(OBJTREE)/include2 \ |
161 | -idirafter $(OBJTREE)/include \ | |
0de71d50 | 162 | -I $(SRCTREE)/lib/libfdt \ |
40b8d909 | 163 | -I $(SRCTREE)/tools \ |
14d0a02a WD |
164 | -DCONFIG_SYS_TEXT_BASE=$(CONFIG_SYS_TEXT_BASE) \ |
165 | -DUSE_HOSTCC \ | |
2f8d396b | 166 | -D__KERNEL_STRICT_NAMES |
8cf30809 | 167 | |
efee1709 | 168 | |
335ffe7e | 169 | all: $(obj).depend $(BINS) $(LOGO-y) subdirs |
efee1709 | 170 | |
14821d7d | 171 | $(obj)bin2header$(SFX): $(obj)bin2header.o |
d984fed0 SW |
172 | $(HOSTCC) $(HOSTCFLAGS) $(HOSTLDFLAGS) -o $@ $^ |
173 | $(HOSTSTRIP) $@ | |
efee1709 | 174 | |
14821d7d | 175 | $(obj)bmp_logo$(SFX): $(obj)bmp_logo.o |
d984fed0 SW |
176 | $(HOSTCC) $(HOSTCFLAGS) $(HOSTLDFLAGS) -o $@ $^ |
177 | $(HOSTSTRIP) $@ | |
efee1709 | 178 | |
6c887b2a SG |
179 | $(obj)proftool(SFX): $(obj)proftool.o |
180 | $(HOSTCC) $(HOSTCFLAGS) $(HOSTLDFLAGS) -o $@ $^ | |
181 | $(HOSTSTRIP) $@ | |
182 | ||
14821d7d | 183 | $(obj)envcrc$(SFX): $(obj)crc32.o $(obj)env_embedded.o $(obj)envcrc.o $(obj)sha1.o |
d984fed0 | 184 | $(HOSTCC) $(HOSTCFLAGS) $(HOSTLDFLAGS) -o $@ $^ |
eedcd078 | 185 | |
f9328639 | 186 | $(obj)gen_eth_addr$(SFX): $(obj)gen_eth_addr.o |
d984fed0 SW |
187 | $(HOSTCC) $(HOSTCFLAGS) $(HOSTLDFLAGS) -o $@ $^ |
188 | $(HOSTSTRIP) $@ | |
efee1709 | 189 | |
14821d7d | 190 | $(obj)img2srec$(SFX): $(obj)img2srec.o |
d984fed0 SW |
191 | $(HOSTCC) $(HOSTCFLAGS) $(HOSTLDFLAGS) -o $@ $^ |
192 | $(HOSTSTRIP) $@ | |
efee1709 | 193 | |
60b74bde | 194 | $(obj)xway-swap-bytes$(SFX): $(obj)xway-swap-bytes.o |
d984fed0 SW |
195 | $(HOSTCC) $(HOSTCFLAGS) $(HOSTLDFLAGS) -o $@ $^ |
196 | $(HOSTSTRIP) $@ | |
3e38691e | 197 | |
8b6a4952 VY |
198 | $(obj)mkenvimage$(SFX): $(obj)crc32.o $(obj)mkenvimage.o \ |
199 | $(obj)os_support.o | |
a6337e6f | 200 | $(HOSTCC) $(HOSTCFLAGS) $(HOSTLDFLAGS) -o $@ $^ |
30de1014 | 201 | $(HOSTSTRIP) $@ |
a6337e6f | 202 | |
4962e38e SB |
203 | $(obj)mkimage$(SFX): $(obj)aisimage.o \ |
204 | $(obj)crc32.o \ | |
89a4d6b1 PW |
205 | $(obj)default_image.o \ |
206 | $(obj)fit_image.o \ | |
53fbb7e8 | 207 | $(obj)image-fit.o \ |
89a4d6b1 | 208 | $(obj)image.o \ |
604f23dd | 209 | $(obj)image-host.o \ |
3e569a6b | 210 | $(FIT_SIG_OBJS) \ |
8edcde5e | 211 | $(obj)imximage.o \ |
aa0c7a86 | 212 | $(obj)kwbimage.o \ |
5d898a00 | 213 | $(obj)pblimage.o \ |
89a4d6b1 PW |
214 | $(obj)md5.o \ |
215 | $(obj)mkimage.o \ | |
216 | $(obj)os_support.o \ | |
3decb14a | 217 | $(obj)omapimage.o \ |
89a4d6b1 | 218 | $(obj)sha1.o \ |
7816f2cf | 219 | $(obj)ublimage.o \ |
19c402af SG |
220 | $(LIBFDT_OBJS) \ |
221 | $(RSA_OBJS) | |
222 | $(HOSTCC) $(HOSTCFLAGS) $(HOSTLDFLAGS) -o $@ $^ $(HOSTLIBS) | |
d984fed0 | 223 | $(HOSTSTRIP) $@ |
14821d7d | 224 | |
81e35203 CK |
225 | $(obj)mk$(BOARD)spl$(SFX): $(obj)mkexynosspl.o |
226 | $(HOSTCC) $(HOSTCFLAGS) $(HOSTLDFLAGS) -o $@ $^ | |
227 | $(HOSTSTRIP) $@ | |
228 | ||
f9328639 | 229 | $(obj)mpc86x_clk$(SFX): $(obj)mpc86x_clk.o |
d984fed0 SW |
230 | $(HOSTCC) $(HOSTCFLAGS) $(HOSTLDFLAGS) -o $@ $^ |
231 | $(HOSTSTRIP) $@ | |
f29f7e02 MV |
232 | |
233 | $(obj)mxsboot$(SFX): $(obj)mxsboot.o | |
234 | $(HOSTCC) $(HOSTCFLAGS) $(HOSTLDFLAGS) -o $@ $^ | |
235 | $(HOSTSTRIP) $@ | |
ef1464cc | 236 | |
14821d7d | 237 | $(obj)ncb$(SFX): $(obj)ncb.o |
d984fed0 SW |
238 | $(HOSTCC) $(HOSTCFLAGS) $(HOSTLDFLAGS) -o $@ $^ |
239 | $(HOSTSTRIP) $@ | |
0a823aa2 | 240 | |
14821d7d | 241 | $(obj)ubsha1$(SFX): $(obj)os_support.o $(obj)sha1.o $(obj)ubsha1.o |
d984fed0 | 242 | $(HOSTCC) $(HOSTCFLAGS) $(HOSTLDFLAGS) -o $@ $^ |
2f8d396b | 243 | |
d131ad68 LP |
244 | $(obj)kwboot$(SFX): $(obj)kwboot.o |
245 | $(HOSTCC) $(HOSTCFLAGS) $(HOSTLDFLAGS) -o $@ $^ | |
246 | $(HOSTSTRIP) $@ | |
247 | ||
b0d4d721 | 248 | # Some of the tool objects need to be accessed from outside the tools directory |
91081e01 | 249 | $(obj)%.o: $(SRCTREE)/common/%.c |
d984fed0 | 250 | $(HOSTCC) -g $(HOSTCFLAGS_NOPED) -c -o $@ $< |
8cf30809 | 251 | |
91081e01 | 252 | $(obj)%.o: $(SRCTREE)/lib/%.c |
d984fed0 | 253 | $(HOSTCC) -g $(HOSTCFLAGS) -c -o $@ $< |
8cf30809 | 254 | |
0de71d50 | 255 | $(obj)%.o: $(SRCTREE)/lib/libfdt/%.c |
d984fed0 | 256 | $(HOSTCC) -g $(HOSTCFLAGS_NOPED) -c -o $@ $< |
8cf30809 | 257 | |
19c402af SG |
258 | $(obj)%.o: $(SRCTREE)/lib/rsa/%.c |
259 | $(HOSTCC) -g $(HOSTCFLAGS_NOPED) -c -o $@ $< | |
260 | ||
efee1709 | 261 | subdirs: |
e0ac62d7 | 262 | ifeq ($(TOOLSUBDIRS),) |
21d28e95 | 263 | @: |
e0ac62d7 | 264 | else |
21d28e95 PT |
265 | @for dir in $(TOOLSUBDIRS) ; do \ |
266 | $(MAKE) \ | |
267 | HOSTOS=$(HOSTOS) \ | |
268 | HOSTARCH=$(HOSTARCH) \ | |
21d28e95 PT |
269 | -C $$dir || exit 1 ; \ |
270 | done | |
e0ac62d7 WD |
271 | endif |
272 | ||
f9328639 | 273 | $(LOGO_H): $(obj)bmp_logo $(LOGO_BMP) |
c270730f CLC |
274 | $(obj)./bmp_logo --gen-info $(LOGO_BMP) > $@ |
275 | ||
276 | $(LOGO_DATA_H): $(obj)bmp_logo $(LOGO_BMP) | |
277 | $(obj)./bmp_logo --gen-data $(LOGO_BMP) > $@ | |
efee1709 WD |
278 | |
279 | ######################################################################### | |
280 | ||
f9328639 MB |
281 | # defines $(obj).depend target |
282 | include $(SRCTREE)/rules.mk | |
efee1709 | 283 | |
f9328639 | 284 | sinclude $(obj).depend |
efee1709 WD |
285 | |
286 | ######################################################################### |