Debian Codegraph @

Unix/Makefile

raw
1 #!/usr/bin/make -f
2 #
3 # Copyright information
4 #
5 # Copyright (C) 2012 Jari Aalto
6 #
7 # License
8 #
9 # This program is free software; you can redistribute it and/or modify
10 # it under the terms of the GNU General Public License as published by
11 # the Free Software Foundation; either version 2 of the License, or
12 # (at your option) any later version.
13 #
14 # This program is distributed in the hope that it will be useful,
15 # but WITHOUT ANY WARRANTY; without even the implied warranty of
16 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 # GNU General Public License for more details.
18 #
19 # You should have received a copy of the GNU General Public License
20 # along with this program. If not, see <http://www.gnu.org/licenses/>.
21
22 ifneq (,)
23 This makefile requires GNU Make.
24 endif
25
26 PACKAGE = cloc
27
28 DESTDIR =
29 prefix = /usr
30 exec_prefix = $(prefix)
31 man_prefix = $(prefix)/share
32 mandir = $(man_prefix)/man
33 bindir = $(exec_prefix)/bin
34 sharedir = $(prefix)/share
35
36 BINDIR = $(DESTDIR)$(bindir)
37 DOCDIR = $(DESTDIR)$(sharedir)/doc
38 LOCALEDIR = $(DESTDIR)$(sharedir)/locale
39 SHAREDIR = $(DESTDIR)$(sharedir)/$(PACKAGE)
40 LIBDIR = $(DESTDIR)$(prefix)/lib/$(PACKAGE)
41 SBINDIR = $(DESTDIR)$(exec_prefix)/sbin
42 ETCDIR = $(DESTDIR)/etc/$(PACKAGE)
43
44 # 1 = regular, 5 = conf, 6 = games, 8 = daemons
45 MANDIR = $(DESTDIR)$(mandir)
46 MANDIR1 = $(MANDIR)/man1
47 MANDIR5 = $(MANDIR)/man5
48 MANDIR6 = $(MANDIR)/man6
49 MANDIR8 = $(MANDIR)/man8
50
51 BIN = $(PACKAGE)
52 PL_SCRIPT = $(BIN)
53
54 INSTALL_OBJS_BIN = $(PL_SCRIPT)
55 INSTALL_OBJS_MAN = *.1
56
57 INSTALL = /usr/bin/install
58 INSTALL_BIN = $(INSTALL) -m 755
59 INSTALL_DATA = $(INSTALL) -m 644
60
61 all: man
62 @echo "Nothing to compile for a Perl script."
63 @echo "Try 'make help' or 'make -n DESTDIR= prefix=/usr/local install'"
64
65 # Rule: help - display Makefile rules
66 help:
67 @grep "^# Rule:" Makefile | sort
68
69 # Rule: clean - remove temporary files
70 clean:
71 # clean
72 rm -f *[#~] *.\#* *.x~~ pod*.tmp *.1
73 rm -rf tmp
74
75 distclean: clean
76
77 realclean: clean
78
79 # Rule: man - Generate or update manual page
80 man:
81 $(MAKE) -f pod2man.mk PACKAGE=$(PACKAGE) makeman
82
83 # Rule: doc - Generate or update all documentation
84 doc: man
85
86 # Rule: test-perl - Check program syntax
87 test-perl:
88 # perl-test - Check syntax
89 perl -cw $(PL_SCRIPT)
90
91 # Rule: test-pod - Check POD syntax
92 test-pod:
93 podchecker *.pod
94
95 # Rule: test-code - Check that the counter works
96 test-code:
97 t/00_C.t
98 t/02_git.t
99 t/01_opts.t
100
101 # Rule: test-unix - Check that the Unix version works
102 test-unix:
103 t/00_C.t -u
104 t/02_git.t -u
105 t/01_opts.t -u
106
107 # Rule: test - Run tests (exclude test-unix)
108 test: test-perl test-pod test-code
109
110 install-man: test-pod man
111 # install-man
112 $(INSTALL_BIN) -d $(MANDIR1)
113 $(INSTALL_DATA) $(INSTALL_OBJS_MAN) $(MANDIR1)
114
115 install-bin: test-perl
116 # install-bin - Install programs
117 $(INSTALL_BIN) -d $(BINDIR)
118 for f in $(INSTALL_OBJS_BIN); \
119 do \
120 dest=$${f%.pl}; \
121 $(INSTALL_BIN) $$f $(BINDIR)/$$dest; \
122 done
123
124 # Rule: install - Standard install
125 install: install-bin install-man
126
127 # Rule: install-test - for Maintainer only
128 install-test:
129 rm -rf tmp
130 $(MAKE) DESTDIR=$$(pwd)/tmp prefix=/usr install
131 find tmp | sort
132
133 # Rule: dist - for Maintainer only, make distribution
134 dist: clean
135 [ -f version ] || fail-version-file-is-missing
136
137 release=$(PACKAGE)-$$(cat version); \
138 rm -rf /tmp/$$release ; \
139 mkdir -vp /tmp/$$release ; \
140 cp -rav . /tmp/$$release/ ; \
141 find /tmp/$$release/ -type d \
142 \( -name .svn -o -name .git -o -name .hg \) | xargs -r rm -r; \
143 tar -C /tmp -zvcf /tmp/$$release.tar.gz $$release ; \
144 echo "DONE: /tmp/$$release.tag.gz"
145
146 .PHONY: clean distclean realclean install install-bin install-man
147
148 # End of file