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