summaryrefslogtreecommitdiffstatshomepage
path: root/makefile
diff options
context:
space:
mode:
author Vas Crabb <vas@vastheman.com>2016-06-10 00:36:29 +1000
committer Vas Crabb <vas@vastheman.com>2016-06-10 00:36:29 +1000
commit93cd0cd40bae01b637132542a93ddbb297d2b0d6 (patch)
treed98d7b4054c8052206c0280e3c101034e587b729 /makefile
parentebd8e7d74b798ee0c7dc2232d72c13b0d51e1fe4 (diff)
Fix git version [Vas Crabb]
* git version is set by top-level make, not just when GENie runs * can set IGNORE_GIT=1 for make to ignore git * git ignored/unavailable uses "unknown" in version string * mark modified trees as dirty * note that version now comes from makefile
Diffstat (limited to 'makefile')
-rw-r--r--makefile47
1 files changed, 34 insertions, 13 deletions
diff --git a/makefile b/makefile
index 89840ad2f9d..c8f64b998dc 100644
--- a/makefile
+++ b/makefile
@@ -15,6 +15,7 @@
# REGENIE = 1
# VERBOSE = 1
# NOWERROR = 1
+# IGNORE_GIT = 1
# TARGET = mame
# SUBTARGET = tiny
@@ -893,26 +894,19 @@ $(error Python is not available in path)
endif
ifneq ($(GIT_AVAILABLE),git)
-PARAMS += --IGNORE_GIT='1'
+ IGNORE_GIT := 1
endif
ifeq ($(wildcard .git/*),)
-PARAMS += --IGNORE_GIT='1'
+ IGNORE_GIT := 1
endif
-ifeq ($(GIT_AVAILABLE),git)
-NEW_GIT_VERSION := $(shell git describe)
-ifeq (posix,$(SHELLTYPE))
-OLD_GIT_VERSION := $(shell cat .mame_version 2> /dev/null)
+OLD_GIT_VERSION := $(file <$(GENDIR)/git_desc)
+ifneq ($(IGNORE_GIT),1)
+NEW_GIT_VERSION := $(shell git describe --dirty)
else
-OLD_GIT_VERSION := $(shell cat .mame_version 2> NUL)
-endif
-ifneq ($(NEW_GIT_VERSION),$(OLD_GIT_VERSION))
-$(shell git describe > .mame_version)
-$(shell touch $(SRC)/version.cpp)
-endif
+NEW_GIT_VERSION := unknown
endif
-
GENIE := 3rdparty/genie/bin/$(GENIEOS)/genie$(EXE)
ifeq ($(TARGET),$(SUBTARGET_FULL))
@@ -1463,6 +1457,7 @@ genie: $(GENIE)
generate: \
genie \
$(GEN_FOLDERS) \
+ $(GENDIR)/version.cpp \
$(patsubst %.po,%.mo,$(call rwildcard, language/, *.po)) \
$(patsubst $(SRC)/%.lay,$(GENDIR)/%.lh,$(LAYOUTS)) \
$(GENDIR)/mame/drivers/ymmu100.hxx \
@@ -1473,6 +1468,32 @@ $(GENDIR)/includes/SDL2:
-$(call MKDIR,$@)
-$(call COPY,3rdparty/SDL2/include/,$(GENDIR)/includes/SDL2)
+ifneq ($(NEW_GIT_VERSION),$(OLD_GIT_VERSION))
+stale:
+
+.PHONY: stale
+
+$(GENDIR)/git_desc: stale | $(GEN_FOLDERS)
+ @echo $(NEW_GIT_VERSION) > $@
+endif
+
+ifeq (posix,$(SHELLTYPE))
+$(GENDIR)/version.cpp: $(GENDIR)/git_desc | $(GEN_FOLDERS)
+ @echo '#define BARE_BUILD_VERSION "0.174"' > $@
+ @echo 'extern const char bare_build_version[];' >> $@
+ @echo 'extern const char build_version[];' >> $@
+ @echo 'const char bare_build_version[] = BARE_BUILD_VERSION;' >> $@
+ @echo 'const char build_version[] = BARE_BUILD_VERSION " ($(NEW_GIT_VERSION))";' >> $@
+else
+$(GENDIR)/version.cpp: $(GENDIR)/git_desc
+ @echo \#define BARE_BUILD_VERSION "0.174" > $@
+ @echo extern const char bare_build_version[]; >> $@
+ @echo extern const char build_version[]; >> $@
+ @echo const char bare_build_version[] = BARE_BUILD_VERSION; >> $@
+ @echo const char build_version[] = BARE_BUILD_VERSION " ($(NEW_GIT_VERSION))"; >> $@
+endif
+
+
$(GENDIR)/%.lh: $(SRC)/%.lay scripts/build/complay.py | $(GEN_FOLDERS)
@echo Compressing $<...
$(SILENT)$(PYTHON) scripts/build/complay.py $< $@ layout_$(basename $(notdir $<))