Browse Source

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

Angus Gratton 9 years ago
parent
commit
f720e82d40

+ 1 - 1
components/bootloader/Makefile.projbuild

@@ -11,7 +11,7 @@
 ifeq ("$(IS_BOOTLOADER_BUILD)","")
 
 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_SDKCONFIG=$(BOOTLOADER_BUILD_DIR)/sdkconfig
 

+ 1 - 1
components/esp32/component.mk

@@ -6,7 +6,7 @@
 # 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.
 #
--include $(BUILD_DIR_BASE)/include/config/auto.conf
+-include include/config/auto.conf
 
 COMPONENT_SRCDIRS := . hwcrypto
 

+ 1 - 1
make/project.mk

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

+ 1 - 1
make/project_config.mk

@@ -18,7 +18,7 @@ $(KCONFIG_TOOL_DIR)/mconf $(KCONFIG_TOOL_DIR)/conf:
 	$(MAKE) -C $(KCONFIG_TOOL_DIR)
 
 # 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_PROJBUILD="$(COMPONENT_KCONFIGS_PROJBUILD)"
 

+ 9 - 1
make/test_build_system.sh

@@ -91,7 +91,7 @@ function run_tests()
 		 failure "Files weren't cleaned: ${ALL_BUILD_FILES}"
 	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}/*
 	OUTOFTREE_BUILD=${TESTDIR}/alt_build
 	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}"
 	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"
 	make clean || failure "Unexpected failure to make clean"
 	find . -exec unix2dos {} \; # CRLFify template dir