From 3273dc2de0d8b5d1263e5a8cb63db203eae086d2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Tue, 3 Nov 2020 18:30:52 +0100 Subject: [PATCH] build: Introduce single container build target. The intention is to batch all container invocations instead of instanciating one for every rule that needs to run within a container. This keeps track of build dependencies using a .any-build timestamp file and define a CONTAINER=1 variable when make is running within the container. When running within the container, only "configure" and "build" targets are active, all the other targets are no-op. When make is run outside of the container, it's the opposite, except for the "build" targets which all depend on this .any-build timestamp file to trigger the container build execution. The targets dependency graph is still complete, so "source" targets will always all be executed before the container, and configure steps will optionally run if the generated files are missing. When source change is detected, only the build rules are executed again, trusting each build system to decide if configure should be run again or not. --- build/makefile_base.mak | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/build/makefile_base.mak b/build/makefile_base.mak index c65249a4..271dfd06 100644 --- a/build/makefile_base.mak +++ b/build/makefile_base.mak @@ -1,3 +1,6 @@ +SRC := $(abspath $(SRCDIR)) +OBJ := $(abspath $(CURDIR)) + ## ## Nested make ## @@ -89,6 +92,30 @@ CONTAINER_SHELL := $(SHELL) STEAM_RUNTIME_RUNSH := endif + +MAKECMDGOALS32 := $(filter-out all32,$(filter %32,$(MAKECMDGOALS))) +MAKECMDGOALS64 := $(filter-out all64,$(filter %64,$(MAKECMDGOALS))) + +all: all32 all64 +.PHONY: all + +all32 $(MAKECMDGOALS32): +.PHONY: all32 $(MAKECMDGOALS32) + +all32 $(MAKECMDGOALS64): +.PHONY: all64 $(MAKECMDGOALS64) + +ifeq ($(CONTAINER),) +container-build: private SHELL := $(CONTAINER_SHELL) +container-build: + +$(MAKE) -f $(firstword $(MAKEFILE_LIST)) $(MFLAGS) $(MAKEOVERRIDES) CONTAINER=1 $(MAKECMDGOALS32) $(MAKECMDGOALS64) +.PHONY: container-build + +all32 $(MAKECMDGOALS32): container-build +all64 $(MAKECMDGOALS64): container-build +endif + + .PHONY: test-container test-container: @echo >&2 ":: Testing container" @@ -268,6 +295,7 @@ OBJ_DIRS := $(TOOLS_DIR32) $(TOOLS_DIR64) \ $(OBJ_DIRS): mkdir -p $@ +ifeq ($(CONTAINER),) ## downloads -- Convenience target to download packages used during the build ## process. Places them in subdirs one up from the Proton source dir, so @@ -471,6 +499,8 @@ module64: module: module32 module64 +endif # ifeq ($(CONTAINER),) + GST_COMMON_MESON_ARGS := \ -Dexamples=disabled \ -Dtests=disabled \ @@ -1528,6 +1558,7 @@ mediaconv64: $(MAKEFILE_DEP) gstreamer64 | $(MEDIACONV_OBJ64) mediaconv: mediaconv32 mediaconv64 +ifeq ($(CONTAINER),) ALL_TARGETS += fonts GOAL_TARGETS += fonts @@ -1668,4 +1699,5 @@ all32_configure: $(GOAL_TARGETS_CONFIGURE32) all64_configure: $(GOAL_TARGETS_CONFIGURE64) @echo ":: make $@ succeeded" +endif # ifeq ($(CONTAINER),) endif # End of NESTED_MAKE from beginning