]> git.cameronkatri.com Git - mandoc.git/blob - Makefile
Delete two preprocessor constants that are no longer used.
[mandoc.git] / Makefile
1 # $Id: Makefile,v 1.469 2015/10/13 22:59:54 schwarze Exp $
2 #
3 # Copyright (c) 2010, 2011, 2012 Kristaps Dzonsons <kristaps@bsd.lv>
4 # Copyright (c) 2011, 2013, 2014, 2015 Ingo Schwarze <schwarze@openbsd.org>
5 #
6 # Permission to use, copy, modify, and distribute this software for any
7 # purpose with or without fee is hereby granted, provided that the above
8 # copyright notice and this permission notice appear in all copies.
9 #
10 # THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
11 # WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
12 # MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
13 # ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
14 # WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
15 # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
16 # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17
18 VERSION = 1.13.3
19
20 # === LIST OF FILES ====================================================
21
22 TESTSRCS = test-dirent-namlen.c \
23 test-err.c \
24 test-fgetln.c \
25 test-fts.c \
26 test-getsubopt.c \
27 test-isblank.c \
28 test-mkdtemp.c \
29 test-mmap.c \
30 test-ohash.c \
31 test-progname.c \
32 test-reallocarray.c \
33 test-sqlite3.c \
34 test-sqlite3_errstr.c \
35 test-strcasestr.c \
36 test-stringlist.c \
37 test-strlcat.c \
38 test-strlcpy.c \
39 test-strptime.c \
40 test-strsep.c \
41 test-strtonum.c \
42 test-vasprintf.c \
43 test-wchar.c
44
45 SRCS = att.c \
46 cgi.c \
47 chars.c \
48 compat_err.c \
49 compat_fgetln.c \
50 compat_fts.c \
51 compat_getsubopt.c \
52 compat_isblank.c \
53 compat_mkdtemp.c \
54 compat_ohash.c \
55 compat_reallocarray.c \
56 compat_sqlite3_errstr.c \
57 compat_strcasestr.c \
58 compat_stringlist.c \
59 compat_strlcat.c \
60 compat_strlcpy.c \
61 compat_strsep.c \
62 compat_strtonum.c \
63 compat_vasprintf.c \
64 demandoc.c \
65 eqn.c \
66 eqn_html.c \
67 eqn_term.c \
68 html.c \
69 lib.c \
70 main.c \
71 man.c \
72 man_hash.c \
73 man_html.c \
74 man_macro.c \
75 man_term.c \
76 man_validate.c \
77 mandoc.c \
78 mandoc_aux.c \
79 mandoc_ohash.c \
80 mandocdb.c \
81 manpage.c \
82 manpath.c \
83 mansearch.c \
84 mansearch_const.c \
85 mdoc.c \
86 mdoc_argv.c \
87 mdoc_hash.c \
88 mdoc_html.c \
89 mdoc_macro.c \
90 mdoc_man.c \
91 mdoc_term.c \
92 mdoc_validate.c \
93 msec.c \
94 out.c \
95 preconv.c \
96 read.c \
97 roff.c \
98 soelim.c \
99 st.c \
100 tag.c \
101 tbl.c \
102 tbl_data.c \
103 tbl_html.c \
104 tbl_layout.c \
105 tbl_opts.c \
106 tbl_term.c \
107 term.c \
108 term_ascii.c \
109 term_ps.c \
110 tree.c
111
112 DISTFILES = INSTALL \
113 LICENSE \
114 Makefile \
115 Makefile.depend \
116 NEWS \
117 TODO \
118 apropos.1 \
119 cgi.h.example \
120 compat_fts.h \
121 compat_ohash.h \
122 compat_stringlist.h \
123 configure \
124 configure.local.example \
125 demandoc.1 \
126 eqn.7 \
127 example.style.css \
128 gmdiff \
129 html.h \
130 lib.in \
131 libman.h \
132 libmandoc.h \
133 libmdoc.h \
134 libroff.h \
135 main.h \
136 makewhatis.8 \
137 man-cgi.css \
138 man.1 \
139 man.7 \
140 man.cgi.8 \
141 man.conf.5 \
142 man.h \
143 manconf.h \
144 mandoc.1 \
145 mandoc.3 \
146 mandoc.db.5 \
147 mandoc.h \
148 mandoc_aux.h \
149 mandoc_char.7 \
150 mandoc_escape.3 \
151 mandoc_headers.3 \
152 mandoc_html.3 \
153 mandoc_malloc.3 \
154 mandoc_ohash.h \
155 mansearch.3 \
156 mansearch.h \
157 mchars_alloc.3 \
158 mdoc.7 \
159 mdoc.h \
160 msec.in \
161 out.h \
162 predefs.in \
163 roff.7 \
164 roff.h \
165 soelim.1 \
166 st.in \
167 style.css \
168 tag.h \
169 tbl.3 \
170 tbl.7 \
171 term.h \
172 $(SRCS) \
173 $(TESTSRCS)
174
175 LIBMAN_OBJS = man.o \
176 man_hash.o \
177 man_macro.o \
178 man_validate.o
179
180 LIBMDOC_OBJS = att.o \
181 lib.o \
182 mdoc.o \
183 mdoc_argv.o \
184 mdoc_hash.o \
185 mdoc_macro.o \
186 mdoc_validate.o \
187 st.o
188
189 LIBROFF_OBJS = eqn.o \
190 roff.o \
191 tbl.o \
192 tbl_data.o \
193 tbl_layout.o \
194 tbl_opts.o
195
196 LIBMANDOC_OBJS = $(LIBMAN_OBJS) \
197 $(LIBMDOC_OBJS) \
198 $(LIBROFF_OBJS) \
199 chars.o \
200 mandoc.o \
201 mandoc_aux.o \
202 mandoc_ohash.o \
203 msec.o \
204 preconv.o \
205 read.o
206
207 COMPAT_OBJS = compat_err.o \
208 compat_fgetln.o \
209 compat_fts.o \
210 compat_getsubopt.o \
211 compat_isblank.o \
212 compat_mkdtemp.o \
213 compat_ohash.o \
214 compat_reallocarray.o \
215 compat_sqlite3_errstr.o \
216 compat_strcasestr.o \
217 compat_strlcat.o \
218 compat_strlcpy.o \
219 compat_strsep.o \
220 compat_strtonum.o \
221 compat_vasprintf.o
222
223 MANDOC_HTML_OBJS = eqn_html.o \
224 html.o \
225 man_html.o \
226 mdoc_html.o \
227 tbl_html.o
228
229 MANDOC_MAN_OBJS = mdoc_man.o
230
231 MANDOC_TERM_OBJS = eqn_term.o \
232 man_term.o \
233 mdoc_term.o \
234 term.o \
235 term_ascii.o \
236 term_ps.o \
237 tbl_term.o
238
239 BASE_OBJS = $(MANDOC_HTML_OBJS) \
240 $(MANDOC_MAN_OBJS) \
241 $(MANDOC_TERM_OBJS) \
242 main.o \
243 manpath.o \
244 out.o \
245 tag.o \
246 tree.o
247
248 MAIN_OBJS = $(BASE_OBJS)
249
250 DB_OBJS = mandocdb.o \
251 mansearch.o \
252 mansearch_const.o
253
254 CGI_OBJS = $(MANDOC_HTML_OBJS) \
255 cgi.o \
256 mansearch.o \
257 mansearch_const.o \
258 out.o
259
260 MANPAGE_OBJS = manpage.o mansearch.o mansearch_const.o manpath.o
261
262 DEMANDOC_OBJS = demandoc.o
263
264 SOELIM_OBJS = soelim.o compat_stringlist.o
265
266 WWW_MANS = apropos.1.html \
267 demandoc.1.html \
268 man.1.html \
269 mandoc.1.html \
270 soelim.1.html \
271 mandoc.3.html \
272 mandoc_escape.3.html \
273 mandoc_headers.3.html \
274 mandoc_html.3.html \
275 mandoc_malloc.3.html \
276 mansearch.3.html \
277 mchars_alloc.3.html \
278 tbl.3.html \
279 man.conf.5.html \
280 mandoc.db.5.html \
281 eqn.7.html \
282 man.7.html \
283 mandoc_char.7.html \
284 mdoc.7.html \
285 roff.7.html \
286 tbl.7.html \
287 makewhatis.8.html \
288 man.cgi.8.html \
289 man.h.html \
290 manconf.h.html \
291 mandoc.h.html \
292 mandoc_aux.h.html \
293 mansearch.h.html \
294 mdoc.h.html \
295 roff.h.html
296
297 WWW_OBJS = mdocml.tar.gz \
298 mdocml.sha256
299
300 # === USER CONFIGURATION ===============================================
301
302 include Makefile.local
303
304 # === DEPENDENCY HANDLING ==============================================
305
306 all: base-build $(BUILD_TARGETS) Makefile.local
307
308 base-build: mandoc demandoc soelim
309
310 cgi-build: man.cgi
311
312 install: base-install $(INSTALL_TARGETS)
313
314 www: $(WWW_OBJS) $(WWW_MANS)
315
316 $(WWW_MANS): mandoc
317
318 .PHONY: base-install cgi-install db-install install www-install
319 .PHONY: clean distclean depend
320
321 include Makefile.depend
322
323 # === TARGETS CONTAINING SHELL COMMANDS ================================
324
325 distclean: clean
326 rm -f Makefile.local config.h config.h.old config.log config.log.old
327
328 clean:
329 rm -f libmandoc.a $(LIBMANDOC_OBJS) $(COMPAT_OBJS)
330 rm -f mandoc $(BASE_OBJS) $(DB_OBJS)
331 rm -f man.cgi $(CGI_OBJS)
332 rm -f manpage $(MANPAGE_OBJS)
333 rm -f demandoc $(DEMANDOC_OBJS)
334 rm -f soelim $(SOELIM_OBJS)
335 rm -f $(WWW_MANS) $(WWW_OBJS)
336 rm -rf *.dSYM
337
338 base-install: base-build
339 mkdir -p $(DESTDIR)$(BINDIR)
340 mkdir -p $(DESTDIR)$(EXAMPLEDIR)
341 mkdir -p $(DESTDIR)$(LIBDIR)
342 mkdir -p $(DESTDIR)$(INCLUDEDIR)
343 mkdir -p $(DESTDIR)$(MANDIR)/man1
344 mkdir -p $(DESTDIR)$(MANDIR)/man3
345 mkdir -p $(DESTDIR)$(MANDIR)/man5
346 mkdir -p $(DESTDIR)$(MANDIR)/man7
347 $(INSTALL_PROGRAM) mandoc demandoc soelim $(DESTDIR)$(BINDIR)
348 ln -f $(DESTDIR)$(BINDIR)/mandoc $(DESTDIR)$(BINDIR)/$(BINM_MAN)
349 $(INSTALL_LIB) libmandoc.a $(DESTDIR)$(LIBDIR)
350 $(INSTALL_LIB) man.h mandoc.h mandoc_aux.h mdoc.h roff.h \
351 $(DESTDIR)$(INCLUDEDIR)
352 $(INSTALL_MAN) mandoc.1 demandoc.1 soelim.1 $(DESTDIR)$(MANDIR)/man1
353 $(INSTALL_MAN) man.1 $(DESTDIR)$(MANDIR)/man1/$(BINM_MAN).1
354 $(INSTALL_MAN) mandoc.3 mandoc_escape.3 mandoc_malloc.3 \
355 mchars_alloc.3 tbl.3 $(DESTDIR)$(MANDIR)/man3
356 $(INSTALL_MAN) man.conf.5 $(DESTDIR)$(MANDIR)/man5/${MANM_MANCONF}.5
357 $(INSTALL_MAN) man.7 $(DESTDIR)$(MANDIR)/man7/${MANM_MAN}.7
358 $(INSTALL_MAN) mdoc.7 $(DESTDIR)$(MANDIR)/man7/${MANM_MDOC}.7
359 $(INSTALL_MAN) roff.7 $(DESTDIR)$(MANDIR)/man7/${MANM_ROFF}.7
360 $(INSTALL_MAN) eqn.7 $(DESTDIR)$(MANDIR)/man7/${MANM_EQN}.7
361 $(INSTALL_MAN) tbl.7 $(DESTDIR)$(MANDIR)/man7/${MANM_TBL}.7
362 $(INSTALL_MAN) mandoc_char.7 $(DESTDIR)$(MANDIR)/man7
363 $(INSTALL_DATA) example.style.css $(DESTDIR)$(EXAMPLEDIR)
364
365 db-install: base-build
366 mkdir -p $(DESTDIR)$(BINDIR)
367 mkdir -p $(DESTDIR)$(SBINDIR)
368 mkdir -p $(DESTDIR)$(MANDIR)/man1
369 mkdir -p $(DESTDIR)$(MANDIR)/man3
370 mkdir -p $(DESTDIR)$(MANDIR)/man5
371 mkdir -p $(DESTDIR)$(MANDIR)/man8
372 ln -f $(DESTDIR)$(BINDIR)/mandoc $(DESTDIR)$(BINDIR)/$(BINM_APROPOS)
373 ln -f $(DESTDIR)$(BINDIR)/mandoc $(DESTDIR)$(BINDIR)/$(BINM_WHATIS)
374 ln -f $(DESTDIR)$(BINDIR)/mandoc \
375 $(DESTDIR)$(SBINDIR)/$(BINM_MAKEWHATIS)
376 $(INSTALL_MAN) apropos.1 $(DESTDIR)$(MANDIR)/man1/$(BINM_APROPOS).1
377 ln -f $(DESTDIR)$(MANDIR)/man1/$(BINM_APROPOS).1 \
378 $(DESTDIR)$(MANDIR)/man1/$(BINM_WHATIS).1
379 $(INSTALL_MAN) mansearch.3 $(DESTDIR)$(MANDIR)/man3
380 $(INSTALL_MAN) mandoc.db.5 $(DESTDIR)$(MANDIR)/man5
381 $(INSTALL_MAN) makewhatis.8 \
382 $(DESTDIR)$(MANDIR)/man8/$(BINM_MAKEWHATIS).8
383
384 cgi-install: cgi-build
385 mkdir -p $(DESTDIR)$(CGIBINDIR)
386 mkdir -p $(DESTDIR)$(HTDOCDIR)
387 mkdir -p $(DESTDIR)$(WWWPREFIX)/man/mandoc/man1
388 mkdir -p $(DESTDIR)$(WWWPREFIX)/man/mandoc/man8
389 $(INSTALL_PROGRAM) man.cgi $(DESTDIR)$(CGIBINDIR)
390 $(INSTALL_DATA) example.style.css $(DESTDIR)$(HTDOCDIR)/man.css
391 $(INSTALL_DATA) man-cgi.css $(DESTDIR)$(HTDOCDIR)
392 $(INSTALL_MAN) apropos.1 $(DESTDIR)$(WWWPREFIX)/man/mandoc/man1/
393 $(INSTALL_MAN) man.cgi.8 $(DESTDIR)$(WWWPREFIX)/man/mandoc/man8/
394
395 Makefile.local config.h: configure ${TESTSRCS}
396 @echo "$@ is out of date; please run ./configure"
397 @exit 1
398
399 libmandoc.a: $(COMPAT_OBJS) $(LIBMANDOC_OBJS)
400 $(AR) rs $@ $(COMPAT_OBJS) $(LIBMANDOC_OBJS)
401
402 mandoc: $(MAIN_OBJS) libmandoc.a
403 $(CC) $(LDFLAGS) -o $@ $(MAIN_OBJS) libmandoc.a $(DBLIB)
404
405 manpage: $(MANPAGE_OBJS) libmandoc.a
406 $(CC) $(LDFLAGS) -o $@ $(MANPAGE_OBJS) libmandoc.a $(DBLIB)
407
408 man.cgi: $(CGI_OBJS) libmandoc.a
409 $(CC) $(LDFLAGS) $(STATIC) -o $@ $(CGI_OBJS) libmandoc.a $(DBLIB)
410
411 demandoc: $(DEMANDOC_OBJS) libmandoc.a
412 $(CC) $(LDFLAGS) -o $@ $(DEMANDOC_OBJS) libmandoc.a -lz
413
414 soelim: $(SOELIM_OBJS) compat_reallocarray.o
415 $(CC) $(LDFLAGS) -o $@ $(SOELIM_OBJS) compat_reallocarray.o
416
417 # --- maintainer targets ---
418
419 www-install: www
420 mkdir -p $(HTDOCDIR)/snapshots
421 $(INSTALL_DATA) $(WWW_MANS) style.css $(HTDOCDIR)
422 $(INSTALL_DATA) $(WWW_OBJS) $(HTDOCDIR)/snapshots
423 $(INSTALL_DATA) mdocml.tar.gz \
424 $(HTDOCDIR)/snapshots/mdocml-$(VERSION).tar.gz
425 $(INSTALL_DATA) mdocml.sha256 \
426 $(HTDOCDIR)/snapshots/mdocml-$(VERSION).sha256
427
428 depend: config.h
429 mkdep -f Makefile.depend $(CFLAGS) $(SRCS)
430 perl -e 'undef $$/; $$_ = <>; s|/usr/include/\S+||g; \
431 s|\\\n||g; s| +| |g; s| $$||mg; print;' \
432 Makefile.depend > Makefile.tmp
433 mv Makefile.tmp Makefile.depend
434
435 mdocml.sha256: mdocml.tar.gz
436 sha256 mdocml.tar.gz > $@
437
438 mdocml.tar.gz: $(DISTFILES)
439 mkdir -p .dist/mdocml-$(VERSION)/
440 $(INSTALL) -m 0644 $(DISTFILES) .dist/mdocml-$(VERSION)
441 chmod 755 .dist/mdocml-$(VERSION)/configure
442 ( cd .dist/ && tar zcf ../$@ mdocml-$(VERSION) )
443 rm -rf .dist/
444
445 # === SUFFIX RULES =====================================================
446
447 .SUFFIXES: .1 .3 .5 .7 .8 .h
448 .SUFFIXES: .1.html .3.html .5.html .7.html .8.html .h.html
449
450 .h.h.html:
451 highlight -I $< > $@
452
453 .1.1.html .3.3.html .5.5.html .7.7.html .8.8.html: mandoc
454 ./mandoc -Thtml -Wall,stop \
455 -Ostyle=style.css,man=%N.%S.html,includes=%I.html $< > $@