build system: Allow BUILD_DIR_BASE to be a relative directory (see github #38)

This commit is contained in:
Angus Gratton 2016-10-06 18:05:51 +11:00
parent eccf54b939
commit f720e82d40
5 changed files with 13 additions and 5 deletions

View File

@ -11,7 +11,7 @@
ifeq ("$(IS_BOOTLOADER_BUILD)","") ifeq ("$(IS_BOOTLOADER_BUILD)","")
BOOTLOADER_COMPONENT_PATH := $(COMPONENT_PATH) BOOTLOADER_COMPONENT_PATH := $(COMPONENT_PATH)
BOOTLOADER_BUILD_DIR=$(BUILD_DIR_BASE)/bootloader BOOTLOADER_BUILD_DIR=$(abspath $(BUILD_DIR_BASE)/bootloader)
BOOTLOADER_BIN=$(BOOTLOADER_BUILD_DIR)/bootloader.bin BOOTLOADER_BIN=$(BOOTLOADER_BUILD_DIR)/bootloader.bin
BOOTLOADER_SDKCONFIG=$(BOOTLOADER_BUILD_DIR)/sdkconfig BOOTLOADER_SDKCONFIG=$(BOOTLOADER_BUILD_DIR)/sdkconfig

View File

@ -6,7 +6,7 @@
# lib(subdirectory_name).a in the build directory. This behaviour is entirely configurable, # lib(subdirectory_name).a in the build directory. This behaviour is entirely configurable,
# please read the esp-idf build system document if you need to do this. # please read the esp-idf build system document if you need to do this.
# #
-include $(BUILD_DIR_BASE)/include/config/auto.conf -include include/config/auto.conf
COMPONENT_SRCDIRS := . hwcrypto COMPONENT_SRCDIRS := . hwcrypto

View File

@ -106,7 +106,7 @@ COMPONENT_INCLUDES := $(abspath $(foreach comp,$(COMPONENT_PATHS_BUILDABLE),$(ad
$(call GetVariable,$(comp),COMPONENT_ADD_INCLUDEDIRS)))) $(call GetVariable,$(comp),COMPONENT_ADD_INCLUDEDIRS))))
#Also add project include path, for sdk includes #Also add project include path, for sdk includes
COMPONENT_INCLUDES += $(BUILD_DIR_BASE)/include/ COMPONENT_INCLUDES += $(abspath $(BUILD_DIR_BASE)/include/)
export COMPONENT_INCLUDES export COMPONENT_INCLUDES
#COMPONENT_LDFLAGS has a list of all flags that are needed to link the components together. It's collected #COMPONENT_LDFLAGS has a list of all flags that are needed to link the components together. It's collected

View File

@ -18,7 +18,7 @@ $(KCONFIG_TOOL_DIR)/mconf $(KCONFIG_TOOL_DIR)/conf:
$(MAKE) -C $(KCONFIG_TOOL_DIR) $(MAKE) -C $(KCONFIG_TOOL_DIR)
# use a wrapper environment for where we run Kconfig tools # use a wrapper environment for where we run Kconfig tools
KCONFIG_TOOL_ENV=KCONFIG_AUTOHEADER=$(BUILD_DIR_BASE)/include/sdkconfig.h \ KCONFIG_TOOL_ENV=KCONFIG_AUTOHEADER=$(abspath $(BUILD_DIR_BASE)/include/sdkconfig.h) \
COMPONENT_KCONFIGS="$(COMPONENT_KCONFIGS)" KCONFIG_CONFIG=$(SDKCONFIG) \ COMPONENT_KCONFIGS="$(COMPONENT_KCONFIGS)" KCONFIG_CONFIG=$(SDKCONFIG) \
COMPONENT_KCONFIGS_PROJBUILD="$(COMPONENT_KCONFIGS_PROJBUILD)" COMPONENT_KCONFIGS_PROJBUILD="$(COMPONENT_KCONFIGS_PROJBUILD)"

View File

@ -91,7 +91,7 @@ function run_tests()
failure "Files weren't cleaned: ${ALL_BUILD_FILES}" failure "Files weren't cleaned: ${ALL_BUILD_FILES}"
fi fi
print_status "Moving BUILD_DIR_BASE out of tree should still build OK" print_status "Moving BUILD_DIR_BASE out of tree"
rm -rf --preserve-root ${BUILD}/* rm -rf --preserve-root ${BUILD}/*
OUTOFTREE_BUILD=${TESTDIR}/alt_build OUTOFTREE_BUILD=${TESTDIR}/alt_build
make BUILD_DIR_BASE=${OUTOFTREE_BUILD} || failure "Failed to build with BUILD_DIR_BASE overriden" make BUILD_DIR_BASE=${OUTOFTREE_BUILD} || failure "Failed to build with BUILD_DIR_BASE overriden"
@ -104,6 +104,14 @@ function run_tests()
failure "Some files were incorrectly put into the default build directory: ${DEFAULT_BUILD_FILES}" failure "Some files were incorrectly put into the default build directory: ${DEFAULT_BUILD_FILES}"
fi fi
print_status "BUILD_DIR_BASE inside default build directory"
rm -rf --preserve-root ${BUILD}/*
make BUILD_DIR_BASE=build/subdirectory || failure "Failed to build with BUILD_DIR_BASE as subdir"
NEW_BUILD_FILES=$(find ${BUILD}/subdirectory -type f)
if [ -z "${NEW_BUILD_FILES}" ]; then
failure "No files found in new build directory!"
fi
print_status "Can still clean build if all text files are CRLFs" print_status "Can still clean build if all text files are CRLFs"
make clean || failure "Unexpected failure to make clean" make clean || failure "Unexpected failure to make clean"
find . -exec unix2dos {} \; # CRLFify template dir find . -exec unix2dos {} \; # CRLFify template dir