Debian Codegraph @

Makefile

raw ◀ ▶
Source reconstructed at patch state 0 of 1 — not the installed (fully patched) source.
1 Debian patch touch this file
1 #!/usr/bin/make -f
2 #
3 # Copyright information
4 #
5 # Copyright (C) 2002-2025 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 = ddir
27 DESTDIR =
28 prefix = /usr
29 exec_prefix = $(prefix)
30 man_prefix = $(prefix)/share
31 mandir = $(man_prefix)/man
32 bindir = $(exec_prefix)/bin
33 sharedir = $(prefix)/share
34
35 BINDIR = $(DESTDIR)$(bindir)
36 DOCDIR = $(DESTDIR)$(sharedir)/doc/$(PACKAGE)
37 LOCALEDIR = $(DESTDIR)$(sharedir)/locale
38 SHAREDIR = $(DESTDIR)$(sharedir)/$(PACKAGE)
39 LIBDIR = $(DESTDIR)$(prefix)/lib/$(PACKAGE)
40 SBINDIR = $(DESTDIR)$(exec_prefix)/sbin
41 ETCDIR = $(DESTDIR)/etc/$(PACKAGE)
42
43 # 1 = regular, 5 = conf, 6 = games, 8 = daemons
44 MANDIR = $(DESTDIR)$(mandir)
45 MANDIR1 = $(MANDIR)/man1
46 MANDIR5 = $(MANDIR)/man5
47 MANDIR6 = $(MANDIR)/man6
48 MANDIR8 = $(MANDIR)/man8
49
50 TAR = tar
51 TAR_OPT_NO = --exclude='.build' \
52 --exclude='.sinst' \
53 --exclude='.inst' \
54 --exclude='tmp' \
55 --exclude='*.bak' \
56 --exclude='*[~\#]' \
57 --exclude='.\#*' \
58 --exclude='CVS' \
59 --exclude='.svn' \
60 --exclude='.git' \
61 --exclude='.bzr' \
62 --exclude='*.tar*' \
63 --exclude='*.tgz'
64
65 INSTALL = /usr/bin/install
66 INSTALL_BIN = $(INSTALL) -m 755
67 INSTALL_DATA = $(INSTALL) -m 644
68 INSTALL_SUID = $(INSTALL) -m 4755
69 INSTALL_DIR = $(INSTALL) -m 755 -d
70
71 DIST_DIR = ../build-area
72 DATE = `date +"%Y.%m%d"`
73 VERSION = $(DATE)
74 RELEASE = $(PACKAGE)-$(VERSION)
75
76 BIN = $(PACKAGE)
77 PL_SCRIPT = bin/$(BIN).pl
78
79 INSTALL_OBJS_BIN = $(PL_SCRIPT)
80 INSTALL_OBJS_DOC = README COPYING
81 INSTALL_OBJS_MAN = bin/*.1
82
83 XARGS = xargs xargs --no-run-if-empty
84 PERL = perl
85
86 # Do not chnage this. This is the location of "local" auto generated
87 # files. Fromt here the fle are installed to $(DOCDIR)
88
89 docdir = doc/manual
90 manpage = bin/$(PACKAGE).1
91
92 all: doc
93 # target: all
94 @echo "For more information, see 'make help'"
95
96 # Rule: help - Display Makefile rules
97 help:
98 grep "^[[:space:]]*# Rule:" Makefile | sed 's/^[[:space:]]*//' | sort
99
100 # Rule: clean - remove temporary files
101 clean:
102 # target: clean
103 find . -name "*[#~]" \
104 -o -name "*.\#*" \
105 -o -name "*.x~~" \
106 -o -name "pod*.tmp" | \
107 $(XARGS) rm -f
108
109 rm -rf tmp
110
111 distclean: clean
112 # Rule: distclean - remove everything that can be generated
113 rm -f $(manpage)
114 rm -rf $(docdir)
115
116 realclean: clean
117
118 dist-git: test doc
119 rm -f $(DIST_DIR)/$(RELEASE)*
120
121 git archive --format=tar --prefix=$(RELEASE)/ master | \
122 gzip --best > $(DIST_DIR)/$(RELEASE).tar.gz
123
124 chmod 644 $(DIST_DIR)/$(RELEASE).tar.gz
125
126 tar -tvf $(DIST_DIR)/$(RELEASE).tar.gz | sort -k 5
127 ls -la $(DIST_DIR)/$(RELEASE).tar.gz
128
129 # The "gt" is maintainer's program frontend to Git
130 # Rule: dist-snap - [maintainer] release snapshot from Git repository
131 dist-snap: test doc
132 @echo gt tar -q -z -p $(PACKAGE) -c -D master
133
134 # Rule: dist-git - [maintainer] make release archive
135 dist: dist-git
136
137 dist-ls:
138 @ls -1tr $(DIST_DIR)/$(PACKAGE)*
139
140 # Rule: dist - [maintainer] list of release files
141 ls: dist-ls
142
143 docdir:
144 # target: docdir - create documentation output directory
145 $(INSTALL_DIR) $(docdir)
146
147 $(manpage): $(PL_SCRIPT)
148 # target: bin/$(PACKAGE).1
149 $(PERL) $< --help-man > $@
150 @-rm -f *.x~~ pod*.tmp
151
152 doc/manual/$(PACKAGE).html: $(PL_SCRIPT)
153 # target: doc/manual/$(PACKAGE).html
154 $(PERL) $< --help-html > $@
155 @-rm -f *.x~~ pod*.tmp
156
157 doc/manual/$(PACKAGE).txt: $(PL_SCRIPT)
158 # target: doc/manual/$(PACKAGE).txt
159 $(PERL) $< --help > $@
160 @-rm -f *.x~~ pod*.tmp
161
162 doc/conversion/index.html: doc/conversion/index.txt
163 perl -S t2html.pl --Auto-detect --Out --print-url $<
164
165 # Rule: man - Generate or update manual page
166 man: docdir $(manpage)
167
168 # Rule: html - Generate HTML pages
169 html: docdir test-pod doc/manual/$(PACKAGE).html
170
171 # Rule: txt - Generate TXT pages
172 txt: docdir test-pod doc/manual/$(PACKAGE).txt
173
174 # Rule: doc - Generate or update all documentation
175 doc: man html txt
176
177 test-pod:
178 # Rule: pod-test - Check POD syntax
179 podchecker $(PL_SCRIPT)
180
181 test-perl:
182 # Rule: perl-test - Check program syntax
183 perl -cw $(PL_SCRIPT)
184
185 # Rule: test - Run all tests
186 test: test-perl test-pod
187
188 # Rule: install-doc - Install documentation
189 install-doc:
190 $(INSTALL_BIN) -d $(DOCDIR)
191
192 [ ! "$(INSTALL_OBJS_DOC)" ] || \
193 $(INSTALL_DATA) $(INSTALL_OBJS_DOC) $(DOCDIR)
194
195 $(TAR) -C doc $(TAR_OPT_NO) --create --file=- . | \
196 $(TAR) -C $(DOCDIR) --extract --file=-
197
198 install-man: man
199 # Rule: install-man - Install manual pages
200 $(INSTALL_BIN) -d $(MANDIR1)
201 $(INSTALL_DATA) $(INSTALL_OBJS_MAN) $(MANDIR1)
202
203 install-bin:
204 # Rule: install-bin - Install programs
205 $(INSTALL_BIN) -d $(BINDIR)
206 for f in $(INSTALL_OBJS_BIN); \
207 do \
208 dest=$$(basename $$f | sed -e 's/\.pl$$//' -e 's/\.py$$//' ); \
209 $(INSTALL_BIN) $$f $(BINDIR)/$$dest; \
210 done
211
212 # Rule: install - Standard install. Use variables like: DESTDIR= prefix=/usr/local
213 install: install-bin install-man install-doc
214
215 # Rule: install-test - [maintainer] Dry-run install to tmp/ directory
216 install-test:
217 rm -rf tmp
218 make DESTDIR=`pwd`/tmp prefix=/usr install
219 find tmp | sort
220
221 .PHONY: clean distclean realclean
222 .PHONY: install install-bin install-man
223 .PHONY: all man doc test install-test perl-test
224 .PHONY: dist dist-git dist-ls ls
225
226 # End of file