From 22a2a392d3234139acd02fab99da6f2959ae1893 Mon Sep 17 00:00:00 2001 From: Yauheni Kaliuta Date: Sun, 24 Nov 2019 19:28:37 +0200 Subject: BUILD: Fix Version Define Being Added to All Code Objects Due to a quirk of target specific make variables which means they are added to all pre-requisities, this resulted in the defines which were meant to be applied only to the version module being applied to most of the codebase. This did not cause any direct issues, but was untidy and unexpected behaviour which was reported in Pull Request 1946 by janisozaur. Fix it by defining a special rule for version.o with own flags instead of using template rule. Signed-off-by: Yauheni Kaliuta --- Makefile.common | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'Makefile.common') diff --git a/Makefile.common b/Makefile.common index 95b090acd3..3d2739f9bf 100644 --- a/Makefile.common +++ b/Makefile.common @@ -136,6 +136,10 @@ ifdef CXX_UPDATE_DEP_FLAG $(QUIET)$(MKDIR) $(*D)/$(DEPDIR) $(QUIET_AS)$(CXX) $(CXX_UPDATE_DEP_FLAG) $(ASFLAGS) -c $(<) -o $*.o +base/version.o: base/version.cpp + $(QUIET)$(MKDIR) $(*D)/$(DEPDIR) + $(QUIET_CXX)$(CXX) $(CXX_UPDATE_DEP_FLAG) $(CXXFLAGS) $(VERFLAGS) $(CPPFLAGS) -c $(<) -o $*.o + else # Dumb compile rule, for C++ compilers that don't allow dependency tracking or @@ -149,6 +153,9 @@ else $(QUIET)$(MKDIR) $(*D) $(QUIET_AS)$(CXX) $(ASFLAGS) -c $(<) -o $*.o +base/version.o: base/version.cpp + $(QUIET)$(MKDIR) $(*D) + $(QUIET_CXX)$(CXX) $(CXXFLAGS) $(VERFLAGS) $(CPPFLAGS) -c $(<) -o $*.o endif # Build rule for assembler files @@ -192,7 +199,7 @@ VER_EXTRA = $(shell echo $(VERSION) | cut -d. -f 3 | cut -c2-) ifdef AMIGAOS # Amiga needs date in specific format for the version cookie AMIGA_DATE = $(shell gdate '+%d.%m.%Y') -base/version.o: CXXFLAGS:=$(CXXFLAGS) -DAMIGA_DATE=\"$(AMIGA_DATE)\" +VERFLAGS += -DAMIGA_DATE=\"$(AMIGA_DATE)\" endif ###################################################################### @@ -214,7 +221,7 @@ endif # Define the Subversion revision if available, either autodetected or # specified by the user, but only for base/version.cpp. ifneq ($(origin VER_REV), undefined) -base/version.o: CXXFLAGS:=$(CXXFLAGS) -DSCUMMVM_REVISION=\"$(VER_REV)\" +VERFLAGS += -DSCUMMVM_REVISION=\"$(VER_REV)\" endif ###################################################################### -- cgit v1.2.3