Makefile: honor BUILD_VERSION and BUILD_TAG

Use BUILD_VERSION an BUILD_TAG variable also for hypervisor,
acrnprobe and crashlog. This eases build from an archive without
git available.

Tracked-On: #6035
Signed-off-by: Helmut Buchsbaum <helmut.buchsbaum@opensource.tttech-industrial.com>
This commit is contained in:
Helmut Buchsbaum 2020-04-27 12:51:27 +02:00 committed by wenlingz
parent 596f27bad3
commit b673bc36b1
3 changed files with 23 additions and 10 deletions

View File

@ -472,10 +472,15 @@ distclean:
PHONY: (VERSION)
$(VERSION): $(HV_CONFIG_H)
touch $(VERSION)
@COMMIT=`git rev-parse --verify --short HEAD 2>/dev/null`;\
DIRTY=`git diff-index --name-only HEAD`;\
if [ -n "$$DIRTY" ];then PATCH="$$COMMIT-dirty";else PATCH="$$COMMIT";fi;\
DAILY_TAG=`git tag --merged HEAD|grep "acrn"|tail -n 1`;\
@if [ "$(BUILD_VERSION)"x = x -o "$(BUILD_TAG)"x = x ];then \
COMMIT=`git rev-parse --verify --short HEAD 2>/dev/null`;\
DIRTY=`git diff-index --name-only HEAD`;\
if [ -n "$$DIRTY" ];then PATCH="$$COMMIT-dirty";else PATCH="$$COMMIT";fi;\
DAILY_TAG=`git tag --merged HEAD|grep "acrn"|tail -n 1`;\
else \
PATCH="$(BUILD_VERSION)"; \
DAILY_TAG="$(BUILD_TAG)"; \
fi; \
TIME=$$(date -u -d "@$${SOURCE_DATE_EPOCH:-$$(date +%s)}" "+%F %T"); \
USER="$${USER:-$$(id -u -n)}"; \
if [ x$(CONFIG_RELEASE) = "xy" ];then BUILD_TYPE="REL";else BUILD_TYPE="DBG";fi;\

View File

@ -63,9 +63,13 @@ $(VERSION_H):
mkdir -p $(BUILDDIR)/include/acrnprobe ; \
fi
touch $(VERSION_H)
@COMMIT=`git log -1 --pretty=format:%h . 2>/dev/null`;\
DIRTY=`git diff --name-only $(CURDIR)`;\
if [ -n "$$DIRTY" ];then PATCH="$$COMMIT-dirty";else PATCH="$$COMMIT";fi;\
@if [ "$(BUILD_VERSION)"x = x ];then \
COMMIT=`git log -1 --pretty=format:%h . 2>/dev/null`;\
DIRTY=`git diff --name-only $(CURDIR)`;\
if [ -n "$$DIRTY" ];then PATCH="$$COMMIT-dirty";else PATCH="$$COMMIT";fi;\
else \
PATCH="$(BUILD_VERSION)"; \
fi; \
TIME=$$(date -u -d "@$${SOURCE_DATE_EPOCH:-$$(date +%s)}" "+%Y-%m-%d %H:%M:%S"); \
USER="$${USER:-$$(id -u -n)}"; \
cat $(CURDIR)/../license_header > $(VERSION_H);\

View File

@ -42,9 +42,13 @@ $(VERSION_H):
mkdir -p $(BUILDDIR)/include/usercrash ; \
fi
touch $(VERSION_H)
@COMMIT=`git log -1 --pretty=format:%h . 2>/dev/null`;\
DIRTY=`git diff --name-only $(CURDIR)`;\
if [ -n "$$DIRTY" ];then PATCH="$$COMMIT-dirty";else PATCH="$$COMMIT";fi;\
@if [ "$(BUILD_VERSION)"x = x ];then \
COMMIT=`git log -1 --pretty=format:%h . 2>/dev/null`;\
DIRTY=`git diff --name-only $(CURDIR)`;\
if [ -n "$$DIRTY" ];then PATCH="$$COMMIT-dirty";else PATCH="$$COMMIT";fi;\
else \
PATCH="$(BUILD_VERSION)"; \
fi; \
TIME=$$(date -u -d "@$${SOURCE_DATE_EPOCH:-$$(date +%s)}" "+%Y-%m-%d %H:%M:%S"); \
USER="$${USER:-$$(id -u -n)}"; \
cat $(CURDIR)/../license_header > $(VERSION_H);\