From 194465c98667f2e6c4f26a17abaa1d6bc274ada8 Mon Sep 17 00:00:00 2001 From: vanhofen Date: Wed, 29 Jun 2022 23:15:26 +0200 Subject: [PATCH] - add $($(PKG)_MAKE_ENV) and $($(PKG)_MAKE_OPTS) --- package/busybox/busybox.mk | 2 +- package/lua/lua.mk | 2 +- package/neutrino/neutrino.mk | 2 +- package/pkg-autotools.mk | 45 ++++++++++++++++++++++-------------- package/pkg-cmake.mk | 20 +++++++--------- package/pkg-generic.mk | 45 +++++++++++------------------------- package/pkg-kernel-module.mk | 4 +++- package/pkg-meson.mk | 22 +++++++++++------- package/pkg-python.mk | 4 ++-- 9 files changed, 72 insertions(+), 74 deletions(-) diff --git a/package/busybox/busybox.mk b/package/busybox/busybox.mk index 62106275..9488a4d2 100644 --- a/package/busybox/busybox.mk +++ b/package/busybox/busybox.mk @@ -29,7 +29,7 @@ BUSYBOX_MAKE_ENV = \ CFLAGS_busybox="$(BUSYBOX_CFLAGS_busybox)" BUSYBOX_MAKE_OPTS = \ - $(TARGET_MAKE_OPTS) \ + $(TARGET_CONFIGURE_ENVIRONMENT) \ CFLAGS_EXTRA="$(TARGET_CFLAGS)" \ EXTRA_LDFLAGS="$(TARGET_LDFLAGS)" \ CONFIG_PREFIX="$(TARGET_DIR)" diff --git a/package/lua/lua.mk b/package/lua/lua.mk index 4de19d8a..da2c50bf 100644 --- a/package/lua/lua.mk +++ b/package/lua/lua.mk @@ -22,7 +22,7 @@ lua: $(LUA_DEPENDENCIES) $(DL_DIR)/$(LUA_SOURCE) | $(TARGET_DIR) $(CHDIR)/$(LUA_DIR); \ $(MAKE) linux \ PKG_VERSION=$(LUA_VERSION) \ - $(TARGET_MAKE_OPTS) \ + $(TARGET_CONFIGURE_ENVIRONMENT) \ AR="$(TARGET_AR) rcu" \ LDFLAGS="$(TARGET_LDFLAGS)" \ ; \ diff --git a/package/neutrino/neutrino.mk b/package/neutrino/neutrino.mk index e4a0b2f0..96a2f426 100644 --- a/package/neutrino/neutrino.mk +++ b/package/neutrino/neutrino.mk @@ -53,7 +53,7 @@ NEUTRINO_LDFLAGS += -lcrypto -ldl -lz # ----------------------------------------------------------------------------- NEUTRINO_CONF_ENV = \ - $(TARGET_MAKE_OPTS) \ + $(TARGET_CONFIGURE_ENVIRONMENT) \ \ CFLAGS="$(NEUTRINO_CFLAGS)" \ CPPFLAGS="$(NEUTRINO_CFLAGS)" \ diff --git a/package/pkg-autotools.mk b/package/pkg-autotools.mk index 6bdca1ac..5d624b6e 100644 --- a/package/pkg-autotools.mk +++ b/package/pkg-autotools.mk @@ -9,15 +9,34 @@ define AUTORECONF_HOOK if [ "$($(PKG)_AUTORECONF)" == "YES" ]; then \ $(call MESSAGE,"Autoreconfiguring"); \ $(CHDIR)/$($(PKG)_DIR)/$($(PKG)_SUBDIR); \ - $($(PKG)_AUTORECONF_ENV) autoreconf -fi $($(PKG)_AUTORECONF_OPTS); \ + $($(PKG)_AUTORECONF_ENV) \ + autoreconf -fi \ + $($(PKG)_AUTORECONF_OPTS); \ fi; \ ) endef # ----------------------------------------------------------------------------- -TARGET_CONFIGURE_ENV = \ - $(TARGET_MAKE_OPTS) \ +TARGET_CONFIGURE_ENVIRONMENT = \ + CROSS_COMPILE="$(TARGET_CROSS)" \ + CC="$(TARGET_CC)" \ + GCC="$(TARGET_CC)" \ + CPP="$(TARGET_CPP)" \ + CXX="$(TARGET_CXX)" \ + LD="$(TARGET_LD)" \ + AR="$(TARGET_AR)" \ + AS="$(TARGET_AS)" \ + NM="$(TARGET_NM)" \ + OBJCOPY="$(TARGET_OBJCOPY)" \ + OBJDUMP="$(TARGET_OBJDUMP)" \ + RANLIB="$(TARGET_RANLIB)" \ + READELF="$(TARGET_READELF)" \ + STRIP="$(TARGET_STRIP)" \ + ARCH=$(TARGET_ARCH) + +TARGET_CONFIGURE_ENV += \ + $(TARGET_CONFIGURE_ENVIRONMENT) \ CFLAGS="$(TARGET_CFLAGS)" \ CPPFLAGS="$(TARGET_CPPFLAGS)" \ CXXFLAGS="$(TARGET_CXXFLAGS)" \ @@ -28,9 +47,6 @@ TARGET_CONFIGURE_ENV += \ PKG_CONFIG_PATH="$(PKG_CONFIG_PATH)" \ PKG_CONFIG_SYSROOT_DIR=$(PKG_CONFIG_SYSROOT_DIR) -TARGET_CONFIGURE_ENV += \ - $($(PKG)_CONF_ENV) - TARGET_CONFIGURE_OPTS = \ --build=$(GNU_HOST_NAME) \ --host=$(TARGET) \ @@ -47,9 +63,6 @@ TARGET_CONFIGURE_OPTS = \ --mandir=$(REMOVE_mandir) \ --infodir=$(REMOVE_infodir) -TARGET_CONFIGURE_OPTS += \ - $($(PKG)_CONF_OPTS) - define TARGET_CONFIGURE @$(call MESSAGE,"Configuring") $(foreach hook,$($(PKG)_PRE_CONFIGURE_HOOKS),$(call $(hook))$(sep)) @@ -58,7 +71,9 @@ define TARGET_CONFIGURE $(CHDIR)/$($(PKG)_DIR)/$($(PKG)_SUBDIR); \ test -f ./configure || ./autogen.sh && \ CONFIG_SITE=/dev/null \ - $(TARGET_CONFIGURE_ENV) ./configure $(TARGET_CONFIGURE_OPTS); \ + $(TARGET_CONFIGURE_ENV) $($(PKG)_CONF_ENV) \ + ./configure \ + $(TARGET_CONFIGURE_OPTS) $($(PKG)_CONF_OPTS); \ ) $(foreach hook,$($(PKG)_POST_CONFIGURE_HOOKS),$(call $(hook))$(sep)) endef @@ -86,16 +101,10 @@ HOST_CONFIGURE_ENV += \ PKG_CONFIG=/usr/bin/pkg-config \ PKG_CONFIG_LIBDIR="$(HOST_DIR)/lib/pkgconfig" -HOST_CONFIGURE_ENV += \ - $($(PKG)_CONF_ENV) - HOST_CONFIGURE_OPTS = \ --prefix=$(HOST_DIR) \ --sysconfdir=$(HOST_DIR)/etc -HOST_CONFIGURE_OPTS += \ - $($(PKG)_CONF_OPTS) - define HOST_CONFIGURE @$(call MESSAGE,"Configuring") $(foreach hook,$($(PKG)_PRE_CONFIGURE_HOOKS),$(call $(hook))$(sep)) @@ -104,7 +113,9 @@ define HOST_CONFIGURE $(CHDIR)/$($(PKG)_DIR)/$($(PKG)_SUBDIR); \ test -f ./configure || ./autogen.sh && \ CONFIG_SITE=/dev/null \ - $(HOST_CONFIGURE_ENV) ./configure $(HOST_CONFIGURE_OPTS); \ + $(HOST_CONFIGURE_ENV) $($(PKG)_CONF_ENV) \ + ./configure \ + $(HOST_CONFIGURE_OPTS) $($(PKG)_CONF_OPTS); \ ) $(foreach hook,$($(PKG)_POST_CONFIGURE_HOOKS),$(call $(hook))$(sep)) endef diff --git a/package/pkg-cmake.mk b/package/pkg-cmake.mk index 95f5be12..d023a592 100644 --- a/package/pkg-cmake.mk +++ b/package/pkg-cmake.mk @@ -4,8 +4,7 @@ # ################################################################################ -TARGET_CMAKE_ENV = \ - $($(PKG)_CONF_ENV) +TARGET_CMAKE_ENV = TARGET_CMAKE_OPTS = \ --no-warn-unused-cli @@ -45,16 +44,15 @@ TARGET_CMAKE_OPTS += \ -DCMAKE_READELF="$(TARGET_READELF)" \ -DCMAKE_STRIP="$(TARGET_STRIP)" -TARGET_CMAKE_OPTS += \ - $($(PKG)_CONF_OPTS) - define TARGET_CMAKE @$(call MESSAGE,"Configuring") $(foreach hook,$($(PKG)_PRE_CONFIGURE_HOOKS),$(call $(hook))$(sep)) $(Q)( \ $(CHDIR)/$($(PKG)_DIR)/$($(PKG)_SUBDIR); \ rm -f CMakeCache.txt; \ - $(TARGET_CMAKE_ENV) cmake $(TARGET_CMAKE_OPTS); \ + $(TARGET_CMAKE_ENV) $($(PKG)_CONF_ENV) \ + cmake \ + $(TARGET_CMAKE_OPTS) $($(PKG)_CONF_OPTS); \ ) $(foreach hook,$($(PKG)_POST_CONFIGURE_HOOKS),$(call $(hook))$(sep)) endef @@ -71,8 +69,7 @@ endef # ----------------------------------------------------------------------------- -HOST_CMAKE_ENV = \ - $($(PKG)_CONF_ENV) +HOST_CMAKE_ENV = HOST_CMAKE_OPTS += \ --no-warn-unused-cli @@ -91,16 +88,15 @@ HOST_CMAKE_OPTS += \ -DCMAKE_INSTALL_PREFIX="$(HOST_DIR)" \ -DCMAKE_PREFIX_PATH="$(HOST_DIR)" -HOST_CMAKE_OPTS += \ - $($(PKG)_CONF_OPTS) - define HOST_CMAKE @$(call MESSAGE,"Configuring") $(foreach hook,$($(PKG)_PRE_CONFIGURE_HOOKS),$(call $(hook))$(sep)) $(Q)( \ $(CHDIR)/$($(PKG)_DIR)/$($(PKG)_SUBDIR); \ rm -f CMakeCache.txt; \ - $(HOST_CMAKE_ENV) cmake $(HOST_CMAKE_OPTS); \ + $(HOST_CMAKE_ENV) $($(PKG)_CONF_ENV) \ + cmake \ + $(HOST_CMAKE_OPTS) $($(PKG)_CONF_OPTS); \ ) $(foreach hook,$($(PKG)_POST_CONFIGURE_HOOKS),$(call $(hook))$(sep)) endef diff --git a/package/pkg-generic.mk b/package/pkg-generic.mk index 62b1dc8e..c959a451 100644 --- a/package/pkg-generic.mk +++ b/package/pkg-generic.mk @@ -4,35 +4,16 @@ # ################################################################################ -#TARGET_MAKE_ENV = -# $($(PKG)_MAKE_ENV) - -TARGET_MAKE_OPTS = \ - CROSS_COMPILE="$(TARGET_CROSS)" \ - CC="$(TARGET_CC)" \ - GCC="$(TARGET_CC)" \ - CPP="$(TARGET_CPP)" \ - CXX="$(TARGET_CXX)" \ - LD="$(TARGET_LD)" \ - AR="$(TARGET_AR)" \ - AS="$(TARGET_AS)" \ - NM="$(TARGET_NM)" \ - OBJCOPY="$(TARGET_OBJCOPY)" \ - OBJDUMP="$(TARGET_OBJDUMP)" \ - RANLIB="$(TARGET_RANLIB)" \ - READELF="$(TARGET_READELF)" \ - STRIP="$(TARGET_STRIP)" \ - ARCH=$(TARGET_ARCH) - -#TARGET_MAKE_OPTS += \ -# $($(PKG)_MAKE_OPTS) +TARGET_MAKE_ENV = define TARGET_MAKE @$(call MESSAGE,"Compiling") $(foreach hook,$($(PKG)_PRE_COMPILE_HOOKS),$(call $(hook))$(sep)) $(Q)( \ $(CHDIR)/$($(PKG)_DIR)/$($(PKG)_SUBDIR); \ - $(MAKE); \ + $(TARGET_MAKE_ENV) $($(PKG)_MAKE_ENV) \ + $(MAKE) \ + $($(PKG)_MAKE_OPTS); \ ) $(foreach hook,$($(PKG)_POST_COMPILE_HOOKS),$(call $(hook))$(sep)) endef @@ -42,7 +23,9 @@ define TARGET_MAKE_INSTALL $(foreach hook,$($(PKG)_PRE_INSTALL_HOOKS),$(call $(hook))$(sep)) $(Q)( \ $(CHDIR)/$($(PKG)_DIR)/$($(PKG)_SUBDIR); \ - $(MAKE) install DESTDIR=$(TARGET_DIR); \ + $(TARGET_MAKE_ENV) $($(PKG)_MAKE_ENV) \ + $(MAKE) install DESTDIR=$(TARGET_DIR) \ + $($(PKG)_MAKE_OPTS); \ ) $(foreach hook,$($(PKG)_POST_INSTALL_HOOKS),$(call $(hook))$(sep)) endef @@ -58,8 +41,7 @@ endef # ----------------------------------------------------------------------------- -#HOST_MAKE_ENV = \ -# $($(PKG)_MAKE_ENV) +HOST_MAKE_ENV = HOST_MAKE_OPTS = \ CC="$(HOSTCC)" \ @@ -73,15 +55,14 @@ HOST_MAKE_OPTS = \ OBJCOPY="$(HOSTOBJCOPY)" \ RANLIB="$(HOSTRANLIB)" -#HOST_MAKE_OPTS += \ -# $($(PKG)_MAKE_OPTS) - define HOST_MAKE @$(call MESSAGE,"Compiling") $(foreach hook,$($(PKG)_PRE_COMPILE_HOOKS),$(call $(hook))$(sep)) $(Q)( \ $(CHDIR)/$($(PKG)_DIR)/$($(PKG)_SUBDIR); \ - $(MAKE); \ + $(HOST_MAKE_ENV) $($(PKG)_MAKE_ENV) \ + $(MAKE) \ + $($(PKG)_MAKE_OPTS); \ ) $(foreach hook,$($(PKG)_POST_COMPILE_HOOKS),$(call $(hook))$(sep)) endef @@ -91,7 +72,9 @@ define HOST_MAKE_INSTALL $(foreach hook,$($(PKG)_PRE_INSTALL_HOOKS),$(call $(hook))$(sep)) $(Q)( \ $(CHDIR)/$($(PKG)_DIR)/$($(PKG)_SUBDIR); \ - $(MAKE) install; \ + $(HOST_MAKE_ENV) $($(PKG)_MAKE_ENV) \ + $(MAKE) install \ + $($(PKG)_MAKE_OPTS); \ ) $(foreach hook,$($(PKG)_POST_INSTALL_HOOKS),$(call $(hook))$(sep)) endef diff --git a/package/pkg-kernel-module.mk b/package/pkg-kernel-module.mk index 20673a3e..443dbcc8 100644 --- a/package/pkg-kernel-module.mk +++ b/package/pkg-kernel-module.mk @@ -20,7 +20,9 @@ KERNEL_MAKE_VARS += \ define KERNEL_MODULE_BUILD @$(call MESSAGE,"Building kernel module") $(CHDIR)/$($(PKG)_DIR); \ - $($(PKG)_MAKE_ENV) $(MAKE) $($(PKG)_MAKE_OPTS) $(KERNEL_MAKE_VARS) + $(TARGET_MAKE_ENV) $($(PKG)_MAKE_ENV) \ + $(MAKE) \ + $($(PKG)_MAKE_OPTS) $(KERNEL_MAKE_VARS) endef # ----------------------------------------------------------------------------- diff --git a/package/pkg-meson.mk b/package/pkg-meson.mk index be7fc1b8..d16b1f90 100644 --- a/package/pkg-meson.mk +++ b/package/pkg-meson.mk @@ -52,7 +52,7 @@ define TARGET_MESON_CONFIGURE $($(PKG)_CONF_ENV) \ $(HOST_MESON_BINARY) \ --buildtype=release \ - --cross-file $(PKG_BUILD_DIR)/build/meson-cross.config \ + --cross-file=$(PKG_BUILD_DIR)/build/meson-cross.config \ -Db_pie=false \ -Dstrip=false \ $($(PKG)_CONF_OPTS) \ @@ -63,13 +63,16 @@ endef define TARGET_NINJA_BUILD $(CHDIR)/$($(PKG)_DIR)/$($(PKG)_SUBDIR); \ - $(HOST_NINJA_BINARY) -C $(PKG_BUILD_DIR)/build + $(TARGET_MAKE_ENV) $($(PKG)_NINJA_ENV) \ + $(HOST_NINJA_BINARY) -C $(PKG_BUILD_DIR)/build \ + $($(PKG)_NINJA_OPTS) endef define TARGET_NINJA_INSTALL $(CHDIR)/$($(PKG)_DIR)/$($(PKG)_SUBDIR); \ - DESTDIR=$(TARGET_DIR) \ - $(HOST_NINJA_BINARY) -C $(PKG_BUILD_DIR)/build install + $(TARGET_MAKE_ENV) $($(PKG)_NINJA_ENV) \ + $(HOST_NINJA_BINARY) -C $(PKG_BUILD_DIR)/build install DESTDIR=$(TARGET_DIR) \ + $($(PKG)_NINJA_OPTS) endef # ----------------------------------------------------------------------------- @@ -94,7 +97,7 @@ define HOST_MESON_CONFIGURE $(CHDIR)/$($(PKG)_DIR)/$($(PKG)_SUBDIR); \ $($(PKG)_CONF_ENV) \ $(HOST_MESON_BINARY) \ - --prefix=/ \ + --prefix=$(HOST_DIR) \ --buildtype=release \ $($(PKG)_CONF_OPTS) \ $(PKG_BUILD_DIR) $(PKG_BUILD_DIR)/build; \ @@ -104,13 +107,16 @@ endef define HOST_NINJA_BUID $(CHDIR)/$($(PKG)_DIR)/$($(PKG)_SUBDIR); \ - $(HOST_NINJA_BINARY) -C $(PKG_BUILD_DIR)/build + $(HOST_MAKE_ENV) $($(PKG)_NINJA_ENV) \ + $(HOST_NINJA_BINARY) -C $(PKG_BUILD_DIR)/build \ + $($(PKG)_NINJA_OPTS) endef define HOST_NINJA_INSTALL $(CHDIR)/$($(PKG)_DIR)/$($(PKG)_SUBDIR); \ - DESTDIR=$(HOST_DIR) \ - $(HOST_NINJA_BINARY) -C $(PKG_BUILD_DIR)/build install + $(HOST_MAKE_ENV) $($(PKG)_NINJA_ENV) \ + $(HOST_NINJA_BINARY) -C $(PKG_BUILD_DIR)/build install \ + $($(PKG)_NINJA_OPTS) endef # ----------------------------------------------------------------------------- diff --git a/package/pkg-python.mk b/package/pkg-python.mk index c4310732..f285a49f 100644 --- a/package/pkg-python.mk +++ b/package/pkg-python.mk @@ -18,14 +18,14 @@ define HOST_PYTHON3_BUILD $(CHDIR)/$($(PKG)_DIR)/$($(PKG)_SUBDIR); \ $(HOST_PYTHON3_ENV) \ $(HOST_PYTHON3_BINARY) ./setup.py build --executable=/usr/bin/python \ - $(HOST_PYTHON3_OPTS) + $(HOST_PYTHON3_OPTS) endef define HOST_PYTHON3_INSTALL $(CHDIR)/$($(PKG)_DIR)/$($(PKG)_SUBDIR); \ $(HOST_PYTHON3_ENV) \ $(HOST_PYTHON3_BINARY) ./setup.py install --root=$(HOST_DIR) --prefix= \ - $(HOST_PYTHON3_OPTS) + $(HOST_PYTHON3_OPTS) endef # -----------------------------------------------------------------------------