Added version file, replace var values in make
authorRicardo Mones <ricardo@mones.org>
Mon, 17 Dec 2007 01:32:17 +0000 (01:32 +0000)
committerRicardo Mones <ricardo@mones.org>
Mon, 17 Dec 2007 01:32:17 +0000 (01:32 +0000)
ChangeLog
Makefile
VERSION [new file with mode: 0644]

index 8c4fc12..524f617 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+107-11-17 2:27  mones   0.0.1svn11
+
+       * VERSION       **NEW**
+       * Makefile
+               Added version file, replace var values in make
+
 2007-12-11     mones
 
        * Initial import
index b9b8b63..84674f9 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -3,22 +3,27 @@
 # $Id$
 #
 
-NAME=clawsker
-PREFIX=/usr/local
-BINDIR=${PREFIX}/bin
-DATADIR=${PREFIX}/share
-LIBDIR=${PREFIX}/lib/${NAME}
-MANDIR=${DATADIR}/man
-MAN1DIR=${MANDIR}/man1
-
-all: ${NAME}.1
-
-${NAME}.1:
-       pod2man ${NAME} > ${NAME}.1
+NAME = clawsker
+VERSION = $(shell cat VERSION)
+PREFIX ?= /usr/local
+BINDIR = ${PREFIX}/bin
+DATADIR = ${PREFIX}/share
+LIBDIR = ${PREFIX}/lib/${NAME}
+MANDIR = ${DATADIR}/man
+MAN1DIR = ${MANDIR}/man1
+
+all: build
+
+build:
+       mkdir build
+       sed -e "s,@PREFIX@,${PREFIX},;s,@LIBDIR@,${LIBDIR},;s,@VERSION@,${VERSION}," \
+               < ${NAME} > build/${NAME}
+       pod2man ${NAME} > build/${NAME}.1
+       
 
 install: all install-dirs
-       install -m 0755 ${NAME} ${DESTDIR}${BINDIR}
-       install -m 0644 ${NAME}.1 ${DESTDIR}${MAN1DIR}
+       install -m 0755 build/${NAME} ${DESTDIR}${BINDIR}
+       install -m 0644 build/${NAME}.1 ${DESTDIR}${MAN1DIR}
 
 install-dirs:
        install -d ${DESTDIR}${BINDIR}
@@ -28,8 +33,11 @@ uninstall:
        rm -f ${DESTDIR}${BINDIR}/${NAME}
        rm -f ${DESTDIR}${MAN1DIR}/${NAME}.1
 
+clean-build:
+       rm -rf build
+
 clean:
        rm -f ${NAME}.1 *~
 
-.PHONY: all install install-dirs uninstall clean
+.PHONY: all build install install-dirs uninstall clean clean-build
 
diff --git a/VERSION b/VERSION
new file mode 100644 (file)
index 0000000..a0dc60d
--- /dev/null
+++ b/VERSION
@@ -0,0 +1 @@
+0.0.1svn11