]> git.cameronkatri.com Git - mandoc.git/blob - Makefile
Make `struct roff' be passed into libmdoc and libman upon creation.
[mandoc.git] / Makefile
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 # CFLAGS += -DOSNAME="\"OpenBSD 4.5\""
13
14 VERSION = 1.11.4
15 VDATE = 12 July 2011
16 # IFF your system supports multi-byte functions (setlocale(), wcwidth(),
17 # putwchar()) AND has __STDC_ISO_10646__ (that is, wchar_t is simply a
18 # UCS-4 value) should you define USE_WCHAR. If you define it and your
19 # system DOESN'T support this, -Tlocale will produce garbage.
20 # If you don't define it, -Tlocale is a synonym for -Tacsii.
21 CFLAGS += -g -DUSE_WCHAR -DHAVE_CONFIG_H -DVERSION="\"$(VERSION)\""
22 CFLAGS += -W -Wall -Wstrict-prototypes -Wno-unused-parameter -Wwrite-strings
23 PREFIX = /usr/local
24 BINDIR = $(PREFIX)/bin
25 INCLUDEDIR = $(PREFIX)/include/mandoc
26 LIBDIR = $(PREFIX)/lib/mandoc
27 MANDIR = $(PREFIX)/man
28 EXAMPLEDIR = $(PREFIX)/share/examples/mandoc
29 INSTALL = install
30 INSTALL_PROGRAM = $(INSTALL) -m 0755
31 INSTALL_DATA = $(INSTALL) -m 0444
32 INSTALL_LIB = $(INSTALL) -m 0644
33 INSTALL_SOURCE = $(INSTALL) -m 0644
34 INSTALL_MAN = $(INSTALL_DATA)
35
36 # Linux needs -ldb to compile mandocdb.
37 #DBLIB = -ldb
38
39 all: mandoc preconv
40
41 SRCS = Makefile \
42 arch.c \
43 arch.in \
44 att.c \
45 att.in \
46 chars.c \
47 chars.in \
48 compat.c \
49 config.h.post \
50 config.h.pre \
51 eqn.7 \
52 eqn.c \
53 example.style.css \
54 external.png \
55 html.c \
56 html.h \
57 index.css \
58 index.sgml \
59 lib.c \
60 lib.in \
61 libman.h \
62 libmandoc.h \
63 libmdoc.h \
64 libroff.h \
65 main.c \
66 main.h \
67 man.h \
68 man.7 \
69 man.c \
70 man_hash.c \
71 man_html.c \
72 man_macro.c \
73 man_term.c \
74 man_validate.c \
75 mandoc.1 \
76 mandoc.3 \
77 mandoc.c \
78 mandoc.h \
79 mandocdb.8 \
80 mandocdb.c \
81 mandoc_char.7 \
82 mdoc.h \
83 mdoc.7 \
84 mdoc.c \
85 mdoc_argv.c \
86 mdoc_hash.c \
87 mdoc_html.c \
88 mdoc_macro.c \
89 mdoc_term.c \
90 mdoc_validate.c \
91 msec.c \
92 msec.in \
93 out.c \
94 out.h \
95 preconv.1 \
96 preconv.c \
97 predefs.in \
98 read.c \
99 roff.7 \
100 roff.c \
101 st.c \
102 st.in \
103 style.css \
104 tbl.7 \
105 tbl.c \
106 tbl_data.c \
107 tbl_html.c \
108 tbl_layout.c \
109 tbl_opts.c \
110 tbl_term.c \
111 term.c \
112 term.h \
113 term_ascii.c \
114 term_ps.c \
115 test-mmap.c \
116 test-strlcat.c \
117 test-strlcpy.c \
118 tree.c \
119 vol.c \
120 vol.in
121
122 LIBMAN_OBJS = man.o \
123 man_hash.o \
124 man_macro.o \
125 man_validate.o
126 LIBMAN_LNS = man.ln \
127 man_hash.ln \
128 man_macro.ln \
129 man_validate.ln
130
131 LIBMDOC_OBJS = arch.o \
132 att.o \
133 lib.o \
134 mdoc.o \
135 mdoc_argv.o \
136 mdoc_hash.o \
137 mdoc_macro.o \
138 mdoc_validate.o \
139 msec.o \
140 st.o \
141 vol.o
142 LIBMDOC_LNS = arch.ln \
143 att.ln \
144 lib.ln \
145 mdoc.ln \
146 mdoc_argv.ln \
147 mdoc_hash.ln \
148 mdoc_macro.ln \
149 mdoc_validate.ln \
150 msec.ln \
151 st.ln \
152 vol.ln
153
154 LIBROFF_OBJS = eqn.o \
155 roff.o \
156 tbl.o \
157 tbl_data.o \
158 tbl_layout.o \
159 tbl_opts.o
160 LIBROFF_LNS = eqn.ln \
161 roff.ln \
162 tbl.ln \
163 tbl_data.ln \
164 tbl_layout.ln \
165 tbl_opts.ln
166
167 LIBMANDOC_OBJS = $(LIBMAN_OBJS) \
168 $(LIBMDOC_OBJS) \
169 $(LIBROFF_OBJS) \
170 chars.o \
171 mandoc.o \
172 read.o
173 LIBMANDOC_LNS = $(LIBMAN_LNS) \
174 $(LIBMDOC_LNS) \
175 $(LIBROFF_LNS) \
176 chars.ln \
177 mandoc.ln \
178 read.ln
179
180 arch.o arch.ln: arch.in
181 att.o att.ln: att.in
182 chars.o chars.ln: chars.in
183 lib.o lib.ln: lib.in
184 msec.o msec.ln: msec.in
185 roff.o roff.ln: predefs.in
186 st.o st.ln: st.in
187 vol.o vol.ln: vol.in
188
189 $(LIBMAN_OBJS) $(LIBMAN_LNS): libman.h
190 $(LIBMDOC_OBJS) $(LIBMDOC_LNS): libmdoc.h
191 $(LIBROFF_OBJS) $(LIBROFF_LNS): libroff.h
192 $(LIBMANDOC_OBJS) $(LIBMANDOC_LNS): mandoc.h mdoc.h man.h libmandoc.h config.h
193
194 MANDOC_HTML_OBJS = html.o \
195 man_html.o \
196 mdoc_html.o \
197 tbl_html.o
198 MANDOC_HTML_LNS = html.ln \
199 man_html.ln \
200 mdoc_html.ln \
201 tbl_html.ln
202
203 MANDOC_TERM_OBJS = man_term.o \
204 mdoc_term.o \
205 term.o \
206 term_ascii.o \
207 term_ps.o \
208 tbl_term.o
209 MANDOC_TERM_LNS = man_term.ln \
210 mdoc_term.ln \
211 term.ln \
212 term_ascii.ln \
213 term_ps.ln \
214 tbl_term.ln
215
216 MANDOC_OBJS = $(MANDOC_HTML_OBJS) \
217 $(MANDOC_TERM_OBJS) \
218 main.o \
219 out.o \
220 tree.o
221 MANDOC_LNS = $(MANDOC_HTML_LNS) \
222 $(MANDOC_TERM_LNS) \
223 main.ln \
224 out.ln \
225 tree.ln
226
227 $(MANDOC_HTML_OBJS) $(MANDOC_HTML_LNS): html.h
228 $(MANDOC_TERM_OBJS) $(MANDOC_TERM_LNS): term.h
229 $(MANDOC_OBJS) $(MANDOC_LNS): main.h mandoc.h mdoc.h man.h config.h out.h
230
231 compat.o compat.ln: config.h
232
233 MANDOCDB_OBJS = mandocdb.o
234 MANDOCDB_LNS = mandocdb.ln
235
236 $(MANDOCDB_OBJS) $(MANDOCDB_LNS): mandoc.h mdoc.h man.h config.h
237
238 PRECONV_OBJS = preconv.o
239 PRECONV_LNS = preconv.ln
240
241 $(PRECONV_OBJS) $(PRECONV_LNS): config.h
242
243 INDEX_MANS = mandoc.1.html \
244 mandoc.1.xhtml \
245 mandoc.1.ps \
246 mandoc.1.pdf \
247 mandoc.1.txt \
248 mandoc.3.html \
249 mandoc.3.xhtml \
250 mandoc.3.ps \
251 mandoc.3.pdf \
252 mandoc.3.txt \
253 eqn.7.html \
254 eqn.7.xhtml \
255 eqn.7.ps \
256 eqn.7.pdf \
257 eqn.7.txt \
258 man.7.html \
259 man.7.xhtml \
260 man.7.ps \
261 man.7.pdf \
262 man.7.txt \
263 mandoc_char.7.html \
264 mandoc_char.7.xhtml \
265 mandoc_char.7.ps \
266 mandoc_char.7.pdf \
267 mandoc_char.7.txt \
268 mdoc.7.html \
269 mdoc.7.xhtml \
270 mdoc.7.ps \
271 mdoc.7.pdf \
272 mdoc.7.txt \
273 preconv.1.html \
274 preconv.1.xhtml \
275 preconv.1.ps \
276 preconv.1.pdf \
277 preconv.1.txt \
278 roff.7.html \
279 roff.7.xhtml \
280 roff.7.ps \
281 roff.7.pdf \
282 roff.7.txt \
283 tbl.7.html \
284 tbl.7.xhtml \
285 tbl.7.ps \
286 tbl.7.pdf \
287 tbl.7.txt \
288 mandocdb.8.html \
289 mandocdb.8.xhtml \
290 mandocdb.8.ps \
291 mandocdb.8.pdf \
292 mandocdb.8.txt
293
294 $(INDEX_MANS): mandoc
295
296 INDEX_OBJS = $(INDEX_MANS) \
297 man.h.html \
298 mandoc.h.html \
299 mdoc.h.html \
300 mdocml.tar.gz \
301 mdocml.md5
302
303 www: index.html
304
305 lint: llib-llibmandoc.ln llib-lmandoc.ln llib-lpreconv.ln
306
307 clean:
308 rm -f libmandoc.a $(LIBMANDOC_OBJS)
309 rm -f llib-llibmandoc.ln $(LIBMANDOC_LNS)
310 rm -f mandocdb $(MANDOCDB_OBJS)
311 rm -f llib-lmandocdb.ln $(MANDOCDB_LNS)
312 rm -f preconv $(PRECONV_OBJS)
313 rm -f llib-lpreconv.ln $(PRECONV_LNS)
314 rm -f mandoc $(MANDOC_OBJS)
315 rm -f llib-lmandoc.ln $(MANDOC_LNS)
316 rm -f config.h config.log compat.o compat.ln
317 rm -f mdocml.tar.gz
318 rm -f index.html $(INDEX_OBJS)
319
320 install: all
321 mkdir -p $(DESTDIR)$(BINDIR)
322 mkdir -p $(DESTDIR)$(EXAMPLEDIR)
323 mkdir -p $(DESTDIR)$(LIBDIR)
324 mkdir -p $(DESTDIR)$(INCLUDEDIR)
325 mkdir -p $(DESTDIR)$(MANDIR)/man1
326 mkdir -p $(DESTDIR)$(MANDIR)/man3
327 mkdir -p $(DESTDIR)$(MANDIR)/man7
328 mkdir -p $(DESTDIR)$(MANDIR)/man8
329 $(INSTALL_PROGRAM) mandoc preconv $(DESTDIR)$(BINDIR)
330 $(INSTALL_LIB) libmandoc.a $(DESTDIR)$(LIBDIR)
331 $(INSTALL_LIB) man.h mdoc.h mandoc.h $(DESTDIR)$(INCLUDEDIR)
332 $(INSTALL_MAN) mandoc.1 preconv.1 $(DESTDIR)$(MANDIR)/man1
333 $(INSTALL_MAN) mandoc.3 $(DESTDIR)$(MANDIR)/man3
334 $(INSTALL_MAN) man.7 mdoc.7 roff.7 eqn.7 tbl.7 mandoc_char.7 $(DESTDIR)$(MANDIR)/man7
335 $(INSTALL_DATA) example.style.css $(DESTDIR)$(EXAMPLEDIR)
336
337 installwww: www
338 mkdir -p $(PREFIX)/snapshots
339 $(INSTALL_DATA) index.html external.png index.css $(PREFIX)
340 $(INSTALL_DATA) $(INDEX_MANS) style.css $(PREFIX)
341 $(INSTALL_DATA) mandoc.h.html man.h.html mdoc.h.html $(PREFIX)
342 $(INSTALL_DATA) mdocml.tar.gz $(PREFIX)/snapshots
343 $(INSTALL_DATA) mdocml.md5 $(PREFIX)/snapshots
344 $(INSTALL_DATA) mdocml.tar.gz $(PREFIX)/snapshots/mdocml-$(VERSION).tar.gz
345 $(INSTALL_DATA) mdocml.md5 $(PREFIX)/snapshots/mdocml-$(VERSION).md5
346
347 libmandoc.a: compat.o $(LIBMANDOC_OBJS)
348 $(AR) rs $@ compat.o $(LIBMANDOC_OBJS)
349
350 llib-llibmandoc.ln: compat.ln $(LIBMANDOC_LNS)
351 $(LINT) $(LINTFLAGS) -Clibmandoc compat.ln $(LIBMANDOC_LNS)
352
353 mandoc: $(MANDOC_OBJS) libmandoc.a
354 $(CC) -o $@ $(MANDOC_OBJS) libmandoc.a
355
356 llib-lmandoc.ln: $(MANDOC_LNS)
357 $(LINT) $(LINTFLAGS) -Cmandoc $(MANDOC_LNS)
358
359 mandocdb: $(MANDOCDB_OBJS) libmandoc.a
360 $(CC) -o $@ $(MANDOCDB_OBJS) libmandoc.a $(DBLIB)
361
362 llib-lmandocdb.ln: $(MANDOCDB_LNS)
363 $(LINT) $(LINTFLAGS) -Cmandocdb $(MANDOCDB_LNS)
364
365 preconv: $(PRECONV_OBJS)
366 $(CC) -o $@ $(PRECONV_OBJS)
367
368 llib-lpreconv.ln: $(PRECONV_LNS)
369 $(LINT) $(LINTFLAGS) -Cpreconv $(PRECONV_LNS)
370
371 mdocml.md5: mdocml.tar.gz
372 md5 mdocml.tar.gz >$@
373
374 mdocml.tar.gz: $(SRCS)
375 mkdir -p .dist/mdocml-$(VERSION)/
376 $(INSTALL_SOURCE) $(SRCS) .dist/mdocml-$(VERSION)
377 ( cd .dist/ && tar zcf ../$@ ./ )
378 rm -rf .dist/
379
380 index.html: $(INDEX_OBJS)
381
382 config.h: config.h.pre config.h.post
383 rm -f config.log
384 ( cat config.h.pre; \
385 echo; \
386 if $(CC) $(CFLAGS) -Werror -o test-strlcat test-strlcat.c >> config.log 2>&1; then \
387 echo '#define HAVE_STRLCAT'; \
388 rm test-strlcat; \
389 fi; \
390 if $(CC) $(CFLAGS) -Werror -o test-mmap test-mmap.c >> config.log 2>&1; then \
391 echo '#define HAVE_MMAP'; \
392 rm test-mmap; \
393 fi; \
394 if $(CC) $(CFLAGS) -Werror -o test-strlcpy test-strlcpy.c >> config.log 2>&1; then \
395 echo '#define HAVE_STRLCPY'; \
396 rm test-strlcpy; \
397 fi; \
398 echo; \
399 cat config.h.post \
400 ) > $@
401
402 .h.h.html:
403 highlight -I $< >$@
404
405 .1.1.txt .3.3.txt .7.7.txt .8.8.txt:
406 ./mandoc -Tascii -Wall,stop $< | col -b >$@
407
408 .1.1.html .3.3.html .7.7.html .8.8.html:
409 ./mandoc -Thtml -Wall,stop -Ostyle=style.css,man=%N.%S.html,includes=%I.html $< >$@
410
411 .1.1.ps .3.3.ps .7.7.ps .8.8.ps:
412 ./mandoc -Tps -Wall,stop $< >$@
413
414 .1.1.xhtml .3.3.xhtml .7.7.xhtml .8.8.xhtml:
415 ./mandoc -Txhtml -Wall,stop -Ostyle=style.css,man=%N.%S.xhtml,includes=%I.html $< >$@
416
417 .1.1.pdf .3.3.pdf .7.7.pdf .8.8.pdf:
418 ./mandoc -Tpdf -Wall,stop $< >$@
419
420 .sgml.html:
421 validate --warn $<
422 sed -e "s!@VERSION@!$(VERSION)!" -e "s!@VDATE@!$(VDATE)!" $< >$@