Signed-off-by: Jonas Fonseca <fonseca@diku.dk> ---
Show changes to 3 files +22 −16
Makefile, cg-version.in, Documentation/Makefile
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