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