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