From 8c105d7aa1ae909f9387792df117239368ccc17d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Sat, 28 Mar 2020 17:39:20 +0100 Subject: [PATCH] build: Introduce rules-autoconf macro. --- build/makefile_base.mak | 1 + make/rules-autoconf.mk | 37 +++++++++++++++++++++++++++++++++++++ 2 files changed, 38 insertions(+) create mode 100644 make/rules-autoconf.mk diff --git a/build/makefile_base.mak b/build/makefile_base.mak index 458685b7..b30c6717 100644 --- a/build/makefile_base.mak +++ b/build/makefile_base.mak @@ -40,6 +40,7 @@ include $(SRC)/make/rules-source.mk include $(SRC)/make/rules-common.mk include $(SRC)/make/rules-meson.mk include $(SRC)/make/rules-cmake.mk +include $(SRC)/make/rules-autoconf.mk # If CC is coming from make's defaults or nowhere, use our own default. Otherwise respect environment. ifeq ($(ENABLE_CCACHE),1) diff --git a/make/rules-autoconf.mk b/make/rules-autoconf.mk new file mode 100644 index 00000000..c6dc2d8d --- /dev/null +++ b/make/rules-autoconf.mk @@ -0,0 +1,37 @@ +# parameters: +# $(1): lowercase package name +# $(2): uppercase package name +# $(3): 32/64, build type +# +define create-rules-autoconf +$(call create-rules-common,$(1),$(2),$(3)) + +ifeq ($(CONTAINER),1) +$$(OBJ)/.$(1)-configure$(3): $$($(2)_SRC)/configure.ac + @echo ":: configuring $(3)bit $(1)..." >&2 + rm -rf "$$($(2)_OBJ$(3))/config.cache" + + cd "$$($(2)_OBJ$(3))" && env $$($(2)_ENV$(3)) \ + $$($(2)_SRC)/configure -C \ + --prefix="$$($(2)_DST$(3))" \ + --libdir="$$($(2)_DST$(3))/lib$(subst 32,,$(3))" \ + $$($(2)_ENV$(3)) \ + CROSSCFLAGS="$$(COMMON_FLAGS)" \ + CROSSCXXFLAGS="$$(COMMON_FLAGS) -std=c++17" \ + CROSSLDFLAGS="$$(CROSSLDFLAGS)" \ + $$($(2)_CONFIGURE_ARGS) \ + $$($(2)_CONFIGURE_ARGS$(3)) + + touch $$@ + +$$(OBJ)/.$(1)-build$(3): + @echo ":: building $(3)bit $(1)..." >&2 + cd "$$($(2)_OBJ$(3))" && env $$($(2)_ENV$(3)) \ + $$(MAKE) + cd "$$($(2)_OBJ$(3))" && env $$($(2)_ENV$(3)) \ + $$(MAKE) install + touch $$@ +endif +endef + +rules-autoconf = $(call create-rules-autoconf,$(1),$(call toupper,$(1)),$(2))