mirror of
https://github.com/schoebel/mars
synced 2025-02-27 10:00:52 +00:00
infra: fix BUILDTAG for out-of-tree builds
This commit is contained in:
parent
646dbfeed8
commit
a81e255ed3
@ -73,10 +73,13 @@ mars-objs += \
|
|||||||
endif
|
endif
|
||||||
|
|
||||||
#
|
#
|
||||||
# buildtag.h should be regenerated in every build. If a file
|
# buildtag.h should be regenerated in every build.
|
||||||
# 'DISTVERSION' exists (out-of-tree tarball), its content is
|
#
|
||||||
# used as the BUILDTAG. Otherwise, if git is available, the
|
# The version is determined by the following preference order:
|
||||||
# git HEAD revision is used instead.
|
# 1) environment variable $MARSVERSION
|
||||||
|
# 2) when git is available: git describe --tags
|
||||||
|
# 3) if a file 'DISTVERSION' exists (out-of-tree tarball), use its content.
|
||||||
|
# 4) otherwise "no-buildtag-available"
|
||||||
#
|
#
|
||||||
extra-y += buildtag.h
|
extra-y += buildtag.h
|
||||||
$(obj)/buildtag.h: $(patsubst $(obj)/buildtag.h,,$(wildcard $(obj)/*.[ch])) $(obj)/*/*.[ch]
|
$(obj)/buildtag.h: $(patsubst $(obj)/buildtag.h,,$(wildcard $(obj)/*.[ch])) $(obj)/*/*.[ch]
|
||||||
@ -85,16 +88,19 @@ $(obj)/buildtag.h: $(patsubst $(obj)/buildtag.h,,$(wildcard $(obj)/*.[ch])) $(ob
|
|||||||
exec > $@;\
|
exec > $@;\
|
||||||
/bin/echo -e "/* Automatically generated -- DO NOT EDIT! */";\
|
/bin/echo -e "/* Automatically generated -- DO NOT EDIT! */";\
|
||||||
cd $(src); \
|
cd $(src); \
|
||||||
if [ -e DISTVERSION ]; then \
|
if [ "$$MARSVERSION" != "" ]; then \
|
||||||
BUILDTAG=$$(cat DISTVERSION); \
|
BUILDTAG="$$MARSVERSION"; \
|
||||||
elif git describe --tags >/dev/null 2>&1; then \
|
elif git describe --tags >/dev/null 2>&1; then \
|
||||||
BUILDTAG="$$(git describe --tags)"; \
|
BUILDTAG="$$(git describe --tags)"; \
|
||||||
|
elif [ -e DISTVERSION ]; then \
|
||||||
|
BUILDTAG=$$(cat DISTVERSION); \
|
||||||
else \
|
else \
|
||||||
BUILDTAG="no-buildtag-available"; \
|
BUILDTAG="no-buildtag-available"; \
|
||||||
fi; \
|
fi; \
|
||||||
/bin/echo -e "#define BUILDTAG \"$$BUILDTAG\"";\
|
/bin/echo -e "#define BUILDTAG \"$$BUILDTAG\"";\
|
||||||
/bin/echo -e "#define BUILDHOST \"$$USER@`hostname`\"";\
|
/bin/echo -e "#define BUILDHOST \"$$USER@`hostname`\"";\
|
||||||
/bin/echo -e "#define BUILDDATE \"$$(date '+%F %T')\""
|
/bin/echo -e "#define BUILDDATE \"$$(date '+%F %T')\""
|
||||||
|
cat $@;
|
||||||
|
|
||||||
ifndef CONFIG_MARS
|
ifndef CONFIG_MARS
|
||||||
# mars_config.h is generated by a simple Kconfig parser (gen_config.pl)
|
# mars_config.h is generated by a simple Kconfig parser (gen_config.pl)
|
||||||
@ -105,7 +111,10 @@ ifndef CONFIG_MARS
|
|||||||
#
|
#
|
||||||
extra-y += mars_config.h
|
extra-y += mars_config.h
|
||||||
GEN_CONFIG_SCRIPT := $(src)/../scripts/gen_config.pl
|
GEN_CONFIG_SCRIPT := $(src)/../scripts/gen_config.pl
|
||||||
|
$(obj)/mars_config.h: $(obj)/buildtag.h
|
||||||
$(obj)/mars_config.h: $(src)/Kconfig $(GEN_CONFIG_SCRIPT)
|
$(obj)/mars_config.h: $(src)/Kconfig $(GEN_CONFIG_SCRIPT)
|
||||||
|
$(Q)$(kecho) "MARS: using compiler $($(CC) --version | head -1)"
|
||||||
|
$(CC) -v
|
||||||
$(Q)$(kecho) "MARS: Generating $@"
|
$(Q)$(kecho) "MARS: Generating $@"
|
||||||
$(Q)set -e; \
|
$(Q)set -e; \
|
||||||
if [ ! -x $(GEN_CONFIG_SCRIPT) ]; then \
|
if [ ! -x $(GEN_CONFIG_SCRIPT) ]; then \
|
||||||
@ -113,4 +122,5 @@ $(obj)/mars_config.h: $(src)/Kconfig $(GEN_CONFIG_SCRIPT)
|
|||||||
/bin/false; \
|
/bin/false; \
|
||||||
fi; \
|
fi; \
|
||||||
cat $< | $(GEN_CONFIG_SCRIPT) > $@;
|
cat $< | $(GEN_CONFIG_SCRIPT) > $@;
|
||||||
|
cat $@;
|
||||||
endif
|
endif
|
||||||
|
Loading…
Reference in New Issue
Block a user