]> git.cameronkatri.com Git - mandoc.git/blob - Makefile
Bumped minor-number.
[mandoc.git] / Makefile
1 .SUFFIXES: .html .sgml
2
3 VERSION = 1.4.1
4 VDATE = 8 March 2009
5
6 BINDIR = $(PREFIX)/bin
7 INCLUDEDIR = $(PREFIX)/include
8 LIBDIR = $(PREFIX)/lib
9 MANDIR = $(PREFIX)/man
10
11 INSTALL_PROGRAM = install -m 0755
12 INSTALL_DATA = install -m 0444
13 INSTALL_LIB = install -m 0644
14 INSTALL_MAN = $(INSTALL_DATA)
15
16 CFLAGS += -W -Wall -Wstrict-prototypes -Wno-unused-parameter -g
17 CFLAGS += -DVERSION=\"$(VERSION)\"
18
19 LIBLNS = macro.ln mdoc.ln hash.ln strings.ln xstd.ln argv.ln \
20 validate.ln action.ln lib.ln att.ln arch.ln vol.ln \
21 msec.ln st.ln
22
23 TREELNS = mdoctree.ln mmain.ln
24
25 TERMLNS = mdoctree.ln mmain.ln term.ln
26
27 LINTLNS = mdoclint.ln mmain.ln
28
29 LNS = $(LIBLNS) $(TREELNS) $(TERMLNS)
30
31 LLNS = llib-llibmdoc.ln llib-lmdoctree.ln llib-lmdocterm.ln
32
33 LIBS = libmdoc.a
34
35 LIBOBJS = macro.o mdoc.o hash.o strings.o xstd.o argv.o \
36 validate.o action.o lib.o att.o arch.o vol.o msec.o \
37 st.o
38
39 TERMOBJS= mdocterm.o mmain.o term.o
40
41 TREEOBJS= mdoctree.o mmain.o
42
43 LINTOBJS= mdoclint.o mmain.o
44
45 OBJS = $(LIBOBJS) $(TERMOBJS) $(TREEOBJS) $(LINTOBJS)
46
47 SRCS = macro.c mdoc.c hash.c strings.c xstd.c argv.c validate.c \
48 action.c term.c mdoctree.c mdocterm.c mmain.c mdoclint.c
49
50 SCRIPTS = strings.sh
51
52 GEN = lib.c att.c arch.c vol.c msec.c st.c
53
54 HEADS = mdoc.h private.h term.h mmain.h
55
56 SGMLS = index.sgml
57
58 HTMLS = index.html
59
60 STATICS = style.css external.png
61
62 TARGZS = mdocml-$(VERSION).tar.gz mdocml-oport-$(VERSION).tar.gz \
63 mdocml-nport-$(VERSION).tar.gz
64
65 MANS = mdoctree.1 mdocterm.1 mdoclint.1 mdoc.3
66
67 BINS = mdocterm mdoctree mdoclint
68
69 CLEAN = $(BINS) $(LNS) $(LLNS) $(LIBS) $(OBJS) $(HTMLS) \
70 $(TARGZS) $(GEN)
71
72 INSTALL = $(SRCS) $(HEADS) Makefile DESCR $(MANS) $(SGMLS) \
73 $(STATICS) $(SCRIPTS) Makefile.netbsd Makefile.openbsd
74
75 FAIL = regress/test.empty \
76 regress/test.prologue.00 \
77 regress/test.prologue.01 \
78 regress/test.prologue.02 \
79 regress/test.prologue.03 \
80 regress/test.prologue.04 \
81 regress/test.prologue.06 \
82 regress/test.prologue.19 \
83 regress/test.prologue.23 \
84 regress/test.prologue.24 \
85 regress/test.prologue.27 \
86 regress/test.prologue.28 \
87 regress/test.prologue.30 \
88 regress/test.prologue.31 \
89 regress/test.prologue.32 \
90 regress/test.sh.03 \
91 regress/test.escape.01 \
92 regress/test.escape.02 \
93 regress/test.escape.03 \
94 regress/test.escape.04 \
95 regress/test.escape.06 \
96 regress/test.escape.07 \
97 regress/test.escape.08 \
98 regress/test.escape.09 \
99 regress/test.escape.11 \
100 regress/test.escape.12 \
101 regress/test.escape.14 \
102 regress/test.argv.01 \
103 regress/test.argv.02
104
105 SUCCEED = regress/test.prologue.05 \
106 regress/test.prologue.07 \
107 regress/test.prologue.08 \
108 regress/test.prologue.09 \
109 regress/test.prologue.10 \
110 regress/test.prologue.11 \
111 regress/test.prologue.12 \
112 regress/test.prologue.13 \
113 regress/test.prologue.14 \
114 regress/test.prologue.15 \
115 regress/test.prologue.16 \
116 regress/test.prologue.17 \
117 regress/test.prologue.18 \
118 regress/test.prologue.20 \
119 regress/test.prologue.21 \
120 regress/test.prologue.22 \
121 regress/test.prologue.25 \
122 regress/test.prologue.26 \
123 regress/test.prologue.29 \
124 regress/test.prologue.33 \
125 regress/test.sh.00 \
126 regress/test.name.00 \
127 regress/test.name.01 \
128 regress/test.name.02 \
129 regress/test.name.03 \
130 regress/test.list.00 \
131 regress/test.list.01 \
132 regress/test.list.02 \
133 regress/test.list.03 \
134 regress/test.list.04 \
135 regress/test.list.05 \
136 regress/test.list.06 \
137 regress/test.list.07 \
138 regress/test.sh.01 \
139 regress/test.sh.02 \
140 regress/test.escape.00 \
141 regress/test.escape.05 \
142 regress/test.escape.10 \
143 regress/test.escape.13 \
144 regress/test.argv.00
145
146 REGRESS = $(FAIL) $(SUCCEED)
147
148 all: $(BINS)
149
150 lint: $(LLNS)
151
152 clean:
153 rm -f $(CLEAN)
154
155 cleanlint:
156 rm -f $(LNS) $(LLNS)
157
158 dist: mdocml-$(VERSION).tar.gz
159
160 port: mdocml-oport-$(VERSION).tar.gz mdocml-nport-$(VERSION).tar.gz
161
162 www: $(HTMLS) $(TARGZS)
163
164 installwww: www
165 install -m 0444 $(HTMLS) $(STATICS) $(PREFIX)/
166 install -m 0444 mdocml-$(VERSION).tar.gz $(PREFIX)/snapshots/
167 install -m 0444 mdocml-$(VERSION).tar.gz $(PREFIX)/snapshots/mdocml.tar.gz
168 install -m 0444 mdocml-oport-$(VERSION).tar.gz $(PREFIX)/ports-openbsd/
169 install -m 0444 mdocml-oport-$(VERSION).tar.gz $(PREFIX)/ports-openbsd/mdocml.tar.gz
170 install -m 0444 mdocml-nport-$(VERSION).tar.gz $(PREFIX)/ports-netbsd/
171 install -m 0444 mdocml-nport-$(VERSION).tar.gz $(PREFIX)/ports-netbsd/mdocml.tar.gz
172
173 regress: mdoclint $(FAIL) $(SUCCEED)
174 @for f in $(FAIL); do \
175 echo "./mdoclint $$f" ; \
176 ./mdoclint $$f 2>/dev/null || continue ; exit 1 ; done
177 @for f in $(SUCCEED); do \
178 echo "./mdoclint $$f" ; \
179 ./mdoclint $$f 2>/dev/null || exit 1 ; done
180
181 install:
182 mkdir -p $(BINDIR)
183 mkdir -p $(INCLUDEDIR)
184 mkdir -p $(LIBDIR)/lib
185 mkdir -p $(MANDIR)/man1
186 mkdir -p $(MANDIR)/man3
187 $(INSTALL_PROGRAM) mdocterm $(BINDIR)
188 $(INSTALL_PROGRAM) mdoctree $(BINDIR)
189 $(INSTALL_PROGRAM) mdoclint $(BINDIR)
190 $(INSTALL_MAN) mdocterm.1 $(MANDIR)/man1
191 $(INSTALL_MAN) mdoctree.1 $(MANDIR)/man1
192 $(INSTALL_MAN) mdoclint.1 $(MANDIR)/man1
193 $(INSTALL_MAN) mdoc.3 $(MANDIR)/man3
194 $(INSTALL_LIB) libmdoc.a $(LIBDIR)
195 $(INSTALL_DATA) mdoc.h $(INCLUDEDIR)
196
197 uninstall:
198 rm -f $(BINDIR)/mdocterm
199 rm -f $(BINDIR)/mdoctree
200 rm -f $(BINDIR)/mdoclint
201 rm -f $(MANDIR)/man1/mdocterm.1
202 rm -f $(MANDIR)/man1/mdoctree.1
203 rm -f $(MANDIR)/man1/mdoclint.1
204 rm -f $(MANDIR)/man3/mdoc.3
205 rm -f $(LIBDIR)/libmdoc.a
206 rm -f $(INCLUDEDIR)/mdoc.h
207
208 lib.ln: lib.c private.h
209 lib.o: lib.c private.h
210
211 att.ln: att.c private.h
212 att.o: att.c private.h
213
214 arch.ln: arch.c private.h
215 arch.o: arch.c private.h
216
217 vol.ln: vol.c private.h
218 vol.o: vol.c private.h
219
220 msec.ln: msec.c private.h
221 msec.o: msec.c private.h
222
223 st.ln: st.c private.h
224 st.o: st.c private.h
225
226 lib.c: lib.in strings.sh
227 sh strings.sh -o $@ lib lib.in
228
229 st.c: st.in strings.sh
230 sh strings.sh -o $@ st st.in
231
232 msec.c: msec.in strings.sh
233 sh strings.sh -o $@ msec msec.in
234
235 att.c: att.in strings.sh
236 sh strings.sh -o $@ att att.in
237
238 arch.c: arch.in strings.sh
239 sh strings.sh -o $@ arch arch.in
240
241 vol.c: vol.in strings.sh
242 sh strings.sh -o $@ vol vol.in
243
244 macro.ln: macro.c private.h
245 macro.o: macro.c private.h
246
247 term.ln: term.c term.h
248 term.o: term.c term.h
249
250 strings.ln: strings.c private.h
251 strings.o: strings.c private.h
252
253 hash.ln: hash.c private.h
254 hash.o: hash.c private.h
255
256 mdoc.ln: mdoc.c private.h
257 mdoc.o: mdoc.c private.h
258
259 mdocterm.ln: mdocterm.c mmain.h
260 mdocterm.o: mdocterm.c mmain.h
261
262 mdoclint.ln: mdoclint.c mmain.h
263 mdoclint.o: mdoclint.c mmain.h
264
265 mdoctree.ln: mdoctree.c mmain.h
266 mdoctree.o: mdoctree.c mmain.h
267
268 xstd.ln: xstd.c private.h
269 xstd.o: xstd.c private.h
270
271 argv.ln: argv.c private.h
272 argv.o: argv.c private.h
273
274 validate.ln: validate.c private.h
275 validate.o: validate.c private.h
276
277 action.ln: action.c private.h
278 action.o: action.c private.h
279
280 mmain.ln: mmain.c mmain.h
281 mmain.o: mmain.c mmain.h
282
283 private.h: mdoc.h
284
285 mmain.h: mdoc.h
286
287 term.h: mdoc.h
288
289 mdocml-nport-$(VERSION).tar.gz: mdocml-$(VERSION).tar.gz Makefile.netbsd DESCR
290 mkdir -p .dist/mdocml/
291 sed -e "s!@VERSION@!$(VERSION)!" Makefile.netbsd > \
292 .dist/mdocml/Makefile
293 md5 mdocml-$(VERSION).tar.gz > .dist/mdocml/distinfo
294 rmd160 mdocml-$(VERSION).tar.gz >> .dist/mdocml/distinfo
295 sha1 mdocml-$(VERSION).tar.gz >> .dist/mdocml/distinfo
296 install -m 0644 DESCR .dist/mdocml/
297 echo @comment $$NetBSD$$ > .dist/mdocml/PLIST
298 echo bin/mdocterm >> .dist/mdocml/PLIST
299 echo bin/mdoctree >> .dist/mdocml/PLIST
300 echo bin/mdoclint >> .dist/mdocml/PLIST
301 echo lib/libmdoc.a >> .dist/mdocml/PLIST
302 echo include/mdoc.h >> .dist/mdocml/PLIST
303 echo man/man1/mdoctree.1 >> .dist/mdocml/PLIST
304 echo man/man1/mdocterm.1 >> .dist/mdocml/PLIST
305 echo man/man1/mdoclint.1 >> .dist/mdocml/PLIST
306 echo man/man3/mdoc.3 >> .dist/mdocml/PLIST
307 ( cd .dist/ && tar zcf ../$@ mdocml/ )
308 rm -rf .dist/
309
310 mdocml-oport-$(VERSION).tar.gz: mdocml-$(VERSION).tar.gz Makefile.openbsd DESCR
311 mkdir -p .dist/mdocml/pkg
312 sed -e "s!@VERSION@!$(VERSION)!" Makefile.openbsd > \
313 .dist/mdocml/Makefile
314 md5 mdocml-$(VERSION).tar.gz > .dist/mdocml/distinfo
315 rmd160 mdocml-$(VERSION).tar.gz >> .dist/mdocml/distinfo
316 sha1 mdocml-$(VERSION).tar.gz >> .dist/mdocml/distinfo
317 install -m 0644 DESCR .dist/mdocml/pkg/DESCR
318 echo @comment $$OpenBSD$$ > .dist/mdocml/pkg/PLIST
319 echo bin/mdocterm >> .dist/mdocml/pkg/PLIST
320 echo bin/mdoctree >> .dist/mdocml/pkg/PLIST
321 echo bin/mdoclint >> .dist/mdocml/pkg/PLIST
322 echo lib/libmdoc.a >> .dist/mdocml/pkg/PLIST
323 echo include/mdoc.h >> .dist/mdocml/pkg/PLIST
324 echo @man man/man1/mdoctree.1 >> .dist/mdocml/pkg/PLIST
325 echo @man man/man1/mdocterm.1 >> .dist/mdocml/pkg/PLIST
326 echo @man man/man1/mdoclint.1 >> .dist/mdocml/pkg/PLIST
327 echo @man man/man3/mdoc.3 >> .dist/mdocml/pkg/PLIST
328 ( cd .dist/ && tar zcf ../$@ mdocml/ )
329 rm -rf .dist/
330
331 mdocml-$(VERSION).tar.gz: $(INSTALL)
332 mkdir -p .dist/mdocml/mdocml-$(VERSION)/
333 mkdir -p .dist/mdocml/mdocml-$(VERSION)/regress/
334 install -m 0644 $(INSTALL) .dist/mdocml/mdocml-$(VERSION)/
335 install -m 0644 $(REGRESS) .dist/mdocml/mdocml-$(VERSION)/regress/
336 ( cd .dist/mdocml/ && tar zcf ../../$@ mdocml-$(VERSION)/ )
337 rm -rf .dist/
338
339 llib-llibmdoc.ln: $(LIBLNS)
340 $(LINT) $(LINTFLAGS) -Clibmdoc $(LIBLNS)
341
342 llib-lmdoctree.ln: $(TREELNS) llib-llibmdoc.ln
343 $(LINT) $(LINTFLAGS) -Cmdoctree $(TREELNS) llib-llibmdoc.ln
344
345 llib-lmdocterm.ln: $(TERMLNS) llib-llibmdoc.ln
346 $(LINT) $(LINTFLAGS) -Cmdocterm $(TERMLNS) llib-llibmdoc.ln
347
348 libmdoc.a: $(LIBOBJS)
349 $(AR) rs $@ $(LIBOBJS)
350
351 mdocterm: $(TERMOBJS) libmdoc.a
352 $(CC) $(CFLAGS) -o $@ $(TERMOBJS) libmdoc.a
353
354 mdoctree: $(TREEOBJS) libmdoc.a
355 $(CC) $(CFLAGS) -o $@ $(TREEOBJS) libmdoc.a
356
357 mdoclint: $(LINTOBJS) libmdoc.a
358 $(CC) $(CFLAGS) -o $@ $(LINTOBJS) libmdoc.a
359
360 .sgml.html:
361 validate $<
362 sed -e "s!@VERSION@!$(VERSION)!" -e "s!@VDATE@!$(VDATE)!" $< > $@
363