diff --git a/polymer/eduke32/Makefile b/polymer/eduke32/Makefile index 1bed4d3a3..c9bc16473 100644 --- a/polymer/eduke32/Makefile +++ b/polymer/eduke32/Makefile @@ -346,11 +346,11 @@ DUKE3D_EDITOR_OBJS_EXP:=$(addprefix $(DUKE3D_OBJ)/,$(addsuffix .$o,$(DUKE3D_EDIT ifeq ($(PRETTY_OUTPUT),1) .SILENT: endif -.PHONY: veryclean clean all test cleanutils utils dxutils sdlutils printutils printsdlutils printdxutils rev rev_clean +.PHONY: veryclean clean all test cleanutils utils dxutils sdlutils printutils printsdlutils printdxutils rev $(DUKE3D_OBJ)/rev.$o # TARGETS -all: start $(DO_REV) $(EDUKE32_TARGET) $(MAPSTER32_TARGET) finish +all: start $(EDUKE32_TARGET) $(MAPSTER32_TARGET) finish ifneq (,$(EDUKE32_TARGET)) @ls -l $(EDUKE32) endif @@ -565,6 +565,10 @@ $(DUKE3D_OBJ)/%.$o: $(DUKE3D_SRC)/%.c | $(DUKE3D_OBJ) $(COMPILE_STATUS) $(RECIPE_IF) $(COMPILER) $(COMMONFLAGS) $(COMPILERFLAGS) $(DUKE3D_CFLAGS) -c $< -o $@ $(RECIPE_RESULT_COMPILE) +$(DUKE3D_OBJ)/rev.$o: $(DUKE3D_SRC)/rev.c | $(DUKE3D_OBJ) + $(COMPILE_STATUS) + $(RECIPE_IF) $(COMPILER) $(COMMONFLAGS) $(COMPILERFLAGS) $(DUKE3D_CFLAGS) $(REVFLAG) -c $< -o $@ $(RECIPE_RESULT_COMPILE) + $(DUKE3D_OBJ)/%.$o: $(DUKE3D_SRC)/util/%.c | $(DUKE3D_OBJ) $(COMPILE_STATUS) $(RECIPE_IF) $(COMPILER) $(COMMONFLAGS) $(COMPILERFLAGS) $(DUKE3D_CFLAGS) -c $< -o $@ $(RECIPE_RESULT_COMPILE) @@ -603,7 +607,7 @@ $(ENGINE_OBJ) $(AUDIOLIB_OBJ) $(ENET_OBJ) $(DUKE3D_OBJ) $(TESTGAME_OBJ): # PHONIES -clean: $(UNDO_REV) +clean: -rm -f $(EDUKE32) $(MAPSTER32) $(COMMON_OBJS_EXP) $(DUKE3D_OBJS_EXP) $(COMMON_EDITOR_OBJS_EXP) $(DUKE3D_EDITOR_OBJS_EXP) $(DUKE3D_MISCDEPS) $(DUKE3D_EDITOR_MISCDEPS) core* ifeq ($(PLATFORM),DARWIN) -rm -rf EDuke32.app Mapster32.app @@ -627,8 +631,4 @@ printdxutils: printsdlutils: echo "$(addsuffix $(EXESUFFIX),$(SDLUTILS))" -rev: - @echo "s_buildRev = \"r$(VC_REV)$(VC_REV_CUSTOM)\";">source/rev.h - -rev_clean: - @$(VC_CLEAN) source/rev.h +rev: $(DUKE3D_OBJ)/rev.$o diff --git a/polymer/eduke32/Makefile.common b/polymer/eduke32/Makefile.common index e20e844d8..9f0d2aca3 100644 --- a/polymer/eduke32/Makefile.common +++ b/polymer/eduke32/Makefile.common @@ -138,20 +138,6 @@ 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 ?= @@ -1000,6 +986,22 @@ ifeq ($(PLATFORM),WII) # -msdata=eabi endif +# Detect version control revision, if applicable +ifeq (,$(VC_REV)) + ifneq (,$(wildcard EDUKE32_REVISION)) + VC_REV := $(shell cat EDUKE32_REVISION) + endif +endif +ifeq (,$(VC_REV)) + VC_REV := $(shell svn info 2>&1 | grep Revision | cut -d' ' -f2) +endif +ifeq (,$(VC_REV)) + VC_REV := $(shell git svn info 2>&1 | grep Revision | cut -d' ' -f2) +endif +ifneq (,$(VC_REV)$(VC_REV_CUSTOM)) + REVFLAG += -DREV="\"r$(VC_REV)$(VC_REV_CUSTOM)\"" +endif + COMPILER=$(CC) $(CONLYFLAGS) LINKER=$(L_CC) ifneq ($(CPLUSPLUS),0) diff --git a/polymer/eduke32/Makefile.deps b/polymer/eduke32/Makefile.deps index 6cded062c..c3a8edb9a 100644 --- a/polymer/eduke32/Makefile.deps +++ b/polymer/eduke32/Makefile.deps @@ -62,7 +62,6 @@ $(DUKE3D_OBJ)/winbits.$o: $(DUKE3D_SRC)/winbits.c $(DUKE3D_OBJ)/osdfuncs.$o: $(DUKE3D_SRC)/names.h $(ENGINE_INC)/build.h $(ENGINE_INC)/osd.h $(DUKE3D_OBJ)/osdcmds.$o: $(DUKE3D_SRC)/osdcmds.c $(DUKE3D_INC)/osdcmds.h $(ENGINE_INC)/osd.h $(duke3d_h) $(DUKE3D_OBJ)/animvpx.$o: $(DUKE3D_SRC)/animvpx.c $(DUKE3D_SRC)/animvpx.h $(duke3d_h) $(ENGINE_INC)/glbuild.h -$(DUKE3D_OBJ)/rev.$o: $(DUKE3D_SRC)/rev.h $(DUKE3D_OBJ)/lunatic_game.$o: $(ENGINE_INC)/lunatic.h $(DUKE3D_SRC)/lunatic/lunatic_game.c $(DUKE3D_SRC)/lunatic/lunatic_game.h $(DUKE3D_SRC)/gamedef.h $(DUKE3D_SRC)/gameexec.h $(ENGINE_INC)/cache1d.h $(ENGINE_INC)/osd.h $(DUKE3D_OBJ)/lunatic_m32.$o: $(ENGINE_INC)/lunatic.h $(DUKE3D_SRC)/lunatic/lunatic_m32.c $(DUKE3D_SRC)/lunatic/lunatic_m32.h $(ENGINE_INC)/cache1d.h $(ENGINE_INC)/osd.h diff --git a/polymer/eduke32/build/include/common.h b/polymer/eduke32/build/include/common.h index 2166d2d5d..cd0bf622f 100644 --- a/polymer/eduke32/build/include/common.h +++ b/polymer/eduke32/build/include/common.h @@ -47,8 +47,14 @@ enum //// EXTERN DECLS extern struct strllist *CommandPaths, *CommandGrps; +#ifdef __cplusplus +extern "C" { +#endif extern const char *s_buildRev; extern const char *s_buildTimestamp; +#ifdef __cplusplus +} +#endif extern const char *s_buildInfo; //// FUNCTIONS diff --git a/polymer/eduke32/platform/osxbuild.sh b/polymer/eduke32/platform/osxbuild.sh index 7cb8f9636..5297f1fd2 100755 --- a/polymer/eduke32/platform/osxbuild.sh +++ b/polymer/eduke32/platform/osxbuild.sh @@ -199,10 +199,7 @@ if [ -z "$rev" ]; then echo "Detected git repository, revision r$rev" fi -if [ -n "$rev" ]; then - # throw the svn revision into a header. this is ugly. - echo "s_buildRev = \"r$rev\";" > source/rev.h -else +if [ -z "$rev" ]; then rev=unknown vc=none fi @@ -372,13 +369,6 @@ if [ $buildmain == 1 ]; then fi fi -# clean up, clean up, everybody everywhere, clean up, clean up, everybody do your share -if [ "$vc" == "svn" ]; then - svn revert "source/rev.h" -elif [ "$vc" == "git" ]; then - git checkout "source/rev.h" -fi - # Duplicating .app bundles for debug build: if [ $builddebug == 1 ] || [ $pack == 1 ]; then for i in Mapster32 EDuke32; do diff --git a/polymer/eduke32/platform/wiibuild.bat b/polymer/eduke32/platform/wiibuild.bat index 824827a0d..1767dd582 100644 --- a/polymer/eduke32/platform/wiibuild.bat +++ b/polymer/eduke32/platform/wiibuild.bat @@ -13,7 +13,6 @@ if not "%rev%"=="" set vc=svn if "%rev%"=="" for /f "delims=" %%G in ('git svn info 2^>^&1 ^| grep Revision ^| cut -d " " -f 2') do @set rev=%%G if not "%rev%"=="" set vc=git if "%rev%"=="" set vc=none -if not "%rev%"=="" echo s_buildRev = "r%rev%";>source\rev.h if "%rev%"=="" set rev=XXXX :: Get the current date: @@ -43,9 +42,5 @@ xcopy /e /q /y /EXCLUDE:%wiidir%\xcopy_exclude.txt package\sdk apps\mapster32\ :end -:: Clean up revision number: -if "%vc%"=="svn" svn revert source\rev.h -if "%vc%"=="git" git checkout source\rev.h - endlocal goto :eof diff --git a/polymer/eduke32/source/rev.c b/polymer/eduke32/source/rev.c index 6affa46c6..055653f00 100644 --- a/polymer/eduke32/source/rev.c +++ b/polymer/eduke32/source/rev.c @@ -1,6 +1,14 @@ -// This file's main purpose is to be recompiled whenever the Makefile slams rev.h (usually always) so the timestamp gets updated, even for a partial recompile. +// This file's main purpose is to be recompiled unconditionally so the timestamp gets updated, even for a partial recompile. -const char * - #include "rev.h" +#if !defined REV +# define REV "r(?)" +#endif +#ifdef __cplusplus +extern "C" { +#endif +const char* s_buildRev = REV; const char* s_buildTimestamp = __DATE__ " " __TIME__; +#ifdef __cplusplus +} +#endif diff --git a/polymer/eduke32/source/rev.h b/polymer/eduke32/source/rev.h deleted file mode 100644 index bc3ea3e89..000000000 --- a/polymer/eduke32/source/rev.h +++ /dev/null @@ -1 +0,0 @@ -s_buildRev = "rXXXX";