Always rebuild version.cpp when there is git version change (nw)

This commit is contained in:
Miodrag Milanovic 2016-04-16 17:17:30 +02:00
parent 37718e8602
commit 3e8559ad7b
3 changed files with 18 additions and 24 deletions

View File

@ -876,6 +876,17 @@ ifeq ($(wildcard .git/*),)
PARAMS += --IGNORE_GIT='1'
endif
ifeq ($(GIT_AVAILABLE),git)
NEW_GIT_VERSION := $(shell git describe)
OLD_GIT_VERSION := $(shell cat .mame_version)
ifneq ($(NEW_GIT_VERSION),$(OLD_GIT_VERSION))
$(shell git describe > .mame_version)
$(shell touch $(SRC)/version.cpp)
endif
endif
GENIE := 3rdparty/genie/bin/$(GENIEOS)/genie$(EXE)
ifeq ($(TARGET),$(SUBTARGET))

View File

@ -362,15 +362,6 @@ newoption {
description = "List of sources to compile.",
}
newoption {
trigger = "FORCE_VERSION_COMPILE",
description = "Force compiling of version.c file.",
allowed = {
{ "0", "Disabled" },
{ "1", "Enabled" },
}
}
newoption {
trigger = "PLATFORM",
description = "Target machine platform (x86,arm,...)",
@ -530,14 +521,13 @@ if (_OPTIONS["SOURCES"] == nil) then
end
if _OPTIONS["IGNORE_GIT"]~="1" then
GIT_VERSION = backtick( "git rev-parse --short HEAD" )
GIT_VERSION_RELEASE = backtick( "git rev-list --tags --max-count=1" )
GIT_VERSION_LASTONE = backtick( "git rev-list --max-count=1 HEAD" )
if (GIT_VERSION_RELEASE ~= GIT_VERSION_LASTONE) then
defines {
"GIT_VERSION=" .. GIT_VERSION,
}
if _OPTIONS["IGNORE_GIT"]~="1" then
GIT_VERSION = backtick( "git describe" )
local p = string.find(GIT_VERSION, '-', 1)
if (p~=nil) then
defines {
"GIT_VERSION=" .. string.sub(GIT_VERSION,p+1)
}
end
end

View File

@ -321,13 +321,6 @@ if (_OPTIONS["SOURCES"] ~= nil) then
}
end
if _OPTIONS["FORCE_VERSION_COMPILE"]=="1" then
configuration { "gmake" }
dependency {
{ ".PHONY", ".FORCE", true },
{ "$(OBJDIR)/src/version.o", ".FORCE", true },
}
end
configuration { "mingw*" }
custombuildtask {
{ MAME_DIR .. "src/version.cpp" , GEN_DIR .. "resource/" .. rctarget .. "vers.rc", { MAME_DIR .. "scripts/build/verinfo.py" }, {"@echo Emitting " .. rctarget .. "vers.rc" .. "...", PYTHON .. " $(1) -r -b " .. rctarget .. " $(<) > $(@)" }},