Browse Source

mk: Introduce KERNEL_MAKE variable

This combines the typical kernel make call idiom into a single variable
reference. A side-effect is that parallel make is enabled (via added
'-j' flag) in many cases, but that shouldn't cause harm.

Signed-off-by: Phil Sutter <phil@nwl.cc>
Phil Sutter 2 months ago
parent
commit
e48e15bff4

+ 1 - 4
mk/build.mk

@@ -232,10 +232,7 @@ targethelp:
 	$(MAKE) -C target targethelp 
 
 kernelconfig:
-	${KERNEL_MAKE_ENV} ${MAKE} -C "${LINUX_DIR}" \
-		ARCH=$(ADK_TARGET_KARCH) \
-		${KERNEL_MAKE_OPTS} \
-		menuconfig
+	${KERNEL_MAKE} menuconfig
 
 ifeq ($(ADK_TARGET_LINUX_KERNEL_USE_CUSTOMCONFIG),y)
 savekconfig:

+ 1 - 2
mk/image.mk

@@ -313,8 +313,7 @@ ifeq ($(ADK_LINUX_KERNEL_COMPRESS_NONE),y)
 		echo "CONFIG_RD_ZSTD=n" >> ${LINUX_DIR}/.config
 endif
 	@-rm $(LINUX_DIR)/usr/initramfs_data.cpio* 2>/dev/null
-	env $(KERNEL_MAKE_ENV) $(MAKE) -C "${LINUX_DIR}" $(KERNEL_MAKE_OPTS) \
-		-j${ADK_MAKE_JOBS} $(ADK_TARGET_KERNEL) $(MAKE_TRACE)
+	${KERNEL_MAKE} $(ADK_TARGET_KERNEL) $(MAKE_TRACE)
 	@cp $(KERNEL) $(FW_DIR)/$(TARGET_KERNEL)
 
 ${FW_DIR}/${ROOTFSISO}: ${TARGET_DIR} kernel-package

+ 5 - 6
mk/kernel-build.mk

@@ -72,23 +72,23 @@ $(LINUX_DIR)/.config: $(LINUX_DIR)/.prepared
 	$(START_TRACE) "target/$(ADK_TARGET_ARCH)-kernel-configure.. "
 	echo "-${KERNEL_RELEASE}" >${LINUX_DIR}/localversion
 ifeq ($(ADK_TARGET_LINUX_KERNEL_USE_DEFCONFIG),y)
-	${KERNEL_MAKE_ENV} $(MAKE) -C "${LINUX_DIR}" ${KERNEL_MAKE_OPTS} $(ADK_TARGET_LINUX_KERNEL_DEFCONFIG) $(MAKE_TRACE)
+	${KERNEL_MAKE} $(ADK_TARGET_LINUX_KERNEL_DEFCONFIG) $(MAKE_TRACE)
 else ifeq ($(ADK_TARGET_LINUX_KERNEL_USE_CUSTOMCONFIG),y)
 	@if [ ! -f $(ADK_TOPDIR)/$(ADK_TARGET_LINUX_KERNEL_CUSTOMCONFIG_PATH) ];then \
 		echo "no kernel configuration found in $(ADK_TOPDIR)/$(ADK_TARGET_LINUX_KERNEL_CUSTOMCONFIG_PATH)"; \
 		exit 1; \
 	fi
-	${KERNEL_MAKE_ENV} $(MAKE) -C "${LINUX_DIR}" ${KERNEL_MAKE_OPTS} KCONFIG_ALLCONFIG=$(ADK_TOPDIR)/$(ADK_TARGET_LINUX_KERNEL_CUSTOMCONFIG_PATH) allnoconfig $(MAKE_TRACE)
+	${KERNEL_MAKE} KCONFIG_ALLCONFIG=$(ADK_TOPDIR)/$(ADK_TARGET_LINUX_KERNEL_CUSTOMCONFIG_PATH) allnoconfig $(MAKE_TRACE)
 else
 	$(CP) $(BUILD_DIR)/.kernelconfig $(LINUX_DIR)/mini.config
-	${KERNEL_MAKE_ENV} $(MAKE) -C "${LINUX_DIR}" ${KERNEL_MAKE_OPTS} KCONFIG_ALLCONFIG=mini.config allnoconfig $(MAKE_TRACE)
+	${KERNEL_MAKE} KCONFIG_ALLCONFIG=mini.config allnoconfig $(MAKE_TRACE)
 endif
 	$(CMD_TRACE) " done"
 	$(END_TRACE)
 
 $(LINUX_DIR)/$(KERNEL_FILE): $(LINUX_DIR)/.config
 	$(START_TRACE) "target/$(ADK_TARGET_ARCH)-kernel-compile.. "
