Git development
 help / color / mirror / Atom feed
From: Jonas Fonseca <fonseca@diku.dk>
To: Petr Baudis <pasky@ucw.cz>
Cc: git@vger.kernel.org
Subject: [PATCH] Introduce cg-version.in template
Date: Tue, 15 Nov 2005 13:23:23 +0100	[thread overview]
Message-ID: <20051115122323.GB13925@diku.dk> (raw)

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

                 reply	other threads:[~2005-11-15 12:23 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20051115122323.GB13925@diku.dk \
    --to=fonseca@diku.dk \
    --cc=git@vger.kernel.org \
    --cc=pasky@ucw.cz \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox