Git development
 help / color / mirror / Atom feed
* [PATCH] Introduce cg-version.in template
@ 2005-11-15 12:23 Jonas Fonseca
  0 siblings, 0 replies; only message in thread
From: Jonas Fonseca @ 2005-11-15 12:23 UTC (permalink / raw)
  To: Petr Baudis; +Cc: git

Signed-off-by: Jonas Fonseca <fonseca@diku.dk>
---
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

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2005-11-15 12:23 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-11-15 12:23 [PATCH] Introduce cg-version.in template Jonas Fonseca

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox