Include tests in tarball
[clawsker.git] / Makefile
1 #
2 # Clawsker Makefile
3 # Copyright 2007-2018 Ricardo Mones <ricardo@mones.org>
4 #
5 # This program is free software: you can redistribute it and/or modify
6 # it under the terms of the GNU General Public License as published by
7 # the Free Software Foundation, either version 3 of the License, or
8 # (at your option) any later version.
9 #
10 # See COPYING file for license details.
11 #
12
13 NAME = clawsker
14 VERSION ?= 1.3.0
15 PREFIX ?= /usr/local
16 BINDIR = ${PREFIX}/bin
17 DATADIR = ${PREFIX}/share
18 LIBDIR = ${PREFIX}/lib/${NAME}
19 MANDIR = ${DATADIR}/man
20 MAN1DIR = ${MANDIR}/man1
21 APPSDIR = ${DATADIR}/applications
22 THEMEDIR = ${DATADIR}/icons/hicolor
23 ICONRES = 48 64 128
24
25 all: build
26
27 build: ${NAME}.1
28         -mkdir build
29         sed -e "s,@PREFIX@,${PREFIX},;s,@LIBDIR@,${LIBDIR},;s,@VERSION@,${VERSION},;s,@DATADIR@,${DATADIR}," < ${NAME} > build/${NAME}
30         cp -p $< build/$<
31         ${MAKE} -C po build
32
33 ${NAME}.1: ${NAME}.pod
34         pod2man --release ${VERSION} -c '' $< > $@
35
36 install: all install-dirs install-icons
37         install -m 0755 build/${NAME} ${DESTDIR}${BINDIR}
38         install -m 0644 build/${NAME}.1 ${DESTDIR}${MAN1DIR}
39         install -m 0644 ${NAME}.desktop ${DESTDIR}${APPSDIR}
40         ${MAKE} -C po install
41
42 install-dirs: install-icons-dirs
43         install -d ${DESTDIR}${BINDIR}
44         install -d ${DESTDIR}${MAN1DIR}
45         install -d ${DESTDIR}${APPSDIR}
46         ${MAKE} -C po install-dirs
47
48 install-icons-dirs:
49         install -d ${DESTDIR}${THEMEDIR}
50         for res in ${ICONRES}; do \
51                 install -d ${DESTDIR}${THEMEDIR}/$${res}x$${res}/apps; \
52         done
53
54 install-icons: install-icons-dirs
55         for res in ${ICONRES}; do \
56                 install -m 0644 icons/${NAME}-$${res}.png ${DESTDIR}${THEMEDIR}/$${res}x$${res}/apps/${NAME}.png; \
57         done
58
59 uninstall-icons:
60         for res in ${ICONRES}; do \
61                 rm -f ${DESTDIR}${THEMEDIR}/$${res}x$${res}/apps/${NAME}.png; \
62         done
63
64 uninstall: uninstall-icons
65         rm -f ${DESTDIR}${BINDIR}/${NAME}
66         rm -f ${DESTDIR}${MAN1DIR}/${NAME}.1
67         rm -f ${DESTDIR}${APPSDIR}/${NAME}.desktop
68         ${MAKE} -C po uninstall
69
70 dist:
71         rm -rf ${NAME}-${VERSION}
72         mkdir ${NAME}-${VERSION}
73         cp -p AUTHORS ChangeLog.old ${NAME} ${NAME}.pod ${NAME}.desktop \
74                 COPYING Makefile NEWS README ${NAME}-${VERSION}
75         mkdir ${NAME}-${VERSION}/po
76         cp -p po/*.po po/*.pot po/Makefile po/POTFILES po/README po/STATUS \
77                 ${NAME}-${VERSION}/po
78         mkdir ${NAME}-${VERSION}/po/unmaint
79         cp -p po/unmaint/*.po ${NAME}-${VERSION}/po/unmaint
80         mkdir ${NAME}-${VERSION}/icons
81         cp -p icons/*.xcf icons/*.png ${NAME}-${VERSION}/icons
82         mkdir ${NAME}-${VERSION}/t
83         cp -p t/*.t ${NAME}-${VERSION}/t
84         tar cJf ${NAME}-${VERSION}.tar.xz ${NAME}-${VERSION} \
85                 && rm -rf ${NAME}-${VERSION}
86
87 clean-build:
88         rm -f ${NAME}.1
89         rm -rf build
90
91 clean: clean-build
92         rm -f *~
93         ${MAKE} -C po clean
94
95 test-setup:
96         @test -h t/Clawsker.pm || ( cd t/ && ln -s ../clawsker Clawsker.pm )
97
98 test: test-setup
99         @env DISPLAY= prove -It
100
101 .PHONY: all build install install-dirs install-icons-dirs install-icons
102 .PHONY: uninstall uninstall-icons clean clean-build dist
103 .PHONY: test-setup test