summaryrefslogtreecommitdiffstats
path: root/Makefile
diff options
context:
space:
mode:
authorDave Reisner <dreisner@archlinux.org>2011-07-04 15:58:31 +0200
committerDave Reisner <dreisner@archlinux.org>2011-07-05 05:00:25 +0200
commit64785d2c7aecbf23cb840b8abc1c76b3a39d573e (patch)
tree36c4eeebe42a6c139ee170818be535ed7cf4703f /Makefile
parentcb8c8351f152e8759fb6106d6435e20b1ead23a2 (diff)
downloadmkinitcpio-64785d2c7aecbf23cb840b8abc1c76b3a39d573e.tar.gz
mkinitcpio-64785d2c7aecbf23cb840b8abc1c76b3a39d573e.tar.xz
Makefile: allow git-describe to determine version
For distribution, a VERSION file is written to and distributed for storing the ref. Signed-off-by: Dave Reisner <dreisner@archlinux.org>
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile15
1 files changed, 10 insertions, 5 deletions
diff --git a/Makefile b/Makefile
index f26610d..72efab1 100644
--- a/Makefile
+++ b/Makefile
@@ -1,6 +1,6 @@
# Makefile for mkinitcpio
-VERSION = 0.7.1
+VERSION = $(shell if test -f VERSION; then cat VERSION; else git describe; fi)
DIRS = \
/bin \
@@ -13,7 +13,8 @@ DIRS = \
/usr/share/man/man5
DIST_EXTRA = \
- mkinitcpio.5
+ mkinitcpio.5 \
+ VERSION
all: doc
@@ -46,6 +47,9 @@ install: all
install -m644 mkinitcpio.5 ${DESTDIR}/usr/share/man/man5/mkinitcpio.5
install -m644 bash-completion ${DESTDIR}/etc/bash_completion.d/mkinitcpio
+write-ver:
+ git describe > VERSION
+
doc: mkinitcpio.5
mkinitcpio.5: mkinitcpio.5.txt Makefile
a2x -d manpage \
@@ -56,15 +60,16 @@ mkinitcpio.5: mkinitcpio.5.txt Makefile
clean:
${RM} -r build mkinitcpio-${VERSION}
- ${RM} mkinitcpio-${VERSION}.tar.gz mkinitcpio.5 mkinitcpio.5.gz
+ ${RM} mkinitcpio-${VERSION}.tar.gz mkinitcpio.5 mkinitcpio.5.gz VERSION
tarball: dist
-dist: doc
+dist: clean write-ver doc
git archive --prefix=mkinitcpio-${VERSION}/ -o mkinitcpio-${VERSION}.tar HEAD
mkdir mkinitcpio-${VERSION}; \
cp -t mkinitcpio-${VERSION} ${DIST_EXTRA}; \
tar uf mkinitcpio-${VERSION}.tar mkinitcpio-${VERSION}; \
${RM} -r mkinitcpio-${VERSION}
gzip -9 mkinitcpio-${VERSION}.tar
+ ${RM} VERSION
-.PHONY: clean dist install tarball
+.PHONY: clean dist install tarball write-ver