build: Using id tool to get builder username

Some build environment might has no USER pre-defined. So use id tool to
get builder username instead of USER environemnt.

Also add a version cleanup for tools to keep them updated.

Signed-off-by: Shuo Liu <shuo.a.liu@intel.com>
Acked-by: Geoffroy Van Cutsem <geoffroy.vancutsem@intel.com>
This commit is contained in:
Shuo Liu
2018-06-28 02:36:10 +00:00
committed by lijinxia
parent 1b97c6ea92
commit 1c605a4f50
4 changed files with 10 additions and 4 deletions

View File

@@ -158,6 +158,7 @@ include/version.h:
DIRTY=`git diff-index --name-only HEAD`;\
if [ -n "$$DIRTY" ];then PATCH="$$COMMIT-dirty";else PATCH="$$COMMIT";fi;\
TIME=`date "+%Y-%m-%d %H:%M:%S"`;\
USER=`id -u -n`; \
echo "/*" > include/version.h; \
sed 's/^/ * /' ../LICENSE >> include/version.h; \
echo " */" >> include/version.h; \
@@ -167,7 +168,7 @@ include/version.h:
echo "#define DM_RC_VERSION $(RC_VERSION)" >> include/version.h;\
echo "#define DM_BUILD_VERSION "\""$$PATCH"\""" >> include/version.h;\
echo "#define DM_BUILD_TIME "\""$$TIME"\""" >> include/version.h;\
echo "#define DM_BUILD_USER "\""$(USER)"\""" >> include/version.h
echo "#define DM_BUILD_USER "\""$$USER"\""" >> include/version.h
$(DM_OBJDIR)/%.o: %.c $(HEADERS)
[ ! -e $@ ] && mkdir -p $(dir $@); \