mirror of
https://github.com/xemu-project/xemu.git
synced 2024-11-26 21:10:42 +00:00
Makefile: Generate C file with xemu build info
This commit is contained in:
parent
0a31c7cf28
commit
578e8e087a
33
Makefile
33
Makefile
@ -495,6 +495,39 @@ qemu-version.h: FORCE
|
|||||||
rm $@.tmp; \
|
rm $@.tmp; \
|
||||||
fi)
|
fi)
|
||||||
|
|
||||||
|
XEMU_DATE := $(shell date -u )
|
||||||
|
|
||||||
|
XEMU_COMMIT := $(if $(PKGVERSION),$(PKGVERSION),$(shell \
|
||||||
|
cd $(SRC_PATH); \
|
||||||
|
if test -e .git; then \
|
||||||
|
git rev-parse HEAD 2>/dev/null | tr -d '\n'; \
|
||||||
|
fi))
|
||||||
|
|
||||||
|
XEMU_BRANCH := $(shell \
|
||||||
|
cd $(SRC_PATH); \
|
||||||
|
if test -e .git; then \
|
||||||
|
git symbolic-ref --short HEAD; \
|
||||||
|
fi)
|
||||||
|
|
||||||
|
XEMU_VERSION := $(shell \
|
||||||
|
cd $(SRC_PATH); \
|
||||||
|
if test -e .git; then \
|
||||||
|
git describe --match 'xemu-v*' | cut -c 6- | tr -d '\n'; \
|
||||||
|
fi)
|
||||||
|
|
||||||
|
xemu-version.c: FORCE
|
||||||
|
$(call quiet-command, (\
|
||||||
|
printf 'const char *xemu_version = "$(XEMU_VERSION)";\n'; \
|
||||||
|
printf 'const char *xemu_branch = "$(XEMU_BRANCH)";\n'; \
|
||||||
|
printf 'const char *xemu_commit = "$(XEMU_COMMIT)";\n'; \
|
||||||
|
printf 'const char *xemu_date = "$(XEMU_DATE)";\n'; \
|
||||||
|
) > $@.tmp)
|
||||||
|
$(call quiet-command, if ! cmp -s $@ $@.tmp; then \
|
||||||
|
mv $@.tmp $@; \
|
||||||
|
else \
|
||||||
|
rm $@.tmp; \
|
||||||
|
fi)
|
||||||
|
|
||||||
config-host.h: config-host.h-timestamp
|
config-host.h: config-host.h-timestamp
|
||||||
config-host.h-timestamp: config-host.mak
|
config-host.h-timestamp: config-host.mak
|
||||||
qemu-options.def: $(SRC_PATH)/qemu-options.hx $(SRC_PATH)/scripts/hxtool
|
qemu-options.def: $(SRC_PATH)/qemu-options.hx $(SRC_PATH)/scripts/hxtool
|
||||||
|
@ -80,6 +80,8 @@ common-obj-$(CONFIG_FDT) += device_tree.o
|
|||||||
|
|
||||||
common-obj-y += qapi/
|
common-obj-y += qapi/
|
||||||
|
|
||||||
|
common-obj-y += xemu-version.o
|
||||||
|
|
||||||
endif # CONFIG_SOFTMMU
|
endif # CONFIG_SOFTMMU
|
||||||
|
|
||||||
#######################################################################
|
#######################################################################
|
||||||
|
9
xemu-version.h
Normal file
9
xemu-version.h
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
#ifndef XEMU_VERSION_H
|
||||||
|
#define XEMU_VERSION_H
|
||||||
|
|
||||||
|
extern const char *xemu_version;
|
||||||
|
extern const char *xemu_branch;
|
||||||
|
extern const char *xemu_commit;
|
||||||
|
extern const char *xemu_date;
|
||||||
|
|
||||||
|
#endif
|
Loading…
Reference in New Issue
Block a user