]> git.cameronkatri.com Git - mandoc.git/blob - Makefile
c9c8a844b004bd4930bbba27cf982c1358b05b72
[mandoc.git] / Makefile
1 .PHONY: clean install installcgi installwww
2 .SUFFIXES: .md5 .h .h.html
3 .SUFFIXES: .1 .3 .5 .7 .8
4 .SUFFIXES: .1.html .3.html .5.html .7.html .8.html
5
6 VERSION = 1.13.0
7
8 # === USER SETTINGS ====================================================
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 #
13 # CFLAGS += -DOSNAME="\"OpenBSD 5.4\""
14
15 # IFF your system supports multi-byte functions (setlocale(), wcwidth(),
16 # putwchar()) AND has __STDC_ISO_10646__ (that is, wchar_t is simply a
17 # UCS-4 value) should you define USE_WCHAR. If you define it and your
18 # system DOESN'T support this, -Tlocale will produce garbage.
19 # If you don't define it, -Tlocale is a synonym for -Tacsii.
20 #
21 CFLAGS += -DUSE_WCHAR
22
23 # If your system has manpath(1), uncomment this. This is most any
24 # system that's not OpenBSD or NetBSD. If uncommented, manpage(1) and
25 # makewhatis(8) will use manpath(1) to get the MANPATH variable.
26 #CFLAGS += -DUSE_MANPATH
27
28 # If your system does not support static binaries, comment this,
29 # for example on Mac OS X.
30 STATIC = -static
31 # Linux requires -pthread to statically link with libdb.
32 #STATIC += -pthread
33
34 CFLAGS += -I/usr/local/include -g -DHAVE_CONFIG_H
35 CFLAGS += -W -Wall -Wstrict-prototypes -Wno-unused-parameter -Wwrite-strings
36 PREFIX = /usr/local
37 WWWPREFIX = /var/www
38 HTDOCDIR = $(WWWPREFIX)/htdocs
39 CGIBINDIR = $(WWWPREFIX)/cgi-bin
40 BINDIR = $(PREFIX)/bin
41 INCLUDEDIR = $(PREFIX)/include/mandoc
42 LIBDIR = $(PREFIX)/lib/mandoc
43 MANDIR = $(PREFIX)/man
44 EXAMPLEDIR = $(PREFIX)/share/examples/mandoc
45 INSTALL = install
46 INSTALL_PROGRAM = $(INSTALL) -m 0755
47 INSTALL_DATA = $(INSTALL) -m 0444
48 INSTALL_LIB = $(INSTALL) -m 0644
49 INSTALL_SOURCE = $(INSTALL) -m 0644
50 INSTALL_MAN = $(INSTALL_DATA)
51
52 # If you want to build without database support, for example to avoid
53 # the dependency on SQLite3, comment the following two lines.
54 DBLIB = -L/usr/local/lib -lsqlite3
55 DBBIN = makewhatis manpage apropos
56
57 # === END OF USER SETTINGS =============================================
58
59 ALLBIN = mandoc preconv demandoc $(DBBIN)
60
61 all: $(ALLBIN)
62
63 TESTSRCS = test-fgetln.c \
64 test-getsubopt.c \
65 test-mmap.c \
66 test-ohash.c \
67 test-strlcat.c \
68 test-strlcpy.c \
69 test-strnlen.c \
70 test-strptime.c
71
72 SRCS = LICENSE \
73 Makefile \
74 NEWS \
75 TODO \
76 apropos.1 \
77 apropos.c \
78 arch.c \
79 arch.in \
80 att.c \
81 att.in \
82 cgi.c \
83 chars.c \
84 chars.in \
85 compat_fgetln.c \
86 compat_getsubopt.c \
87 compat_ohash.c \
88 compat_ohash.h \
89 compat_strcasestr.c \
90 compat_strlcat.c \
91 compat_strlcpy.c \
92 compat_strnlen.c \
93 compat_strsep.c \
94 config.h.post \
95 config.h.pre \
96 configure \
97 demandoc.1 \
98 demandoc.c \
99 eqn.7 \
100 eqn.c \
101 eqn_html.c \
102 eqn_term.c \
103 example.style.css \
104 gmdiff \
105 html.c \
106 html.h \
107 lib.c \
108 lib.in \
109 libman.h \
110 libmandoc.h \
111 libmdoc.h \
112 libroff.h \
113 main.c \
114 main.h \
115 makewhatis.8 \
116 man.7 \
117 man.c \
118 man-cgi.css \
119 man.h \
120 man_hash.c \
121 man_html.c \
122 man_macro.c \
123 man_term.c \
124 man_validate.c \
125 mandoc.1 \
126 mandoc.3 \
127 mandoc.c \
128 mandoc.db.5 \
129 mandoc.h \
130 mandoc_aux.c \
131 mandoc_aux.h \
132 mandoc_char.7 \
133 mandocdb.c \
134 manpage.c \
135 manpath.c \
136 manpath.h \
137 mansearch.3 \
138 mansearch.c \
139 mansearch.h \
140 mansearch_const.c \
141 mdoc.7 \
142 mdoc.c \
143 mdoc.h \
144 mdoc_argv.c \
145 mdoc_hash.c \
146 mdoc_html.c \
147 mdoc_macro.c \
148 mdoc_man.c \
149 mdoc_term.c \
150 mdoc_validate.c \
151 msec.c \
152 msec.in \
153 out.c \
154 out.h \
155 preconv.1 \
156 preconv.c \
157 predefs.in \
158 read.c \
159 roff.7 \
160 roff.c \
161 st.c \
162 st.in \
163 style.css \
164 tbl.3 \
165 tbl.7 \
166 tbl.c \
167 tbl_data.c \
168 tbl_html.c \
169 tbl_layout.c \
170 tbl_opts.c \
171 tbl_term.c \
172 term.c \
173 term.h \
174 term_ascii.c \
175 term_ps.c \
176 tree.c \
177 vol.c \
178 vol.in \
179 $(TESTSRCS)
180
181 LIBMAN_OBJS = man.o \
182 man_hash.o \
183 man_macro.o \
184 man_validate.o
185
186 LIBMDOC_OBJS = arch.o \
187 att.o \
188 lib.o \
189 mdoc.o \
190 mdoc_argv.o \
191 mdoc_hash.o \
192 mdoc_macro.o \
193 mdoc_validate.o \
194 st.o \
195 vol.o
196
197 LIBROFF_OBJS = eqn.o \
198 roff.o \
199 tbl.o \
200 tbl_data.o \
201 tbl_layout.o \
202 tbl_opts.o
203
204 LIBMANDOC_OBJS = $(LIBMAN_OBJS) \
205 $(LIBMDOC_OBJS) \
206 $(LIBROFF_OBJS) \
207 chars.o \
208 mandoc.o \
209 mandoc_aux.o \
210 msec.o \
211 read.o
212
213 COMPAT_OBJS = compat_fgetln.o \
214 compat_getsubopt.o \
215 compat_ohash.o \
216 compat_strcasestr.o \
217 compat_strlcat.o \
218 compat_strlcpy.o \
219 compat_strnlen.o \
220 compat_strsep.o
221
222 arch.o: arch.in
223 att.o: att.in
224 chars.o: chars.in
225 lib.o: lib.in
226 msec.o: msec.in
227 roff.o: predefs.in
228 st.o: st.in
229 vol.o: vol.in
230
231 $(LIBMAN_OBJS): libman.h
232 $(LIBMDOC_OBJS): libmdoc.h
233 $(LIBROFF_OBJS): libroff.h
234 $(LIBMANDOC_OBJS): mandoc.h mandoc_aux.h mdoc.h man.h libmandoc.h config.h
235 $(COMPAT_OBJS): config.h compat_ohash.h
236
237 MANDOC_HTML_OBJS = eqn_html.o \
238 html.o \
239 man_html.o \
240 mdoc_html.o \
241 tbl_html.o
242 $(MANDOC_HTML_OBJS): html.h
243
244 MANDOC_MAN_OBJS = mdoc_man.o
245
246 MANDOC_TERM_OBJS = eqn_term.o \
247 man_term.o \
248 mdoc_term.o \
249 term.o \
250 term_ascii.o \
251 term_ps.o \
252 tbl_term.o
253 $(MANDOC_TERM_OBJS): term.h
254
255 MANDOC_OBJS = $(MANDOC_HTML_OBJS) \
256 $(MANDOC_MAN_OBJS) \
257 $(MANDOC_TERM_OBJS) \
258 main.o \
259 out.o \
260 tree.o
261 $(MANDOC_OBJS): main.h mandoc.h mandoc_aux.h mdoc.h man.h config.h out.h
262
263 MAKEWHATIS_OBJS = mandocdb.o mansearch_const.o manpath.o
264 $(MAKEWHATIS_OBJS): mansearch.h mandoc.h mandoc_aux.h \
265 mdoc.h man.h config.h manpath.h
266
267 PRECONV_OBJS = preconv.o
268 $(PRECONV_OBJS): config.h
269
270 APROPOS_OBJS = apropos.o mansearch.o mansearch_const.o manpath.o
271 $(APROPOS_OBJS): config.h manpath.h mansearch.h
272
273 MANPAGE_OBJS = manpage.o mansearch.o mansearch_const.o manpath.o
274 $(MANPAGE_OBJS): config.h manpath.h mansearch.h
275
276 DEMANDOC_OBJS = demandoc.o
277 $(DEMANDOC_OBJS): config.h
278
279 WWW_MANS = apropos.1.html \
280 demandoc.1.html \
281 mandoc.1.html \
282 preconv.1.html \
283 mandoc.3.html \
284 mansearch.3.html \
285 tbl.3.html \
286 mandoc.db.5.html \
287 eqn.7.html \
288 man.7.html \
289 mandoc_char.7.html \
290 mdoc.7.html \
291 roff.7.html \
292 tbl.7.html \
293 makewhatis.8.html \
294 man.h.html \
295 mandoc.h.html \
296 manpath.h.html \
297 mansearch.h.html \
298 mdoc.h.html
299
300 $(WWW_MANS): mandoc
301
302 WWW_OBJS = mdocml.tar.gz \
303 mdocml.md5
304
305 clean:
306 rm -f libmandoc.a $(LIBMANDOC_OBJS)
307 rm -f apropos $(APROPOS_OBJS)
308 rm -f makewhatis $(MAKEWHATIS_OBJS)
309 rm -f preconv $(PRECONV_OBJS)
310 rm -f manpage $(MANPAGE_OBJS)
311 rm -f demandoc $(DEMANDOC_OBJS)
312 rm -f mandoc $(MANDOC_OBJS)
313 rm -f config.h config.log $(COMPAT_OBJS)
314 rm -f $(WWW_MANS) $(WWW_OBJS)
315 rm -rf *.dSYM
316
317 install: all
318 mkdir -p $(DESTDIR)$(BINDIR)
319 mkdir -p $(DESTDIR)$(EXAMPLEDIR)
320 mkdir -p $(DESTDIR)$(LIBDIR)
321 mkdir -p $(DESTDIR)$(INCLUDEDIR)
322 mkdir -p $(DESTDIR)$(MANDIR)/man1
323 mkdir -p $(DESTDIR)$(MANDIR)/man3
324 mkdir -p $(DESTDIR)$(MANDIR)/man5
325 mkdir -p $(DESTDIR)$(MANDIR)/man7
326 $(INSTALL_PROGRAM) $(ALLBIN) $(DESTDIR)$(BINDIR)
327 $(INSTALL_LIB) libmandoc.a $(DESTDIR)$(LIBDIR)
328 $(INSTALL_LIB) man.h mdoc.h mandoc.h $(DESTDIR)$(INCLUDEDIR)
329 $(INSTALL_MAN) mandoc.1 preconv.1 demandoc.1 $(DESTDIR)$(MANDIR)/man1
330 $(INSTALL_MAN) mandoc.3 mansearch.3 tbl.3 $(DESTDIR)$(MANDIR)/man3
331 $(INSTALL_MAN) mandoc.db.5 $(DESTDIR)$(MANDIR)/man5
332 $(INSTALL_MAN) man.7 mdoc.7 roff.7 eqn.7 tbl.7 mandoc_char.7 $(DESTDIR)$(MANDIR)/man7
333 $(INSTALL_DATA) example.style.css $(DESTDIR)$(EXAMPLEDIR)
334
335 installcgi: all
336 mkdir -p $(DESTDIR)$(CGIBINDIR)
337 mkdir -p $(DESTDIR)$(HTDOCDIR)
338 #$(INSTALL_PROGRAM) man.cgi $(DESTDIR)$(CGIBINDIR)
339 $(INSTALL_DATA) example.style.css $(DESTDIR)$(HTDOCDIR)/man.css
340 $(INSTALL_DATA) man-cgi.css $(DESTDIR)$(HTDOCDIR)
341
342 installwww: $(WWW_MANS) $(WWW_OBJS)
343 mkdir -p $(DESTDIR)$(HTDOCDIR)/snapshots
344 $(INSTALL_DATA) $(WWW_MANS) style.css $(DESTDIR)$(HTDOCDIR)
345 $(INSTALL_DATA) $(WWW_OBJS) $(DESTDIR)$(HTDOCDIR)/snapshots
346 $(INSTALL_DATA) mdocml.tar.gz \
347 $(DESTDIR)$(HTDOCDIR)/snapshots/mdocml-$(VERSION).tar.gz
348 $(INSTALL_DATA) mdocml.md5 \
349 $(DESTDIR)$(HTDOCDIR)/snapshots/mdocml-$(VERSION).md5
350
351 libmandoc.a: $(COMPAT_OBJS) $(LIBMANDOC_OBJS)
352 $(AR) rs $@ $(COMPAT_OBJS) $(LIBMANDOC_OBJS)
353
354 mandoc: $(MANDOC_OBJS) libmandoc.a
355 $(CC) $(LDFLAGS) -o $@ $(MANDOC_OBJS) libmandoc.a
356
357 makewhatis: $(MAKEWHATIS_OBJS) libmandoc.a
358 $(CC) $(LDFLAGS) -o $@ $(MAKEWHATIS_OBJS) libmandoc.a $(DBLIB)
359
360 preconv: $(PRECONV_OBJS)
361 $(CC) $(LDFLAGS) -o $@ $(PRECONV_OBJS)
362
363 manpage: $(MANPAGE_OBJS) libmandoc.a
364 $(CC) $(LDFLAGS) -o $@ $(MANPAGE_OBJS) libmandoc.a $(DBLIB)
365
366 apropos: $(APROPOS_OBJS) libmandoc.a
367 $(CC) $(LDFLAGS) -o $@ $(APROPOS_OBJS) libmandoc.a $(DBLIB)
368
369 demandoc: $(DEMANDOC_OBJS) libmandoc.a
370 $(CC) $(LDFLAGS) -o $@ $(DEMANDOC_OBJS) libmandoc.a
371
372 mdocml.md5: mdocml.tar.gz
373 md5 mdocml.tar.gz >$@
374
375 mdocml.tar.gz: $(SRCS)
376 mkdir -p .dist/mdocml-$(VERSION)/
377 $(INSTALL_SOURCE) $(SRCS) .dist/mdocml-$(VERSION)
378 chmod 755 .dist/mdocml-$(VERSION)/configure
379 ( cd .dist/ && tar zcf ../$@ mdocml-$(VERSION) )
380 rm -rf .dist/
381
382 config.h: configure config.h.pre config.h.post $(TESTSRCS)
383 rm -f config.log
384 CC="$(CC)" CFLAGS="$(CFLAGS)" VERSION="$(VERSION)" ./configure
385
386 .h.h.html:
387 highlight -I $< >$@
388
389 .1.1.html .3.3.html .5.5.html .7.7.html .8.8.html:
390 ./mandoc -Thtml -Wall,stop -Ostyle=style.css,man=%N.%S.html,includes=%I.html $< >$@