]> git.cameronkatri.com Git - mandoc.git/blob - Makefile
Re-constitution of `ds' symbol processing. First, push the
[mandoc.git] / Makefile
1 .SUFFIXES: .html .xml .sgml .1 .3 .7 .md5 .tar.gz .1.txt .3.txt .7.txt .1.sgml .3.sgml .7.sgml .h .h.html .1.ps .3.ps .7.ps
2
3 PREFIX = /usr/local
4 BINDIR = $(PREFIX)/bin
5 INCLUDEDIR = $(PREFIX)/include
6 LIBDIR = $(PREFIX)/lib
7 MANDIR = $(PREFIX)/man
8 EXAMPLEDIR = $(PREFIX)/share/examples/mandoc
9 INSTALL = install
10 INSTALL_PROGRAM = $(INSTALL) -m 0755
11 INSTALL_DATA = $(INSTALL) -m 0444
12 INSTALL_LIB = $(INSTALL) -m 0644
13 INSTALL_MAN = $(INSTALL_DATA)
14
15 VERSION = 1.10.3
16 VDATE = 29 June 2010
17
18 VFLAGS = -DVERSION="\"$(VERSION)\""
19 WFLAGS = -W -Wall -Wstrict-prototypes -Wno-unused-parameter -Wwrite-strings
20 CFLAGS += -g $(WFLAGS) $(VFLAGS) -DHAVE_CONFIG_H
21
22 # Specify this if you want to hard-code the operating system to appear
23 # in the lower-left hand corner of -mdoc manuals.
24 # CFLAGS += -DOSNAME="\"OpenBSD 4.5\""
25
26 LINTFLAGS += $(VFLAGS)
27
28 MANDOCFLAGS = -Wall -fstrict
29
30 MANDOCHTML = -Thtml -Ostyle=style.css,man=%N.%S.html,includes=%I.html
31
32 MANDOCPS = -Tps
33
34 ROFFLNS = roff.ln
35
36 ROFFSRCS = roff.c
37
38 ROFFOBJS = roff.o
39
40 MANDOCLNS = mandoc.ln
41
42 MANDOCSRCS = mandoc.c
43
44 MANDOCOBJS = mandoc.o
45
46 MDOCLNS = mdoc_macro.ln mdoc.ln mdoc_hash.ln mdoc_strings.ln \
47 mdoc_argv.ln mdoc_validate.ln mdoc_action.ln \
48 lib.ln att.ln arch.ln vol.ln msec.ln st.ln
49
50 MDOCOBJS = mdoc_macro.o mdoc.o mdoc_hash.o mdoc_strings.o \
51 mdoc_argv.o mdoc_validate.o mdoc_action.o lib.o att.o \
52 arch.o vol.o msec.o st.o
53
54 MDOCSRCS = mdoc_macro.c mdoc.c mdoc_hash.c mdoc_strings.c \
55 mdoc_argv.c mdoc_validate.c mdoc_action.c lib.c att.c \
56 arch.c vol.c msec.c st.c
57
58 MANLNS = man_macro.ln man.ln man_hash.ln man_validate.ln \
59 man_action.ln man_argv.ln
60
61 MANOBJS = man_macro.o man.o man_hash.o man_validate.o \
62 man_action.o man_argv.o
63 MANSRCS = man_macro.c man.c man_hash.c man_validate.c \
64 man_action.c man_argv.c
65
66 MAINLNS = main.ln mdoc_term.ln chars.ln term.ln tree.ln \
67 compat.ln man_term.ln html.ln mdoc_html.ln \
68 man_html.ln out.ln term_ps.ln term_ascii.ln
69
70 MAINOBJS = main.o mdoc_term.o chars.o term.o tree.o compat.o \
71 man_term.o html.o mdoc_html.o man_html.o out.o \
72 term_ps.o term_ascii.o
73
74 MAINSRCS = main.c mdoc_term.c chars.c term.c tree.c compat.c \
75 man_term.c html.c mdoc_html.c man_html.c out.c \
76 term_ps.c term_ascii.c
77
78 LLNS = llib-llibmdoc.ln llib-llibman.ln llib-lmandoc.ln \
79 llib-llibmandoc.ln llib-llibroff.ln
80
81 LNS = $(MAINLNS) $(MDOCLNS) $(MANLNS) \
82 $(MANDOCLNS) $(ROFFLNS)
83
84 LIBS = libmdoc.a libman.a libmandoc.a libroff.a
85
86 OBJS = $(MDOCOBJS) $(MAINOBJS) $(MANOBJS) \
87 $(MANDOCOBJS) $(ROFFOBJS)
88
89 SRCS = $(MDOCSRCS) $(MAINSRCS) $(MANSRCS) \
90 $(MANDOCSRCS) $(ROFFSRCS)
91
92 DATAS = arch.in att.in lib.in msec.in st.in \
93 vol.in chars.in
94
95 HEADS = mdoc.h libmdoc.h man.h libman.h term.h \
96 libmandoc.h html.h chars.h out.h main.h roff.h \
97 mandoc.h
98
99 GSGMLS = mandoc.1.sgml mdoc.3.sgml mdoc.7.sgml \
100 mandoc_char.7.sgml man.7.sgml man.3.sgml roff.7.sgml \
101 roff.3.sgml
102
103 SGMLS = index.sgml
104
105 HTMLS = ChangeLog.html index.html man.h.html mdoc.h.html \
106 mandoc.h.html roff.h.html mandoc.1.html mdoc.3.html \
107 man.3.html mdoc.7.html man.7.html mandoc_char.7.html \
108 roff.7.html roff.3.html
109
110 PSS = mandoc.1.ps mdoc.3.ps man.3.ps mdoc.7.ps man.7.ps \
111 mandoc_char.7.ps roff.7.ps roff.3.ps
112
113 XSLS = ChangeLog.xsl
114
115 TEXTS = mandoc.1.txt mdoc.3.txt man.3.txt mdoc.7.txt man.7.txt \
116 mandoc_char.7.txt ChangeLog.txt \
117 roff.7.txt roff.3.txt
118
119 EXAMPLES = example.style.css
120
121 XMLS = ChangeLog.xml
122
123 STATICS = index.css style.css external.png
124
125 MD5S = mdocml-$(VERSION).md5
126
127 TARGZS = mdocml-$(VERSION).tar.gz
128
129 MANS = mandoc.1 mdoc.3 mdoc.7 mandoc_char.7 man.7 \
130 man.3 roff.7 roff.3
131
132 BINS = mandoc
133
134 TESTS = test-strlcat.c test-strlcpy.c
135
136 CONFIGS = config.h.pre config.h.post
137
138 DOCLEAN = $(BINS) $(LNS) $(LLNS) $(LIBS) $(OBJS) $(HTMLS) \
139 $(TARGZS) tags $(MD5S) $(XMLS) $(TEXTS) $(GSGMLS) \
140 config.h config.log $(PSS)
141
142 DOINSTALL = $(SRCS) $(HEADS) Makefile $(MANS) $(SGMLS) $(STATICS) \
143 $(DATAS) $(XSLS) $(EXAMPLES) $(TESTS) $(CONFIGS)
144
145 all: $(BINS)
146
147 lint: $(LLNS)
148
149 clean:
150 rm -f $(DOCLEAN)
151
152 dist: mdocml-$(VERSION).tar.gz
153
154 www: all $(GSGMLS) $(HTMLS) $(TEXTS) $(MD5S) $(TARGZS) $(PSS)
155
156 ps: $(PSS)
157
158 installwww: www
159 $(INSTALL_DATA) $(HTMLS) $(PSS) $(TEXTS) $(STATICS) $(DESTDIR)$(PREFIX)/
160 $(INSTALL_DATA) mdocml-$(VERSION).tar.gz $(DESTDIR)$(PREFIX)/snapshots/
161 $(INSTALL_DATA) mdocml-$(VERSION).md5 $(DESTDIR)$(PREFIX)/snapshots/
162 $(INSTALL_DATA) mdocml-$(VERSION).tar.gz $(DESTDIR)$(PREFIX)/snapshots/mdocml.tar.gz
163 $(INSTALL_DATA) mdocml-$(VERSION).md5 $(DESTDIR)$(PREFIX)/snapshots/mdocml.md5
164
165 install:
166 mkdir -p $(DESTDIR)$(BINDIR)
167 mkdir -p $(DESTDIR)$(EXAMPLEDIR)
168 mkdir -p $(DESTDIR)$(MANDIR)/man1
169 mkdir -p $(DESTDIR)$(MANDIR)/man7
170 $(INSTALL_PROGRAM) mandoc $(DESTDIR)$(BINDIR)
171 $(INSTALL_MAN) mandoc.1 $(DESTDIR)$(MANDIR)/man1
172 $(INSTALL_MAN) man.7 mdoc.7 roff.7 mandoc_char.7 $(DESTDIR)$(MANDIR)/man7
173 $(INSTALL_DATA) example.style.css $(DESTDIR)$(EXAMPLEDIR)
174
175 uninstall:
176 rm -f $(DESTDIR)$(BINDIR)/mandoc
177 rm -f $(DESTDIR)$(MANDIR)/man1/mandoc.1
178 rm -f $(DESTDIR)$(MANDIR)/man7/mdoc.7
179 rm -f $(DESTDIR)$(MANDIR)/man7/roff.7
180 rm -f $(DESTDIR)$(MANDIR)/man7/man.7
181 rm -f $(DESTDIR)$(MANDIR)/man7/mandoc_char.7
182 rm -f $(DESTDIR)$(EXAMPLEDIR)/example.style.css
183
184 $(OBJS): config.h
185
186 $(LNS): config.h
187
188 man_macro.ln man_macro.o: man_macro.c libman.h
189
190 lib.ln lib.o: lib.c lib.in libmdoc.h
191
192 att.ln att.o: att.c att.in libmdoc.h
193
194 arch.ln arch.o: arch.c arch.in libmdoc.h
195
196 vol.ln vol.o: vol.c vol.in libmdoc.h
197
198 chars.ln chars.o: chars.c chars.in chars.h
199
200 msec.ln msec.o: msec.c msec.in libmdoc.h
201
202 st.ln st.o: st.c st.in libmdoc.h
203
204 mdoc_macro.ln mdoc_macro.o: mdoc_macro.c libmdoc.h
205
206 mdoc_term.ln mdoc_term.o: mdoc_term.c term.h mdoc.h
207
208 mdoc_strings.ln mdoc_strings.o: mdoc_strings.c libmdoc.h
209
210 man_hash.ln man_hash.o: man_hash.c libman.h
211
212 mdoc_hash.ln mdoc_hash.o: mdoc_hash.c libmdoc.h
213
214 mdoc.ln mdoc.o: mdoc.c libmdoc.h
215
216 man.ln man.o: man.c libman.h
217
218 main.ln main.o: main.c mdoc.h man.h roff.h
219
220 compat.ln compat.o: compat.c
221
222 term.ln term.o: term.c term.h man.h mdoc.h chars.h
223
224 term_ps.ln term_ps.o: term_ps.c term.h main.h
225
226 term_ascii.ln term_ascii.o: term_ascii.c term.h main.h
227
228 html.ln html.o: html.c html.h chars.h
229
230 mdoc_html.ln mdoc_html.o: mdoc_html.c html.h mdoc.h
231
232 man_html.ln man_html.o: man_html.c html.h man.h out.h
233
234 out.ln out.o: out.c out.h
235
236 mandoc.ln mandoc.o: mandoc.c libmandoc.h
237
238 tree.ln tree.o: tree.c man.h mdoc.h
239
240 mdoc_argv.ln mdoc_argv.o: mdoc_argv.c libmdoc.h
241
242 man_argv.ln man_argv.o: man_argv.c libman.h
243
244 man_validate.ln man_validate.o: man_validate.c libman.h
245
246 mdoc_validate.ln mdoc_validate.o: mdoc_validate.c libmdoc.h
247
248 mdoc_action.ln mdoc_action.o: mdoc_action.c libmdoc.h
249
250 libmdoc.h: mdoc.h
251
252 ChangeLog.xml:
253 cvs2cl --xml --xml-encoding iso-8859-15 -t --noxmlns -f $@
254
255 ChangeLog.txt:
256 cvs2cl -t -f $@
257
258 ChangeLog.html: ChangeLog.xml ChangeLog.xsl
259 xsltproc -o $@ ChangeLog.xsl ChangeLog.xml
260
261 mdocml-$(VERSION).tar.gz: $(DOINSTALL)
262 mkdir -p .dist/mdocml/mdocml-$(VERSION)/
263 cp -f $(DOINSTALL) .dist/mdocml/mdocml-$(VERSION)/
264 ( cd .dist/mdocml/ && tar zcf ../../$@ mdocml-$(VERSION)/ )
265 rm -rf .dist/
266
267 llib-llibmdoc.ln: $(MDOCLNS)
268 $(LINT) -Clibmdoc $(MDOCLNS)
269
270 llib-llibman.ln: $(MANLNS)
271 $(LINT) -Clibman $(MANLNS)
272
273 llib-llibmandoc.ln: $(MANDOCLNS)
274 $(LINT) -Clibmandoc $(MANDOCLNS)
275
276 llib-llibroff.ln: $(ROFFLNS)
277 $(LINT) -Clibroff $(ROFFLNS)
278
279 llib-lmandoc.ln: $(MAINLNS) llib-llibmdoc.ln llib-llibman.ln llib-llibmandoc.ln llib-llibroff.ln
280 $(LINT) -Cmandoc $(MAINLNS) llib-llibmdoc.ln llib-llibman.ln llib-llibmandoc.ln llib-llibroff.ln
281
282 libmdoc.a: $(MDOCOBJS)
283 $(AR) rs $@ $(MDOCOBJS)
284
285 libman.a: $(MANOBJS)
286 $(AR) rs $@ $(MANOBJS)
287
288 libmandoc.a: $(MANDOCOBJS)
289 $(AR) rs $@ $(MANDOCOBJS)
290
291 libroff.a: $(ROFFOBJS)
292 $(AR) rs $@ $(ROFFOBJS)
293
294 mandoc: $(MAINOBJS) libroff.a libmdoc.a libman.a libmandoc.a
295 $(CC) $(CFLAGS) -o $@ $(MAINOBJS) libroff.a libmdoc.a libman.a libmandoc.a
296
297 .sgml.html:
298 validate --warn $<
299 sed -e "s!@VERSION@!$(VERSION)!" -e "s!@VDATE@!$(VDATE)!" $< > $@
300
301 .1.1.txt .3.3.txt .7.7.txt:
302 ./mandoc $(MANDOCFLAGS) $< | col -b > $@
303
304 .1.1.sgml .3.3.sgml .7.7.sgml:
305 ./mandoc $(MANDOCFLAGS) $(MANDOCHTML) $< > $@
306
307 .1.1.ps .3.3.ps .7.7.ps:
308 ./mandoc $(MANDOCFLAGS) $(MANDOCPS) $< > $@
309
310 .tar.gz.md5:
311 md5 $< > $@
312
313 .h.h.html:
314 highlight -I $< >$@
315
316 config.h: config.h.pre config.h.post
317 rm -f config.log
318 ( cat config.h.pre; \
319 echo; \
320 if $(CC) $(CFLAGS) -Werror -c test-strlcat.c >> config.log 2>&1; then \
321 echo '#define HAVE_STRLCAT'; \
322 rm test-strlcat.o; \
323 fi; \
324 if $(CC) $(CFLAGS) -Werror -c test-strlcpy.c >> config.log 2>&1; then \
325 echo '#define HAVE_STRLCPY'; \
326 rm test-strlcpy.o; \
327 fi; \
328 echo; \
329 cat config.h.post \
330 ) > $@