-	${KERNEL_MAKE_ENV} $(MAKE) -C "${LINUX_DIR}" ${KERNEL_MAKE_OPTS} -j${ADK_MAKE_JOBS} $(KERNEL_TARGET) $(MAKE_TRACE)
+	${KERNEL_MAKE}  $(KERNEL_TARGET) $(MAKE_TRACE)
 	$(CMD_TRACE) " done"
 	$(END_TRACE)
 
@@ -98,8 +98,7 @@ install:
 ifneq ($(KERNEL_MODULES_USED),)
 	$(START_TRACE) "target/$(ADK_TARGET_ARCH)-kernel-modules-install.. "
 	rm -rf $(LINUX_BUILD_DIR)/modules
-	${KERNEL_MAKE_ENV} $(MAKE) -C "${LINUX_DIR}" ${KERNEL_MAKE_OPTS} \
-		DEPMOD=$(ADK_DEPMOD) \
+	${KERNEL_MAKE} DEPMOD=$(ADK_DEPMOD) \
 		INSTALL_MOD_PATH=$(LINUX_BUILD_DIR)/modules \
 		modules_install $(MAKE_TRACE)
 	$(CMD_TRACE) " done"

+ 3 - 0
mk/kernel-vars.mk

@@ -35,3 +35,6 @@ endif
 
 KERNEL_MAKE_ENV:=	PATH="${TOOLCHAIN_DIR}/usr/bin:${STAGING_HOST_DIR}/usr/bin:$$PATH"
 LINUX_BUILD_DIR:=	$(BUILD_DIR)/$(ADK_TARGET_OS)-$(ADK_TARGET_ARCH)
+
+# wrapper to simplify calling make in kernel tree
+KERNEL_MAKE:=		env $(KERNEL_MAKE_ENV) $(MAKE) -C "${LINUX_DIR}" $(KERNEL_MAKE_OPTS) -j${ADK_MAKE_JOBS}

+ 1 - 5
package/glibc/Makefile

@@ -113,11 +113,7 @@ endif
 		cd $(IDIR_GLIBC_DEV)/$(ADK_TARGET_LIBC_PATH); ln -sf $$file-$(PKG_GLIBCVER).so $$file.so; \
 	done
 	# header package
