build: fix issues with targets installed via feeds
authorFelix Fietkau <nbd@nbd.name>
Tue, 27 Sep 2022 11:39:12 +0000 (13:39 +0200)
committerFelix Fietkau <nbd@nbd.name>
Tue, 27 Sep 2022 11:45:03 +0000 (13:45 +0200)
- fix including modules.mk when a target is being replaced
- fix calling make targets from target/linux

Signed-off-by: Felix Fietkau <nbd@nbd.name>
(cherry-picked from commit 3a8825ad6acbf18b2b472ace56be58868af78be7)

include/target.mk
package/kernel/linux/Makefile
target/linux/Makefile

index a2c8b7bdbf7c14584f5ed0d41a70d2956e57e339..708ba395c61e51cf288f9d72f42d1b6190cfca4a 100644 (file)
@@ -68,7 +68,7 @@ endif
 
 target_conf=$(subst .,_,$(subst -,_,$(subst /,_,$(1))))
 ifeq ($(DUMP),)
-  PLATFORM_DIR:=$(TOPDIR)/target/linux/$(BOARD)
+  PLATFORM_DIR:=$(firstword $(wildcard $(TOPDIR)/target/linux/feeds/$(BOARD) $(TOPDIR)/target/linux/$(BOARD)))
   SUBTARGET:=$(strip $(foreach subdir,$(patsubst $(PLATFORM_DIR)/%/target.mk,%,$(wildcard $(PLATFORM_DIR)/*/target.mk)),$(if $(CONFIG_TARGET_$(call target_conf,$(BOARD)_$(subdir))),$(subdir))))
 else
   PLATFORM_DIR:=${CURDIR}
index ad68bde9b3137b27554742ac49dae5c693b9f923..ff917602701ab6d6729d4a9bc3e955df80bb5200 100644 (file)
@@ -12,7 +12,9 @@ PKG_NAME:=kernel
 PKG_FLAGS:=hold
 
 PKG_BUILD_DIR:=$(KERNEL_BUILD_DIR)/packages
-SCAN_DEPS=modules/*.mk $(TOPDIR)/target/linux/*/modules.mk $(TOPDIR)/target/linux/*/*/modules.mk $(TOPDIR)/include/netfilter.mk
+SUBTARGETS = $(sort $(filter-out feeds,$(notdir $(wildcard $(TOPDIR)/target/linux/* $(TOPDIR)/target/linux/feeds/*))))
+SUBTARGET_MODULES = $(foreach t,$(SUBTARGETS),$(firstword $(wildcard $(TOPDIR)/target/linux/feeds/$(t)/modules.mk $(TOPDIR)/target/linux/$(t)/modules.mk)))
+SCAN_DEPS=modules/*.mk $(SUBTARGET_MODULES) $(TOPDIR)/include/netfilter.mk
 
 PKG_LICENSE:=GPL-2.0
 PKG_LICENSE_FILES:=
@@ -63,5 +65,4 @@ endef
 $(eval $(if $(DUMP),,$(call BuildPackage,kernel)))
 
 include $(sort $(wildcard ./modules/*.mk))
--include $(TOPDIR)/target/linux/*/modules.mk
--include $(TOPDIR)/target/linux/*/*/modules.mk
+-include $(SUBTARGET_MODULES)
index a939d42bc05463beaa0455b9ff5abc6c304ce2bd..8eea40ee18a6dd032d9b858ec0e0f301675efa53 100644 (file)
@@ -8,4 +8,4 @@ include $(INCLUDE_DIR)/target.mk
 export TARGET_BUILD=1
 
 prereq clean download prepare compile install oldconfig menuconfig nconfig xconfig update refresh: FORCE
-       @+$(NO_TRACE_MAKE) -C $(BOARD) $@
+       @+$(NO_TRACE_MAKE) -C $(firstword $(wildcard feeds/$(BOARD) $(BOARD))) $@