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
8 INSTALL_PROGRAM = install -m 0755
9 INSTALL_DATA = install -m 0444
10 INSTALL_LIB = install -m 0644
11 INSTALL_MAN = $(INSTALL_DATA)
16 VFLAGS = -DVERSION="\"$(VERSION)\""
17 WFLAGS = -W -Wall -Wstrict-prototypes -Wno-unused-parameter -Wwrite-strings
18 CFLAGS += -g $(WFLAGS) $(VFLAGS) -DHAVE_CONFIG_H
20 # Specify this if you want to hard-code the operating system to appear
21 # in the lower-left hand corner of -mdoc manuals.
22 # CFLAGS += -DOSNAME="\"OpenBSD 4.5\""
24 # Specify this if you want to accept Xo/Xc macros extending the head of
25 # block full-implicit macros.
28 LINTFLAGS += $(VFLAGS)
30 MANDOCFLAGS = -Wall -fstrict
31 MANDOCHTML = -Thtml -Ostyle=style.css,man=%N.%S.html,includes=%I.html
33 MDOCLNS = mdoc_macro.ln mdoc.ln mdoc_hash.ln mdoc_strings.ln \
34 mdoc_argv.ln mdoc_validate.ln mdoc_action.ln \
35 lib.ln att.ln arch.ln vol.ln msec.ln st.ln \
37 MDOCOBJS = mdoc_macro.o mdoc.o mdoc_hash.o mdoc_strings.o \
38 mdoc_argv.o mdoc_validate.o mdoc_action.o lib.o att.o \
39 arch.o vol.o msec.o st.o mandoc.o
40 MDOCSRCS = mdoc_macro.c mdoc.c mdoc_hash.c mdoc_strings.c \
41 mdoc_argv.c mdoc_validate.c mdoc_action.c lib.c att.c \
42 arch.c vol.c msec.c st.c mandoc.c
44 MANLNS = man_macro.ln man.ln man_hash.ln man_validate.ln \
45 man_action.ln mandoc.ln man_argv.ln
46 MANOBJS = man_macro.o man.o man_hash.o man_validate.o \
47 man_action.o mandoc.o man_argv.o
48 MANSRCS = man_macro.c man.c man_hash.c man_validate.c \
49 man_action.c mandoc.c man_argv.c
51 MAINLNS = main.ln mdoc_term.ln chars.ln term.ln tree.ln \
52 compat.ln man_term.ln html.ln mdoc_html.ln \
54 MAINOBJS = main.o mdoc_term.o chars.o term.o tree.o compat.o \
55 man_term.o html.o mdoc_html.o man_html.o out.o
56 MAINSRCS = main.c mdoc_term.c chars.c term.c tree.c compat.c \
57 man_term.c html.c mdoc_html.c man_html.c out.c
59 LLNS = llib-llibmdoc.ln llib-llibman.ln llib-lmandoc.ln
60 LNS = $(MAINLNS) $(MDOCLNS) $(MANLNS)
61 LIBS = libmdoc.a libman.a
62 OBJS = $(MDOCOBJS) $(MAINOBJS) $(MANOBJS)
63 SRCS = $(MDOCSRCS) $(MAINSRCS) $(MANSRCS)
64 DATAS = arch.in att.in lib.in msec.in st.in \
66 HEADS = mdoc.h libmdoc.h man.h libman.h term.h \
67 libmandoc.h html.h chars.h out.h main.h
68 GSGMLS = mandoc.1.sgml mdoc.3.sgml mdoc.7.sgml manuals.7.sgml \
69 mandoc_char.7.sgml man.7.sgml man.3.sgml
71 HTMLS = ChangeLog.html index.html man.h.html mdoc.h.html
73 GHTMLS = mandoc.1.html mdoc.3.html man.3.html mdoc.7.html \
74 man.7.html mandoc_char.7.html manuals.7.html
75 TEXTS = mandoc.1.txt mdoc.3.txt man.3.txt mdoc.7.txt man.7.txt \
76 mandoc_char.7.txt manuals.7.txt ChangeLog.txt
77 EXAMPLES = example.style.css
79 STATICS = index.css style.css external.png
80 MD5S = mdocml-$(VERSION).md5
81 TARGZS = mdocml-$(VERSION).tar.gz
82 MANS = mandoc.1 mdoc.3 mdoc.7 manuals.7 mandoc_char.7 \
85 TESTS = test-strlcat.c test-strlcpy.c
86 CONFIGS = config.h.pre config.h.post
87 CLEAN = $(BINS) $(LNS) $(LLNS) $(LIBS) $(OBJS) $(HTMLS) \
88 $(TARGZS) tags $(MD5S) $(XMLS) $(TEXTS) $(GSGMLS) \
89 $(GHTMLS) config.h config.log
90 INSTALL = $(SRCS) $(HEADS) Makefile $(MANS) $(SGMLS) $(STATICS) \
91 $(DATAS) $(XSLS) $(EXAMPLES) $(TESTS) $(CONFIGS)
104 rm -f $(HTMLS) $(GSGMLS) $(GHTMLS)
106 dist: mdocml-$(VERSION).tar.gz
108 www: all $(GSGMLS) $(GHTMLS) $(HTMLS) $(TEXTS) $(MD5S) $(TARGZS)
110 htmls: all $(GSGMLS) $(GHTMLS)
113 install -m 0444 $(GHTMLS) $(HTMLS) $(TEXTS) $(STATICS) $(PREFIX)/
114 install -m 0444 mdocml-$(VERSION).tar.gz $(PREFIX)/snapshots/
115 install -m 0444 mdocml-$(VERSION).md5 $(PREFIX)/snapshots/
116 install -m 0444 mdocml-$(VERSION).tar.gz $(PREFIX)/snapshots/mdocml.tar.gz
117 install -m 0444 mdocml-$(VERSION).md5 $(PREFIX)/snapshots/mdocml.md5
121 mkdir -p $(EXAMPLEDIR)
122 mkdir -p $(MANDIR)/man1
123 mkdir -p $(MANDIR)/man7
124 $(INSTALL_PROGRAM) mandoc $(BINDIR)
125 $(INSTALL_MAN) mandoc.1 $(MANDIR)/man1
126 $(INSTALL_MAN) man.7 mdoc.7 mandoc_char.7 $(MANDIR)/man7
127 $(INSTALL_DATA) example.style.css $(EXAMPLEDIR)
130 rm -f $(BINDIR)/mandoc
131 rm -f $(MANDIR)/man1/mandoc.1
132 rm -f $(MANDIR)/man7/mdoc.7
133 rm -f $(MANDIR)/man7/man.7
134 rm -f $(MANDIR)/man7/mandoc_char.7
135 rm -f $(EXAMPLEDIR)/example.style.css
141 man_macro.ln man_macro.o: man_macro.c libman.h
143 lib.ln lib.o: lib.c lib.in libmdoc.h
145 att.ln att.o: att.c att.in libmdoc.h
147 arch.ln arch.o: arch.c arch.in libmdoc.h
149 vol.ln vol.o: vol.c vol.in libmdoc.h
151 chars.ln chars.o: chars.c chars.in chars.h
153 msec.ln msec.o: msec.c msec.in libmdoc.h
155 st.ln st.o: st.c st.in libmdoc.h
157 mdoc_macro.ln mdoc_macro.o: mdoc_macro.c libmdoc.h
159 mdoc_term.ln mdoc_term.o: mdoc_term.c term.h mdoc.h
161 mdoc_strings.ln mdoc_strings.o: mdoc_strings.c libmdoc.h
163 man_hash.ln man_hash.o: man_hash.c libman.h
165 mdoc_hash.ln mdoc_hash.o: mdoc_hash.c libmdoc.h
167 mdoc.ln mdoc.o: mdoc.c libmdoc.h
169 man.ln man.o: man.c libman.h
171 main.ln main.o: main.c mdoc.h
173 compat.ln compat.o: compat.c
175 term.ln term.o: term.c term.h man.h mdoc.h chars.h
177 html.ln html.o: html.c html.h chars.h
179 mdoc_html.ln mdoc_html.o: mdoc_html.c html.h mdoc.h
181 man_html.ln man_html.o: man_html.c html.h man.h out.h
183 out.ln out.o: out.c out.h
185 tree.ln tree.o: tree.c man.h mdoc.h
187 mdoc_argv.ln mdoc_argv.o: mdoc_argv.c libmdoc.h
189 man_argv.ln man_argv.o: man_argv.c libman.h
191 man_validate.ln man_validate.o: man_validate.c libman.h
193 mdoc_validate.ln mdoc_validate.o: mdoc_validate.c libmdoc.h
195 mdoc_action.ln mdoc_action.o: mdoc_action.c libmdoc.h
200 cvs2cl --xml --xml-encoding iso-8859-15 -t --noxmlns -f $@
205 ChangeLog.html: ChangeLog.xml ChangeLog.xsl
206 xsltproc -o $@ ChangeLog.xsl ChangeLog.xml
208 mdocml-$(VERSION).tar.gz: $(INSTALL)
209 mkdir -p .dist/mdocml/mdocml-$(VERSION)/
210 cp -f $(INSTALL) .dist/mdocml/mdocml-$(VERSION)/
211 ( cd .dist/mdocml/ && tar zcf ../../$@ mdocml-$(VERSION)/ )
214 llib-llibmdoc.ln: $(MDOCLNS)
215 $(LINT) -Clibmdoc $(MDOCLNS)
217 llib-llibman.ln: $(MANLNS)
218 $(LINT) -Clibman $(MANLNS)
220 llib-lmandoc.ln: $(MAINLNS) llib-llibmdoc.ln
221 $(LINT) -Cmandoc $(MAINLNS) llib-llibmdoc.ln
223 libmdoc.a: $(MDOCOBJS)
224 $(AR) rs $@ $(MDOCOBJS)
227 $(AR) rs $@ $(MANOBJS)
229 mandoc: $(MAINOBJS) libmdoc.a libman.a
230 $(CC) $(CFLAGS) -o $@ $(MAINOBJS) libmdoc.a libman.a
234 sed -e "s!@VERSION@!$(VERSION)!" -e "s!@VDATE@!$(VDATE)!" $< > $@
236 .1.1.txt .3.3.txt .7.7.txt:
237 ./mandoc $(MANDOCFLAGS) $< | col -b > $@
239 .1.1.sgml .3.3.sgml .7.7.sgml:
240 ./mandoc $(MANDOCFLAGS) $(MANDOCHTML) $< > $@
248 config.h: config.h.pre config.h.post
250 ( cat config.h.pre; \
252 if $(CC) $(CFLAGS) -Werror -c test-strlcat.c >> config.log 2>&1; then \
253 echo '#define HAVE_STRLCAT'; \
256 if $(CC) $(CFLAGS) -Werror -c test-strlcpy.c >> config.log 2>&1; then \
257 echo '#define HAVE_STRLCPY'; \