[PATCH] Introduce cg-version.in template
From: Jonas Fonseca <hidden>
Date: 2016-06-15 22:42:11
Subsystem:
documentation, kernel build + files below scripts/ (unless maintained elsewhere), the rest · Maintainers:
Jonathan Corbet, Nathan Chancellor, Nicolas Schier, Linus Torvalds
Signed-off-by: Jonas Fonseca <redacted> ---
diff --git a/Makefile b/Makefile
index 72d7d12..700491f 100644
--- a/Makefile
+++ b/Makefile@@ -37,24 +37,14 @@ cogito: $(GEN_SCRIPT) ifneq (,$(wildcard .git)) GIT_HEAD=.git/$(shell git-symbolic-ref HEAD) -GIT_HEAD_ID=" \($(shell cat $(GIT_HEAD))\)" +GIT_HEAD_ID=($(shell cat $(GIT_HEAD))) endif -cg-version: $(VERSION) $(GIT_HEAD) Makefile +cg-version: cg-version.in $(VERSION) $(GIT_HEAD) @echo Generating cg-version... @rm -f $@ - @echo "#!/bin/sh" > $@ - @echo "#" >> $@ - @echo "# Show the version of the Cogito toolkit." >> $@ - @echo "# Copyright (c) Petr Baudis, 2005" >> $@ - @echo "#" >> $@ - @echo "# Show which version of Cogito is installed." >> $@ - @echo "# Additionally, the 'HEAD' of the installed Cogito" >> $@ - @echo "# is also shown if this information was available" >> $@ - @echo "# at the build time." >> $@ - @echo >> $@ - @echo "USAGE=\"cg-version\"" >> $@ - @echo >> $@ - @echo "echo \"$(shell cat $(VERSION))$(GIT_HEAD_ID)\"" >> $@ + @sed -e 's/@@VERSION@@/$(shell cat $(VERSION))/' \ + -e 's/@@GIT_HEAD_ID@@/$(GIT_HEAD_ID)/' \ + < $< > $@ @chmod +x $@ doc:
diff --git a/cg-version.in b/cg-version.in
new file mode 100644
index 0000000..369818e
--- /dev/null
+++ b/cg-version.in@@ -0,0 +1,16 @@ +#!/usr/bin/env bash +# +# Show the version of the Cogito toolkit. +# Copyright (c) Petr Baudis, 2005 +# +# Show which version of Cogito is installed. +# Additionally, the 'HEAD' of the installed Cogito +# is also shown if this information was available +# at the build time. + +USAGE="cg-version" +_git_repo_unneeded=1 + +. ${COGITO_LIB}cg-Xlib || exit 1 + +echo "@@VERSION@@ @@GIT_HEAD_ID@@"
diff --git a/Documentation/Makefile b/Documentation/Makefile
index 4fe009a..3aad2fb 100644
--- a/Documentation/Makefile
+++ b/Documentation/Makefile@@ -1,4 +1,4 @@ -CG_IGNORE=$(wildcard ../cg-X* ../cg-*.orig ../cg-*.rej) +CG_IGNORE=$(wildcard ../cg-X* ../cg-*.orig ../cg-*.rej ../cg-*.in) CG_SRC=$(filter-out $(CG_IGNORE), $(wildcard ../cg*)) PACKAGE=cogito
--
Jonas Fonseca