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