diff --git a/pkg/micropython/Makefile b/pkg/micropython/Makefile index 4dd9e1536e..d5fc6f1851 100644 --- a/pkg/micropython/Makefile +++ b/pkg/micropython/Makefile @@ -5,8 +5,12 @@ PKG_LICENSE=MIT CFLAGS += -Wno-implicit-fallthrough -Wno-unused-parameter -Wno-error +# Micropython build system doesn't support (yet) out-of-source builds +# so clone and build micropython within the application build directory +PKG_BUILD_OUT_OF_SOURCE = 0 + include $(RIOTBASE)/pkg/pkg.mk all: - @mkdir -p $(PKG_BUILDDIR)/tmp - BUILD=$(PKG_BUILDDIR) "$(MAKE)" -C $(PKG_BUILDDIR)/ports/riot + @mkdir -p $(PKG_BUILD_DIR)/tmp + BUILD=$(PKG_BUILD_DIR) "$(MAKE)" -C $(PKG_SOURCE_DIR)/ports/riot diff --git a/pkg/micropython/Makefile.include b/pkg/micropython/Makefile.include index b19a7006b7..4b60bb2649 100644 --- a/pkg/micropython/Makefile.include +++ b/pkg/micropython/Makefile.include @@ -5,8 +5,8 @@ CFLAGS += -DMP_RIOT_HEAPSIZE=$(MP_RIOT_HEAPSIZE) # include paths INCLUDES += -I$(RIOTBASE)/pkg/micropython/include -INCLUDES += -I$(PKGDIRBASE)/micropython -INCLUDES += -I$(PKGDIRBASE)/micropython/ports/riot +INCLUDES += -I$(BINDIR)/pkg/micropython +INCLUDES += -I$(BINDIR)/pkg/micropython/ports/riot # The port currently doesn't build with llvm TOOLCHAINS_BLACKLIST += llvm diff --git a/pkg/nordic_softdevice_ble/Makefile b/pkg/nordic_softdevice_ble/Makefile index 509589ee48..79f8bd89ca 100644 --- a/pkg/nordic_softdevice_ble/Makefile +++ b/pkg/nordic_softdevice_ble/Makefile @@ -5,9 +5,10 @@ PKG_URL = https://developer.nordicsemi.com/nRF5_IoT_SDK/nRF5_IoT_SDK_v0.9.x/$(PK PKG_MD5 = 291c875df69c51e22491e6112128bd9c PKG_LICENSE = nordic-bsd -PKG_DIR=$(CURDIR) -PKG_BUILDDIR=$(PKGDIRBASE)/$(PKG_NAME) -PKG_SRCDIR=$(PKG_BUILDDIR)/src +PKG_DIR = $(CURDIR) +PKG_BUILD_DIR = $(BINDIR)/pkg/$(PKG_NAME) +PKG_SOURCE_DIR = $(PKGDIRBASE)/$(PKG_NAME) +PKG_SRCDIR = $(PKG_SOURCE_DIR)/src SOFTDEVICE := components/softdevice/s1xx_iot/s1xx-iot-prototype3_nrf52_softdevice.hex BLE_6LOWPAN_LIB := components/iot/ble_6lowpan/lib/ble_6lowpan.a @@ -21,13 +22,13 @@ all: $(BINDIR)/ble_6lowpan.a $(BINDIR)/softdevice.hex $(SOFTDEVICE_MODULES) prepare: $(PKG_SRCDIR)/.extracted softdevice_handler: - make -C $(PKG_BUILDDIR)/src/components/softdevice/common/softdevice_handler -f $(RIOTBASE)/Makefile.base + "$(MAKE)" -C $(PKG_SRCDIR)/components/softdevice/common/softdevice_handler -f $(RIOTBASE)/Makefile.base ble_common: - make -C $(PKG_BUILDDIR)/src/components/ble/common -f $(CURDIR)/ble_common.mk + "$(MAKE)" -C $(PKG_SRCDIR)/components/ble/common -f $(CURDIR)/ble_common.mk ble_ipsp: - make -C $(PKG_BUILDDIR)/src/components/iot/ble_ipsp -f $(RIOTBASE)/Makefile.base + "$(MAKE)" -C $(PKG_SRCDIR)/components/iot/ble_ipsp -f $(RIOTBASE)/Makefile.base $(BINDIR)/ble_6lowpan.a: $(PKG_SRCDIR)/.extracted cp $(PKG_SRCDIR)/$(BLE_6LOWPAN_LIB) $@ @@ -38,18 +39,18 @@ $(BINDIR)/ble_6lowpan.a: $(PKG_SRCDIR)/.extracted $(BINDIR)/softdevice.hex: $(PKG_SRCDIR)/.extracted $(Q)$(OBJCOPY) $(OFLAGS) -Oihex --gap-fill 0xff $(PKG_SRCDIR)/$(SOFTDEVICE) $@ -$(PKG_SRCDIR)/.extracted: $(PKG_BUILDDIR)/$(PKG_FILE) +$(PKG_SRCDIR)/.extracted: $(PKG_SOURCE_DIR)/$(PKG_FILE) rm -rf $(@D) mkdir -p $(@D) - $(Q)cd $(@D) && $(UNZIP_HERE) $(PKG_BUILDDIR)/$(PKG_FILE) + $(Q)cd $(@D) && $(UNZIP_HERE) $(PKG_SOURCE_DIR)/$(PKG_FILE) touch $@ -$(PKG_BUILDDIR)/$(PKG_FILE): +$(PKG_SOURCE_DIR)/$(PKG_FILE): @mkdir -p $(@D) $(Q)$(DLCACHE) $(PKG_URL) $(PKG_MD5) $@ clean:: - rm -rf $(PKG_SRCDIR)/ + rm -rf $(PKG_SOURCE_DIR)/ distclean:: - rm -rf $(PKG_BUILDDIR)/ + rm -rf $(PKG_BUILD_DIR)/ diff --git a/pkg/openthread/Makefile b/pkg/openthread/Makefile index 1c09a8c1fd..ada040a2f7 100644 --- a/pkg/openthread/Makefile +++ b/pkg/openthread/Makefile @@ -3,6 +3,10 @@ PKG_URL=https://github.com/openthread/openthread.git PKG_VERSION=thread-reference-20180926 PKG_LICENSE=BSD-3-Clause +# OpenThread build system doesn't support (yet) out-of-source builds +# so clone and build OpenThread within the application build directory +PKG_BUILD_OUT_OF_SOURCE = 0 + include $(RIOTBASE)/pkg/pkg.mk ifneq (,$(filter openthread-ftd,$(USEMODULE))) @@ -25,7 +29,7 @@ OPENTHREAD_COMMON_FLAGS = -fdata-sections -ffunction-sections -Os OPENTHREAD_COMMON_FLAGS += -Wno-implicit-fallthrough -Wno-unused-parameter OPENTHREAD_CXXFLAGS += -Wno-class-memaccess -OT_LIB_DIR = $(PKG_BUILDDIR)/output/lib +OT_LIB_DIR = $(PKG_BUILD_DIR)/output/lib MODULE_LIBS = mbedcrypto.a openthread-$(TD).a ifneq (,$(filter openthread-cli,$(USEMODULE))) MODULE_LIBS += openthread-cli.a @@ -43,12 +47,12 @@ $(BINDIR)/mbedcrypto.a: $(BINDIR)/openthread-$(TD).a $(BINDIR)/openthread-cli.a: $(BINDIR)/openthread-$(TD).a @cp $(OT_LIB_DIR)/libopenthread-cli-$(TD).a $@ -$(OT_LIB_DIR)/libopenthread-$(TD).a: $(PKG_BUILDDIR)/Makefile - make -C $(PKG_BUILDDIR) -j4 --no-print-directory install DESTDIR=$(PKG_BUILDDIR)/output PREFIX=/ +$(OT_LIB_DIR)/libopenthread-$(TD).a: $(PKG_BUILD_DIR)/Makefile + make -C $(PKG_BUILD_DIR) -j4 --no-print-directory install DESTDIR=$(PKG_BUILD_DIR)/output PREFIX=/ $(Q)printf "OpenThread built for %s device\n" $(TD) -$(PKG_BUILDDIR)/Makefile: $(PKG_BUILDDIR)/configure - $(Q)cd $(PKG_BUILDDIR) && CPP="$(CPP)" CC="$(CC)" CXX="$(CXX)"\ +$(PKG_BUILD_DIR)/Makefile: $(PKG_BUILD_DIR)/configure + $(Q)cd $(PKG_BUILD_DIR) && CPP="$(CPP)" CC="$(CC)" CXX="$(CXX)"\ OBJC="" OBJCXX="" AR="$(AR)" RANLIB="$(RANLIB)" NM="$(NM)" \ STRIP="$(STRIP)" \ CPPFLAGS="$(OPENTHREAD_COMMON_FLAGS) $(CFLAGS_CPU) -D$(CONFIG_FILE)" \ @@ -60,6 +64,6 @@ $(PKG_BUILDDIR)/Makefile: $(PKG_BUILDDIR)/configure ./configure --disable-docs --host=$(TARGET_ARCH) --target=$(TARGET_ARCH) \ --prefix=/ --enable-default-logging $(OPENTHREAD_ARGS) -$(PKG_BUILDDIR)/configure: $(PKG_PREPARED) +$(PKG_BUILD_DIR)/configure: $(PKG_PREPARED) $(Q)printf "OPENTHREAD_ARGS is [$(OPENTHREAD_ARGS)]\n" - $(Q)cd $(PKG_BUILDDIR) && PREFIX="/" ./bootstrap + $(Q)cd $(PKG_BUILD_DIR) && PREFIX="/" ./bootstrap diff --git a/pkg/openthread/Makefile.include b/pkg/openthread/Makefile.include index 5121661545..e8301970a5 100644 --- a/pkg/openthread/Makefile.include +++ b/pkg/openthread/Makefile.include @@ -1,7 +1,7 @@ OPENTHREAD_DIR = $(RIOTBASE)/pkg/openthread INCLUDES += -I$(OPENTHREAD_DIR)/include \ - -I$(PKGDIRBASE)/openthread/include + -I$(BINDIR)/pkg/openthread/include ifneq (,$(filter openthread_contrib,$(USEMODULE))) DIRS += $(OPENTHREAD_DIR)/contrib