1
0
mirror of https://github.com/cc65/cc65.git synced 2024-12-26 08:32:00 +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_OBJ = $(datadir)/lib
LD65_CFG = $(datadir)/cfg 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 CC = $(CROSS_COMPILE)gcc
AR = $(CROSS_COMPILE)ar AR = $(CROSS_COMPILE)ar
@ -39,13 +50,15 @@ ifdef USER_CFLAGS
$(info USER_CFLAGS: $(USER_CFLAGS)) $(info USER_CFLAGS: $(USER_CFLAGS))
endif endif
ifndef GIT_SHA ifdef GIT_SHA
GIT_SHA := $(if $(wildcard ../.git),$(shell git rev-parse --short HEAD)) $(info GIT_SHA: $(GIT_SHA))
else
GIT_SHA := $(shell git rev-parse --short HEAD 2>$(NULLDEV))
ifneq ($(words $(GIT_SHA)),1) ifneq ($(words $(GIT_SHA)),1)
GIT_SHA := N/A GIT_SHA := N/A
$(info GIT_SHA: N/A)
endif endif
endif endif
$(info GIT_SHA: $(GIT_SHA))
CFLAGS += -MMD -MP -O -I common \ CFLAGS += -MMD -MP -O -I common \
-Wall -Wextra -Wno-char-subscripts $(USER_CFLAGS) \ -Wall -Wextra -Wno-char-subscripts $(USER_CFLAGS) \
@ -62,15 +75,6 @@ ifdef CROSS_COMPILE
EXE_SUFFIX=.exe EXE_SUFFIX=.exe
endif 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) all bin: $(PROGS)
mostlyclean: mostlyclean: