xref: /freebsd/contrib/mandoc/Makefile (revision 59c8e88e72633afbc47a4ace0d2170d00d51f7dc)
1# $Id: Makefile,v 1.540 2021/09/21 11:04:40 schwarze Exp $
2#
3# Copyright (c) 2011, 2013-2021 Ingo Schwarze <schwarze@openbsd.org>
4# Copyright (c) 2010, 2011, 2012 Kristaps Dzonsons <kristaps@bsd.lv>
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
18VERSION = 1.14.6
19
20# === LIST OF FILES ====================================================
21
22TESTSRCS	 = test-attribute.c \
23		   test-be32toh.c \
24		   test-cmsg.c \
25		   test-dirent-namlen.c \
26		   test-EFTYPE.c \
27		   test-err.c \
28		   test-fts.c \
29		   test-getline.c \
30		   test-getsubopt.c \
31		   test-isblank.c \
32		   test-mkdtemp.c \
33		   test-mkstemps.c \
34		   test-nanosleep.c \
35		   test-noop.c \
36		   test-ntohl.c \
37		   test-O_DIRECTORY.c \
38		   test-ohash.c \
39		   test-PATH_MAX.c \
40		   test-pledge.c \
41		   test-progname.c \
42		   test-reallocarray.c \
43		   test-recallocarray.c \
44		   test-recvmsg.c \
45		   test-rewb-bsd.c \
46		   test-rewb-sysv.c \
47		   test-sandbox_init.c \
48		   test-strcasestr.c \
49		   test-stringlist.c \
50		   test-strlcat.c \
51		   test-strlcpy.c \
52		   test-strndup.c \
53		   test-strptime.c \
54		   test-strsep.c \
55		   test-strtonum.c \
56		   test-vasprintf.c \
57		   test-wchar.c
58
59SRCS		 = arch.c \
60		   att.c \
61		   catman.c \
62		   cgi.c \
63		   chars.c \
64		   compat_err.c \
65		   compat_fts.c \
66		   compat_getline.c \
67		   compat_getsubopt.c \
68		   compat_isblank.c \
69		   compat_mkdtemp.c \
70		   compat_mkstemps.c \
71		   compat_ohash.c \
72		   compat_progname.c \
73		   compat_reallocarray.c \
74		   compat_recallocarray.c \
75		   compat_strcasestr.c \
76		   compat_stringlist.c \
77		   compat_strlcat.c \
78		   compat_strlcpy.c \
79		   compat_strndup.c \
80		   compat_strsep.c \
81		   compat_strtonum.c \
82		   compat_vasprintf.c \
83		   dba.c \
84		   dba_array.c \
85		   dba_read.c \
86		   dba_write.c \
87		   dbm.c \
88		   dbm_map.c \
89		   demandoc.c \
90		   eqn.c \
91		   eqn_html.c \
92		   eqn_term.c \
93		   html.c \
94		   lib.c \
95		   main.c \
96		   man.c \
97		   man_html.c \
98		   man_macro.c \
99		   man_term.c \
100		   man_validate.c \
101		   mandoc.c \
102		   mandoc_aux.c \
103		   mandoc_msg.c \
104		   mandoc_ohash.c \
105		   mandoc_xr.c \
106		   mandocd.c \
107		   mandocdb.c \
108		   manpath.c \
109		   mansearch.c \
110		   mdoc.c \
111		   mdoc_argv.c \
112		   mdoc_html.c \
113		   mdoc_macro.c \
114		   mdoc_man.c \
115		   mdoc_markdown.c \
116		   mdoc_state.c \
117		   mdoc_term.c \
118		   mdoc_validate.c \
119		   msec.c \
120		   out.c \
121		   preconv.c \
122		   read.c \
123		   roff.c \
124		   roff_html.c \
125		   roff_term.c \
126		   roff_validate.c \
127		   soelim.c \
128		   st.c \
129		   tag.c \
130		   tbl.c \
131		   tbl_data.c \
132		   tbl_html.c \
133		   tbl_layout.c \
134		   tbl_opts.c \
135		   tbl_term.c \
136		   term.c \
137		   term_ascii.c \
138		   term_ps.c \
139		   term_tab.c \
140		   term_tag.c \
141		   tree.c
142
143DISTFILES	 = INSTALL \
144		   LICENSE \
145		   Makefile \
146		   Makefile.depend \
147		   NEWS \
148		   TODO \
149		   apropos.1 \
150		   catman.8 \
151		   cgi.h.example \
152		   compat_fts.h \
153		   compat_ohash.h \
154		   compat_stringlist.h \
155		   configure \
156		   configure.local.example \
157		   dba.h \
158		   dba_array.h \
159		   dba_write.h \
160		   dbm.h \
161		   dbm_map.h \
162		   demandoc.1 \
163		   eqn.7 \
164		   eqn.h \
165		   eqn_parse.h \
166		   gmdiff \
167		   html.h \
168		   lib.in \
169		   libman.h \
170		   libmandoc.h \
171		   libmdoc.h \
172		   main.h \
173		   makewhatis.8 \
174		   man.1 \
175		   man.7 \
176		   man.cgi.3 \
177		   man.cgi.8 \
178		   man.conf.5 \
179		   man.h \
180		   man.options.1 \
181		   manconf.h \
182		   mandoc.1 \
183		   mandoc.3 \
184		   mandoc.css \
185		   mandoc.db.5 \
186		   mandoc.h \
187		   mandoc_aux.h \
188		   mandoc_char.7 \
189		   mandoc_escape.3 \
190		   mandoc_headers.3 \
191		   mandoc_html.3 \
192		   mandoc_malloc.3 \
193		   mandoc_ohash.h \
194		   mandoc_parse.h \
195		   mandoc_xr.h \
196		   mandocd.8 \
197		   mansearch.3 \
198		   mansearch.h \
199		   mchars_alloc.3 \
200		   mdoc.7 \
201		   mdoc.h \
202		   msec.in \
203		   out.h \
204		   predefs.in \
205		   roff.7 \
206		   roff.h \
207		   roff_int.h \
208		   soelim.1 \
209		   tag.h \
210		   tbl.3 \
211		   tbl.7 \
212		   tbl.h \
213		   tbl_int.h \
214		   tbl_parse.h \
215		   term.h \
216		   term_tag.h \
217		   $(SRCS) \
218		   $(TESTSRCS)
219
220LIBMAN_OBJS	 = man.o \
221		   man_macro.o \
222		   man_validate.o
223
224LIBMDOC_OBJS	 = att.o \
225		   lib.o \
226		   mdoc.o \
227		   mdoc_argv.o \
228		   mdoc_macro.o \
229		   mdoc_state.o \
230		   mdoc_validate.o \
231		   st.o
232
233LIBROFF_OBJS	 = eqn.o \
234		   roff.o \
235		   roff_validate.o \
236		   tbl.o \
237		   tbl_data.o \
238		   tbl_layout.o \
239		   tbl_opts.o
240
241LIBMANDOC_OBJS	 = $(LIBMAN_OBJS) \
242		   $(LIBMDOC_OBJS) \
243		   $(LIBROFF_OBJS) \
244		   arch.o \
245		   chars.o \
246		   mandoc.o \
247		   mandoc_aux.o \
248		   mandoc_msg.o \
249		   mandoc_ohash.o \
250		   mandoc_xr.o \
251		   msec.o \
252		   preconv.o \
253		   read.o \
254		   tag.o
255
256ALL_COBJS	 = compat_err.o \
257		   compat_fts.o \
258		   compat_getline.o \
259		   compat_getsubopt.o \
260		   compat_isblank.o \
261		   compat_mkdtemp.o \
262		   compat_mkstemps.o \
263		   compat_ohash.o \
264		   compat_progname.o \
265		   compat_reallocarray.o \
266		   compat_recallocarray.o \
267		   compat_strcasestr.o \
268		   compat_stringlist.o \
269		   compat_strlcat.o \
270		   compat_strlcpy.o \
271		   compat_strndup.o \
272		   compat_strsep.o \
273		   compat_strtonum.o \
274		   compat_vasprintf.o
275
276MANDOC_HTML_OBJS = eqn_html.o \
277		   html.o \
278		   man_html.o \
279		   mdoc_html.o \
280		   roff_html.o \
281		   tbl_html.o
282
283MANDOC_TERM_OBJS = eqn_term.o \
284		   man_term.o \
285		   mdoc_term.o \
286		   roff_term.o \
287		   term.o \
288		   term_ascii.o \
289		   term_ps.o \
290		   term_tab.o \
291		   term_tag.o \
292		   tbl_term.o
293
294DBM_OBJS	 = dbm.o \
295		   dbm_map.o \
296		   mansearch.o
297
298DBA_OBJS	 = dba.o \
299		   dba_array.o \
300		   dba_read.o \
301		   dba_write.o \
302		   mandocdb.o
303
304MAIN_OBJS	 = $(MANDOC_HTML_OBJS) \
305		   $(MANDOC_MAN_OBJS) \
306		   $(MANDOC_TERM_OBJS) \
307		   $(DBM_OBJS) \
308		   $(DBA_OBJS) \
309		   main.o \
310		   manpath.o \
311		   mdoc_man.o \
312		   mdoc_markdown.o \
313		   out.o \
314		   tree.o
315
316CGI_OBJS	 = $(MANDOC_HTML_OBJS) \
317		   $(DBM_OBJS) \
318		   cgi.o \
319		   out.o
320
321MANDOCD_OBJS	 = $(MANDOC_HTML_OBJS) \
322		   $(MANDOC_TERM_OBJS) \
323		   mandocd.o \
324		   out.o
325
326DEMANDOC_OBJS	 = demandoc.o
327
328WWW_MANS	 = apropos.1.html \
329		   demandoc.1.html \
330		   man.1.html \
331		   man.options.1.html \
332		   mandoc.1.html \
333		   soelim.1.html \
334		   man.cgi.3.html \
335		   mandoc.3.html \
336		   mandoc_escape.3.html \
337		   mandoc_headers.3.html \
338		   mandoc_html.3.html \
339		   mandoc_malloc.3.html \
340		   mansearch.3.html \
341		   mchars_alloc.3.html \
342		   tbl.3.html \
343		   man.conf.5.html \
344		   mandoc.db.5.html \
345		   eqn.7.html \
346		   man.7.html \
347		   mandoc_char.7.html \
348		   mdoc.7.html \
349		   roff.7.html \
350		   tbl.7.html \
351		   catman.8.html \
352		   makewhatis.8.html \
353		   man.cgi.8.html \
354		   mandocd.8.html
355
356WWW_INCS	 = eqn.h.html \
357		   html.h.html \
358		   man.h.html \
359		   manconf.h.html \
360		   mandoc.h.html \
361		   mandoc_aux.h.html \
362		   mandoc_parse.h.html \
363		   mansearch.h.html \
364		   mdoc.h.html \
365		   roff.h.html \
366		   tbl.h.html \
367		   tbl_int.h.html \
368		   tbl_parse.h.html
369
370# === USER CONFIGURATION ===============================================
371
372include Makefile.local
373
374# === DEPENDENCY HANDLING ==============================================
375
376all: mandoc man demandoc soelim $(BUILD_TARGETS) Makefile.local
377
378install: base-install $(INSTALL_TARGETS)
379
380www: $(WWW_MANS) $(WWW_INCS)
381
382$(WWW_MANS) $(WWW_INCS): mandoc
383
384.PHONY: base-install cgi-install install www-install
385.PHONY: clean distclean depend
386
387include Makefile.depend
388
389# === TARGETS CONTAINING SHELL COMMANDS ================================
390
391distclean: clean
392	rm -f Makefile.local config.h config.h.old config.log config.log.old
393
394clean:
395	rm -f libmandoc.a $(LIBMANDOC_OBJS) $(ALL_COBJS)
396	rm -f mandoc man $(MAIN_OBJS)
397	rm -f man.cgi $(CGI_OBJS)
398	rm -f mandocd catman catman.o $(MANDOCD_OBJS)
399	rm -f demandoc $(DEMANDOC_OBJS)
400	rm -f soelim soelim.o
401	rm -f $(WWW_MANS) $(WWW_INCS) mandoc*.tar.gz mandoc*.sha256
402	rm -f Makefile.tmp1 Makefile.tmp2
403	rm -rf *.dSYM
404
405base-install: mandoc demandoc soelim
406	mkdir -p $(DESTDIR)$(BINDIR)
407	mkdir -p $(DESTDIR)$(SBINDIR)
408	mkdir -p $(DESTDIR)$(MANDIR)/man1
409	mkdir -p $(DESTDIR)$(MANDIR)/man5
410	mkdir -p $(DESTDIR)$(MANDIR)/man7
411	mkdir -p $(DESTDIR)$(MANDIR)/man8
412	$(INSTALL_PROGRAM) mandoc demandoc $(DESTDIR)$(BINDIR)
413	$(INSTALL_PROGRAM) soelim $(DESTDIR)$(BINDIR)/$(BINM_SOELIM)
414	cd $(DESTDIR)$(BINDIR) && $(LN) mandoc $(BINM_MAN)
415	cd $(DESTDIR)$(BINDIR) && $(LN) mandoc $(BINM_APROPOS)
416	cd $(DESTDIR)$(BINDIR) && $(LN) mandoc $(BINM_WHATIS)
417	cd $(DESTDIR)$(SBINDIR) && \
418		$(LN) ${BIN_FROM_SBIN}/mandoc $(BINM_MAKEWHATIS)
419	$(INSTALL_MAN) mandoc.1 demandoc.1 $(DESTDIR)$(MANDIR)/man1
420	$(INSTALL_MAN) soelim.1 $(DESTDIR)$(MANDIR)/man1/$(BINM_SOELIM).1
421	$(INSTALL_MAN) man.1 $(DESTDIR)$(MANDIR)/man1/$(BINM_MAN).1
422	$(INSTALL_MAN) apropos.1 $(DESTDIR)$(MANDIR)/man1/$(BINM_APROPOS).1
423	cd $(DESTDIR)$(MANDIR)/man1 && $(LN) $(BINM_APROPOS).1 $(BINM_WHATIS).1
424	$(INSTALL_MAN) man.conf.5 $(DESTDIR)$(MANDIR)/man5/$(MANM_MANCONF).5
425	$(INSTALL_MAN) mandoc.db.5 $(DESTDIR)$(MANDIR)/man5
426	$(INSTALL_MAN) man.7 $(DESTDIR)$(MANDIR)/man7/$(MANM_MAN).7
427	$(INSTALL_MAN) mdoc.7 $(DESTDIR)$(MANDIR)/man7/$(MANM_MDOC).7
428	$(INSTALL_MAN) roff.7 $(DESTDIR)$(MANDIR)/man7/$(MANM_ROFF).7
429	$(INSTALL_MAN) eqn.7 $(DESTDIR)$(MANDIR)/man7/$(MANM_EQN).7
430	$(INSTALL_MAN) tbl.7 $(DESTDIR)$(MANDIR)/man7/$(MANM_TBL).7
431	$(INSTALL_MAN) mandoc_char.7 $(DESTDIR)$(MANDIR)/man7
432	$(INSTALL_MAN) makewhatis.8 \
433		$(DESTDIR)$(MANDIR)/man8/$(BINM_MAKEWHATIS).8
434
435lib-install: libmandoc.a
436	mkdir -p $(DESTDIR)$(LIBDIR)
437	mkdir -p $(DESTDIR)$(INCLUDEDIR)
438	mkdir -p $(DESTDIR)$(MANDIR)/man3
439	$(INSTALL_LIB) libmandoc.a $(DESTDIR)$(LIBDIR)
440	$(INSTALL_LIB) eqn.h man.h mandoc.h mandoc_aux.h mandoc_parse.h \
441		mdoc.h roff.h tbl.h $(DESTDIR)$(INCLUDEDIR)
442	$(INSTALL_MAN) mandoc.3 mandoc_escape.3 mandoc_malloc.3 \
443		mansearch.3 mchars_alloc.3 tbl.3 $(DESTDIR)$(MANDIR)/man3
444
445cgi-install: man.cgi
446	mkdir -p $(DESTDIR)$(CGIBINDIR)
447	mkdir -p $(DESTDIR)$(HTDOCDIR)
448	$(INSTALL_PROGRAM) man.cgi $(DESTDIR)$(CGIBINDIR)
449	$(INSTALL_DATA) mandoc.css $(DESTDIR)$(HTDOCDIR)
450
451catman-install: mandocd catman
452	mkdir -p $(DESTDIR)$(SBINDIR)
453	mkdir -p $(DESTDIR)$(MANDIR)/man8
454	$(INSTALL_PROGRAM) mandocd $(DESTDIR)$(SBINDIR)
455	$(INSTALL_PROGRAM) catman $(DESTDIR)$(SBINDIR)/$(BINM_CATMAN)
456	$(INSTALL_MAN) mandocd.8 $(DESTDIR)$(MANDIR)/man8
457	$(INSTALL_MAN) catman.8 $(DESTDIR)$(MANDIR)/man8/$(BINM_CATMAN).8
458
459uninstall:
460	rm -f $(DESTDIR)$(BINDIR)/mandoc
461	rm -f $(DESTDIR)$(BINDIR)/demandoc
462	rm -f $(DESTDIR)$(BINDIR)/$(BINM_SOELIM)
463	rm -f $(DESTDIR)$(BINDIR)/$(BINM_MAN)
464	rm -f $(DESTDIR)$(BINDIR)/$(BINM_APROPOS)
465	rm -f $(DESTDIR)$(BINDIR)/$(BINM_WHATIS)
466	rm -f $(DESTDIR)$(SBINDIR)/$(BINM_MAKEWHATIS)
467	rm -f $(DESTDIR)$(MANDIR)/man1/mandoc.1
468	rm -f $(DESTDIR)$(MANDIR)/man1/demandoc.1
469	rm -f $(DESTDIR)$(MANDIR)/man1/$(BINM_SOELIM).1
470	rm -f $(DESTDIR)$(MANDIR)/man1/$(BINM_MAN).1
471	rm -f $(DESTDIR)$(MANDIR)/man1/$(BINM_APROPOS).1
472	rm -f $(DESTDIR)$(MANDIR)/man1/$(BINM_WHATIS).1
473	rm -f $(DESTDIR)$(MANDIR)/man5/$(MANM_MANCONF).5
474	rm -f $(DESTDIR)$(MANDIR)/man5/mandoc.db.5
475	rm -f $(DESTDIR)$(MANDIR)/man7/$(MANM_MAN).7
476	rm -f $(DESTDIR)$(MANDIR)/man7/$(MANM_MDOC).7
477	rm -f $(DESTDIR)$(MANDIR)/man7/$(MANM_ROFF).7
478	rm -f $(DESTDIR)$(MANDIR)/man7/$(MANM_EQN).7
479	rm -f $(DESTDIR)$(MANDIR)/man7/$(MANM_TBL).7
480	rm -f $(DESTDIR)$(MANDIR)/man7/mandoc_char.7
481	rm -f $(DESTDIR)$(MANDIR)/man8/$(BINM_MAKEWHATIS).8
482	rm -f $(DESTDIR)$(CGIBINDIR)/man.cgi
483	rm -f $(DESTDIR)$(HTDOCDIR)/mandoc.css
484	rm -f $(DESTDIR)$(SBINDIR)/mandocd
485	rm -f $(DESTDIR)$(SBINDIR)/$(BINM_CATMAN)
486	rm -f $(DESTDIR)$(MANDIR)/man8/mandocd.8
487	rm -f $(DESTDIR)$(MANDIR)/man8/$(BINM_CATMAN).8
488	rm -f $(DESTDIR)$(LIBDIR)/libmandoc.a
489	rm -f $(DESTDIR)$(MANDIR)/man3/mandoc.3
490	rm -f $(DESTDIR)$(MANDIR)/man3/mandoc_escape.3
491	rm -f $(DESTDIR)$(MANDIR)/man3/mandoc_malloc.3
492	rm -f $(DESTDIR)$(MANDIR)/man3/mansearch.3
493	rm -f $(DESTDIR)$(MANDIR)/man3/mchars_alloc.3
494	rm -f $(DESTDIR)$(MANDIR)/man3/tbl.3
495	rm -f $(DESTDIR)$(INCLUDEDIR)/eqn.h
496	rm -f $(DESTDIR)$(INCLUDEDIR)/man.h
497	rm -f $(DESTDIR)$(INCLUDEDIR)/mandoc.h
498	rm -f $(DESTDIR)$(INCLUDEDIR)/mandoc_aux.h
499	rm -f $(DESTDIR)$(INCLUDEDIR)/mandoc_parse.h
500	rm -f $(DESTDIR)$(INCLUDEDIR)/mdoc.h
501	rm -f $(DESTDIR)$(INCLUDEDIR)/roff.h
502	rm -f $(DESTDIR)$(INCLUDEDIR)/tbl.h
503	[ ! -e $(DESTDIR)$(INCLUDEDIR) ] || rmdir $(DESTDIR)$(INCLUDEDIR)
504
505regress: all
506	cd regress && ./regress.pl
507
508regress-clean:
509	cd regress && ./regress.pl . clean
510
511Makefile.local config.h: configure $(TESTSRCS)
512	@echo "$@ is out of date; please run ./configure"
513	@exit 1
514
515libmandoc.a: $(MANDOC_COBJS) $(LIBMANDOC_OBJS)
516	$(AR) rs $@ $(MANDOC_COBJS) $(LIBMANDOC_OBJS)
517
518mandoc: $(MAIN_OBJS) libmandoc.a
519	$(CC) -o $@ $(LDFLAGS) $(MAIN_OBJS) libmandoc.a $(LDADD)
520
521man: mandoc
522	$(LN) mandoc man
523
524man.cgi: $(CGI_OBJS) libmandoc.a
525	$(CC) $(STATIC) -o $@ $(LDFLAGS) $(CGI_OBJS) libmandoc.a $(LDADD)
526
527mandocd: $(MANDOCD_OBJS) libmandoc.a
528	$(CC) -o $@ $(LDFLAGS) $(MANDOCD_OBJS) libmandoc.a $(LDADD)
529
530catman: catman.o libmandoc.a
531	$(CC) -o $@ $(LDFLAGS) catman.o libmandoc.a $(LDADD)
532
533demandoc: $(DEMANDOC_OBJS) libmandoc.a
534	$(CC) -o $@ $(LDFLAGS) $(DEMANDOC_OBJS) libmandoc.a $(LDADD)
535
536soelim: $(SOELIM_COBJS) soelim.o
537	$(CC) -o $@ $(LDFLAGS) $(SOELIM_COBJS) soelim.o
538
539# --- maintainer targets ---
540
541www-install: www
542	$(INSTALL_DATA) mandoc.css $(HTDOCDIR)
543	$(INSTALL_DATA) $(WWW_MANS) $(HTDOCDIR)/man
544	$(INSTALL_DATA) $(WWW_INCS) $(HTDOCDIR)/includes
545
546depend: config.h
547	./configure -depend
548	mkdep -f Makefile.tmp1 $(CFLAGS) $(SRCS)
549	perl -e 'undef $$/; $$_ = <>; s|/usr/include/\S+||g; \
550		s|\\\n||g; s|  +| |g; s| $$||mg; print;' \
551		Makefile.tmp1 > Makefile.tmp2
552	rm Makefile.tmp1
553	mv Makefile.tmp2 Makefile.depend
554
555regress-distclean:
556	@find regress \
557		-name '.#*' -o \
558		-name '*.orig' -o \
559		-name '*.rej' -o \
560		-name '*.core' \
561		-exec rm -i {} \;
562
563regress-distcheck:
564	@find regress ! -type d ! -type f
565	@find regress -type f \
566		! -path '*/CVS/*' \
567		! -name Makefile \
568		! -name Makefile.inc \
569		! -name '*.in' \
570		! -name '*.out_ascii' \
571		! -name '*.out_utf8' \
572		! -name '*.out_html' \
573		! -name '*.out_markdown' \
574		! -name '*.out_lint' \
575		! -path regress/regress.pl \
576		! -path regress/regress.pl.1
577
578dist: mandoc-$(VERSION).sha256
579
580mandoc-$(VERSION).sha256: mandoc-$(VERSION).tar.gz
581	sha256 mandoc-$(VERSION).tar.gz > $@
582
583mandoc-$(VERSION).tar.gz: $(DISTFILES)
584	ls regress/*/*/*.mandoc_* && exit 1 || true
585	mkdir -p .dist/mandoc-$(VERSION)/
586	$(INSTALL) -m 0644 $(DISTFILES) .dist/mandoc-$(VERSION)
587	cp -pR regress .dist/mandoc-$(VERSION)
588	find .dist/mandoc-$(VERSION)/regress \
589	    -type d -name CVS -print0 | xargs -0 rm -rf
590	chmod 755 .dist/mandoc-$(VERSION)/configure
591	( cd .dist/ && tar zcf ../$@ mandoc-$(VERSION) )
592	rm -rf .dist/
593
594dist-install: dist
595	$(INSTALL_DATA) mandoc-$(VERSION).tar.gz mandoc-$(VERSION).sha256 \
596	    $(HTDOCDIR)/snapshots
597
598# === SUFFIX RULES =====================================================
599
600.SUFFIXES:	 .1       .3       .5       .7       .8       .h
601.SUFFIXES:	 .1.html  .3.html  .5.html  .7.html  .8.html  .h.html
602
603.h.h.html:
604	highlight -I $< > $@
605
606.1.1.html .3.3.html .5.5.html .7.7.html .8.8.html:
607	./mandoc -Thtml -Wwarning,stop \
608		-O 'style=/mandoc.css,man=/man/%N.%S.html;https://man.openbsd.org/%N.%S,includes=/includes/%I.html' \
609		$< > $@
610