From 5a1904fd93fb278f657bfae7e101ec17625870ee Mon Sep 17 00:00:00 2001 From: Adam Saponara Date: Tue, 16 Apr 2024 12:10:42 -0400 Subject: [PATCH] Auto-add COMMIT if building from git repo --- Makefile | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Makefile b/Makefile index b07d5e5..15a1d23 100644 --- a/Makefile +++ b/Makefile @@ -15,6 +15,7 @@ php_path?=php sinclude config.mk has_phpconf := $(shell command -v php-config >/dev/null 2>&1 && echo :) +git_sha := $(shell test -d .git && command -v git >/dev/null && git rev-parse --short HEAD) ifdef USE_ZEND $(or $(has_phpconf), $(error Need php-config)) @@ -24,6 +25,8 @@ endif ifdef COMMIT phpspy_defines:=$(phpspy_defines) -DCOMMIT=$(COMMIT) +else ifneq ($(git_sha),) + phpspy_defines:=$(phpspy_defines) -DCOMMIT=$(git_sha) endif all: phpspy