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