make: Add support for arbitrary archs / cross archs selection.

This commit is contained in:
Rémi Bernon 2025-01-12 15:12:20 +01:00 committed by Arkadiusz Hiler
parent acc431b93c
commit 0dc3217e02
9 changed files with 49 additions and 4 deletions

View File

@ -14,6 +14,9 @@ MFLAGS += V=1 VERBOSE=1
endif
SHELL := /bin/bash
ARCHS := i386-unix x86_64-unix i386-windows x86_64-windows
unix_ARCHS = $(subst -unix,,$(filter %-unix,$(ARCHS)))
windows_ARCHS = $(subst -windows,,$(filter %-windows,$(ARCHS)))
##
## General/global config
@ -427,11 +430,15 @@ WINE_AUTOCONF_ARGS = \
--with-mingw \
--disable-tests
WINE_i386_AUTOCONF_ARGS = \
WINE_x86_64_AUTOCONF_ARGS = \
--enable-archs="x86_64 $(filter-out x86_64 $(unix_ARCHS),$(windows_ARCHS))" \
--enable-win64 \
WINE_i386_AUTOCONF_ARGS += \
VKD3D_PE_CFLAGS="-I$(VULKAN_HEADERS_i386_DST)/include -I$(VKD3D_i386_DST)/include/vkd3d" \
VKD3D_PE_LIBS="-L$(VKD3D_i386_LIBDIR)/vkd3d/i386-windows -l:libvkd3d-1.dll -l:libvkd3d-shader-1.dll"
WINE_x86_64_AUTOCONF_ARGS = --enable-win64 \
WINE_x86_64_AUTOCONF_ARGS += \
VKD3D_PE_CFLAGS="-I$(VULKAN_HEADERS_x86_64_DST)/include -I$(VKD3D_x86_64_DST)/include/vkd3d" \
VKD3D_PE_LIBS="-L$(VKD3D_x86_64_LIBDIR)/vkd3d/x86_64-windows -l:libvkd3d-1.dll -l:libvkd3d-shader-1.dll"
@ -452,12 +459,22 @@ $(OBJ)/.wine-post-source:
touch $@
$(OBJ)/.wine-x86_64-post-build:
mkdir -p $(DST_DIR)/{bin,share}
ifeq ($(findstring i386,$(unix_ARCHS)),)
mkdir -p $(DST_DIR)/bin
$(call install-strip,$(WINE_x86_64_DST)/bin/wine,$(DST_DIR)/bin)
$(call install-strip,$(WINE_x86_64_DST)/bin/wine-preloader,$(DST_DIR)/bin)
$(call install-strip,$(WINE_x86_64_DST)/bin/wineserver,$(DST_DIR)/bin)
cp -a $(WINE_x86_64_DST)/bin/msidb $(DST_DIR)/bin/
else
mkdir -p $(DST_DIR)/bin
$(call install-strip,$(WINE_x86_64_DST)/bin/wine64,$(DST_DIR)/bin)
$(call install-strip,$(WINE_x86_64_DST)/bin/wine64-preloader,$(DST_DIR)/bin)
$(call install-strip,$(WINE_x86_64_DST)/bin/wineserver,$(DST_DIR)/bin)
cp -a $(WINE_x86_64_DST)/share/wine $(DST_DIR)/share
cp -a $(WINE_x86_64_DST)/bin/msidb $(DST_DIR)/bin
endif
mkdir -p $(DST_DIR)/share
cp -a $(WINE_x86_64_DST)/share/wine $(DST_DIR)/share
touch $@
$(OBJ)/.wine-i386-post-build:

View File

@ -6,6 +6,7 @@
#
define create-rules-autoconf
$(call create-rules-common,$(1),$(2),$(3),$(4))
ifneq ($(findstring $(3)-$(4),$(ARCHS)),)
$$($(2)_SRC)/configure: $$($(2)_ORIGIN)/configure.ac | $$(OBJ)/.$(1)-post-source
@echo ":: autoreconfing $(1)..." >&2
@ -34,6 +35,8 @@ $$(OBJ)/.$(1)-$(3)-build:
cd "$$($(2)_$(3)_OBJ)" && env $$($(2)_$(3)_ENV) \
$$(MAKE) install
touch $$@
endif
endef
rules-autoconf = $(call create-rules-autoconf,$(1),$(call toupper,$(1)),$(2),$(3))

View File

@ -6,6 +6,7 @@
#
define create-rules-cargo
$(call create-rules-common,$(1),$(2),$(3),$(4))
ifneq ($(findstring $(3)-$(4),$(ARCHS)),)
$$(OBJ)/.$(1)-$(3)-configure:
@echo ":: configuring $(1)-$(3)..." >&2
@ -21,6 +22,7 @@ $$(OBJ)/.$(1)-$(3)-build:
$$($(2)_CARGO_ARGS) \
$$($(2)_$(3)_CARGO_ARGS)
touch $$@
endif
endef
rules-cargo = $(call create-rules-cargo,$(1),$(call toupper,$(1)),$(2),$(3))

