Add dist target and fix version
[clawsker.git] / Makefile
1 #
2 # Clawsker makefile
3 #
4
5 NAME = clawsker
6 VERSION ?= 0.7.9
7 PREFIX ?= /usr/local
8 BINDIR = ${PREFIX}/bin
9 DATADIR = ${PREFIX}/share
10 LIBDIR = ${PREFIX}/lib/${NAME}
11 MANDIR = ${DATADIR}/man
12 MAN1DIR = ${MANDIR}/man1
13
14 all: build
15
16 build:
17         -mkdir build
18         sed -e "s,@PREFIX@,${PREFIX},;s,@LIBDIR@,${LIBDIR},;s,@VERSION@,${VERSION}," < ${NAME} > build/${NAME}
19         pod2man --release ${VERSION} -c '' ${NAME}.pod > build/${NAME}.1
20         ${MAKE} -C po build
21         
22
23 install: all install-dirs
24         install -m 0755 build/${NAME} ${DESTDIR}${BINDIR}
25         install -m 0644 build/${NAME}.1 ${DESTDIR}${MAN1DIR}
26         ${MAKE} -C po install
27
28 install-dirs:
29         install -d ${DESTDIR}${BINDIR}
30         install -d ${DESTDIR}${MAN1DIR}
31         ${MAKE} -C po install-dirs
32
33 uninstall:
34         rm -f ${DESTDIR}${BINDIR}/${NAME}
35         rm -f ${DESTDIR}${MAN1DIR}/${NAME}.1
36         ${MAKE} -C po uninstall
37
38 dist:
39         rm -rf ${NAME}-${VERSION}
40         mkdir ${NAME}-${VERSION}
41         cp -p AUTHORS ChangeLog.old clawsker clawsker.pod \
42                 COPYING Makefile NEWS README ${NAME}-${VERSION}
43         cp -rp po ${NAME}-${VERSION}
44         tar czf ${NAME}-${VERSION}.tar.gz ${NAME}-${VERSION} \
45                 && rm -rf ${NAME}-${VERSION}
46
47 clean-build:
48         rm -rf build
49
50 clean: clean-build
51         rm -f *~
52         ${MAKE} -C po clean
53
54 .PHONY: all build install install-dirs uninstall clean clean-build dist
55