mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2026-06-08 18:14:53 +00:00
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:
@@ -1,4 +1,7 @@
|
||||
all: check_obj usercrash_s usercrash_c debugger
|
||||
MAJOR_VERSION=1
|
||||
MINOR_VERSION=0
|
||||
|
||||
all: include/version.h check_obj usercrash_s usercrash_c debugger
|
||||
|
||||
CURRDIR := $(shell pwd)
|
||||
INCLUDE += -I $(CURRDIR)/include/
|
||||
@@ -30,6 +33,19 @@ debugger: $(BUILDDIR)/usercrash/obj/debugger.o \
|
||||
$(BUILDDIR)/usercrash/obj/%.o:%.c
|
||||
$(CC) $(CFLAGS) $(INCLUDE) -o $@ -c $<
|
||||
|
||||
include/version.h:
|
||||
touch include/version.h
|
||||
@COMMIT=`git log -1 --pretty=format:%h . 2>/dev/null`;\
|
||||
DIRTY=`git diff --name-only $(CURRDIR)`;\
|
||||
if [ -n "$$DIRTY" ];then PATCH="$$COMMIT-dirty";else PATCH="$$COMMIT";fi;\
|
||||
TIME=`date "+%Y-%m-%d %H:%M:%S"`;\
|
||||
cat $(CURRDIR)/../license_header > include/version.h;\
|
||||
echo "#define UC_MAJOR_VERSION $(MAJOR_VERSION)" >> include/version.h;\
|
||||
echo "#define UC_MINOR_VERSION $(MINOR_VERSION)" >> include/version.h;\
|
||||
echo "#define UC_BUILD_VERSION "\""$$PATCH"\""" >> include/version.h;\
|
||||
echo "#define UC_BUILD_TIME "\""$$TIME"\""" >> include/version.h;\
|
||||
echo "#define UC_BUILD_USER "\""$(USER)"\""" >> include/version.h
|
||||
|
||||
check_obj:
|
||||
@if [ ! -d $(BUILDDIR)/usercrash/bin ]; then \
|
||||
mkdir -p $(BUILDDIR)/usercrash/bin ; \
|
||||
@@ -41,6 +57,9 @@ check_obj:
|
||||
.PHONY:clean
|
||||
clean:
|
||||
@echo "Clean objects and binaries"
|
||||
@if [ -e include/version.h ]; then \
|
||||
$(RM) -f include/version.h; \
|
||||
fi
|
||||
@if [ -d $(BUILDDIR)/usercrash/obj ]; then \
|
||||
find $(BUILDDIR)/usercrash/obj -name "*.o" -exec $(RM) {} \; 2>&1 || exit 0; \
|
||||
fi
|
||||
|
||||
@@ -30,6 +30,7 @@
|
||||
#include "packet.h"
|
||||
#include "log_sys.h"
|
||||
#include "protocol.h"
|
||||
#include "version.h"
|
||||
|
||||
/**
|
||||
* Usercrash works as C/S model: usercrash_c works as usercrash client to
|
||||
@@ -185,7 +186,10 @@ int main(int argc, char *argv[])
|
||||
|
||||
if (argc > 1) {
|
||||
if (strcmp(argv[1], "-v") == 0) {
|
||||
printf("usercrash_c version is 1.0\n");
|
||||
printf("version is %d.%d-%s, build by %s@%s\n",
|
||||
UC_MAJOR_VERSION, UC_MINOR_VERSION,
|
||||
UC_BUILD_VERSION, UC_BUILD_USER,
|
||||
UC_BUILD_TIME);
|
||||
return 0;
|
||||
}
|
||||
if (strcmp(argv[1], "-h") == 0) {
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
#include <unistd.h>
|
||||
#include "crash_dump.h"
|
||||
#include "log_sys.h"
|
||||
#include "version.h"
|
||||
|
||||
/**
|
||||
* Debugger can work without server when uses "debugger pid" commands to
|
||||
@@ -33,7 +34,10 @@ int main(int argc, char *argv[])
|
||||
|
||||
if (argc > 1) {
|
||||
if (strcmp(argv[1], "-v") == 0) {
|
||||
printf("debugger version is 1.0\n");
|
||||
printf("version is %d.%d-%s, build by %s@%s\n",
|
||||
UC_MAJOR_VERSION, UC_MINOR_VERSION,
|
||||
UC_BUILD_VERSION, UC_BUILD_USER,
|
||||
UC_BUILD_TIME);
|
||||
return 0;
|
||||
}
|
||||
if (strcmp(argv[1], "-h") == 0) {
|
||||
|
||||
@@ -42,6 +42,7 @@
|
||||
#include "packet.h"
|
||||
#include "protocol.h"
|
||||
#include "log_sys.h"
|
||||
#include "version.h"
|
||||
|
||||
#define FILE_PATH_LEN_MAX 256
|
||||
|
||||
@@ -389,7 +390,10 @@ int main(int argc, char *argv[])
|
||||
while ((opt = getopt(argc, argv, "vh")) != -1) {
|
||||
switch (opt) {
|
||||
case 'v':
|
||||
printf("usercrash_s version is 1.0\n");
|
||||
printf("version is %d.%d-%s, build by %s@%s\n",
|
||||
UC_MAJOR_VERSION, UC_MINOR_VERSION,
|
||||
UC_BUILD_VERSION, UC_BUILD_USER,
|
||||
UC_BUILD_TIME);
|
||||
break;
|
||||
case 'h':
|
||||
print_usage();
|
||||
|
||||
Reference in New Issue
Block a user