xref: /minix/external/bsd/mdocml/dist/Makefile (revision 6c8f7fc3)
1.PHONY: 	 clean install installwww
2.SUFFIXES:	 .sgml .html .md5 .h .h.html
3.SUFFIXES:	 .1       .3       .7       .8
4.SUFFIXES:	 .1.txt   .3.txt   .7.txt   .8.txt
5.SUFFIXES:	 .1.pdf   .3.pdf   .7.pdf   .8.pdf
6.SUFFIXES:	 .1.ps    .3.ps    .7.ps    .8.ps
7.SUFFIXES:	 .1.html  .3.html  .7.html  .8.html
8.SUFFIXES:	 .1.xhtml .3.xhtml .7.xhtml .8.xhtml
9
10# Specify this if you want to hard-code the operating system to appear
11# in the lower-left hand corner of -mdoc manuals.
12#
13# CFLAGS	+= -DOSNAME="\"OpenBSD 4.5\""
14
15VERSION		 = 1.12.0
16VDATE		 = 8 October 2011
17
18# IFF your system supports multi-byte functions (setlocale(), wcwidth(),
19# putwchar()) AND has __STDC_ISO_10646__ (that is, wchar_t is simply a
20# UCS-4 value) should you define USE_WCHAR.  If you define it and your
21# system DOESN'T support this, -Tlocale will produce garbage.
22# If you don't define it, -Tlocale is a synonym for -Tacsii.
23#
24CFLAGS	 	+= -DUSE_WCHAR
25
26# If your system has manpath(1), uncomment this.  This is most any
27# system that's not OpenBSD or NetBSD.  If uncommented, apropos(1),
28# mandocdb(8), and man.cgi will popen(3) manpath(1) to get the MANPATH
29# variable.
30#CFLAGS		+= -DUSE_MANPATH
31
32# If your system supports static binaries only, uncomment this.  This
33# appears only to be BSD UNIX systems (Mac OS X has no support and Linux
34# requires -pthreads for static libdb).
35STATIC		 = -static
36
37CFLAGS		+= -g -DHAVE_CONFIG_H -DVERSION="\"$(VERSION)\""
38CFLAGS     	+= -W -Wall -Wstrict-prototypes -Wno-unused-parameter -Wwrite-strings
39PREFIX		 = /usr/local
40WWWPREFIX	 = /var/www
41HTDOCDIR	 = $(WWWPREFIX)/htdocs
42CGIBINDIR	 = $(WWWPREFIX)/cgi-bin
43BINDIR		 = $(PREFIX)/bin
44INCLUDEDIR	 = $(PREFIX)/include/mandoc
45LIBDIR		 = $(PREFIX)/lib/mandoc
46MANDIR		 = $(PREFIX)/man
47EXAMPLEDIR	 = $(PREFIX)/share/examples/mandoc
48INSTALL		 = install
49INSTALL_PROGRAM	 = $(INSTALL) -m 0755
50INSTALL_DATA	 = $(INSTALL) -m 0444
51INSTALL_LIB	 = $(INSTALL) -m 0644
52INSTALL_SOURCE	 = $(INSTALL) -m 0644
53INSTALL_MAN	 = $(INSTALL_DATA)
54
55# Non-BSD systems (Linux, etc.) need -ldb to compile mandocdb and
56# apropos.
57# However, if you don't have -ldb at all (or it's not native), then
58# comment out apropos and mandocdb.
59#
60#DBLIB		 = -ldb
61DBBIN		 = apropos mandocdb man.cgi catman whatis
62DBLN		 = llib-lapropos.ln llib-lmandocdb.ln llib-lman.cgi.ln llib-lcatman.ln
63
64all: mandoc preconv demandoc $(DBBIN)
65
66SRCS		 = Makefile \
67		   TODO \
68		   apropos.1 \
69		   apropos.c \
70		   apropos_db.c \
71		   apropos_db.h \
72		   arch.c \
73		   arch.in \
74		   att.c \
75		   att.in \
76		   catman.8 \
77		   catman.c \
78		   cgi.c \
79		   chars.c \
80		   chars.in \
81		   compat_fgetln.c \
82		   compat_getsubopt.c \
83		   compat_strlcat.c \
84		   compat_strlcpy.c \
85		   config.h.post \
86		   config.h.pre \
87		   demandoc.1 \
88		   demandoc.c \
89		   eqn.7 \
90		   eqn.c \
91		   eqn_html.c \
92		   eqn_term.c \
93		   example.style.css \
94		   external.png \
95		   html.c \
96		   html.h \
97		   index.css \
98		   index.sgml \
99		   lib.c \
100		   lib.in \
101		   libman.h \
102		   libmandoc.h \
103		   libmdoc.h \
104		   libroff.h \
105		   main.c \
106		   main.h \
107		   man.7 \
108		   man.c \
109		   man.cgi.7 \
110		   man-cgi.css \
111		   man.h \
112		   man_hash.c \
113		   man_html.c \
114		   man_macro.c \
115		   man_term.c \
116		   man_validate.c \
117		   mandoc.1 \
118		   mandoc.3 \
119		   mandoc.c \
120		   mandoc.h \
121		   mandoc_char.7 \
122		   mandocdb.8 \
123		   mandocdb.c \
124		   mandocdb.h \
125		   manpath.c \
126		   manpath.h \
127		   mdoc.7 \
128		   mdoc.c \
129		   mdoc.h \
130		   mdoc_argv.c \
131		   mdoc_hash.c \
132		   mdoc_html.c \
133		   mdoc_macro.c \
134		   mdoc_man.c \
135		   mdoc_term.c \
136		   mdoc_validate.c \
137		   msec.c \
138		   msec.in \
139		   out.c \
140		   out.h \
141		   preconv.1 \
142		   preconv.c \
143		   predefs.in \
144		   read.c \
145		   regress \
146		   roff.7 \
147		   roff.c \
148		   st.c \
149		   st.in \
150		   style.css \
151		   tbl.7 \
152		   tbl.c \
153		   tbl_data.c \
154		   tbl_html.c \
155		   tbl_layout.c \
156		   tbl_opts.c \
157		   tbl_term.c \
158		   term.c \
159		   term.h \
160		   term_ascii.c \
161		   term_ps.c \
162		   test-fgetln.c \
163		   test-getsubopt.c \
164		   test-mmap.c \
165		   test-strlcat.c \
166		   test-strlcpy.c \
167		   test-strptime.c \
168		   tree.c \
169		   vol.c \
170		   vol.in \
171		   whatis.1
172
173LIBMAN_OBJS	 = man.o \
174		   man_hash.o \
175		   man_macro.o \
176		   man_validate.o
177LIBMAN_LNS	 = man.ln \
178		   man_hash.ln \
179		   man_macro.ln \
180		   man_validate.ln
181
182LIBMDOC_OBJS	 = arch.o \
183		   att.o \
184		   lib.o \
185		   mdoc.o \
186		   mdoc_argv.o \
187		   mdoc_hash.o \
188		   mdoc_macro.o \
189		   mdoc_validate.o \
190		   st.o \
191		   vol.o
192LIBMDOC_LNS	 = arch.ln \
193		   att.ln \
194		   lib.ln \
195		   mdoc.ln \
196		   mdoc_argv.ln \
197		   mdoc_hash.ln \
198		   mdoc_macro.ln \
199		   mdoc_validate.ln \
200		   st.ln \
201		   vol.ln
202
203LIBROFF_OBJS	 = eqn.o \
204		   roff.o \
205		   tbl.o \
206		   tbl_data.o \
207		   tbl_layout.o \
208		   tbl_opts.o
209LIBROFF_LNS	 = eqn.ln \
210		   roff.ln \
211		   tbl.ln \
212		   tbl_data.ln \
213		   tbl_layout.ln \
214		   tbl_opts.ln
215
216LIBMANDOC_OBJS	 = $(LIBMAN_OBJS) \
217		   $(LIBMDOC_OBJS) \
218		   $(LIBROFF_OBJS) \
219		   chars.o \
220		   mandoc.o \
221		   msec.o \
222		   read.o
223LIBMANDOC_LNS	 = $(LIBMAN_LNS) \
224		   $(LIBMDOC_LNS) \
225		   $(LIBROFF_LNS) \
226		   chars.ln \
227		   mandoc.ln \
228		   msec.ln \
229		   read.ln
230
231COMPAT_OBJS	 = compat_fgetln.o \
232		   compat_getsubopt.o \
233		   compat_strlcat.o \
234		   compat_strlcpy.o
235COMPAT_LNS	 = compat_fgetln.ln \
236		   compat_getsubopt.ln \
237		   compat_strlcat.ln \
238		   compat_strlcpy.ln
239
240arch.o arch.ln: arch.in
241att.o att.ln: att.in
242chars.o chars.ln: chars.in
243lib.o lib.ln: lib.in
244msec.o msec.ln: msec.in
245roff.o roff.ln: predefs.in
246st.o st.ln: st.in
247vol.o vol.ln: vol.in
248
249$(LIBMAN_OBJS) $(LIBMAN_LNS): libman.h
250$(LIBMDOC_OBJS) $(LIBMDOC_LNS): libmdoc.h
251$(LIBROFF_OBJS) $(LIBROFF_LNS): libroff.h
252$(LIBMANDOC_OBJS) $(LIBMANDOC_LNS): mandoc.h mdoc.h man.h libmandoc.h config.h
253
254$(COMPAT_OBJS) $(COMPAT_LNS): config.h
255
256MANDOC_HTML_OBJS = eqn_html.o \
257		   html.o \
258		   man_html.o \
259		   mdoc_html.o \
260		   tbl_html.o
261MANDOC_HTML_LNS	 = eqn_html.ln \
262		   html.ln \
263		   man_html.ln \
264		   mdoc_html.ln \
265		   tbl_html.ln
266
267MANDOC_MAN_OBJS  = mdoc_man.o
268MANDOC_MAN_LNS   = mdoc_man.ln
269
270MANDOC_TERM_OBJS = eqn_term.o \
271		   man_term.o \
272		   mdoc_term.o \
273		   term.o \
274		   term_ascii.o \
275		   term_ps.o \
276		   tbl_term.o
277MANDOC_TERM_LNS	 = eqn_term.ln \
278		   man_term.ln \
279		   mdoc_term.ln \
280		   term.ln \
281		   term_ascii.ln \
282		   term_ps.ln \
283		   tbl_term.ln
284
285MANDOC_OBJS	 = $(MANDOC_HTML_OBJS) \
286		   $(MANDOC_MAN_OBJS) \
287		   $(MANDOC_TERM_OBJS) \
288		   main.o \
289		   out.o \
290		   tree.o
291MANDOC_LNS	 = $(MANDOC_HTML_LNS) \
292		   $(MANDOC_MAN_LNS) \
293		   $(MANDOC_TERM_LNS) \
294		   main.ln \
295		   out.ln \
296		   tree.ln
297
298$(MANDOC_HTML_OBJS) $(MANDOC_HTML_LNS): html.h
299$(MANDOC_TERM_OBJS) $(MANDOC_TERM_LNS): term.h
300$(MANDOC_OBJS) $(MANDOC_LNS): main.h mandoc.h mdoc.h man.h config.h out.h
301
302MANDOCDB_OBJS	 = mandocdb.o manpath.o
303MANDOCDB_LNS	 = mandocdb.ln manpath.ln
304
305$(MANDOCDB_OBJS) $(MANDOCDB_LNS): mandocdb.h mandoc.h mdoc.h man.h config.h manpath.h
306
307PRECONV_OBJS	 = preconv.o
308PRECONV_LNS	 = preconv.ln
309
310$(PRECONV_OBJS) $(PRECONV_LNS): config.h
311
312APROPOS_OBJS	 = apropos.o apropos_db.o manpath.o
313APROPOS_LNS	 = apropos.ln apropos_db.ln manpath.ln
314
315$(APROPOS_OBJS) $(APROPOS_LNS): config.h mandoc.h apropos_db.h manpath.h mandocdb.h
316
317CGI_OBJS	 = $(MANDOC_HTML_OBJS) \
318		   $(MANDOC_MAN_OBJS) \
319		   $(MANDOC_TERM_OBJS) \
320		   cgi.o \
321		   apropos_db.o \
322		   manpath.o \
323		   out.o \
324		   tree.o
325
326CGI_LNS	 	 = $(MANDOC_HTML_LNS) \
327		   $(MANDOC_MAN_LNS) \
328		   $(MANDOC_TERM_LNS) \
329		   cgi.ln \
330		   apropos_db.ln \
331		   manpath.ln \
332		   out.ln \
333		   tree.ln
334
335$(CGI_OBJS) $(CGI_LNS): main.h mdoc.h man.h out.h config.h mandoc.h apropos_db.h manpath.h mandocdb.h
336
337CATMAN_OBJS	 = catman.o manpath.o
338CATMAN_LNS 	 = catman.ln manpath.ln
339
340$(CATMAN_OBJS) $(CATMAN_LNS): config.h mandoc.h manpath.h mandocdb.h
341
342DEMANDOC_OBJS	 = demandoc.o
343DEMANDOC_LNS	 = demandoc.ln
344
345$(DEMANDOC_OBJS) $(DEMANDOC_LNS): config.h
346
347INDEX_MANS	 = apropos.1.html \
348		   apropos.1.xhtml \
349		   apropos.1.ps \
350		   apropos.1.pdf \
351		   apropos.1.txt \
352		   catman.8.html \
353		   catman.8.xhtml \
354		   catman.8.ps \
355		   catman.8.pdf \
356		   catman.8.txt \
357		   demandoc.1.html \
358		   demandoc.1.xhtml \
359		   demandoc.1.ps \
360		   demandoc.1.pdf \
361		   demandoc.1.txt \
362		   mandoc.1.html \
363		   mandoc.1.xhtml \
364		   mandoc.1.ps \
365		   mandoc.1.pdf \
366		   mandoc.1.txt \
367		   whatis.1.html \
368		   whatis.1.xhtml \
369		   whatis.1.ps \
370		   whatis.1.pdf \
371		   whatis.1.txt \
372		   mandoc.3.html \
373		   mandoc.3.xhtml \
374		   mandoc.3.ps \
375		   mandoc.3.pdf \
376		   mandoc.3.txt \
377		   eqn.7.html \
378		   eqn.7.xhtml \
379		   eqn.7.ps \
380		   eqn.7.pdf \
381		   eqn.7.txt \
382		   man.7.html \
383		   man.7.xhtml \
384		   man.7.ps \
385		   man.7.pdf \
386		   man.7.txt \
387		   man.cgi.7.html \
388		   man.cgi.7.xhtml \
389		   man.cgi.7.ps \
390		   man.cgi.7.pdf \
391		   man.cgi.7.txt \
392		   mandoc_char.7.html \
393		   mandoc_char.7.xhtml \
394		   mandoc_char.7.ps \
395		   mandoc_char.7.pdf \
396		   mandoc_char.7.txt \
397		   mdoc.7.html \
398		   mdoc.7.xhtml \
399		   mdoc.7.ps \
400		   mdoc.7.pdf \
401		   mdoc.7.txt \
402		   preconv.1.html \
403		   preconv.1.xhtml \
404		   preconv.1.ps \
405		   preconv.1.pdf \
406		   preconv.1.txt \
407		   roff.7.html \
408		   roff.7.xhtml \
409		   roff.7.ps \
410		   roff.7.pdf \
411		   roff.7.txt \
412		   tbl.7.html \
413		   tbl.7.xhtml \
414		   tbl.7.ps \
415		   tbl.7.pdf \
416		   tbl.7.txt \
417		   mandocdb.8.html \
418		   mandocdb.8.xhtml \
419		   mandocdb.8.ps \
420		   mandocdb.8.pdf \
421		   mandocdb.8.txt
422
423$(INDEX_MANS): mandoc
424
425INDEX_OBJS	 = $(INDEX_MANS) \
426		   man.h.html \
427		   mandoc.h.html \
428		   mdoc.h.html \
429		   mdocml.tar.gz \
430		   mdocml.md5
431
432www: index.html
433
434lint: llib-lmandoc.ln llib-lpreconv.ln llib-ldemandoc.ln $(DBLN)
435
436clean:
437	rm -f libmandoc.a $(LIBMANDOC_OBJS)
438	rm -f llib-llibmandoc.ln $(LIBMANDOC_LNS)
439	rm -f mandocdb $(MANDOCDB_OBJS)
440	rm -f llib-lmandocdb.ln $(MANDOCDB_LNS)
441	rm -f preconv $(PRECONV_OBJS)
442	rm -f llib-lpreconv.ln $(PRECONV_LNS)
443	rm -f apropos whatis $(APROPOS_OBJS)
444	rm -f llib-lapropos.ln $(APROPOS_LNS)
445	rm -f man.cgi $(CGI_OBJS)
446	rm -f llib-lman.cgi.ln $(CGI_LNS)
447	rm -f catman $(CATMAN_OBJS)
448	rm -f llib-lcatman.ln $(CATMAN_LNS)
449	rm -f demandoc $(DEMANDOC_OBJS)
450	rm -f llib-ldemandoc.ln $(DEMANDOC_LNS)
451	rm -f mandoc $(MANDOC_OBJS)
452	rm -f llib-lmandoc.ln $(MANDOC_LNS)
453	rm -f config.h config.log $(COMPAT_OBJS) $(COMPAT_LNS)
454	rm -f mdocml.tar.gz mdocml-win32.zip mdocml-win64.zip mdocml-macosx.zip
455	rm -f index.html $(INDEX_OBJS)
456	rm -rf test-fgetln.DSYM
457	rm -rf test-strlcpy.DSYM
458	rm -rf test-strlcat.DSYM
459	rm -rf test-strptime.DSYM
460	rm -rf test-mmap.DSYM
461	rm -rf test-getsubopt.DSYM
462
463install: all
464	mkdir -p $(DESTDIR)$(BINDIR)
465	mkdir -p $(DESTDIR)$(EXAMPLEDIR)
466	mkdir -p $(DESTDIR)$(LIBDIR)
467	mkdir -p $(DESTDIR)$(INCLUDEDIR)
468	mkdir -p $(DESTDIR)$(MANDIR)/man1
469	mkdir -p $(DESTDIR)$(MANDIR)/man3
470	mkdir -p $(DESTDIR)$(MANDIR)/man7
471	mkdir -p $(DESTDIR)$(MANDIR)/man8
472	$(INSTALL_PROGRAM) mandoc preconv demandoc $(DESTDIR)$(BINDIR)
473	$(INSTALL_LIB) libmandoc.a $(DESTDIR)$(LIBDIR)
474	$(INSTALL_LIB) man.h mdoc.h mandoc.h $(DESTDIR)$(INCLUDEDIR)
475	$(INSTALL_MAN) mandoc.1 preconv.1 demandoc.1 $(DESTDIR)$(MANDIR)/man1
476	$(INSTALL_MAN) mandoc.3 $(DESTDIR)$(MANDIR)/man3
477	$(INSTALL_MAN) man.7 mdoc.7 roff.7 eqn.7 tbl.7 mandoc_char.7 $(DESTDIR)$(MANDIR)/man7
478	$(INSTALL_DATA) example.style.css $(DESTDIR)$(EXAMPLEDIR)
479
480installcgi: all
481	mkdir -p $(DESTDIR)$(CGIBINDIR)
482	mkdir -p $(DESTDIR)$(HTDOCDIR)
483	$(INSTALL_PROGRAM) man.cgi $(DESTDIR)$(CGIBINDIR)
484	$(INSTALL_DATA) example.style.css $(DESTDIR)$(HTDOCDIR)/man.css
485	$(INSTALL_DATA) man-cgi.css $(DESTDIR)$(HTDOCDIR)
486
487installwww: www
488	mkdir -p $(PREFIX)/snapshots
489	mkdir -p $(PREFIX)/binaries
490	$(INSTALL_DATA) index.html external.png index.css $(PREFIX)
491	$(INSTALL_DATA) $(INDEX_MANS) style.css $(PREFIX)
492	$(INSTALL_DATA) mandoc.h.html man.h.html mdoc.h.html $(PREFIX)
493	$(INSTALL_DATA) mdocml.tar.gz $(PREFIX)/snapshots
494	$(INSTALL_DATA) mdocml.md5 $(PREFIX)/snapshots
495	$(INSTALL_DATA) mdocml.tar.gz $(PREFIX)/snapshots/mdocml-$(VERSION).tar.gz
496	$(INSTALL_DATA) mdocml.md5 $(PREFIX)/snapshots/mdocml-$(VERSION).md5
497
498libmandoc.a: $(COMPAT_OBJS) $(LIBMANDOC_OBJS)
499	$(AR) rs $@ $(COMPAT_OBJS) $(LIBMANDOC_OBJS)
500
501llib-llibmandoc.ln: $(COMPAT_LNS) $(LIBMANDOC_LNS)
502	$(LINT) $(LINTFLAGS) -Clibmandoc $(COMPAT_LNS) $(LIBMANDOC_LNS)
503
504mandoc: $(MANDOC_OBJS) libmandoc.a
505	$(CC) $(LDFLAGS) -o $@ $(MANDOC_OBJS) libmandoc.a
506
507llib-lmandoc.ln: $(MANDOC_LNS) llib-llibmandoc.ln
508	$(LINT) $(LINTFLAGS) -Cmandoc $(MANDOC_LNS) llib-llibmandoc.ln
509
510mandocdb: $(MANDOCDB_OBJS) libmandoc.a
511	$(CC) $(LDFLAGS) -o $@ $(MANDOCDB_OBJS) libmandoc.a $(DBLIB)
512
513llib-lmandocdb.ln: $(MANDOCDB_LNS) llib-llibmandoc.ln
514	$(LINT) $(LINTFLAGS) -Cmandocdb $(MANDOCDB_LNS) llib-llibmandoc.ln
515
516preconv: $(PRECONV_OBJS)
517	$(CC) $(LDFLAGS) -o $@ $(PRECONV_OBJS)
518
519llib-lpreconv.ln: $(PRECONV_LNS) llib-llibmandoc.ln
520	$(LINT) $(LINTFLAGS) -Cpreconv $(PRECONV_LNS) llib-llibmandoc.ln
521
522whatis: apropos
523	cp -f apropos whatis
524
525apropos: $(APROPOS_OBJS) libmandoc.a
526	$(CC) $(LDFLAGS) -o $@ $(APROPOS_OBJS) libmandoc.a $(DBLIB)
527
528llib-lapropos.ln: $(APROPOS_LNS) llib-llibmandoc.ln
529	$(LINT) $(LINTFLAGS) -Capropos $(APROPOS_LNS) llib-llibmandoc.ln
530
531catman: $(CATMAN_OBJS) libmandoc.a
532	$(CC) $(LDFLAGS) -o $@ $(CATMAN_OBJS) libmandoc.a $(DBLIB)
533
534llib-lcatman.ln: $(CATMAN_LNS) llib-llibmandoc.ln
535	$(LINT) $(LINTFLAGS) -Ccatman $(CATMAN_LNS) llib-llibmandoc.ln
536
537man.cgi: $(CGI_OBJS) libmandoc.a
538	$(CC) $(LDFLAGS) $(STATIC) -o $@ $(CGI_OBJS) libmandoc.a $(DBLIB)
539
540llib-lman.cgi.ln: $(CGI_LNS) llib-llibmandoc.ln
541	$(LINT) $(LINTFLAGS) -Cman.cgi $(CGI_LNS) llib-llibmandoc.ln
542
543demandoc: $(DEMANDOC_OBJS) libmandoc.a
544	$(CC) $(LDFLAGS) -o $@ $(DEMANDOC_OBJS) libmandoc.a
545
546llib-ldemandoc.ln: $(DEMANDOC_LNS) llib-llibmandoc.ln
547	$(LINT) $(LINTFLAGS) -Cdemandoc $(DEMANDOC_LNS) llib-llibmandoc.ln
548
549mdocml.md5: mdocml.tar.gz
550	md5 mdocml.tar.gz >$@
551
552mdocml.tar.gz: $(SRCS)
553	mkdir -p .dist/mdocml-$(VERSION)/
554	$(INSTALL_SOURCE) $(SRCS) .dist/mdocml-$(VERSION)
555	( cd .dist/ && tar zcf ../$@ ./ )
556	rm -rf .dist/
557
558mdocml-win32.zip: $(SRCS)
559	mkdir -p .win32/mdocml-$(VERSION)/
560	$(INSTALL_SOURCE) $(SRCS) .win32
561	cp .win32/Makefile .win32/Makefile.old
562	egrep -v -e DUSE_WCHAR -e ^DBBIN .win32/Makefile.old >.win32/Makefile
563	( cd .win32; \
564		CC=i686-w64-mingw32-gcc AR=i686-w64-mingw32-ar CFLAGS='-DOSNAME=\"Windows\"' make; \
565		make install PREFIX=mdocml-$(VERSION) ; \
566		zip -r ../$@ mdocml-$(VERSION) )
567	rm -rf .win32
568
569mdocml-win64.zip: $(SRCS)
570	mkdir -p .win64/mdocml-$(VERSION)/
571	$(INSTALL_SOURCE) $(SRCS) .win64
572	cp .win64/Makefile .win64/Makefile.old
573	egrep -v -e DUSE_WCHAR -e ^DBBIN .win64/Makefile.old >.win64/Makefile
574	( cd .win64; \
575		CC=x86_64-w64-mingw32-gcc AR=x86_64-w64-mingw32-ar CFLAGS='-DOSNAME=\"Windows\"' make; \
576		make install PREFIX=mdocml-$(VERSION) ; \
577		zip -r ../$@ mdocml-$(VERSION) )
578	rm -rf .win64
579
580mdocml-macosx.zip: $(SRCS)
581	mkdir -p .macosx/mdocml-$(VERSION)/
582	$(INSTALL_SOURCE) $(SRCS) .macosx
583	( cd .macosx; \
584		CFLAGS="-arch i386 -arch x86_64 -arch ppc" LDFLAGS="-arch i386 -arch x86_64 -arch ppc" make; \
585		make install PREFIX=mdocml-$(VERSION) ; \
586		zip -r ../$@ mdocml-$(VERSION) )
587	rm -rf .macosx
588
589index.html: $(INDEX_OBJS)
590
591config.h: config.h.pre config.h.post
592	rm -f config.log
593	( cat config.h.pre; \
594	  echo; \
595	  if $(CC) $(CFLAGS) -Werror -o test-fgetln test-fgetln.c >> config.log 2>&1; then \
596		echo '#define HAVE_FGETLN'; \
597		rm test-fgetln; \
598	  fi; \
599	  if $(CC) $(CFLAGS) -Werror -o test-strptime test-strptime.c >> config.log 2>&1; then \
600		echo '#define HAVE_STRPTIME'; \
601		rm test-strptime; \
602	  fi; \
603	  if $(CC) $(CFLAGS) -Werror -o test-getsubopt test-getsubopt.c >> config.log 2>&1; then \
604		echo '#define HAVE_GETSUBOPT'; \
605		rm test-getsubopt; \
606	  fi; \
607	  if $(CC) $(CFLAGS) -Werror -o test-strlcat test-strlcat.c >> config.log 2>&1; then \
608		echo '#define HAVE_STRLCAT'; \
609		rm test-strlcat; \
610	  fi; \
611	  if $(CC) $(CFLAGS) -Werror -o test-mmap test-mmap.c >> config.log 2>&1; then \
612		echo '#define HAVE_MMAP'; \
613		rm test-mmap; \
614	  fi; \
615	  if $(CC) $(CFLAGS) -Werror -o test-strlcpy test-strlcpy.c >> config.log 2>&1; then \
616		echo '#define HAVE_STRLCPY'; \
617		rm test-strlcpy; \
618	  fi; \
619	  echo; \
620	  cat config.h.post \
621	) > $@
622
623.h.h.html:
624	highlight -I $< >$@
625
626.1.1.txt .3.3.txt .7.7.txt .8.8.txt:
627	./mandoc -Tascii -Wall,stop $< | col -b >$@
628
629.1.1.html .3.3.html .7.7.html .8.8.html:
630	./mandoc -Thtml -Wall,stop -Ostyle=style.css,man=%N.%S.html,includes=%I.html $< >$@
631
632.1.1.ps .3.3.ps .7.7.ps .8.8.ps:
633	./mandoc -Tps -Wall,stop $< >$@
634
635.1.1.xhtml .3.3.xhtml .7.7.xhtml .8.8.xhtml:
636	./mandoc -Txhtml -Wall,stop -Ostyle=style.css,man=%N.%S.xhtml,includes=%I.html $< >$@
637
638.1.1.pdf .3.3.pdf .7.7.pdf .8.8.pdf:
639	./mandoc -Tpdf -Wall,stop $< >$@
640
641.sgml.html:
642	validate --warn $<
643	sed -e "s!@VERSION@!$(VERSION)!" -e "s!@VDATE@!$(VDATE)!" $< >$@
644