From 14db3b178d9fedd4bd510eeafaf8e98627aba6bd Mon Sep 17 00:00:00 2001 From: hendricks266 Date: Sat, 22 Feb 2014 08:02:41 +0000 Subject: [PATCH] Build system: Detect the SVN revision and generate rev.h directly from the Makefile, if applicable. git-svn-id: https://svn.eduke32.com/eduke32@4343 1a8010ca-5511-0410-912e-c29ae57300e0 --- polymer/eduke32/Makefile | 10 ++++++++-- polymer/eduke32/Makefile.common | 14 +++++++++++++- polymer/eduke32/Makefile.deps | 7 ++++--- polymer/eduke32/source/astub.c | 8 +++++++- polymer/synthesis.sh | 6 +++--- 5 files changed, 35 insertions(+), 10 deletions(-) diff --git a/polymer/eduke32/Makefile b/polymer/eduke32/Makefile index f42e004d5..1561c3bb1 100644 --- a/polymer/eduke32/Makefile +++ b/polymer/eduke32/Makefile @@ -350,7 +350,7 @@ endif UTILOBJS=$(OBJ)/ivfrate.$o UTILS=ivfrate$(EXESUFFIX) -all: start $(EDUKE32_TARGET) $(MAPSTER32_TARGET) finish +all: start $(DO_REV) $(EDUKE32_TARGET) $(MAPSTER32_TARGET) finish ifneq (,$(EDUKE32_TARGET)) @ls -l $(EDUKE32) endif @@ -552,7 +552,7 @@ $(RSRC)/editor_banner.c: $(RSRC)/build.bmp # PHONIES -clean: +clean: $(UNDO_REV) -rm -f $(OBJ)/* $(EDUKE32) $(EDUKE32).memmap $(MAPSTER32) $(MAPSTER32).memmap core* && $(MAKE) -C $(JAUDIOLIBDIR) clean && $(MAKE) -C $(ENETDIR) clean ifeq ($(PLATFORM),DARWIN) -rm -rf EDuke32.app Mapster32.app @@ -568,3 +568,9 @@ veryclean: clean cleanutils printutils: echo "$(UTILS)" + +rev: + @echo "s_buildRev = \"r$(VC_REV)$(VC_REV_CUSTOM)\";">source/rev.h + +rev_clean: + @$(VC_CLEAN) source/rev.h diff --git a/polymer/eduke32/Makefile.common b/polymer/eduke32/Makefile.common index dffb41a8e..b993d5fec 100644 --- a/polymer/eduke32/Makefile.common +++ b/polymer/eduke32/Makefile.common @@ -115,7 +115,19 @@ ifndef SUBPLATFORM endif endif - +# Detect version control revision, if applicable +ifeq (,$(VC_REV)) + VC_REV := $(shell svn info 2>&1 | grep Revision | cut -d' ' -f2) + VC_CLEAN := svn revert +endif +ifeq (,$(VC_REV)) + VC_REV := $(shell git svn info 2>&1 | grep Revision | cut -d' ' -f2) + VC_CLEAN := git checkout +endif +ifneq (,$(VC_REV)) + DO_REV :=rev + UNDO_REV :=rev_clean +endif # Binary suffix override: EXESUFFIX_OVERRIDE ?= diff --git a/polymer/eduke32/Makefile.deps b/polymer/eduke32/Makefile.deps index ed433dcb0..bd42755db 100644 --- a/polymer/eduke32/Makefile.deps +++ b/polymer/eduke32/Makefile.deps @@ -36,7 +36,7 @@ gamedef_h=$(SRC)/gamedef.h $(SRC)/gameexec.h $(SRC)/gamevars.h game_defs_dep=$(SRC)/lunatic/defs.ilua -$(OBJ)/game.$o: $(SRC)/game.c $(game_defs_dep) $(SRC)/jmact/scriplib.h $(duke3d_h) $(SRC)/input.h $(INC)/osdfuncs.h $(INC)/osdcmds.h $(INC)/grpscan.h $(INC)/demo.h $(EINC)/hightile.h +$(OBJ)/game.$o: $(SRC)/game.c $(game_defs_dep) $(SRC)/jmact/scriplib.h $(duke3d_h) $(SRC)/input.h $(INC)/osdfuncs.h $(INC)/osdcmds.h $(INC)/grpscan.h $(INC)/demo.h $(EINC)/hightile.h $(SRC)/rev.h $(OBJ)/actors.$o: $(SRC)/actors.c $(duke3d_h) $(OBJ)/anim.$o: $(SRC)/anim.c $(duke3d_h) $(SRC)/input.h $(SRC)/jmact/animlib.h $(SRC)/animvpx.h $(OBJ)/demo.$o: $(SRC)/demo.c $(duke3d_h) $(SRC)/input.h @@ -44,7 +44,7 @@ $(OBJ)/gamedef.$o: $(SRC)/gamedef.c $(duke3d_h) $(gamedef_h) $(SRC)/savegame.h $(OBJ)/gameexec.$o: $(SRC)/gameexec.c $(SRC)/gamestructures.c $(duke3d_h) $(gamedef_h) $(OBJ)/gamestructures.$o: $(SRC)/gamestructures.c $(duke3d_h) $(gamedef_h) $(OBJ)/gamevars.$o: $(SRC)/gamevars.c $(SRC)/gamestructures.c $(duke3d_h) $(gamedef_h) $(SRC)/savegame.h -$(OBJ)/global.$o: $(SRC)/*.c $(SRC)/global.c $(duke3d_h) +$(OBJ)/global.$o: $(SRC)/*.c $(SRC)/global.c $(duke3d_h) $(SRC)/rev.h $(OBJ)/input.$o: $(SRC)/input.c $(duke3d_h) $(SRC)/input.h $(OBJ)/mdump.$o: $(SRC)/mdump.cpp $(SRC)/mdump.h $(OBJ)/menus.$o: $(SRC)/menus.c $(duke3d_h) $(SRC)/input.h $(SRC)/jmact/mouse.h @@ -84,7 +84,8 @@ $(OBJ)/astub.$o: $(SRC)/astub.c \ $(SRC)/names.h \ $(SRC)/mapster32.h \ $(SRC)/keys.h \ - $(m32_script_hs) + $(m32_script_hs) \ + $(SRC)/rev.h $(OBJ)/sounds_mapster32.$o: $(SRC)/sounds_mapster32.c \ $(SRC)/sounds_mapster32.h \ $(SRC)/sounds_common.h \ diff --git a/polymer/eduke32/source/astub.c b/polymer/eduke32/source/astub.c index 98cc78fa1..34cd5d237 100644 --- a/polymer/eduke32/source/astub.c +++ b/polymer/eduke32/source/astub.c @@ -8883,8 +8883,14 @@ int32_t ExtPreInit(int32_t argc,const char **argv) #else " (32-bit)" #endif +#if defined (_MSC_VER) || defined(__cplusplus) +#ifdef _MSC_VER + " MSVC" +#endif #ifdef __cplusplus - " C++ build" + " C++" +#endif + " build" #endif "\n", VERSION, s_buildRev); initprintf("Compiled %s\n", __DATE__ " " __TIME__); diff --git a/polymer/synthesis.sh b/polymer/synthesis.sh index 9b0d9fbe2..1935dd976 100755 --- a/polymer/synthesis.sh +++ b/polymer/synthesis.sh @@ -127,9 +127,6 @@ then cd $top/$source - # throw the svn revision into a header. this is ugly. - echo "s_buildRev = \"r$head\";" > source/rev.h - # get the date in the YYYYMMDD format (ex: 20091001) date=`date +%Y%m%d` @@ -246,6 +243,9 @@ then echo svn update -r $head svn update -r $head + # throw the svn revision into a header. + echo "s_buildRev = \"r$head\";" > source/rev.h + # export the source tree into the output directory svn export . $output/$date-$head/${basename}_$date-$head echo svn export . $output/$date-$head/${basename}_$date-$head