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
This commit is contained in:
hendricks266 2014-02-22 08:02:41 +00:00
parent 0df08d2204
commit 14db3b178d
5 changed files with 35 additions and 10 deletions

View file

@ -350,7 +350,7 @@ endif
UTILOBJS=$(OBJ)/ivfrate.$o UTILOBJS=$(OBJ)/ivfrate.$o
UTILS=ivfrate$(EXESUFFIX) UTILS=ivfrate$(EXESUFFIX)
all: start $(EDUKE32_TARGET) $(MAPSTER32_TARGET) finish all: start $(DO_REV) $(EDUKE32_TARGET) $(MAPSTER32_TARGET) finish
ifneq (,$(EDUKE32_TARGET)) ifneq (,$(EDUKE32_TARGET))
@ls -l $(EDUKE32) @ls -l $(EDUKE32)
endif endif
@ -552,7 +552,7 @@ $(RSRC)/editor_banner.c: $(RSRC)/build.bmp
# PHONIES # PHONIES
clean: clean: $(UNDO_REV)
-rm -f $(OBJ)/* $(EDUKE32) $(EDUKE32).memmap $(MAPSTER32) $(MAPSTER32).memmap core* && $(MAKE) -C $(JAUDIOLIBDIR) clean && $(MAKE) -C $(ENETDIR) clean -rm -f $(OBJ)/* $(EDUKE32) $(EDUKE32).memmap $(MAPSTER32) $(MAPSTER32).memmap core* && $(MAKE) -C $(JAUDIOLIBDIR) clean && $(MAKE) -C $(ENETDIR) clean
ifeq ($(PLATFORM),DARWIN) ifeq ($(PLATFORM),DARWIN)
-rm -rf EDuke32.app Mapster32.app -rm -rf EDuke32.app Mapster32.app
@ -568,3 +568,9 @@ veryclean: clean cleanutils
printutils: printutils:
echo "$(UTILS)" echo "$(UTILS)"
rev:
@echo "s_buildRev = \"r$(VC_REV)$(VC_REV_CUSTOM)\";">source/rev.h
rev_clean:
@$(VC_CLEAN) source/rev.h

View file

@ -115,7 +115,19 @@ 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 ?=

View file

@ -36,7 +36,7 @@ gamedef_h=$(SRC)/gamedef.h $(SRC)/gameexec.h $(SRC)/gamevars.h
game_defs_dep=$(SRC)/lunatic/defs.ilua 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)/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)/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 $(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)/gameexec.$o: $(SRC)/gameexec.c $(SRC)/gamestructures.c $(duke3d_h) $(gamedef_h)
$(OBJ)/gamestructures.$o: $(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)/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)/input.$o: $(SRC)/input.c $(duke3d_h) $(SRC)/input.h
$(OBJ)/mdump.$o: $(SRC)/mdump.cpp $(SRC)/mdump.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 $(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)/names.h \
$(SRC)/mapster32.h \ $(SRC)/mapster32.h \
$(SRC)/keys.h \ $(SRC)/keys.h \
$(m32_script_hs) $(m32_script_hs) \
$(SRC)/rev.h
$(OBJ)/sounds_mapster32.$o: $(SRC)/sounds_mapster32.c \ $(OBJ)/sounds_mapster32.$o: $(SRC)/sounds_mapster32.c \
$(SRC)/sounds_mapster32.h \ $(SRC)/sounds_mapster32.h \
$(SRC)/sounds_common.h \ $(SRC)/sounds_common.h \

View file

@ -8883,8 +8883,14 @@ int32_t ExtPreInit(int32_t argc,const char **argv)
#else #else
" (32-bit)" " (32-bit)"
#endif #endif
#if defined (_MSC_VER) || defined(__cplusplus)
#ifdef _MSC_VER
" MSVC"
#endif
#ifdef __cplusplus #ifdef __cplusplus
" C++ build" " C++"
#endif
" build"
#endif #endif
"\n", VERSION, s_buildRev); "\n", VERSION, s_buildRev);
initprintf("Compiled %s\n", __DATE__ " " __TIME__); initprintf("Compiled %s\n", __DATE__ " " __TIME__);

View file

@ -127,9 +127,6 @@ then
cd $top/$source 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) # get the date in the YYYYMMDD format (ex: 20091001)
date=`date +%Y%m%d` date=`date +%Y%m%d`
@ -246,6 +243,9 @@ then
echo svn update -r $head echo svn update -r $head
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 # export the source tree into the output directory
svn export . $output/$date-$head/${basename}_$date-$head svn export . $output/$date-$head/${basename}_$date-$head
echo svn export . $output/$date-$head/${basename}_$date-$head echo svn export . $output/$date-$head/${basename}_$date-$head