Sometimes we want to build common tools without configuring for specific target. Currently top Makefile has some support for this but it doesn't work. This patch tries to fix this. Things changed: - config.mk disable 'ld script not found error' in case if we are building tools only. - Makefile mkimage relies on autogenerated version so we need to move $(VERSION_FILE) rule out of ifeq and make tools rule depend on it. - tools/Makefile put common/env_embedded.o and envcrc.o to object list conditionally. This fixes errors during dependency generation.
Signed-off-by: Ilya Yanok <ya...@emcraft.com> --- Makefile | 34 +++++++++++++++++----------------- config.mk | 2 ++ tools/Makefile | 19 ++++++++++++++++--- 3 files changed, 35 insertions(+), 20 deletions(-) diff --git a/Makefile b/Makefile index dcf5d93..4f7326e 100644 --- a/Makefile +++ b/Makefile @@ -140,7 +140,7 @@ SUBDIRS = tools \ examples/standalone \ examples/api -.PHONY : $(SUBDIRS) +.PHONY : $(SUBDIRS) $(VERSION_FILE) ifeq ($(obj)include/config.mk,$(wildcard $(obj)include/config.mk)) @@ -422,19 +422,6 @@ mmc_spl: $(TIMESTAMP_FILE) $(VERSION_FILE) depend $(obj)mmc_spl/u-boot-mmc-spl.bin: mmc_spl -$(VERSION_FILE): - @( localvers='$(shell $(TOPDIR)/tools/setlocalversion $(TOPDIR))' ; \ - printf '#define PLAIN_VERSION "%s%s"\n' \ - "$(U_BOOT_VERSION)" "$${localvers}" ; \ - printf '#define U_BOOT_VERSION "U-Boot %s%s"\n' \ - "$(U_BOOT_VERSION)" "$${localvers}" ; \ - ) > $@.tmp - @( printf '#define CC_VERSION_STRING "%s"\n' \ - '$(shell $(CC) --version | head -n 1)' )>> $@.tmp - @( printf '#define LD_VERSION_STRING "%s"\n' \ - '$(shell $(LD) -v | head -n 1)' )>> $@.tmp - @cmp -s $@ $@.tmp && rm -f $@.tmp || mv -f $@.tmp $@ - $(TIMESTAMP_FILE): @LC_ALL=C date +'#define U_BOOT_DATE "%b %d %C%y"' > $@ @LC_ALL=C date +'#define U_BOOT_TIME "%T"' >> $@ @@ -509,20 +496,33 @@ $(obj)lib/asm-offsets.s: $(obj)include/autoconf.mk.dep \ else # !config.mk all $(obj)u-boot.hex $(obj)u-boot.srec $(obj)u-boot.bin \ $(obj)u-boot.img $(obj)u-boot.dis $(obj)u-boot \ -$(filter-out tools,$(SUBDIRS)) $(TIMESTAMP_FILE) $(VERSION_FILE) \ +$(filter-out tools,$(SUBDIRS)) $(TIMESTAMP_FILE) \ updater depend dep tags ctags etags cscope $(obj)System.map: @echo "System not configured - see README" >&2 @ exit 1 -tools: +tools: $(VERSION_FILE) $(MAKE) -C $@ all endif # config.mk +$(VERSION_FILE): + @( localvers='$(shell $(TOPDIR)/tools/setlocalversion $(TOPDIR))' ; \ + printf '#define PLAIN_VERSION "%s%s"\n' \ + "$(U_BOOT_VERSION)" "$${localvers}" ; \ + printf '#define U_BOOT_VERSION "U-Boot %s%s"\n' \ + "$(U_BOOT_VERSION)" "$${localvers}" ; \ + ) > $@.tmp + @( printf '#define CC_VERSION_STRING "%s"\n' \ + '$(shell $(CC) --version | head -n 1)' )>> $@.tmp + @( printf '#define LD_VERSION_STRING "%s"\n' \ + '$(shell $(LD) -v | head -n 1)' )>> $@.tmp + @cmp -s $@ $@.tmp && rm -f $@.tmp || mv -f $@.tmp $@ + easylogo env gdb: $(MAKE) -C tools/$@ all MTD_VERSION=${MTD_VERSION} gdbtools: gdb -tools-all: easylogo env gdb +tools-all: easylogo env gdb $(VERSION_FILE) $(MAKE) -C tools HOST_TOOLS_ALL=y .PHONY : CHANGELOG diff --git a/config.mk b/config.mk index 7ce554e..51994f2 100644 --- a/config.mk +++ b/config.mk @@ -180,7 +180,9 @@ ifndef LDSCRIPT LDSCRIPT := $(TOPDIR)/$(CPUDIR)/u-boot.lds endif ifeq ($(wildcard $(LDSCRIPT)),) + ifeq ($(obj)include/config.mk,$(wildcard $(obj)include/config.mk)) $(error could not find linker script) + endif endif endif diff --git a/tools/Makefile b/tools/Makefile index 623f908..30ae0b5 100644 --- a/tools/Makefile +++ b/tools/Makefile @@ -67,7 +67,14 @@ BIN_FILES-$(CONFIG_NETCONSOLE) += ncb$(SFX) BIN_FILES-$(CONFIG_SHA1_CHECK_UB_IMG) += ubsha1$(SFX) # Source files which exist outside the tools directory -EXT_OBJ_FILES-y += common/env_embedded.o +EXT_OBJ_FILES-$(CONFIG_ENV_IS_EMBEDDED) += common/env_embedded.o +EXT_OBJ_FILES-$(CONFIG_ENV_IS_IN_DATAFLASH) += common/env_embedded.o +EXT_OBJ_FILES-$(CONFIG_ENV_IS_IN_EEPROM) += common/env_embedded.o +EXT_OBJ_FILES-$(CONFIG_ENV_IS_IN_FLASH) += common/env_embedded.o +EXT_OBJ_FILES-$(CONFIG_ENV_IS_IN_ONENAND) += common/env_embedded.o +EXT_OBJ_FILES-$(CONFIG_ENV_IS_IN_NAND) += common/env_embedded.o +EXT_OBJ_FILES-$(CONFIG_ENV_IS_IN_NVRAM) += common/env_embedded.o +EXT_OBJ_FILES-$(CONFIG_ENV_IS_IN_SPI_FLASH) += common/env_embedded.o EXT_OBJ_FILES-y += common/image.o EXT_OBJ_FILES-y += lib/crc32.o EXT_OBJ_FILES-y += lib/md5.o @@ -77,7 +84,14 @@ EXT_OBJ_FILES-y += lib/sha1.o OBJ_FILES-$(CONFIG_LCD_LOGO) += bmp_logo.o OBJ_FILES-$(CONFIG_VIDEO_LOGO) += bmp_logo.o NOPED_OBJ_FILES-y += default_image.o -OBJ_FILES-y += envcrc.o +OBJ_FILES-$(CONFIG_ENV_IS_EMBEDDED) += envcrc.o +OBJ_FILES-$(CONFIG_ENV_IS_IN_DATAFLASH) += envcrc.o +OBJ_FILES-$(CONFIG_ENV_IS_IN_EEPROM) += envcrc.o +OBJ_FILES-$(CONFIG_ENV_IS_IN_FLASH) += envcrc.o +OBJ_FILES-$(CONFIG_ENV_IS_IN_ONENAND) += envcrc.o +OBJ_FILES-$(CONFIG_ENV_IS_IN_NAND) += envcrc.o +OBJ_FILES-$(CONFIG_ENV_IS_IN_NVRAM) += envcrc.o +OBJ_FILES-$(CONFIG_ENV_IS_IN_SPI_FLASH) += envcrc.o NOPED_OBJ_FILES-y += fit_image.o OBJ_FILES-$(CONFIG_CMD_NET) += gen_eth_addr.o OBJ_FILES-$(CONFIG_CMD_LOADS) += img2srec.o @@ -149,7 +163,6 @@ HOSTCPPFLAGS = -idirafter $(SRCTREE)/include \ -DUSE_HOSTCC \ -D__KERNEL_STRICT_NAMES - all: $(obj).depend $(BINS) $(LOGO-y) subdirs $(obj)bin2header$(SFX): $(obj)bin2header.o -- 1.7.4.4 _______________________________________________ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot