1 .PHONY: clean install installwww
2 .SUFFIXES: .sgml .html .md5 .h .h.html
4 .SUFFIXES: .1.txt .3.txt .7.txt
5 .SUFFIXES: .1.pdf .3.pdf .7.pdf
6 .SUFFIXES: .1.ps .3.ps .7.ps
7 .SUFFIXES: .1.html .3.html .7.html
8 .SUFFIXES: .1.xhtml .3.xhtml .7.xhtml
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 # CFLAGS += -DOSNAME="\"OpenBSD 4.5\""
16 CFLAGS += -g -DHAVE_CONFIG_H -DVERSION="\"$(VERSION)\""
17 CFLAGS += -W -Wall -Wstrict-prototypes -Wno-unused-parameter -Wwrite-strings
19 BINDIR = $(PREFIX)/bin
20 INCLUDEDIR = $(PREFIX)/include/mandoc
21 LIBDIR = $(PREFIX)/lib/mandoc
22 MANDIR = $(PREFIX)/man
23 EXAMPLEDIR = $(PREFIX)/share/examples/mandoc
25 INSTALL_PROGRAM = $(INSTALL) -m 0755
26 INSTALL_DATA = $(INSTALL) -m 0444
27 INSTALL_LIB = $(INSTALL) -m 0644
28 INSTALL_MAN = $(INSTALL_DATA)
106 LIBMAN_OBJS = man.o \
111 LIBMDOC_OBJS = arch.o \
122 LIBROFF_OBJS = eqn.o \
128 LIBMANDOC_OBJS = $(LIBMAN_OBJS) \
141 $(LIBMAN_OBJS): libman.h
142 $(LIBMDOC_OBJS): libmdoc.h
143 $(LIBROFF_OBJS): libroff.h
144 $(LIBMANDOC_OBJS): mandoc.h mdoc.h man.h libmandoc.h config.h
146 MANDOC_HTML_OBJS = html.o \
150 MANDOC_TERM_OBJS = man_term.o \
156 MANDOC_OBJS = $(MANDOC_HTML_OBJS) \
157 $(MANDOC_TERM_OBJS) \
165 $(MANDOC_HTML_OBJS): html.h
166 $(MANDOC_TERM_OBJS): term.h
167 $(MANDOC_OBJS): main.h mandoc.h mdoc.h man.h config.h out.h
171 INDEX_MANS = mandoc.1.html \
192 mandoc_char.7.xhtml \
212 $(INDEX_MANS): mandoc
214 INDEX_OBJS = $(INDEX_MANS) \
224 rm -f libmandoc.a $(LIBMANDOC_OBJS)
225 rm -f mandoc $(MANDOC_OBJS)
226 rm -f config.h compat.o config.log
228 rm -f index.html $(INDEX_OBJS)
231 mkdir -p $(DESTDIR)$(BINDIR)
232 mkdir -p $(DESTDIR)$(EXAMPLEDIR)
233 mkdir -p $(DESTDIR)$(MANDIR)/man1
234 mkdir -p $(DESTDIR)$(MANDIR)/man3
235 mkdir -p $(DESTDIR)$(MANDIR)/man7
236 $(INSTALL_PROGRAM) mandoc $(DESTDIR)$(BINDIR)
237 $(INSTALL_LIB) libmandoc.a $(DESTDIR)$(LIBDIR)/
238 $(INSTALL_MAN) mandoc.1 $(DESTDIR)$(MANDIR)/man1
239 $(INSTALL_MAN) mandoc.3 $(DESTDIR)$(MANDIR)/man3
240 $(INSTALL_MAN) man.7 mdoc.7 roff.7 eqn.7 tbl.7 mandoc_char.7 $(DESTDIR)$(MANDIR)/man7
241 $(INSTALL_DATA) example.style.css $(DESTDIR)$(EXAMPLEDIR)
244 mkdir -p $(PREFIX)/snapshots
245 $(INSTALL_DATA) index.html external.png index.css $(PREFIX)
246 $(INSTALL_DATA) $(INDEX_MANS) style.css $(PREFIX)
247 $(INSTALL_DATA) mandoc.h.html man.h.html mdoc.h.html $(PREFIX)
248 $(INSTALL_DATA) mdocml.tar.gz $(PREFIX)/snapshots
249 $(INSTALL_DATA) mdocml.md5 $(PREFIX)/snapshots
250 $(INSTALL_DATA) mdocml.tar.gz $(PREFIX)/snapshots/mdocml-$(VERSION).tar.gz
251 $(INSTALL_DATA) mdocml.md5 $(PREFIX)/snapshots/mdocml-$(VERSION).md5
253 libmandoc.a: compat.o $(LIBMANDOC_OBJS)
254 $(AR) rs $@ compat.o $(LIBMANDOC_OBJS)
256 mandoc: $(MANDOC_OBJS) libmandoc.a
257 $(CC) -o $@ $(MANDOC_OBJS) libmandoc.a
259 mdocml.md5: mdocml.tar.gz
260 md5 mdocml.tar.gz >$@
262 mdocml.tar.gz: $(SRCS)
263 mkdir -p .dist/mdocml-$(VERSION)/
264 $(INSTALL) -m 0444 $(SRCS) .dist/mdocml-$(VERSION)
265 ( cd .dist/ && tar zcf ../$@ ./ )
268 index.html: $(INDEX_OBJS)
270 config.h: config.h.pre config.h.post
272 ( cat config.h.pre; \
274 if $(CC) $(CFLAGS) -Werror -o test-strlcat test-strlcat.c >> config.log 2>&1; then \
275 echo '#define HAVE_STRLCAT'; \
278 if $(CC) $(CFLAGS) -Werror -o test-strlcpy test-strlcpy.c >> config.log 2>&1; then \
279 echo '#define HAVE_STRLCPY'; \
289 .1.1.txt .3.3.txt .7.7.txt:
290 ./mandoc -Tascii -Wall,stop $< | col -b >$@
292 .1.1.html .3.3.html .7.7.html:
293 ./mandoc -Thtml -Wall,stop -Ostyle=style.css,man=%N.%S.html,includes=%I.html $< >$@
295 .1.1.ps .3.3.ps .7.7.ps:
296 ./mandoc -Tps -Wall,stop $< >$@
298 .1.1.xhtml .3.3.xhtml .7.7.xhtml:
299 ./mandoc -Txhtml -Wall,stop -Ostyle=style.css,man=%N.%S.xhtml,includes=%I.html $< >$@
301 .1.1.pdf .3.3.pdf .7.7.pdf:
302 ./mandoc -Tpdf -Wall,stop $< >$@
306 sed -e "s!@VERSION@!$(VERSION)!" -e "s!@VDATE@!$(VDATE)!" $< >$@