]> git.sur5r.net Git - cc65/blobdiff - src/Makefile
Merge remote-tracking branch 'upstream/master' into a5200
[cc65] / src / Makefile
index 17754190c501bc38a065c0e53c0dc419ae8201e4..2c2267ae78b76605181926c0769829a350ddb325 100644 (file)
@@ -39,9 +39,17 @@ ifdef USER_CFLAGS
   $(info USER_CFLAGS: $(USER_CFLAGS))
 endif
 
+ifndef GIT_SHA
+  GIT_SHA := $(if $(wildcard ../.git),$(shell git rev-parse --short HEAD))
+  ifneq ($(words $(GIT_SHA)),1)
+    GIT_SHA := N/A
+  endif
+endif
+$(info GIT_SHA: $(GIT_SHA))
+
 CFLAGS += -MMD -MP -O -I common \
           -Wall -Wextra -Wno-char-subscripts $(USER_CFLAGS) \
-          -DCA65_INC=$(CA65_INC) -DCC65_INC=$(CC65_INC) \
+          -DGIT_SHA=$(GIT_SHA) -DCA65_INC=$(CA65_INC) -DCC65_INC=$(CC65_INC) \
           -DLD65_LIB=$(LD65_LIB) -DLD65_OBJ=$(LD65_OBJ) -DLD65_CFG=$(LD65_CFG)
 
 LDLIBS += -lm