]> git.cameronkatri.com Git - mandoc.git/blob - Makefile
- remove index.html, it is now part of the website repo
[mandoc.git] / Makefile
1 .PHONY: clean install installcgi installwww
2 .SUFFIXES: .md5 .h .h.html
3 .SUFFIXES: .1 .3 .7 .8
4 .SUFFIXES: .1.html .3.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 # mandocdb(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 = mandocdb 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 = Makefile \
73 NEWS \
74 TODO \
75 apropos.1 \
76 apropos.c \
77 arch.c \
78 arch.in \
79 att.c \
80 att.in \
81 cgi.c \
82 chars.c \
83 chars.in \
84 compat_fgetln.c \
85 compat_getsubopt.c \
86 compat_ohash.c \
87 compat_ohash.h \
88 compat_strcasestr.c \
89 compat_strlcat.c \
90 compat_strlcpy.c \
91 compat_strnlen.c \
92 compat_strsep.c \
93 config.h.post \
94 config.h.pre \
95 configure \
96 demandoc.1 \
97 demandoc.c \
98 eqn.7 \
99 eqn.c \
100 eqn_html.c \
101 eqn_term.c \
102 example.style.css \
103 gmdiff \
104 html.c \
105 html.h \
106 lib.c \
107 lib.in \
108 libman.h \
109 libmandoc.h \
110 libmdoc.h \
111 libroff.h \
112 main.c \
113 main.h \
114 man.7 \
115 man.c \
116 man-cgi.css \
117 man.h \
118 man_hash.c \
119 man_html.c \
120 man_macro.c \
121 man_term.c \
122 man_validate.c \
123 mandoc.1 \
124 mandoc.3 \
125 mandoc.c \
126 mandoc.h \
127 mandoc_char.7 \
128 mandocdb.8 \
129 mandocdb.c \
130 manpage.c \
131 manpath.c \
132 manpath.h \
133 mansearch.c \
134 mansearch.h \
135 mansearch_const.c \
136 mdoc.7 \
137 mdoc.c \
138 mdoc.h \
139 mdoc_argv.c \
140 mdoc_hash.c \
141 mdoc_html.c \
142 mdoc_macro.c \
143 mdoc_man.c \
144 mdoc_term.c \
145 mdoc_validate.c \
146 msec.c \
147 msec.in \
148 out.c \
149 out.h \
150 preconv.1 \
151 preconv.c \
152 predefs.in \
153 read.c \
154 roff.7 \
155 roff.c \
156 st.c \
157 st.in \
158 style.css \
159 tbl.3 \
160 tbl.7 \
161 tbl.c \
162 tbl_data.c \
163 tbl_html.c \
164 tbl_layout.c \
165 tbl_opts.c \
166 tbl_term.c \
167 term.c \
168 term.h \
169 term_ascii.c \
170 term_ps.c \
171 tree.c \
172 vol.c \
173 vol.in \
174 $(TESTSRCS)
175
176 LIBMAN_OBJS = man.o \
177 man_hash.o \
178 man_macro.o \
179 man_validate.o
180
181 LIBMDOC_OBJS = arch.o \
182 att.o \
183 lib.o \
184 mdoc.o \
185 mdoc_argv.o \
186 mdoc_hash.o \
187 mdoc_macro.o \
188 mdoc_validate.o \
189 st.o \
190 vol.o
191
192 LIBROFF_OBJS = eqn.o \
193 roff.o \
194 tbl.o \
195 tbl_data.o \
196 tbl_layout.o \
197 tbl_opts.o
198
199 LIBMANDOC_OBJS = $(LIBMAN_OBJS) \
200 $(LIBMDOC_OBJS) \
201 $(LIBROFF_OBJS) \
202 chars.o \
203 mandoc.o \
204 msec.o \
205 read.o
206
207 COMPAT_OBJS = compat_fgetln.o \
208 compat_getsubopt.o \
209 compat_ohash.o \
210 compat_strcasestr.o \
211 compat_strlcat.o \
212 compat_strlcpy.o \
213 compat_strnlen.o \
214 compat_strsep.o
215
216 arch.o: arch.in
217 att.o: att.in
218 chars.o: chars.in
219 lib.o: lib.in
220 msec.o: msec.in
221 roff.o: predefs.in
222 st.o: st.in
223 vol.o: vol.in
224
225 $(LIBMAN_OBJS): libman.h
226 $(LIBMDOC_OBJS): libmdoc.h
227 $(LIBROFF_OBJS): libroff.h
228 $(LIBMANDOC_OBJS): mandoc.h mdoc.h man.h libmandoc.h config.h
229 $(COMPAT_OBJS): config.h compat_ohash.h
230
231 MANDOC_HTML_OBJS = eqn_html.o \
232 html.o \
233 man_html.o \
234 mdoc_html.o \
235 tbl_html.o
236 $(MANDOC_HTML_OBJS): html.h
237
238 MANDOC_MAN_OBJS = mdoc_man.o
239
240 MANDOC_TERM_OBJS = eqn_term.o \
241 man_term.o \
242 mdoc_term.o \
243 term.o \
244 term_ascii.o \
245 term_ps.o \
246 tbl_term.o
247 $(MANDOC_TERM_OBJS): term.h
248
249 MANDOC_OBJS = $(MANDOC_HTML_OBJS) \
250 $(MANDOC_MAN_OBJS) \
251 $(MANDOC_TERM_OBJS) \
252 main.o \
253 out.o \
254 tree.o
255 $(MANDOC_OBJS): main.h mandoc.h mdoc.h man.h config.h out.h
256
257 MANDOCDB_OBJS = mandocdb.o mansearch_const.o manpath.o
258 $(MANDOCDB_OBJS): mansearch.h mandoc.h mdoc.h man.h config.h manpath.h
259
260 PRECONV_OBJS = preconv.o
261 $(PRECONV_OBJS): config.h
262
263 APROPOS_OBJS = apropos.o mansearch.o mansearch_const.o manpath.o
264 $(APROPOS_OBJS): config.h manpath.h mansearch.h
265
266 MANPAGE_OBJS = manpage.o mansearch.o mansearch_const.o manpath.o
267 $(MANPAGE_OBJS): config.h manpath.h mansearch.h
268
269 DEMANDOC_OBJS = demandoc.o
270 $(DEMANDOC_OBJS): config.h
271
272 WWW_MANS = apropos.1.html \
273 demandoc.1.html \
274 mandoc.1.html \
275 preconv.1.html \
276 mandoc.3.html \
277 tbl.3.html \
278 eqn.7.html \
279 man.7.html \
280 mandoc_char.7.html \
281 mdoc.7.html \
282 roff.7.html \
283 tbl.7.html \
284 mandocdb.8.html \
285 man.h.html \
286 mandoc.h.html \
287 mdoc.h.html
288
289 $(WWW_MANS): mandoc
290
291 WWW_OBJS = mdocml.tar.gz \
292 mdocml.md5
293
294 clean:
295 rm -f libmandoc.a $(LIBMANDOC_OBJS)
296 rm -f apropos $(APROPOS_OBJS)
297 rm -f mandocdb $(MANDOCDB_OBJS)
298 rm -f preconv $(PRECONV_OBJS)
299 rm -f manpage $(MANPAGE_OBJS)
300 rm -f demandoc $(DEMANDOC_OBJS)
301 rm -f mandoc $(MANDOC_OBJS)
302 rm -f config.h config.log $(COMPAT_OBJS)
303 rm -f $(WWW_MANS) $(WWW_OBJS)
304 rm -rf *.dSYM
305
306 install: all
307 mkdir -p $(DESTDIR)$(BINDIR)
308 mkdir -p $(DESTDIR)$(EXAMPLEDIR)
309 mkdir -p $(DESTDIR)$(LIBDIR)
310 mkdir -p $(DESTDIR)$(INCLUDEDIR)
311 mkdir -p $(DESTDIR)$(MANDIR)/man1
312 mkdir -p $(DESTDIR)$(MANDIR)/man3
313 mkdir -p $(DESTDIR)$(MANDIR)/man7
314 $(INSTALL_PROGRAM) $(ALLBIN) $(DESTDIR)$(BINDIR)
315 $(INSTALL_LIB) libmandoc.a $(DESTDIR)$(LIBDIR)
316 $(INSTALL_LIB) man.h mdoc.h mandoc.h $(DESTDIR)$(INCLUDEDIR)
317 $(INSTALL_MAN) mandoc.1 preconv.1 demandoc.1 $(DESTDIR)$(MANDIR)/man1
318 $(INSTALL_MAN) mandoc.3 tbl.3 $(DESTDIR)$(MANDIR)/man3
319 $(INSTALL_MAN) man.7 mdoc.7 roff.7 eqn.7 tbl.7 mandoc_char.7 $(DESTDIR)$(MANDIR)/man7
320 $(INSTALL_DATA) example.style.css $(DESTDIR)$(EXAMPLEDIR)
321
322 installcgi: all
323 mkdir -p $(DESTDIR)$(CGIBINDIR)
324 mkdir -p $(DESTDIR)$(HTDOCDIR)
325 #$(INSTALL_PROGRAM) man.cgi $(DESTDIR)$(CGIBINDIR)
326 $(INSTALL_DATA) example.style.css $(DESTDIR)$(HTDOCDIR)/man.css
327 $(INSTALL_DATA) man-cgi.css $(DESTDIR)$(HTDOCDIR)
328
329 installwww: $(WWW_MANS) $(WWW_OBJS)
330 mkdir -p $(DESTDIR)$(HTDOCDIR)/snapshots
331 $(INSTALL_DATA) $(WWW_MANS) style.css $(DESTDIR)$(HTDOCDIR)
332 $(INSTALL_DATA) $(WWW_OBJS) $(DESTDIR)$(HTDOCDIR)/snapshots
333 $(INSTALL_DATA) mdocml.tar.gz \
334 $(DESTDIR)$(HTDOCDIR)/snapshots/mdocml-$(VERSION).tar.gz
335 $(INSTALL_DATA) mdocml.md5 \
336 $(DESTDIR)$(HTDOCDIR)/snapshots/mdocml-$(VERSION).md5
337
338 libmandoc.a: $(COMPAT_OBJS) $(LIBMANDOC_OBJS)
339 $(AR) rs $@ $(COMPAT_OBJS) $(LIBMANDOC_OBJS)
340
341 mandoc: $(MANDOC_OBJS) libmandoc.a
342 $(CC) $(LDFLAGS) -o $@ $(MANDOC_OBJS) libmandoc.a
343
344 mandocdb: $(MANDOCDB_OBJS) libmandoc.a
345 $(CC) $(LDFLAGS) -o $@ $(MANDOCDB_OBJS) libmandoc.a $(DBLIB)
346
347 preconv: $(PRECONV_OBJS)
348 $(CC) $(LDFLAGS) -o $@ $(PRECONV_OBJS)
349
350 manpage: $(MANPAGE_OBJS) libmandoc.a
351 $(CC) $(LDFLAGS) -o $@ $(MANPAGE_OBJS) libmandoc.a $(DBLIB)
352
353 apropos: $(APROPOS_OBJS) libmandoc.a
354 $(CC) $(LDFLAGS) -o $@ $(APROPOS_OBJS) libmandoc.a $(DBLIB)
355
356 demandoc: $(DEMANDOC_OBJS) libmandoc.a
357 $(CC) $(LDFLAGS) -o $@ $(DEMANDOC_OBJS) libmandoc.a
358
359 mdocml.md5: mdocml.tar.gz
360 md5 mdocml.tar.gz >$@
361
362 mdocml.tar.gz: $(SRCS)
363 mkdir -p .dist/mdocml-$(VERSION)/
364 $(INSTALL_SOURCE) $(SRCS) .dist/mdocml-$(VERSION)
365 chmod 755 .dist/mdocml-$(VERSION)/configure
366 ( cd .dist/ && tar zcf ../$@ mdocml-$(VERSION) )
367 rm -rf .dist/
368
369 config.h: configure config.h.pre config.h.post $(TESTSRCS)
370 rm -f config.log
371 CC="$(CC)" CFLAGS="$(CFLAGS)" VERSION="$(VERSION)" ./configure
372
373 .h.h.html:
374 highlight -I $< >$@
375
376 .1.1.html .3.3.html .7.7.html .8.8.html:
377 ./mandoc -Thtml -Wall,stop -Ostyle=style.css,man=%N.%S.html,includes=%I.html $< >$@