common.mk: Consider possibility that not building inside a git checkout

This commit is contained in:
Angus Gratton 2016-02-17 15:51:46 +11:00
parent 71a2eb7b85
commit e12077513f

View file

@ -131,7 +131,10 @@ else
LDFLAGS += -g -O2
endif
GITSHORTREV=\"$(shell cd $(ROOT); git rev-parse --short -q HEAD)\"
GITSHORTREV=\"$(shell cd $(ROOT); git rev-parse --short -q HEAD 2> /dev/null)\"
ifeq ($(GITSHORTREV),\"\")
GITSHORTREV="\"(nogit)\"" # (same length as a short git hash)
endif
CPPFLAGS += -DGITSHORTREV=$(GITSHORTREV)
ifeq ($(OTA),0)