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