Do not croak when git is not available

targets.mk: if no .git directory is present, assume that Git is
	not available.  Make ORGVERSION, GITVERSION and GITSTATUS
	customizable from local.mk (override from command line is also
	possible and probably easier)
This commit is contained in:
Achim Gratz 2012-01-02 21:24:36 +01:00
parent 24fa46a9e5
commit 6ec5f30165
1 changed files with 13 additions and 8 deletions

View File

@ -3,15 +3,20 @@
DISTFILES_extra= Makefile request-assign-future.txt contrib etc
.EXPORT_ALL_VARIABLES:
LISPDIRS = lisp
SUBDIRS = doc etc $(LISPDIRS)
INSTSUB = $(SUBDIRS:%=install-%)
LISPDIRS = lisp
SUBDIRS = doc etc $(LISPDIRS)
INSTSUB = $(SUBDIRS:%=install-%)
GITVERSION = $(shell git describe --abbrev=6 HEAD)
ORGVERSION = $(subst release_,,$(shell git describe --abbrev=0 HEAD))
GITSTATUS = $(shell git status -uno --porcelain)
DATE = $(shell date +%Y-%m-%d)
ifneq ("$(GITSTATUS)", "")
ifneq ($(wildcard .git),)
GITVERSION ?= $(shell git describe --abbrev=6 HEAD)
ORGVERSION ?= $(subst release_,,$(shell git describe --abbrev=0 HEAD))
GITSTATUS ?= $(shell git status -uno --porcelain)
else
GITVERSION ?= N/A
ORGVERSION ?= N/A
endif
DATE = $(shell date +%Y-%m-%d)
ifneq ($(GITSTATUS),)
GITVERSION := $(GITVERSION).dirty
endif