]> git.cameronkatri.com Git - mandoc.git/blob - Makefile
Make libman use mandoc_getcontrol() for real this time.
[mandoc.git] / Makefile
1 .PHONY: clean install installwww
2 .SUFFIXES: .sgml .html .md5 .h .h.html
3 .SUFFIXES: .1 .3 .7
4 .SUFFIXES: .1.txt .3.txt .7.txt
5 .SUFFIXES: .1.pdf .3.pdf .7.pdf
6 .SUFFIXES: .1.ps .3.ps .7.ps
7 .SUFFIXES: .1.html .3.html .7.html
8 .SUFFIXES: .1.xhtml .3.xhtml .7.xhtml
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 # CFLAGS += -DOSNAME="\"OpenBSD 4.5\""
13
14 VERSION = 1.10.10
15 VDATE = 20 March 2011
16 CFLAGS += -g -DHAVE_CONFIG_H -DVERSION="\"$(VERSION)\""
17 CFLAGS += -W -Wall -Wstrict-prototypes -Wno-unused-parameter -Wwrite-strings
18 PREFIX = /usr/local
19 BINDIR = $(PREFIX)/bin
20 INCLUDEDIR = $(PREFIX)/include/mandoc
21 LIBDIR = $(PREFIX)/lib/mandoc
22 MANDIR = $(PREFIX)/man
23 EXAMPLEDIR = $(PREFIX)/share/examples/mandoc
24 INSTALL = install
25 INSTALL_PROGRAM = $(INSTALL) -m 0755
26 INSTALL_DATA = $(INSTALL) -m 0444
27 INSTALL_LIB = $(INSTALL) -m 0644
28 INSTALL_MAN = $(INSTALL_DATA)
29
30 all: mandoc
31
32 SRCS = Makefile \
33 arch.c \
34 arch.in \
35 att.c \
36 att.in \
37 chars.c \
38 chars.in \
39 compat.c \
40 config.h.post \
41 config.h.pre \
42 eqn.7 \
43 eqn.c \
44 example.style.css \
45 external.png \
46 html.c \
47 html.h \
48 index.css \
49 index.sgml \
50 lib.c \
51 lib.in \
52 libman.h \
53 libmandoc.h \
54 libmdoc.h \
55 libroff.h \
56 main.c \
57 main.h \
58 man.7 \
59 man.c \
60 man_hash.c \
61 man_html.c \
62 man_macro.c \
63 man_term.c \
64 man_validate.c \
65 mandoc.1 \
66 mandoc.3 \
67 mandoc.c \
68 mandoc.h \
69 mandoc_char.7 \
70 mdoc.7 \
71 mdoc.c \
72 mdoc_argv.c \
73 mdoc_hash.c \
74 mdoc_html.c \
75 mdoc_macro.c \
76 mdoc_term.c \
77 mdoc_validate.c \
78 msec.c \
79 msec.in \
80 out.c \
81 out.h \
82 read.c \
83 roff.7 \
84 roff.c \
85 st.c \
86 st.in \
87 style.css \
88 tbl.7 \
89 tbl.c \
90 tbl_data.c \
91 tbl_html.c \
92 tbl_layout.c \
93 tbl_opts.c \
94 tbl_term.c \
95 term.c \
96 term.h \
97 term_ascii.c \
98 term_ps.c \
99 test-strlcat.c \
100 test-strlcpy.c \
101 tree.c \
102 vol.c \
103 vol.in
104
105 LIBMAN_OBJS = man.o \
106 man_hash.o \
107 man_macro.o \
108 man_validate.o
109 LIBMDOC_OBJS = arch.o \
110 att.o \
111 lib.o \
112 mdoc.o \
113 mdoc_argv.o \
114 mdoc_hash.o \
115 mdoc_macro.o \
116 mdoc_validate.o \
117 msec.o \
118 st.o \
119 vol.o
120 LIBROFF_OBJS = eqn.o \
121 roff.o \
122 tbl.o \
123 tbl_data.o \
124 tbl_layout.o \
125 tbl_opts.o
126 LIBMANDOC_OBJS = $(LIBMAN_OBJS) \
127 $(LIBMDOC_OBJS) \
128 $(LIBROFF_OBJS) \
129 mandoc.o \
130 read.o
131
132 arch.o: arch.in
133 att.o: att.in
134 lib.o: lib.in
135 msec.o: msec.in
136 st.o: st.in
137 vol.o: vol.in
138
139 $(LIBMAN_OBJS): libman.h
140 $(LIBMDOC_OBJS): libmdoc.h
141 $(LIBROFF_OBJS): libroff.h
142 $(LIBMANDOC_OBJS): mandoc.h mdoc.h man.h libmandoc.h config.h
143
144 MANDOC_HTML_OBJS = html.o \
145 man_html.o \
146 mdoc_html.o \
147 tbl_html.o
148 MANDOC_TERM_OBJS = man_term.o \
149 mdoc_term.o \
150 term.o \
151 term_ascii.o \
152 term_ps.o \
153 tbl_term.o
154 MANDOC_OBJS = $(MANDOC_HTML_OBJS) \
155 $(MANDOC_TERM_OBJS) \
156 chars.o \
157 main.o \
158 out.o \
159 tree.o
160
161 chars.o: chars.in
162
163 $(MANDOC_HTML_OBJS): html.h
164 $(MANDOC_TERM_OBJS): term.h
165 $(MANDOC_OBJS): main.h mandoc.h mdoc.h man.h config.h out.h
166
167 compat.o: config.h
168
169 INDEX_MANS = mandoc.1.html \
170 mandoc.1.xhtml \
171 mandoc.1.ps \
172 mandoc.1.pdf \
173 mandoc.1.txt \
174 mandoc.3.html \
175 mandoc.3.xhtml \
176 mandoc.3.ps \
177 mandoc.3.pdf \
178 mandoc.3.txt \
179 eqn.7.html \
180 eqn.7.xhtml \
181 eqn.7.ps \
182 eqn.7.pdf \
183 eqn.7.txt \
184 man.7.html \
185 man.7.xhtml \
186 man.7.ps \
187 man.7.pdf \
188 man.7.txt \
189 mandoc_char.7.html \
190 mandoc_char.7.xhtml \
191 mandoc_char.7.ps \
192 mandoc_char.7.pdf \
193 mandoc_char.7.txt \
194 mdoc.7.html \
195 mdoc.7.xhtml \
196 mdoc.7.ps \
197 mdoc.7.pdf \
198 mdoc.7.txt \
199 roff.7.html \
200 roff.7.xhtml \
201 roff.7.ps \
202 roff.7.pdf \
203 roff.7.txt \
204 tbl.7.html \
205 tbl.7.xhtml \
206 tbl.7.ps \
207 tbl.7.pdf \
208 tbl.7.txt
209
210 $(INDEX_MANS): mandoc
211
212 INDEX_OBJS = $(INDEX_MANS) \
213 man.h.html \
214 mandoc.h.html \
215 mdoc.h.html \
216 mdocml.tar.gz \
217 mdocml.md5
218
219 www: index.html
220
221 clean:
222 rm -f libmandoc.a $(LIBMANDOC_OBJS)
223 rm -f mandoc $(MANDOC_OBJS)
224 rm -f config.h compat.o config.log
225 rm -f mdocml.tar.gz
226 rm -f index.html $(INDEX_OBJS)
227
228 install: all
229 mkdir -p $(DESTDIR)$(BINDIR)
230 mkdir -p $(DESTDIR)$(EXAMPLEDIR)
231 mkdir -p $(DESTDIR)$(MANDIR)/man1
232 mkdir -p $(DESTDIR)$(MANDIR)/man3
233 mkdir -p $(DESTDIR)$(MANDIR)/man7
234 $(INSTALL_PROGRAM) mandoc $(DESTDIR)$(BINDIR)
235 $(INSTALL_LIB) libmandoc.a $(DESTDIR)$(LIBDIR)
236 $(INSTALL_MAN) mandoc.1 $(DESTDIR)$(MANDIR)/man1
237 $(INSTALL_MAN) mandoc.3 $(DESTDIR)$(MANDIR)/man3
238 $(INSTALL_MAN) man.7 mdoc.7 roff.7 eqn.7 tbl.7 mandoc_char.7 $(DESTDIR)$(MANDIR)/man7
239 $(INSTALL_DATA) example.style.css $(DESTDIR)$(EXAMPLEDIR)
240
241 installwww: www
242 mkdir -p $(PREFIX)/snapshots
243 $(INSTALL_DATA) index.html external.png index.css $(PREFIX)
244 $(INSTALL_DATA) $(INDEX_MANS) style.css $(PREFIX)
245 $(INSTALL_DATA) mandoc.h.html man.h.html mdoc.h.html $(PREFIX)
246 $(INSTALL_DATA) mdocml.tar.gz $(PREFIX)/snapshots
247 $(INSTALL_DATA) mdocml.md5 $(PREFIX)/snapshots
248 $(INSTALL_DATA) mdocml.tar.gz $(PREFIX)/snapshots/mdocml-$(VERSION).tar.gz
249 $(INSTALL_DATA) mdocml.md5 $(PREFIX)/snapshots/mdocml-$(VERSION).md5
250
251 libmandoc.a: compat.o $(LIBMANDOC_OBJS)
252 $(AR) rs $@ compat.o $(LIBMANDOC_OBJS)
253
254 mandoc: $(MANDOC_OBJS) libmandoc.a
255 $(CC) -o $@ $(MANDOC_OBJS) libmandoc.a
256
257 mdocml.md5: mdocml.tar.gz
258 md5 mdocml.tar.gz >$@
259
260 mdocml.tar.gz: $(SRCS)
261 mkdir -p .dist/mdocml-$(VERSION)/
262 $(INSTALL) -m 0444 $(SRCS) .dist/mdocml-$(VERSION)
263 ( cd .dist/ && tar zcf ../$@ ./ )
264 rm -rf .dist/
265
266 index.html: $(INDEX_OBJS)
267
268 config.h: config.h.pre config.h.post
269 rm -f config.log
270 ( cat config.h.pre; \
271 echo; \
272 if $(CC) $(CFLAGS) -Werror -o test-strlcat test-strlcat.c >> config.log 2>&1; then \
273 echo '#define HAVE_STRLCAT'; \
274 rm test-strlcat; \
275 fi; \
276 if $(CC) $(CFLAGS) -Werror -o test-strlcpy test-strlcpy.c >> config.log 2>&1; then \
277 echo '#define HAVE_STRLCPY'; \
278 rm test-strlcpy; \
279 fi; \
280 echo; \
281 cat config.h.post \
282 ) > $@
283
284 .h.h.html:
285 highlight -I $< >$@
286
287 .1.1.txt .3.3.txt .7.7.txt:
288 ./mandoc -Tascii -Wall,stop $< | col -b >$@
289
290 .1.1.html .3.3.html .7.7.html:
291 ./mandoc -Thtml -Wall,stop -Ostyle=style.css,man=%N.%S.html,includes=%I.html $< >$@
292
293 .1.1.ps .3.3.ps .7.7.ps:
294 ./mandoc -Tps -Wall,stop $< >$@
295
296 .1.1.xhtml .3.3.xhtml .7.7.xhtml:
297 ./mandoc -Txhtml -Wall,stop -Ostyle=style.css,man=%N.%S.xhtml,includes=%I.html $< >$@
298
299 .1.1.pdf .3.3.pdf .7.7.pdf:
300 ./mandoc -Tpdf -Wall,stop $< >$@
301
302 .sgml.html:
303 validate --warn $<
304 sed -e "s!@VERSION@!$(VERSION)!" -e "s!@VDATE@!$(VDATE)!" $< >$@