1
0
mirror of https://github.com/cc65/cc65.git synced 2024-12-25 02:29:52 +00:00

Finetuned Git commit hash retrieval.

- Force usage of shell wrapper in order to allow to suppress potential message about git not found (thanks to Greg King).
- Do $(info GIT_SHA ...) only if there's something special - as done with the other $(info ...).
This commit is contained in:
Oliver Schmidt 2014-03-27 21:40:28 +01:00
parent 986c2248e2
commit c9438ae1a7

View File

@ -27,6 +27,17 @@ LD65_LIB = $(datadir)/lib
LD65_OBJ = $(datadir)/lib
LD65_CFG = $(datadir)/cfg
ifdef CMD_EXE
NULLDEV = nul:
DIRLIST = $(strip $(foreach dir,$1,$(wildcard $(dir))))
MKDIR = mkdir $(subst /,\,$1)
RMDIR = $(if $(DIRLIST),rmdir /s /q $(subst /,\,$(DIRLIST)))
else
NULLDEV = /dev/nul
MKDIR = mkdir -p $1
RMDIR = $(RM) -r $1
endif
CC = $(CROSS_COMPILE)gcc
AR = $(CROSS_COMPILE)ar
@ -39,13 +50,15 @@ ifdef USER_CFLAGS
$(info USER_CFLAGS: $(USER_CFLAGS))
endif
ifndef GIT_SHA
GIT_SHA := $(if $(wildcard ../.git),$(shell git rev-parse --short HEAD))
ifdef GIT_SHA
$(info GIT_SHA: $(GIT_SHA))
else
GIT_SHA := $(shell git rev-parse --short HEAD 2>$(NULLDEV))
ifneq ($(words $(GIT_SHA)),1)
GIT_SHA := N/A
$(info GIT_SHA: N/A)
endif
endif
$(info GIT_SHA: $(GIT_SHA))
CFLAGS += -MMD -MP -O -I common \
-Wall -Wextra -Wno-char-subscripts $(USER_CFLAGS) \
@ -62,15 +75,6 @@ ifdef CROSS_COMPILE
EXE_SUFFIX=.exe
endif
ifdef CMD_EXE
DIRLIST = $(strip $(foreach dir,$1,$(wildcard $(dir))))
MKDIR = mkdir $(subst /,\,$1)
RMDIR = $(if $(DIRLIST),rmdir /s /q $(subst /,\,$(DIRLIST)))
else
MKDIR = mkdir -p $1
RMDIR = $(RM) -r $1
endif
all bin: $(PROGS)
mostlyclean: