1 .SUFFIXES: .html .xml .sgml .1 .3 .7 .md5 .tar.gz .1.txt .3.txt .7.txt .1.sgml .3.sgml .7.sgml .h .h.html
4 INCLUDEDIR = $(PREFIX)/include
7 EXAMPLEDIR = $(PREFIX)/share/examples/mandoc
9 INSTALL_PROGRAM = $(INSTALL) -m 0755
10 INSTALL_DATA = $(INSTALL) -m 0444
11 INSTALL_LIB = $(INSTALL) -m 0644
12 INSTALL_MAN = $(INSTALL_DATA)
17 VFLAGS = -DVERSION="\"$(VERSION)\""
18 WFLAGS = -W -Wall -Wstrict-prototypes -Wno-unused-parameter -Wwrite-strings
19 CFLAGS += -g $(WFLAGS) $(VFLAGS) -DHAVE_CONFIG_H
21 # Specify this if you want to hard-code the operating system to appear
22 # in the lower-left hand corner of -mdoc manuals.
23 # CFLAGS += -DOSNAME="\"OpenBSD 4.5\""
25 # Unset this if you don't want Xo/Xc allowing split `It' lines, which
29 LINTFLAGS += $(VFLAGS)
31 MANDOCFLAGS = -Wall -fstrict
32 MANDOCHTML = -Thtml -Ostyle=style.css,man=%N.%S.html,includes=%I.html
34 MDOCLNS = mdoc_macro.ln mdoc.ln mdoc_hash.ln mdoc_strings.ln \
35 mdoc_argv.ln mdoc_validate.ln mdoc_action.ln \
36 lib.ln att.ln arch.ln vol.ln msec.ln st.ln \
38 MDOCOBJS = mdoc_macro.o mdoc.o mdoc_hash.o mdoc_strings.o \
39 mdoc_argv.o mdoc_validate.o mdoc_action.o lib.o att.o \
40 arch.o vol.o msec.o st.o mandoc.o
41 MDOCSRCS = mdoc_macro.c mdoc.c mdoc_hash.c mdoc_strings.c \
42 mdoc_argv.c mdoc_validate.c mdoc_action.c lib.c att.c \
43 arch.c vol.c msec.c st.c mandoc.c
45 MANLNS = man_macro.ln man.ln man_hash.ln man_validate.ln \
46 man_action.ln mandoc.ln man_argv.ln
47 MANOBJS = man_macro.o man.o man_hash.o man_validate.o \
48 man_action.o mandoc.o man_argv.o
49 MANSRCS = man_macro.c man.c man_hash.c man_validate.c \
50 man_action.c mandoc.c man_argv.c
52 MAINLNS = main.ln mdoc_term.ln chars.ln term.ln tree.ln \
53 compat.ln man_term.ln html.ln mdoc_html.ln \
55 MAINOBJS = main.o mdoc_term.o chars.o term.o tree.o compat.o \
56 man_term.o html.o mdoc_html.o man_html.o out.o
57 MAINSRCS = main.c mdoc_term.c chars.c term.c tree.c compat.c \
58 man_term.c html.c mdoc_html.c man_html.c out.c
60 LLNS = llib-llibmdoc.ln llib-llibman.ln llib-lmandoc.ln
61 LNS = $(MAINLNS) $(MDOCLNS) $(MANLNS)
62 LIBS = libmdoc.a libman.a
63 OBJS = $(MDOCOBJS) $(MAINOBJS) $(MANOBJS)
64 SRCS = $(MDOCSRCS) $(MAINSRCS) $(MANSRCS)
65 DATAS = arch.in att.in lib.in msec.in st.in \
67 HEADS = mdoc.h libmdoc.h man.h libman.h term.h \
68 libmandoc.h html.h chars.h out.h main.h
69 GSGMLS = mandoc.1.sgml mdoc.3.sgml mdoc.7.sgml manuals.7.sgml \
70 mandoc_char.7.sgml man.7.sgml man.3.sgml
72 HTMLS = ChangeLog.html index.html man.h.html mdoc.h.html
74 GHTMLS = mandoc.1.html mdoc.3.html man.3.html mdoc.7.html \
75 man.7.html mandoc_char.7.html manuals.7.html
76 TEXTS = mandoc.1.txt mdoc.3.txt man.3.txt mdoc.7.txt man.7.txt \
77 mandoc_char.7.txt manuals.7.txt ChangeLog.txt
78 EXAMPLES = example.style.css
80 STATICS = index.css style.css external.png
81 MD5S = mdocml-$(VERSION).md5
82 TARGZS = mdocml-$(VERSION).tar.gz
83 MANS = mandoc.1 mdoc.3 mdoc.7 manuals.7 mandoc_char.7 \
86 TESTS = test-strlcat.c test-strlcpy.c
87 CONFIGS = config.h.pre config.h.post
88 DOCLEAN = $(BINS) $(LNS) $(LLNS) $(LIBS) $(OBJS) $(HTMLS) \
89 $(TARGZS) tags $(MD5S) $(XMLS) $(TEXTS) $(GSGMLS) \
90 $(GHTMLS) config.h config.log
91 DOINSTALL = $(SRCS) $(HEADS) Makefile $(MANS) $(SGMLS) $(STATICS) \
92 $(DATAS) $(XSLS) $(EXAMPLES) $(TESTS) $(CONFIGS)
105 rm -f $(HTMLS) $(GSGMLS) $(GHTMLS)
107 dist: mdocml-$(VERSION).tar.gz
109 www: all $(GSGMLS) $(GHTMLS) $(HTMLS) $(TEXTS) $(MD5S) $(TARGZS)
111 htmls: all $(GSGMLS) $(GHTMLS)
114 $(INSTALL_DATA) $(GHTMLS) $(HTMLS) $(TEXTS) $(STATICS) $(PREFIX)/
115 $(INSTALL_DATA) mdocml-$(VERSION).tar.gz $(PREFIX)/snapshots/
116 $(INSTALL_DATA) mdocml-$(VERSION).md5 $(PREFIX)/snapshots/
117 $(INSTALL_DATA) mdocml-$(VERSION).tar.gz $(PREFIX)/snapshots/mdocml.tar.gz
118 $(INSTALL_DATA) mdocml-$(VERSION).md5 $(PREFIX)/snapshots/mdocml.md5
122 mkdir -p $(EXAMPLEDIR)
123 mkdir -p $(MANDIR)/man1
124 mkdir -p $(MANDIR)/man7
125 $(INSTALL_PROGRAM) mandoc $(BINDIR)
126 $(INSTALL_MAN) mandoc.1 $(MANDIR)/man1
127 $(INSTALL_MAN) man.7 mdoc.7 mandoc_char.7 $(MANDIR)/man7
128 $(INSTALL_DATA) example.style.css $(EXAMPLEDIR)
131 rm -f $(BINDIR)/mandoc
132 rm -f $(MANDIR)/man1/mandoc.1
133 rm -f $(MANDIR)/man7/mdoc.7
134 rm -f $(MANDIR)/man7/man.7
135 rm -f $(MANDIR)/man7/mandoc_char.7
136 rm -f $(EXAMPLEDIR)/example.style.css
142 man_macro.ln man_macro.o: man_macro.c libman.h
144 lib.ln lib.o: lib.c lib.in libmdoc.h
146 att.ln att.o: att.c att.in libmdoc.h
148 arch.ln arch.o: arch.c arch.in libmdoc.h
150 vol.ln vol.o: vol.c vol.in libmdoc.h
152 chars.ln chars.o: chars.c chars.in chars.h
154 msec.ln msec.o: msec.c msec.in libmdoc.h
156 st.ln st.o: st.c st.in libmdoc.h
158 mdoc_macro.ln mdoc_macro.o: mdoc_macro.c libmdoc.h
160 mdoc_term.ln mdoc_term.o: mdoc_term.c term.h mdoc.h
162 mdoc_strings.ln mdoc_strings.o: mdoc_strings.c libmdoc.h
164 man_hash.ln man_hash.o: man_hash.c libman.h
166 mdoc_hash.ln mdoc_hash.o: mdoc_hash.c libmdoc.h
168 mdoc.ln mdoc.o: mdoc.c libmdoc.h
170 man.ln man.o: man.c libman.h
172 main.ln main.o: main.c mdoc.h
174 compat.ln compat.o: compat.c
176 term.ln term.o: term.c term.h man.h mdoc.h chars.h
178 html.ln html.o: html.c html.h chars.h
180 mdoc_html.ln mdoc_html.o: mdoc_html.c html.h mdoc.h
182 man_html.ln man_html.o: man_html.c html.h man.h out.h
184 out.ln out.o: out.c out.h
186 tree.ln tree.o: tree.c man.h mdoc.h
188 mdoc_argv.ln mdoc_argv.o: mdoc_argv.c libmdoc.h
190 man_argv.ln man_argv.o: man_argv.c libman.h
192 man_validate.ln man_validate.o: man_validate.c libman.h
194 mdoc_validate.ln mdoc_validate.o: mdoc_validate.c libmdoc.h
196 mdoc_action.ln mdoc_action.o: mdoc_action.c libmdoc.h
201 cvs2cl --xml --xml-encoding iso-8859-15 -t --noxmlns -f $@
206 ChangeLog.html: ChangeLog.xml ChangeLog.xsl
207 xsltproc -o $@ ChangeLog.xsl ChangeLog.xml
209 mdocml-$(VERSION).tar.gz: $(DOINSTALL)
210 mkdir -p .dist/mdocml/mdocml-$(VERSION)/
211 cp -f $(DOINSTALL) .dist/mdocml/mdocml-$(VERSION)/
212 ( cd .dist/mdocml/ && tar zcf ../../$@ mdocml-$(VERSION)/ )
215 llib-llibmdoc.ln: $(MDOCLNS)
216 $(LINT) -Clibmdoc $(MDOCLNS)
218 llib-llibman.ln: $(MANLNS)
219 $(LINT) -Clibman $(MANLNS)
221 llib-lmandoc.ln: $(MAINLNS) llib-llibmdoc.ln
222 $(LINT) -Cmandoc $(MAINLNS) llib-llibmdoc.ln
224 libmdoc.a: $(MDOCOBJS)
225 $(AR) rs $@ $(MDOCOBJS)
228 $(AR) rs $@ $(MANOBJS)
230 mandoc: $(MAINOBJS) libmdoc.a libman.a
231 $(CC) $(CFLAGS) -o $@ $(MAINOBJS) libmdoc.a libman.a
235 sed -e "s!@VERSION@!$(VERSION)!" -e "s!@VDATE@!$(VDATE)!" $< > $@
237 .1.1.txt .3.3.txt .7.7.txt:
238 ./mandoc $(MANDOCFLAGS) $< | col -b > $@
240 .1.1.sgml .3.3.sgml .7.7.sgml:
241 ./mandoc $(MANDOCFLAGS) $(MANDOCHTML) $< > $@
249 config.h: config.h.pre config.h.post
251 ( cat config.h.pre; \
253 if $(CC) $(CFLAGS) -Werror -c test-strlcat.c >> config.log 2>&1; then \
254 echo '#define HAVE_STRLCAT'; \
257 if $(CC) $(CFLAGS) -Werror -c test-strlcpy.c >> config.log 2>&1; then \
258 echo '#define HAVE_STRLCPY'; \