tools: acrn-crashlog: version control patch for binaries

This patch is the version control patch for the binaries
of acrn-crashlog.

Signed-off-by: CHEN Gang <gang.c.chen@intel.com>
Reviewed-by: Zhang Yanmin <yanmin.zhang@intel.com>
Reviewed-by: Liu Chuansheng <chuansheng.liu@intel.com>
Reviewed-by: Zhao Yakui <yakui.zhao@intel.com>
Reviewed-by: Geoffroy Van Cutsem <geoffroy.vancutsem@intel.com>
Acked-by: Eddie Dong <Eddie.dong@intel.com>
This commit is contained in:
CHEN Gang
2018-05-16 06:47:04 +00:00
committed by lijinxia
parent 047ffc3f92
commit d4b4c03cde
7 changed files with 65 additions and 7 deletions

View File

@@ -1,3 +1,6 @@
MAJOR_VERSION=1
MINOR_VERSION=0
BASEDIR := $(shell pwd)
LIBS = -lpthread -lxml2 -lcrypto -lrt -lsystemd -ltelemetry
@@ -10,7 +13,7 @@ LDFLAGS += $(LIBS) -Wl,--gc-sections
TARGET = $(BUILDDIR)/acrnprobe/bin/acrnprobe
all: check_dirs $(TARGET)
all: include/version.h check_dirs $(TARGET)
$(BUILDDIR)/acrnprobe/obj/%.o:%.c
$(CC) -c $(CFLAGS) $< -o $@
@@ -35,6 +38,9 @@ $(BUILDDIR)/acrnprobe/bin/acrnprobe: $(BUILDDIR)/acrnprobe/obj/main.o \
clean:
@echo "Clean objects and binaries"
@if [ -e include/version.h ]; then \
$(RM) -f include/version.h; \
fi
@if [ -d $(BUILDDIR)/acrnprobe/obj ]; then \
find $(BUILDDIR)/acrnprobe/obj -name "*.o" -exec $(RM) {} \; 2>&1 || exit 0; \
fi
@@ -45,6 +51,19 @@ clean:
$(RM) -r $(BUILDDIR)/acrnprobe/obj ; \
fi
include/version.h:
touch include/version.h
@COMMIT=`git log -1 --pretty=format:%h . 2>/dev/null`;\
DIRTY=`git diff --name-only $(BASEDIR)`;\
if [ -n "$$DIRTY" ];then PATCH="$$COMMIT-dirty";else PATCH="$$COMMIT";fi;\
TIME=`date "+%Y-%m-%d %H:%M:%S"`;\
cat $(BASEDIR)/../license_header > include/version.h;\
echo "#define AP_MAJOR_VERSION $(MAJOR_VERSION)" >> include/version.h;\
echo "#define AP_MINOR_VERSION $(MINOR_VERSION)" >> include/version.h;\
echo "#define AP_BUILD_VERSION "\""$$PATCH"\""" >> include/version.h;\
echo "#define AP_BUILD_TIME "\""$$TIME"\""" >> include/version.h;\
echo "#define AP_BUILD_USER "\""$(USER)"\""" >> include/version.h
check_dirs:
@if [ ! -d $(BUILDDIR)/acrnprobe/bin ]; then \
mkdir -p $(BUILDDIR)/acrnprobe/bin ; \