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