-	${KERNEL_MAKE_ENV} \
-	$(MAKE) -C $(TOOLCHAIN_BUILD_DIR)/w-linux-$(KERNEL_FILE_VER)-1/linux-$(KERNEL_FILE_VER) \
-		$(KERNEL_MAKE_OPTS) \
-		INSTALL_HDR_PATH=$(IDIR_GLIBC_DEV)/usr \
-		headers_install
+	${KERNEL_MAKE} INSTALL_HDR_PATH=$(IDIR_GLIBC_DEV)/usr headers_install
 	(cd $(WRKBUILD); \
 		$(GLIBC_ENV) \
 		$(TOOLCHAIN_BUILD_DIR)/w-$(PKG_NAME)-$(PKG_VERSION)-$(PKG_RELEASE)/$(PKG_NAME)-$(PKG_VERSION)/configure \

+ 1 - 5
package/musl/Makefile

@@ -48,11 +48,7 @@ endif
 musl-dev-install:
 	${INSTALL_DIR} ${IDIR_MUSL_DEV}/usr/lib 
 	${CP} ${STAGING_TARGET_DIR}/usr/lib/crt*.o ${IDIR_MUSL_DEV}/usr/lib
-	${KERNEL_MAKE_ENV} \
-	$(MAKE) -C $(TOOLCHAIN_BUILD_DIR)/w-linux-$(KERNEL_VERSION)/linux-$(KERNEL_FILE_VER) \
-		$(KERNEL_MAKE_OPTS) \
-		INSTALL_HDR_PATH=$(IDIR_MUSL_DEV)/usr \
-		headers_install
+	${KERNEL_MAKE} INSTALL_HDR_PATH=$(IDIR_MUSL_DEV)/usr headers_install
 	$(MAKE) -C $(TOOLCHAIN_BUILD_DIR)/w-$(PKG_NAME)-$(PKG_VERSION)-$(PKG_RELEASE)/${PKG_NAME}-${PKG_VERSION} \
 		DESTDIR=$(IDIR_MUSL_DEV) \
 		install-headers

+ 2 - 4
package/perf/Makefile

@@ -28,12 +28,10 @@ BUILD_STYLE:=		manual
 INSTALL_STYLE:=		manual
 
 do-build:
-	$(KERNEL_MAKE_ENV) $(MAKE) -C "${LINUX_DIR}" \
-		$(KERNEL_MAKE_OPTS) WERROR=0 -C "$(LINUX_DIR)/tools/perf" all
+	${KERNEL_MAKE} WERROR=0 -C "$(LINUX_DIR)/tools/perf" all
 
 do-install:
-	$(KERNEL_MAKE_ENV) $(MAKE) -C "${LINUX_DIR}" \
-		$(KERNEL_MAKE_OPTS) WERROR=0 -C "$(LINUX_DIR)/tools/perf" \
+	${KERNEL_MAKE} WERROR=0 -C "$(LINUX_DIR)/tools/perf" \
 		prefix="$(WRKINST)" install
 
 perf-install:

+ 1 - 5
package/uclibc-ng/Makefile

@@ -49,11 +49,7 @@ uclibc-ng-dev-install:
 	-${CP} ${STAGING_TARGET_DIR}/usr/lib/libc.so ${IDIR_UCLIBC_NG_DEV}/usr/lib
 	-${CP} ${STAGING_TARGET_DIR}/usr/lib/uclibc_nonshared.a ${IDIR_UCLIBC_NG_DEV}/usr/lib
 	${CP} ${STAGING_TARGET_DIR}/usr/lib/crt*.o ${IDIR_UCLIBC_NG_DEV}/usr/lib
-	${KERNEL_MAKE_ENV} \
-	$(MAKE) -C $(TOOLCHAIN_BUILD_DIR)/w-linux-$(KERNEL_FILE_VER)-1/linux-$(KERNEL_FILE_VER) \
-		$(KERNEL_MAKE_OPTS) \
-		INSTALL_HDR_PATH=$(IDIR_UCLIBC_NG_DEV)/usr \
-		headers_install
+	${KERNEL_MAKE} INSTALL_HDR_PATH=$(IDIR_UCLIBC_NG_DEV)/usr headers_install
 	$(MAKE) -C $(TOOLCHAIN_BUILD_DIR)/w-$(PKG_NAME)-$(PKG_VERSION)-$(PKG_RELEASE)/${PKG_NAME}-${PKG_VERSION} \
 		PREFIX=$(IDIR_UCLIBC_NG_DEV)/ \
 		DEVEL_PREFIX=/usr \

+ 1 - 2
target/aarch64/Makefile

@@ -63,8 +63,7 @@ kernel-install: kernel-strip
 
 dtb-install:
 ifeq ($(ADK_TARGET_BOARD_BCM28XX),y)
-	env $(KERNEL_MAKE_ENV) $(MAKE) -C "${LINUX_DIR}" $(KERNEL_MAKE_OPTS) \
-		dtbs $(MAKE_TRACE)
+	${KERNEL_MAKE} dtbs $(MAKE_TRACE)
 	mkdir -p $(FW_DIR)/overlays
 	for x in $(LINUX_DIR)/arch/arm64/boot/dts/overlays/*.dtbo; do \
 		[[ -e "$$x" ]] && cp $(LINUX_DIR)/arch/arm64/boot/dts/overlays/*.dtbo $(FW_DIR)/overlays; \

+ 15 - 28
target/arm/Makefile

@@ -170,39 +170,31 @@ endif
 
 dtb-install:
 ifeq ($(ADK_TARGET_SYSTEM_QEMU_ARM_XILINX_ZYNQ),y)
-	env $(KERNEL_MAKE_ENV) $(MAKE) -C "${LINUX_DIR}" $(KERNEL_MAKE_OPTS) \
-		dtbs $(MAKE_TRACE)
+	${KERNEL_MAKE} dtbs $(MAKE_TRACE)
 endif
 ifeq ($(ADK_TARGET_SYSTEM_QEMU_ARM_VEXPRESS_A9),y)
-	env $(KERNEL_MAKE_ENV) $(MAKE) -C "${LINUX_DIR}" $(KERNEL_MAKE_OPTS) \
-		vexpress-v2p-ca9.dtb $(MAKE_TRACE)
+	${KERNEL_MAKE} vexpress-v2p-ca9.dtb $(MAKE_TRACE)
 endif
 ifeq ($(ADK_TARGET_SYSTEM_QEMU_ARM_REALVIEW_EB_MPCORE),y)
-	env $(KERNEL_MAKE_ENV) $(MAKE) -C "${LINUX_DIR}" $(KERNEL_MAKE_OPTS) \
-		arm-realview-eb-11mp-ctrevb.dtb $(MAKE_TRACE)
+	${KERNEL_MAKE} arm-realview-eb-11mp-ctrevb.dtb $(MAKE_TRACE)
 endif
 ifeq ($(ADK_TARGET_SYSTEM_QEMU_ARM_VERSATILEPB),y)
-	env $(KERNEL_MAKE_ENV) $(MAKE) -C "${LINUX_DIR}" $(KERNEL_MAKE_OPTS) \
-		versatile-pb.dtb $(MAKE_TRACE)
+	${KERNEL_MAKE} versatile-pb.dtb $(MAKE_TRACE)
 endif
 ifeq ($(ADK_TARGET_SYSTEM_PHYTEC_WEGA),y)
-	env $(KERNEL_MAKE_ENV) $(MAKE) -C "${LINUX_DIR}" $(KERNEL_MAKE_OPTS) \
-		am335x-wega-rdk.dtb
+	${KERNEL_MAKE} am335x-wega-rdk.dtb $(MAKE_TRACE)
 	cp $(LINUX_DIR)/arch/arm/boot/dts/am335x-wega-rdk.dtb ${TARGET_DIR}/boot
 endif
 ifeq ($(ADK_TARGET_SYSTEM_PHYTEC_IMX6),y)
-	env $(KERNEL_MAKE_ENV) $(MAKE) -C "${LINUX_DIR}" $(KERNEL_MAKE_OPTS) \
- 		imx6q-phytec-pbab01.dtb
+	${KERNEL_MAKE} imx6q-phytec-pbab01.dtb $(MAKE_TRACE)
 	cp $(LINUX_DIR)/arch/arm/boot/dts/imx6q-phytec-pbab01.dtb ${TARGET_DIR}/boot
 endif
 ifeq ($(ADK_TARGET_SYSTEM_BEAGLEBONE_BLACK),y)
-	env $(KERNEL_MAKE_ENV) $(MAKE) -C "${LINUX_DIR}" $(KERNEL_MAKE_OPTS) \
-		am335x-boneblack.dtb
+	${KERNEL_MAKE} am335x-boneblack.dtb $(MAKE_TRACE)
 	cp $(LINUX_DIR)/arch/arm/boot/dts/am335x-boneblack.dtb ${TARGET_DIR}/boot
 endif
 ifeq ($(ADK_TARGET_BOARD_BCM28XX),y)
-	env $(KERNEL_MAKE_ENV) $(MAKE) -C "${LINUX_DIR}" $(KERNEL_MAKE_OPTS) \
-		dtbs $(MAKE_TRACE)
+	${KERNEL_MAKE} dtbs $(MAKE_TRACE)
 	mkdir -p $(FW_DIR)/overlays
 	for x in $(LINUX_DIR)/arch/arm/boot/dts/overlays/*.dtbo; do \
 		[[ -e "$$x" ]] && cp $(LINUX_DIR)/arch/arm/boot/dts/overlays/*.dtbo $(FW_DIR)/overlays; \
@@ -210,28 +202,23 @@ ifeq ($(ADK_TARGET_BOARD_BCM28XX),y)
 	done
 endif
 ifeq ($(ADK_TARGET_SYSTEM_BANANA_PRO),y)
-	env $(KERNEL_MAKE_ENV) $(MAKE) -C "${LINUX_DIR}" $(KERNEL_MAKE_OPTS) \
-		sun7i-a20-bananapro.dtb $(MAKE_TRACE)
+	${KERNEL_MAKE} sun7i-a20-bananapro.dtb $(MAKE_TRACE)
 endif
 ifeq ($(ADK_TARGET_SYSTEM_ORANGE_PI0),y)
-	env $(KERNEL_MAKE_ENV) $(MAKE) -C "${LINUX_DIR}" $(KERNEL_MAKE_OPTS) \
-		sun8i-h2-plus-orangepi-zero.dtb $(MAKE_TRACE)
+	${KERNEL_MAKE} sun8i-h2-plus-orangepi-zero.dtb $(MAKE_TRACE)
 endif
 ifeq ($(ADK_TARGET_SYSTEM_SOLIDRUN_IMX6),y)
-	env $(KERNEL_MAKE_ENV) $(MAKE) -C "${LINUX_DIR}" $(KERNEL_MAKE_OPTS) \
-		imx6q-cubox-i.dtb imx6dl-cubox-i.dtb imx6dl-hummingboard.dtb imx6q-hummingboard.dtb $(MAKE_TRACE)
+	${KERNEL_MAKE} imx6q-cubox-i.dtb imx6dl-cubox-i.dtb \
+		imx6dl-hummingboard.dtb imx6q-hummingboard.dtb $(MAKE_TRACE)
 endif
 ifeq ($(ADK_TARGET_SYSTEM_SOLIDRUN_CLEARFOG),y)
-	env $(KERNEL_MAKE_ENV) $(MAKE) -C "${LINUX_DIR}" $(KERNEL_MAKE_OPTS) \
-		armada-388-clearfog.dtb $(MAKE_TRACE)
+	${KERNEL_MAKE} armada-388-clearfog.dtb $(MAKE_TRACE)
 endif
 ifeq ($(ADK_TARGET_SYSTEM_ST_STM32F429),y)
-	env $(KERNEL_MAKE_ENV) $(MAKE) -C "${LINUX_DIR}" $(KERNEL_MAKE_OPTS) \
-		dtbs $(MAKE_TRACE)
+	${KERNEL_MAKE} dtbs $(MAKE_TRACE)
 endif
 ifeq ($(ADK_TARGET_SYSTEM_ST_STM32F769),y)
-	env $(KERNEL_MAKE_ENV) $(MAKE) -C "${LINUX_DIR}" $(KERNEL_MAKE_OPTS) \
-		dtbs $(MAKE_TRACE)
+	${KERNEL_MAKE} dtbs $(MAKE_TRACE)
 endif
 	for x in $(LINUX_DIR)/arch/arm/boot/dts/*.dtb; do \
 		[[ -e "$$x" ]] && cp $(LINUX_DIR)/arch/arm/boot/dts/*.dtb $(FW_DIR); \

+ 1 - 2
target/nios2/Makefile

@@ -59,8 +59,7 @@ kernel-install: kernel-strip
 	@cp $(BUILD_DIR)/$(TARGET_KERNEL) $(FW_DIR)/$(TARGET_KERNEL)
 
 dtb-install:
-	env $(KERNEL_MAKE_ENV) $(MAKE) -C "${LINUX_DIR}" $(KERNEL_MAKE_OPTS) \
-		10m50_devboard.dtb $(MAKE_TRACE)
+	${KERNEL_MAKE} 10m50_devboard.dtb $(MAKE_TRACE)
 	for x in $(LINUX_DIR)/arch/nios2/boot/*.dtb; do \
 		[[ -e "$$x" ]] && cp $(LINUX_DIR)/arch/nios2/boot/*.dtb $(FW_DIR); \
 		break; \

+ 1 - 2
target/ppc/Makefile

@@ -74,8 +74,7 @@ kernel-install: kernel-strip
 
 dtb-install:
 ifeq ($(ADK_TARGET_SYSTEM_QEMU_PPC_VIRTEX_ML507),y)
-	env $(KERNEL_MAKE_ENV) $(MAKE) -C "${LINUX_DIR}" $(KERNEL_MAKE_OPTS) \
-		-j${ADK_MAKE_JOBS} virtex440-ml507.dtb $(MAKE_TRACE)
+	${KERNEL_MAKE} virtex440-ml507.dtb $(MAKE_TRACE)
 	$(CP) $(LINUX_DIR)/arch/powerpc/boot/virtex440-ml507.dtb \
 		$(FW_DIR)/ppc.dtb
 endif

+ 1 - 3
toolchain/linux-headers/Makefile

@@ -44,9 +44,7 @@ endif
 	touch $@
 
 $(WRKBUILD)/.configured: $(TOOLCHAIN_BUILD_DIR)/w-$(PKG_NAME)-$(PKG_VERSION)-$(PKG_RELEASE)/linux-$(KERNEL_FILE_VER)/.patched
-	$(KERNEL_MAKE_ENV) $(MAKE) -C "${LINUX_DIR}" $(KERNEL_MAKE_OPTS) \
-		INSTALL_HDR_PATH=$(STAGING_TARGET_DIR)/usr \
-		headers_install
+	${KERNEL_MAKE} INSTALL_HDR_PATH=$(STAGING_TARGET_DIR)/usr headers_install
 ifeq ($(ADK_TARGET_ARCH_CRIS),y)
 ifeq ($(ADK_TARGET_CPU_ARCH),crisv32)
 	cd $(STAGING_TARGET_DIR)/usr/include && ln -sf arch-v32/arch arch