Debian Codegraph @

tests/inputs/mfile.mk

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
99 # Rule: test - Run tests
100 test: test-perl test-pod test-code
101
102 install-man: test-pod man
103 # install-man
104 $(INSTALL_BIN) -d $(MANDIR1)
105 $(INSTALL_DATA) $(INSTALL_OBJS_MAN) $(MANDIR1)
106
107 install-bin: test-perl
108 # install-bin - Install programs
109 $(INSTALL_BIN) -d $(BINDIR)
110 for f in $(INSTALL_OBJS_BIN); \
111 do \
112 dest=$${f%.pl}; \
113 $(INSTALL_BIN) $$f $(BINDIR)/$$dest; \
114 done
115
116 # Rule: install - Standard install
117 install: install-bin install-man
118
119 # Rule: install-test - for Maintainer only
120 install-test:
121 rm -rf tmp
122 make DESTDIR=$$(pwd)/tmp prefix=/usr install
123 find tmp | sort
124
125 # Rule: dist - for Maintainer only, make distribution
126 dist: clean
127 [ -f version ] || fail-version-file-is-missing
128
129 release=$(PACKAGE)-$$(cat version); \
130 rm -rf /tmp/$$release ; \
131 mkdir -vp /tmp/$$release ; \
132 cp -rav . /tmp/$$release/ ; \
133 find /tmp/$$release/ -type d \
134 \( -name .svn -o -name .git -o -name .hg \) | xargs -r rm -r; \
135 tar -C /tmp -zvcf /tmp/$$release.tar.gz $$release ; \
136 echo "DONE: /tmp/$$release.tag.gz"
137
138 .PHONY: clean distclean realclean install install-bin install-man
139
140 # End of file