1 .SUFFIXES: .html .xml .sgml .1 .3 .7 .md5 .tar.gz .1.txt .3.txt .7.txt .1.sgml .3.sgml .7.sgml
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)
14 VDATE = 02 January 2010
16 VFLAGS = -DVERSION="\"$(VERSION)\"" -DHAVE_CONFIG_H
17 WFLAGS = -W -Wall -Wstrict-prototypes -Wno-unused-parameter -Wwrite-strings
18 CFLAGS += -g $(VFLAGS) $(WFLAGS)
19 #CFLAGS += -DOSNAME="\"OpenBSD 4.5\""
20 LINTFLAGS += $(VFLAGS)
22 MANDOCFLAGS = -Wall -fstrict
23 MANDOCHTML = -Thtml -Ostyle=style.css,man=%N.%S.html,includes=%I.html
25 MDOCLNS = mdoc_macro.ln mdoc.ln mdoc_hash.ln mdoc_strings.ln \
26 mdoc_argv.ln mdoc_validate.ln mdoc_action.ln \
27 lib.ln att.ln arch.ln vol.ln msec.ln st.ln \
29 MDOCOBJS = mdoc_macro.o mdoc.o mdoc_hash.o mdoc_strings.o \
30 mdoc_argv.o mdoc_validate.o mdoc_action.o lib.o att.o \
31 arch.o vol.o msec.o st.o mandoc.o
32 MDOCSRCS = mdoc_macro.c mdoc.c mdoc_hash.c mdoc_strings.c \
33 mdoc_argv.c mdoc_validate.c mdoc_action.c lib.c att.c \
34 arch.c vol.c msec.c st.c mandoc.c
36 MANLNS = man_macro.ln man.ln man_hash.ln man_validate.ln \
37 man_action.ln mandoc.ln man_argv.ln
38 MANOBJS = man_macro.o man.o man_hash.o man_validate.o \
39 man_action.o mandoc.o man_argv.o
40 MANSRCS = man_macro.c man.c man_hash.c man_validate.c \
41 man_action.c mandoc.c man_argv.c
43 MAINLNS = main.ln mdoc_term.ln chars.ln term.ln tree.ln \
44 compat.ln man_term.ln html.ln mdoc_html.ln \
46 MAINOBJS = main.o mdoc_term.o chars.o term.o tree.o compat.o \
47 man_term.o html.o mdoc_html.o man_html.o out.o
48 MAINSRCS = main.c mdoc_term.c chars.c term.c tree.c compat.c \
49 man_term.c html.c mdoc_html.c man_html.c out.c
51 LLNS = llib-llibmdoc.ln llib-llibman.ln llib-lmandoc.ln
52 LNS = $(MAINLNS) $(MDOCLNS) $(MANLNS)
53 LIBS = libmdoc.a libman.a
54 OBJS = $(MDOCOBJS) $(MAINOBJS) $(MANOBJS)
55 SRCS = $(MDOCSRCS) $(MAINSRCS) $(MANSRCS)
56 DATAS = arch.in att.in lib.in msec.in st.in \
58 HEADS = mdoc.h libmdoc.h man.h libman.h term.h \
59 libmandoc.h html.h chars.h out.h main.h
60 GSGMLS = mandoc.1.sgml mdoc.3.sgml mdoc.7.sgml manuals.7.sgml \
61 mandoc_char.7.sgml man.7.sgml man.3.sgml
63 HTMLS = ChangeLog.html index.html
65 GHTMLS = mandoc.1.html mdoc.3.html man.3.html mdoc.7.html \
66 man.7.html mandoc_char.7.html manuals.7.html
67 TEXTS = mandoc.1.txt mdoc.3.txt man.3.txt mdoc.7.txt man.7.txt \
68 mandoc_char.7.txt manuals.7.txt ChangeLog.txt
69 EXAMPLES = example.style.css
71 STATICS = index.css style.css external.png
72 MD5S = mdocml-$(VERSION).md5
73 TARGZS = mdocml-$(VERSION).tar.gz
74 MANS = mandoc.1 mdoc.3 mdoc.7 manuals.7 mandoc_char.7 \
77 TESTS = test-strlcat.c test-strlcpy.c
78 CONFIGS = config.h.pre config.h.post
79 CLEAN = $(BINS) $(LNS) $(LLNS) $(LIBS) $(OBJS) $(HTMLS) \
80 $(TARGZS) tags $(MD5S) $(XMLS) $(TEXTS) $(GSGMLS) \
81 $(GHTMLS) config.h config.log
82 INSTALL = $(SRCS) $(HEADS) Makefile $(MANS) $(SGMLS) $(STATICS) \
83 $(DATAS) $(XSLS) $(EXAMPLES) $(TESTS) $(CONFIGS)
96 rm -f $(HTMLS) $(GSGMLS) $(GHTMLS)
98 dist: mdocml-$(VERSION).tar.gz
100 www: all $(GSGMLS) $(GHTMLS) $(HTMLS) $(TEXTS) $(MD5S) $(TARGZS)
102 htmls: all $(GSGMLS) $(GHTMLS)
105 install -m 0444 $(GHTMLS) $(HTMLS) $(TEXTS) $(STATICS) $(PREFIX)/
106 install -m 0444 mdocml-$(VERSION).tar.gz $(PREFIX)/snapshots/
107 install -m 0444 mdocml-$(VERSION).md5 $(PREFIX)/snapshots/
108 install -m 0444 mdocml-$(VERSION).tar.gz $(PREFIX)/snapshots/mdocml.tar.gz
109 install -m 0444 mdocml-$(VERSION).md5 $(PREFIX)/snapshots/mdocml.md5
113 mkdir -p $(EXAMPLEDIR)
114 mkdir -p $(MANDIR)/man1
115 mkdir -p $(MANDIR)/man7
116 $(INSTALL_PROGRAM) mandoc $(BINDIR)
117 $(INSTALL_MAN) mandoc.1 $(MANDIR)/man1
118 $(INSTALL_MAN) man.7 mdoc.7 $(MANDIR)/man7
119 $(INSTALL_DATA) example.style.css $(EXAMPLEDIR)
122 rm -f $(BINDIR)/mandoc
123 rm -f $(MANDIR)/man1/mandoc.1
124 rm -f $(MANDIR)/man7/mdoc.7
125 rm -f $(MANDIR)/man7/man.7
126 rm -f $(EXAMPLEDIR)/example.style.css
130 man_macro.ln: man_macro.c libman.h
131 man_macro.o: man_macro.c libman.h
133 lib.ln: lib.c lib.in libmdoc.h
134 lib.o: lib.c lib.in libmdoc.h
136 att.ln: att.c att.in libmdoc.h
137 att.o: att.c att.in libmdoc.h
139 arch.ln: arch.c arch.in libmdoc.h
140 arch.o: arch.c arch.in libmdoc.h
142 vol.ln: vol.c vol.in libmdoc.h
143 vol.o: vol.c vol.in libmdoc.h
145 chars.ln: chars.c chars.in chars.h
146 chars.o: chars.c chars.in chars.h
148 msec.ln: msec.c msec.in libmdoc.h
149 msec.o: msec.c msec.in libmdoc.h
151 st.ln: st.c st.in libmdoc.h
152 st.o: st.c st.in libmdoc.h
154 mdoc_macro.ln: mdoc_macro.c libmdoc.h
155 mdoc_macro.o: mdoc_macro.c libmdoc.h
157 mdoc_term.ln: mdoc_term.c term.h mdoc.h
158 mdoc_term.o: mdoc_term.c term.h mdoc.h
160 mdoc_strings.ln: mdoc_strings.c libmdoc.h
161 mdoc_strings.o: mdoc_strings.c libmdoc.h
163 man_hash.ln: man_hash.c libman.h
164 man_hash.o: man_hash.c libman.h
166 mdoc_hash.ln: mdoc_hash.c libmdoc.h
167 mdoc_hash.o: mdoc_hash.c libmdoc.h
169 mdoc.ln: mdoc.c libmdoc.h
170 mdoc.o: mdoc.c libmdoc.h
172 man.ln: man.c libman.h
173 man.o: man.c libman.h
175 main.ln: main.c mdoc.h
176 main.o: main.c mdoc.h
181 term.ln: term.c term.h man.h mdoc.h chars.h
182 term.o: term.c term.h man.h mdoc.h chars.h
184 html.ln: html.c html.h chars.h
185 html.o: html.c html.h chars.h
187 mdoc_html.ln: mdoc_html.c html.h mdoc.h
188 mdoc_html.o: mdoc_html.c html.h mdoc.h
190 man_html.ln: man_html.c html.h man.h out.h
191 man_html.o: man_html.c html.h man.h out.h
196 tree.ln: tree.c man.h mdoc.h
197 tree.o: tree.c man.h mdoc.h
199 mdoc_argv.ln: mdoc_argv.c libmdoc.h
200 mdoc_argv.o: mdoc_argv.c libmdoc.h
202 man_argv.ln: man_argv.c libman.h
203 man_argv.o: man_argv.c libman.h
205 man_validate.ln: man_validate.c libman.h
206 man_validate.o: man_validate.c libman.h
208 mdoc_validate.ln: mdoc_validate.c libmdoc.h
209 mdoc_validate.o: mdoc_validate.c libmdoc.h
211 mdoc_action.ln: mdoc_action.c libmdoc.h
212 mdoc_action.o: mdoc_action.c libmdoc.h
217 cvs2cl --xml --xml-encoding iso-8859-15 -t --noxmlns -f $@
222 ChangeLog.html: ChangeLog.xml ChangeLog.xsl
223 xsltproc -o $@ ChangeLog.xsl ChangeLog.xml
225 mdocml-$(VERSION).tar.gz: $(INSTALL)
226 mkdir -p .dist/mdocml/mdocml-$(VERSION)/
227 cp -f $(INSTALL) .dist/mdocml/mdocml-$(VERSION)/
228 ( cd .dist/mdocml/ && tar zcf ../../$@ mdocml-$(VERSION)/ )
231 llib-llibmdoc.ln: $(MDOCLNS)
232 $(LINT) -Clibmdoc $(MDOCLNS)
234 llib-llibman.ln: $(MANLNS)
235 $(LINT) -Clibman $(MANLNS)
237 llib-lmandoc.ln: $(MAINLNS) llib-llibmdoc.ln
238 $(LINT) -Cmandoc $(MAINLNS) llib-llibmdoc.ln
240 libmdoc.a: $(MDOCOBJS)
241 $(AR) rs $@ $(MDOCOBJS)
244 $(AR) rs $@ $(MANOBJS)
246 mandoc: $(MAINOBJS) libmdoc.a libman.a
247 $(CC) $(CFLAGS) -o $@ $(MAINOBJS) libmdoc.a libman.a
251 sed -e "s!@VERSION@!$(VERSION)!" -e "s!@VDATE@!$(VDATE)!" $< > $@
253 .1.1.txt .3.3.txt .7.7.txt:
254 ./mandoc $(MANDOCFLAGS) $< | col -b > $@
256 .1.1.sgml .3.3.sgml .7.7.sgml:
257 ./mandoc $(MANDOCFLAGS) $(MANDOCHTML) $< > $@
262 config.h: config.h.pre config.h.post
264 ( cat config.h.pre; \
266 if $(CC) $(CFLAGS) -Werror -c test-strlcat.c >> config.log 2>&1; then \
267 echo '#define HAVE_STRLCAT'; \
270 if $(CC) $(CFLAGS) -Werror -c test-strlcpy.c >> config.log 2>&1; then \
271 echo '#define HAVE_STRLCPY'; \