Nuke rev.h.

Note to MSVC users: You can get the revision number if you run `make rev o=obj` with MinGW before you build.

DONT_BUILD.

git-svn-id: https://svn.eduke32.com/eduke32@4565 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
hendricks266 2014-07-28 08:59:58 +00:00
parent b0e82d4264
commit 9a4a4a627b
8 changed files with 42 additions and 43 deletions

View file

@ -346,11 +346,11 @@ DUKE3D_EDITOR_OBJS_EXP:=$(addprefix $(DUKE3D_OBJ)/,$(addsuffix .$o,$(DUKE3D_EDIT
ifeq ($(PRETTY_OUTPUT),1) ifeq ($(PRETTY_OUTPUT),1)
.SILENT: .SILENT:
endif 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 # TARGETS
all: start $(DO_REV) $(EDUKE32_TARGET) $(MAPSTER32_TARGET) finish all: start $(EDUKE32_TARGET) $(MAPSTER32_TARGET) finish
ifneq (,$(EDUKE32_TARGET)) ifneq (,$(EDUKE32_TARGET))
@ls -l $(EDUKE32) @ls -l $(EDUKE32)
endif endif
@ -565,6 +565,10 @@ $(DUKE3D_OBJ)/%.$o: $(DUKE3D_SRC)/%.c | $(DUKE3D_OBJ)
$(COMPILE_STATUS) $(COMPILE_STATUS)
$(RECIPE_IF) $(COMPILER) $(COMMONFLAGS) $(COMPILERFLAGS) $(DUKE3D_CFLAGS) -c $< -o $@ $(RECIPE_RESULT_COMPILE) $(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) $(DUKE3D_OBJ)/%.$o: $(DUKE3D_SRC)/util/%.c | $(DUKE3D_OBJ)
$(COMPILE_STATUS) $(COMPILE_STATUS)
$(RECIPE_IF) $(COMPILER) $(COMMONFLAGS) $(COMPILERFLAGS) $(DUKE3D_CFLAGS) -c $< -o $@ $(RECIPE_RESULT_COMPILE) $(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 # 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* -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) ifeq ($(PLATFORM),DARWIN)
-rm -rf EDuke32.app Mapster32.app -rm -rf EDuke32.app Mapster32.app
@ -627,8 +631,4 @@ printdxutils:
printsdlutils: printsdlutils:
echo "$(addsuffix $(EXESUFFIX),$(SDLUTILS))" echo "$(addsuffix $(EXESUFFIX),$(SDLUTILS))"
rev: rev: $(DUKE3D_OBJ)/rev.$o
@echo "s_buildRev = \"r$(VC_REV)$(VC_REV_CUSTOM)\";">source/rev.h
rev_clean:
@$(VC_CLEAN) source/rev.h

View file

@ -138,20 +138,6 @@ ifndef SUBPLATFORM
endif endif
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: # Binary suffix override:
EXESUFFIX_OVERRIDE ?= EXESUFFIX_OVERRIDE ?=
@ -1000,6 +986,22 @@ ifeq ($(PLATFORM),WII)
# -msdata=eabi # -msdata=eabi
endif 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) COMPILER=$(CC) $(CONLYFLAGS)
LINKER=$(L_CC) LINKER=$(L_CC)
ifneq ($(CPLUSPLUS),0) ifneq ($(CPLUSPLUS),0)

View file

@ -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)/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)/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)/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_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 $(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

View file

@ -47,8 +47,14 @@ enum
//// EXTERN DECLS //// EXTERN DECLS
extern struct strllist *CommandPaths, *CommandGrps; extern struct strllist *CommandPaths, *CommandGrps;
#ifdef __cplusplus
extern "C" {
#endif
extern const char *s_buildRev; extern const char *s_buildRev;
extern const char *s_buildTimestamp; extern const char *s_buildTimestamp;
#ifdef __cplusplus
}
#endif
extern const char *s_buildInfo; extern const char *s_buildInfo;
//// FUNCTIONS //// FUNCTIONS

View file

@ -199,10 +199,7 @@ if [ -z "$rev" ]; then
echo "Detected git repository, revision r$rev" echo "Detected git repository, revision r$rev"
fi fi
if [ -n "$rev" ]; then if [ -z "$rev" ]; then
# throw the svn revision into a header. this is ugly.
echo "s_buildRev = \"r$rev\";" > source/rev.h
else
rev=unknown rev=unknown
vc=none vc=none
fi fi
@ -372,13 +369,6 @@ if [ $buildmain == 1 ]; then
fi fi
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: # Duplicating .app bundles for debug build:
if [ $builddebug == 1 ] || [ $pack == 1 ]; then if [ $builddebug == 1 ] || [ $pack == 1 ]; then
for i in Mapster32 EDuke32; do for i in Mapster32 EDuke32; do

View file

@ -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 "%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 not "%rev%"=="" set vc=git
if "%rev%"=="" set vc=none if "%rev%"=="" set vc=none
if not "%rev%"=="" echo s_buildRev = "r%rev%";>source\rev.h
if "%rev%"=="" set rev=XXXX if "%rev%"=="" set rev=XXXX
:: Get the current date: :: Get the current date:
@ -43,9 +42,5 @@ xcopy /e /q /y /EXCLUDE:%wiidir%\xcopy_exclude.txt package\sdk apps\mapster32\
:end :end
:: Clean up revision number:
if "%vc%"=="svn" svn revert source\rev.h
if "%vc%"=="git" git checkout source\rev.h
endlocal endlocal
goto :eof goto :eof

View file

@ -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 * #if !defined REV
#include "rev.h" # define REV "r(?)"
#endif
#ifdef __cplusplus
extern "C" {
#endif
const char* s_buildRev = REV;
const char* s_buildTimestamp = __DATE__ " " __TIME__; const char* s_buildTimestamp = __DATE__ " " __TIME__;
#ifdef __cplusplus
}
#endif

View file

@ -1 +0,0 @@
s_buildRev = "rXXXX";