View File

@ -6,6 +6,7 @@
#
define create-rules-cmake
$(call create-rules-common,$(1),$(2),$(3),$(4))
ifneq ($(findstring $(3)-$(4),$(ARCHS)),)
$$($(2)_SRC)/CMakeLists.txt: | $$(OBJ)/.$(1)-post-source
$$(OBJ)/.$(1)-$(3)-configure: $$($(2)_SRC)/CMakeLists.txt
@ -30,6 +31,7 @@ $$(OBJ)/.$(1)-$(3)-build:
cd "$$($(2)_$(3)_OBJ)" && env $$($(2)_$(3)_ENV) \
$$(MAKE) install
touch $$@
endif
endef
i386-unix_CMAKE_ARGS := -DCMAKE_SHARED_LIBRARY_PREFIX_C=lib -DCMAKE_IMPORT_LIBRARY_PREFIX_C=lib

View File

@ -43,6 +43,15 @@ all-build: $(1)-build
.PHONY: all-build
ifeq ($$(findstring $(3)-$(4),$$(ARCHS)),)
$$(OBJ)/.$(1)-$(3)-configure:
touch $$@
$$(OBJ)/.$(1)-$(3)-build:
touch $$@
$$(OBJ)/.$(1)-$(3)-dist:
touch $$@
else
$$(OBJ)/.$(1)-$(3)-dist: $$(OBJ)/.$(1)-$(3)-build
$$(OBJ)/.$(1)-$(3)-dist: $$(OBJ)/.$(1)-$(3)-post-build
@ -74,6 +83,8 @@ else
touch $$@
endif
endif
$(1)-$(3)-dist: $$(OBJ)/.$(1)-$(3)-dist
.INTERMEDIATE: $(1)-$(3)-dist

View File

@ -6,6 +6,7 @@
#
define create-rules-configure
$(call create-rules-common,$(1),$(2),$(3),$(4))
ifneq ($(findstring $(3)-$(4),$(ARCHS)),)
$$(OBJ)/.$(1)-$(3)-configure:
@echo ":: configuring $(1)-$(3)..." >&2
@ -28,6 +29,7 @@ $$(OBJ)/.$(1)-$(3)-build:
cd "$$($(2)_$(3)_OBJ)" && env $$($(2)_$(3)_ENV) \
$$(MAKE) install
touch $$@
endif
endef
i386-unix_CONFIGURE_ARGS := --arch=x86 --target-os=linux

View File

@ -5,6 +5,7 @@
#
define create-rules-makedep
$(call create-rules-common,$(1),$(2),$(3),unix)
ifneq ($(findstring $(3)-unix,$(ARCHS)),)
$$(OBJ)/.$(1)-$(3)-configure:
@echo ":: configuring $(1)-$(3)..." >&2
@ -49,6 +50,7 @@ $$(OBJ)/.$(1)-$(3)-build:
cd "$$($(2)_$(3)_OBJ)" && env $$($(2)_$(3)_ENV) \
$$(MAKE) install
touch $$@
endif
endef
rules-makedep = $(call create-rules-makedep,$(1),$(call toupper,$(1)),$(2))

View File

@ -6,6 +6,7 @@
#
define create-rules-meson
$(call create-rules-common,$(1),$(2),$(3),$(4))
ifneq ($(findstring $(3)-$(4),$(ARCHS)),)
define $(2)_$(3)_MESON_CROSS
cat <<EOF
@ -62,6 +63,7 @@ $$(OBJ)/.$(1)-$(3)-build:
+env $$($(2)_$(3)_ENV) \
ninja -C "$$($(2)_$(3)_OBJ)" install
touch $$@
endif
endef
i386_MESON_CPU := x86

View File

@ -6,6 +6,8 @@
#
define create-rules-winemaker
$(call create-rules-common,$(1),$(2),$(3),unix)
ifneq ($(findstring $(3)-unix,$(ARCHS)),)
$(2)_$(3)_OBJ := $$($(2)_$(3)_OBJ)/$(4)
$$(OBJ)/.$(1)-$(3)-configure:
@ -36,6 +38,8 @@ $$(OBJ)/.$(1)-$(3)-build:
mkdir -p $$($(2)_$(3)_LIBDIR)/wine/$(3)-windows
cp -a $$($(2)_$(3)_OBJ)/$(4).fake $$($(2)_$(3)_LIBDIR)/wine/$(3)-windows/$(4)
touch $$@
endif
endef
i386_WINEMAKER_ARGS := --wine32