xref: /minix/external/bsd/mdocml/dist/Makefile (revision 84d9c625)
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.1
16VDATE		 = 23 March 2012
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		   roff.7 \
146		   roff.c \
147		   st.c \
148		   st.in \
149		   style.css \
150		   tbl.7 \
151		   tbl.c \
152		   tbl_data.c \
153		   tbl_html.c \
154		   tbl_layout.c \
155		   tbl_opts.c \
156		   tbl_term.c \
157		   term.c \
158		   term.h \
159		   term_ascii.c \
160		   term_ps.c \
161		   test-fgetln.c \
162		   test-getsubopt.c \
163		   test-mmap.c \
164		   test-strlcat.c \
165		   test-strlcpy.c \
166		   test-strptime.c \
167		   tree.c \
168		   vol.c \
169		   vol.in \
170		   whatis.1
171
172LIBMAN_OBJS	 = man.o \
173		   man_hash.o \
174		   man_macro.o \
175		   man_validate.o
176LIBMAN_LNS	 = man.ln \
177		   man_hash.ln \
178		   man_macro.ln \
179		   man_validate.ln
180
181LIBMDOC_OBJS	 = arch.o \
182		   att.o \
183		   lib.o \
184		   mdoc.o \
185		   mdoc_argv.o \
186		   mdoc_hash.o \
187		   mdoc_macro.o \
188		   mdoc_validate.o \
189		   st.o \
190		   vol.o
191LIBMDOC_LNS	 = arch.ln \
192		   att.ln \
193		   lib.ln \
194		   mdoc.ln \
195		   mdoc_argv.ln \
196		   mdoc_hash.ln \
197		   mdoc_macro.ln \
198		   mdoc_validate.ln \
199		   st.ln \
200		   vol.ln
201
202LIBROFF_OBJS	 = eqn.o \
203		   roff.o \
204		   tbl.o \
205		   tbl_data.o \
206		   tbl_layout.o \
207		   tbl_opts.o
208LIBROFF_LNS	 = eqn.ln \
209		   roff.ln \
210		   tbl.ln \
211		   tbl_data.ln \
212		   tbl_layout.ln \
213		   tbl_opts.ln
214
215LIBMANDOC_OBJS	 = $(LIBMAN_OBJS) \
216		   $(LIBMDOC_OBJS) \
217		   $(LIBROFF_OBJS) \
218		   chars.o \
219		   mandoc.o \
220		   msec.o \
221		   read.o
222LIBMANDOC_LNS	 = $(LIBMAN_LNS) \
223		   $(LIBMDOC_LNS) \
224		   $(LIBROFF_LNS) \
225		   chars.ln \
226		   mandoc.ln \
227		   msec.ln \
228		   read.ln
229
230COMPAT_OBJS	 = compat_fgetln.o \
231		   compat_getsubopt.o \
232		   compat_strlcat.o \
233		   compat_strlcpy.o
234COMPAT_LNS	 = compat_fgetln.ln \
235		   compat_getsubopt.ln \
236		   compat_strlcat.ln \
237		   compat_strlcpy.ln
238
239arch.o arch.ln: arch.in
240att.o att.ln: att.in
241chars.o chars.ln: chars.in
242lib.o lib.ln: lib.in
243msec.o msec.ln: msec.in
244roff.o roff.ln: predefs.in
245st.o st.ln: st.in
246vol.o vol.ln: vol.in
247
248$(LIBMAN_OBJS) $(LIBMAN_LNS): libman.h
249$(LIBMDOC_OBJS) $(LIBMDOC_LNS): libmdoc.h
250$(LIBROFF_OBJS) $(LIBROFF_LNS): libroff.h
251$(LIBMANDOC_OBJS) $(LIBMANDOC_LNS): mandoc.h mdoc.h man.h libmandoc.h config.h
252
253$(COMPAT_OBJS) $(COMPAT_LNS): config.h
254
255MANDOC_HTML_OBJS = eqn_html.o \
256		   html.o \
257		   man_html.o \
258		   mdoc_html.o \
259		   tbl_html.o
260MANDOC_HTML_LNS	 = eqn_html.ln \
261		   html.ln \
262		   man_html.ln \
263		   mdoc_html.ln \
264		   tbl_html.ln
265
266MANDOC_MAN_OBJS  = mdoc_man.o
267MANDOC_MAN_LNS   = mdoc_man.ln
268
269MANDOC_TERM_OBJS = eqn_term.o \
270		   man_term.o \
271		   mdoc_term.o \
272		   term.o \
273		   term_ascii.o \
274		   term_ps.o \
275		   tbl_term.o
276MANDOC_TERM_LNS	 = eqn_term.ln \
277		   man_term.ln \
278		   mdoc_term.ln \
279		   term.ln \
280		   term_ascii.ln \
281		   term_ps.ln \
282		   tbl_term.ln
283
284MANDOC_OBJS	 = $(MANDOC_HTML_OBJS) \
285		   $(MANDOC_MAN_OBJS) \
286		   $(MANDOC_TERM_OBJS) \
287		   main.o \
288		   out.o \
289		   tree.o
290MANDOC_LNS	 = $(MANDOC_HTML_LNS) \
291		   $(MANDOC_MAN_LNS) \
292		   $(MANDOC_TERM_LNS) \
293		   main.ln \
294		   out.ln \
295		   tree.ln
296
297$(MANDOC_HTML_OBJS) $(MANDOC_HTML_LNS): html.h
298$(MANDOC_TERM_OBJS) $(MANDOC_TERM_LNS): term.h
299$(MANDOC_OBJS) $(MANDOC_LNS): main.h mandoc.h mdoc.h man.h config.h out.h
300
301MANDOCDB_OBJS	 = mandocdb.o manpath.o
302MANDOCDB_LNS	 = mandocdb.ln manpath.ln
303
304$(MANDOCDB_OBJS) $(MANDOCDB_LNS): mandocdb.h mandoc.h mdoc.h man.h config.h manpath.h
305
306PRECONV_OBJS	 = preconv.o
307PRECONV_LNS	 = preconv.ln
308
309$(PRECONV_OBJS) $(PRECONV_LNS): config.h
310
311APROPOS_OBJS	 = apropos.o apropos_db.o manpath.o
312APROPOS_LNS	 = apropos.ln apropos_db.ln manpath.ln
313
314$(APROPOS_OBJS) $(APROPOS_LNS): config.h mandoc.h apropos_db.h manpath.h mandocdb.h
315
316CGI_OBJS	 = $(MANDOC_HTML_OBJS) \
317		   $(MANDOC_MAN_OBJS) \
318		   $(MANDOC_TERM_OBJS) \
319		   cgi.o \
320		   apropos_db.o \
321		   manpath.o \
322		   out.o \
323		   tree.o
324
325CGI_LNS	 	 = $(MANDOC_HTML_LNS) \
326		   $(MANDOC_MAN_LNS) \
327		   $(MANDOC_TERM_LNS) \
328		   cgi.ln \
329		   apropos_db.ln \
330		   manpath.ln \
331		   out.ln \
332		   tree.ln
333
334$(CGI_OBJS) $(CGI_LNS): main.h mdoc.h man.h out.h config.h mandoc.h apropos_db.h manpath.h mandocdb.h
335
336CATMAN_OBJS	 = catman.o manpath.o
337CATMAN_LNS 	 = catman.ln manpath.ln
338
339$(CATMAN_OBJS) $(CATMAN_LNS): config.h mandoc.h manpath.h mandocdb.h
340
341DEMANDOC_OBJS	 = demandoc.o
342DEMANDOC_LNS	 = demandoc.ln
343
344$(DEMANDOC_OBJS) $(DEMANDOC_LNS): config.h
345
346INDEX_MANS	 = apropos.1.html \
347		   apropos.1.xhtml \
348		   apropos.1.ps \
349		   apropos.1.pdf \
350		   apropos.1.txt \
351		   catman.8.html \
352		   catman.8.xhtml \
353		   catman.8.ps \
354		   catman.8.pdf \
355		   catman.8.txt \
356		   demandoc.1.html \
357		   demandoc.1.xhtml \
358		   demandoc.1.ps \
359		   demandoc.1.pdf \
360		   demandoc.1.txt \
361		   mandoc.1.html \
362		   mandoc.1.xhtml \
363		   mandoc.1.ps \
364		   mandoc.1.pdf \
365		   mandoc.1.txt \
366		   whatis.1.html \
367		   whatis.1.xhtml \
368		   whatis.1.ps \
369		   whatis.1.pdf \
370		   whatis.1.txt \
371		   mandoc.3.html \
372		   mandoc.3.xhtml \
373		   mandoc.3.ps \
374		   mandoc.3.pdf \
375		   mandoc.3.txt \
376		   eqn.7.html \
377		   eqn.7.xhtml \
378		   eqn.7.ps \
379		   eqn.7.pdf \
380		   eqn.7.txt \
381		   man.7.html \
382		   man.7.xhtml \
383		   man.7.ps \
384		   man.7.pdf \
385		   man.7.txt \
386		   man.cgi.7.html \
387		   man.cgi.7.xhtml \
388		   man.cgi.7.ps \
389		   man.cgi.7.pdf \
390		   man.cgi.7.txt \
391		   mandoc_char.7.html \
392		   mandoc_char.7.xhtml \
393		   mandoc_char.7.ps \
394		   mandoc_char.7.pdf \
395		   mandoc_char.7.txt \
396		   mdoc.7.html \
397		   mdoc.7.xhtml \
398		   mdoc.7.ps \
399		   mdoc.7.pdf \
400		   mdoc.7.txt \
401		   preconv.1.html \
402		   preconv.1.xhtml \
403		   preconv.1.ps \
404		   preconv.1.pdf \
405		   preconv.1.txt \
406		   roff.7.html \
407		   roff.7.xhtml \
408		   roff.7.ps \
409		   roff.7.pdf \
410		   roff.7.txt \
411		   tbl.7.html \
412		   tbl.7.xhtml \
413		   tbl.7.ps \
414		   tbl.7.pdf \
415		   tbl.7.txt \
416		   mandocdb.8.html \
417		   mandocdb.8.xhtml \
418		   mandocdb.8.ps \
419		   mandocdb.8.pdf \
420		   mandocdb.8.txt
421
422$(INDEX_MANS): mandoc
423
424INDEX_OBJS	 = $(INDEX_MANS) \
425		   man.h.html \
426		   mandoc.h.html \
427		   mdoc.h.html \
428		   mdocml.tar.gz \
429		   mdocml.md5
430
431www: index.html
432
433lint: llib-lmandoc.ln llib-lpreconv.ln llib-ldemandoc.ln $(DBLN)
434
435clean:
436	rm -f libmandoc.a $(LIBMANDOC_OBJS)
437	rm -f llib-llibmandoc.ln $(LIBMANDOC_LNS)
438	rm -f mandocdb $(MANDOCDB_OBJS)
439	rm -f llib-lmandocdb.ln $(MANDOCDB_LNS)
440	rm -f preconv $(PRECONV_OBJS)
441	rm -f llib-lpreconv.ln $(PRECONV_LNS)
442	rm -f apropos whatis $(APROPOS_OBJS)
443	rm -f llib-lapropos.ln $(APROPOS_LNS)
444	rm -f man.cgi $(CGI_OBJS)
445	rm -f llib-lman.cgi.ln $(CGI_LNS)
446	rm -f catman $(CATMAN_OBJS)
447	rm -f llib-lcatman.ln $(CATMAN_LNS)
448	rm -f demandoc $(DEMANDOC_OBJS)
449	rm -f llib-ldemandoc.ln $(DEMANDOC_LNS)
450	rm -f mandoc $(MANDOC_OBJS)
451	rm -f llib-lmandoc.ln $(MANDOC_LNS)
452	rm -f config.h config.log $(COMPAT_OBJS) $(COMPAT_LNS)
453	rm -f mdocml.tar.gz mdocml-win32.zip mdocml-win64.zip mdocml-macosx.zip
454	rm -f index.html $(INDEX_OBJS)
455	rm -rf test-fgetln.dSYM
456	rm -rf test-strlcpy.dSYM
457	rm -rf test-strlcat.dSYM
458	rm -rf test-strptime.dSYM
459	rm -rf test-mmap.dSYM
460	rm -rf test-getsubopt.dSYM
461	rm -rf apropos.dSYM
462	rm -rf catman.dSYM
463	rm -rf mandocdb.dSYM
464	rm -rf whatis.dSYM
465
466install: all
467	mkdir -p $(DESTDIR)$(BINDIR)
468	mkdir -p $(DESTDIR)$(EXAMPLEDIR)
469	mkdir -p $(DESTDIR)$(LIBDIR)
470	mkdir -p $(DESTDIR)$(INCLUDEDIR)
471	mkdir -p $(DESTDIR)$(MANDIR)/man1
472	mkdir -p $(DESTDIR)$(MANDIR)/man3
473	mkdir -p $(DESTDIR)$(MANDIR)/man7
474	$(INSTALL_PROGRAM) mandoc preconv demandoc $(DESTDIR)$(BINDIR)
475	$(INSTALL_LIB) libmandoc.a $(DESTDIR)$(LIBDIR)
476	$(INSTALL_LIB) man.h mdoc.h mandoc.h $(DESTDIR)$(INCLUDEDIR)
477	$(INSTALL_MAN) mandoc.1 preconv.1 demandoc.1 $(DESTDIR)$(MANDIR)/man1
478	$(INSTALL_MAN) mandoc.3 $(DESTDIR)$(MANDIR)/man3
479	$(INSTALL_MAN) man.7 mdoc.7 roff.7 eqn.7 tbl.7 mandoc_char.7 $(DESTDIR)$(MANDIR)/man7
480	$(INSTALL_DATA) example.style.css $(DESTDIR)$(EXAMPLEDIR)
481
482installcgi: all
483	mkdir -p $(DESTDIR)$(CGIBINDIR)
484	mkdir -p $(DESTDIR)$(HTDOCDIR)
485	$(INSTALL_PROGRAM) man.cgi $(DESTDIR)$(CGIBINDIR)
486	$(INSTALL_DATA) example.style.css $(DESTDIR)$(HTDOCDIR)/man.css
487	$(INSTALL_DATA) man-cgi.css $(DESTDIR)$(HTDOCDIR)
488
489installwww: www
490	mkdir -p $(PREFIX)/snapshots
491	mkdir -p $(PREFIX)/binaries
492	$(INSTALL_DATA) index.html external.png index.css $(PREFIX)
493	$(INSTALL_DATA) $(INDEX_MANS) style.css $(PREFIX)
494	$(INSTALL_DATA) mandoc.h.html man.h.html mdoc.h.html $(PREFIX)
495	$(INSTALL_DATA) mdocml.tar.gz $(PREFIX)/snapshots
496	$(INSTALL_DATA) mdocml.md5 $(PREFIX)/snapshots
497	$(INSTALL_DATA) mdocml.tar.gz $(PREFIX)/snapshots/mdocml-$(VERSION).tar.gz
498	$(INSTALL_DATA) mdocml.md5 $(PREFIX)/snapshots/mdocml-$(VERSION).md5
499
500libmandoc.a: $(COMPAT_OBJS) $(LIBMANDOC_OBJS)
501	$(AR) rs $@ $(COMPAT_OBJS) $(LIBMANDOC_OBJS)
502
503llib-llibmandoc.ln: $(COMPAT_LNS) $(LIBMANDOC_LNS)
504	$(LINT) $(LINTFLAGS) -Clibmandoc $(COMPAT_LNS) $(LIBMANDOC_LNS)
505
506mandoc: $(MANDOC_OBJS) libmandoc.a
507	$(CC) $(LDFLAGS) -o $@ $(MANDOC_OBJS) libmandoc.a
508
509llib-lmandoc.ln: $(MANDOC_LNS) llib-llibmandoc.ln
510	$(LINT) $(LINTFLAGS) -Cmandoc $(MANDOC_LNS) llib-llibmandoc.ln
511
512mandocdb: $(MANDOCDB_OBJS) libmandoc.a
513	$(CC) $(LDFLAGS) -o $@ $(MANDOCDB_OBJS) libmandoc.a $(DBLIB)
514
515llib-lmandocdb.ln: $(MANDOCDB_LNS) llib-llibmandoc.ln
516	$(LINT) $(LINTFLAGS) -Cmandocdb $(MANDOCDB_LNS) llib-llibmandoc.ln
517
518preconv: $(PRECONV_OBJS)
519	$(CC) $(LDFLAGS) -o $@ $(PRECONV_OBJS)
520
521llib-lpreconv.ln: $(PRECONV_LNS) llib-llibmandoc.ln
522	$(LINT) $(LINTFLAGS) -Cpreconv $(PRECONV_LNS) llib-llibmandoc.ln
523
524whatis: apropos
525	cp -f apropos whatis
526
527apropos: $(APROPOS_OBJS) libmandoc.a
528	$(CC) $(LDFLAGS) -o $@ $(APROPOS_OBJS) libmandoc.a $(DBLIB)
529
530llib-lapropos.ln: $(APROPOS_LNS) llib-llibmandoc.ln
531	$(LINT) $(LINTFLAGS) -Capropos $(APROPOS_LNS) llib-llibmandoc.ln
532
533catman: $(CATMAN_OBJS) libmandoc.a
534	$(CC) $(LDFLAGS) -o $@ $(CATMAN_OBJS) libmandoc.a $(DBLIB)
535
536llib-lcatman.ln: $(CATMAN_LNS) llib-llibmandoc.ln
537	$(LINT) $(LINTFLAGS) -Ccatman $(CATMAN_LNS) llib-llibmandoc.ln
538
539man.cgi: $(CGI_OBJS) libmandoc.a
540	$(CC) $(LDFLAGS) $(STATIC) -o $@ $(CGI_OBJS) libmandoc.a $(DBLIB)
541
542llib-lman.cgi.ln: $(CGI_LNS) llib-llibmandoc.ln
543	$(LINT) $(LINTFLAGS) -Cman.cgi $(CGI_LNS) llib-llibmandoc.ln
544
545demandoc: $(DEMANDOC_OBJS) libmandoc.a
546	$(CC) $(LDFLAGS) -o $@ $(DEMANDOC_OBJS) libmandoc.a
547
548llib-ldemandoc.ln: $(DEMANDOC_LNS) llib-llibmandoc.ln
549	$(LINT) $(LINTFLAGS) -Cdemandoc $(DEMANDOC_LNS) llib-llibmandoc.ln
550
551mdocml.md5: mdocml.tar.gz
552	md5 mdocml.tar.gz >$@
553
554mdocml.tar.gz: $(SRCS)
555	mkdir -p .dist/mdocml-$(VERSION)/
556	$(INSTALL_SOURCE) $(SRCS) .dist/mdocml-$(VERSION)
557	( cd .dist/ && tar zcf ../$@ ./ )
558	rm -rf .dist/
559
560mdocml-win32.zip: $(SRCS)
561	mkdir -p .win32/mdocml-$(VERSION)/
562	$(INSTALL_SOURCE) $(SRCS) .win32
563	cp .win32/Makefile .win32/Makefile.old
564	egrep -v -e DUSE_WCHAR -e ^DBBIN .win32/Makefile.old >.win32/Makefile
565	( cd .win32; \
566		CC=i686-w64-mingw32-gcc AR=i686-w64-mingw32-ar CFLAGS='-DOSNAME=\"Windows\"' make; \
567		make install PREFIX=mdocml-$(VERSION) ; \
568		zip -r ../$@ mdocml-$(VERSION) )
569	rm -rf .win32
570
571mdocml-win64.zip: $(SRCS)
572	mkdir -p .win64/mdocml-$(VERSION)/
573	$(INSTALL_SOURCE) $(SRCS) .win64
574	cp .win64/Makefile .win64/Makefile.old
575	egrep -v -e DUSE_WCHAR -e ^DBBIN .win64/Makefile.old >.win64/Makefile
576	( cd .win64; \
577		CC=x86_64-w64-mingw32-gcc AR=x86_64-w64-mingw32-ar CFLAGS='-DOSNAME=\"Windows\"' make; \
578		make install PREFIX=mdocml-$(VERSION) ; \
579		zip -r ../$@ mdocml-$(VERSION) )
580	rm -rf .win64
581
582mdocml-macosx.zip: $(SRCS)
583	mkdir -p .macosx/mdocml-$(VERSION)/
584	$(INSTALL_SOURCE) $(SRCS) .macosx
585	( cd .macosx; \
586		CFLAGS="-arch i386 -arch x86_64 -arch ppc" LDFLAGS="-arch i386 -arch x86_64 -arch ppc" make; \
587		make install PREFIX=mdocml-$(VERSION) ; \
588		zip -r ../$@ mdocml-$(VERSION) )
589	rm -rf .macosx
590
591index.html: $(INDEX_OBJS)
592
593config.h: config.h.pre config.h.post
594	rm -f config.log
595	( cat config.h.pre; \
596	  echo; \
597	  if $(CC) $(CFLAGS) -Werror -o test-fgetln test-fgetln.c >> config.log 2>&1; then \
598		echo '#define HAVE_FGETLN'; \
599		rm test-fgetln; \
600	  fi; \
601	  if $(CC) $(CFLAGS) -Werror -o test-strptime test-strptime.c >> config.log 2>&1; then \
602		echo '#define HAVE_STRPTIME'; \
603		rm test-strptime; \
604	  fi; \
605	  if $(CC) $(CFLAGS) -Werror -o test-getsubopt test-getsubopt.c >> config.log 2>&1; then \
606		echo '#define HAVE_GETSUBOPT'; \
607		rm test-getsubopt; \
608	  fi; \
609	  if $(CC) $(CFLAGS) -Werror -o test-strlcat test-strlcat.c >> config.log 2>&1; then \
610		echo '#define HAVE_STRLCAT'; \
611		rm test-strlcat; \
612	  fi; \
613	  if $(CC) $(CFLAGS) -Werror -o test-mmap test-mmap.c >> config.log 2>&1; then \
614		echo '#define HAVE_MMAP'; \
615		rm test-mmap; \
616	  fi; \
617	  if $(CC) $(CFLAGS) -Werror -o test-strlcpy test-strlcpy.c >> config.log 2>&1; then \
618		echo '#define HAVE_STRLCPY'; \
619		rm test-strlcpy; \
620	  fi; \
621	  echo; \
622	  cat config.h.post \
623	) > $@
624
625.h.h.html:
626	highlight -I $< >$@
627
628.1.1.txt .3.3.txt .7.7.txt .8.8.txt:
629	./mandoc -Tascii -Wall,stop $< | col -b >$@
630
631.1.1.html .3.3.html .7.7.html .8.8.html:
632	./mandoc -Thtml -Wall,stop -Ostyle=style.css,man=%N.%S.html,includes=%I.html $< >$@
633
634.1.1.ps .3.3.ps .7.7.ps .8.8.ps:
635	./mandoc -Tps -Wall,stop $< >$@
636
637.1.1.xhtml .3.3.xhtml .7.7.xhtml .8.8.xhtml:
638	./mandoc -Txhtml -Wall,stop -Ostyle=style.css,man=%N.%S.xhtml,includes=%I.html $< >$@
639
640.1.1.pdf .3.3.pdf .7.7.pdf .8.8.pdf:
641	./mandoc -Tpdf -Wall,stop $< >$@
642
643.sgml.html:
644	validate --warn $<
645	sed -e "s!@VERSION@!$(VERSION)!" -e "s!@VDATE@!$(VDATE)!" $< >$@
646