]> git.cameronkatri.com Git - mandoc.git/blob - Makefile
c7792be2b16a28c40172f33e5d72fa6b9fedf6e2
[mandoc.git] / Makefile
1 .SUFFIXES: .html .sgml
2
3 VERSION = 1.3.15
4 VDATE = 02 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
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.14 \
113 regress/test.prologue.17 \
114 regress/test.prologue.20 \
115 regress/test.sh.00 \
116 regress/test.name.00 \
117 regress/test.name.01 \
118 regress/test.name.02 \
119 regress/test.name.03 \
120 regress/test.list.00 \
121 regress/test.list.01 \
122 regress/test.list.02 \
123 regress/test.list.03 \
124 regress/test.list.04 \
125 regress/test.list.05 \
126 regress/test.list.06 \
127 regress/test.list.07 \
128 regress/test.sh.01 \
129 regress/test.sh.02 \
130 regress/test.escape.00 \
131 regress/test.escape.05 \
132 regress/test.escape.10
133
134 REGRESS = $(FAIL) $(SUCCEED)
135
136 all: $(BINS)
137
138 lint: $(LLNS)
139
140 clean:
141 rm -f $(CLEAN)
142
143 cleanlint:
144 rm -f $(LNS) $(LLNS)
145
146 dist: mdocml-$(VERSION).tar.gz
147
148 port: mdocml-oport-$(VERSION).tar.gz mdocml-nport-$(VERSION).tar.gz
149
150 www: $(HTMLS) $(TARGZS)
151
152 installwww: www
153 install -m 0444 $(HTMLS) $(STATICS) $(PREFIX)/
154 install -m 0444 mdocml-$(VERSION).tar.gz $(PREFIX)/snapshots/
155 install -m 0444 mdocml-$(VERSION).tar.gz $(PREFIX)/snapshots/mdocml.tar.gz
156 install -m 0444 mdocml-oport-$(VERSION).tar.gz $(PREFIX)/ports-openbsd/
157 install -m 0444 mdocml-oport-$(VERSION).tar.gz $(PREFIX)/ports-openbsd/mdocml.tar.gz
158 install -m 0444 mdocml-nport-$(VERSION).tar.gz $(PREFIX)/ports-netbsd/
159 install -m 0444 mdocml-nport-$(VERSION).tar.gz $(PREFIX)/ports-netbsd/mdocml.tar.gz
160
161 regress: mdoclint
162 @for f in $(FAIL); do \
163 echo "./mdoclint $$f" ; \
164 ./mdoclint $$f 2>/dev/null || continue ; exit 1 ; done
165 @for f in $(SUCCEED); do \
166 echo "./mdoclint $$f" ; \
167 ./mdoclint $$f 2>/dev/null || exit 1 ; done
168
169 install:
170 mkdir -p $(BINDIR)
171 mkdir -p $(INCLUDEDIR)
172 mkdir -p $(LIBDIR)/lib
173 mkdir -p $(MANDIR)/man1
174 mkdir -p $(MANDIR)/man3
175 $(INSTALL_PROGRAM) mdocterm $(BINDIR)
176 $(INSTALL_PROGRAM) mdoctree $(BINDIR)
177 $(INSTALL_PROGRAM) mdoclint $(BINDIR)
178 $(INSTALL_MAN) mdocterm.1 $(MANDIR)/man1
179 $(INSTALL_MAN) mdoctree.1 $(MANDIR)/man1
180 $(INSTALL_MAN) mdoclint.1 $(MANDIR)/man1
181 $(INSTALL_MAN) mdoc.3 $(MANDIR)/man3
182 $(INSTALL_LIB) libmdoc.a $(LIBDIR)
183 $(INSTALL_DATA) mdoc.h $(INCLUDEDIR)
184
185 uninstall:
186 rm -f $(BINDIR)/mdocterm
187 rm -f $(BINDIR)/mdoctree
188 rm -f $(BINDIR)/mdoclint
189 rm -f $(MANDIR)/man1/mdocterm.1
190 rm -f $(MANDIR)/man1/mdoctree.1
191 rm -f $(MANDIR)/man1/mdoclint.1
192 rm -f $(MANDIR)/man3/mdoc.3
193 rm -f $(LIBDIR)/libmdoc.a
194 rm -f $(INCLUDEDIR)/mdoc.h
195
196 macro.ln: macro.c private.h
197 macro.o: macro.c private.h
198
199 term.ln: term.c term.h
200 term.o: term.c term.h
201
202 strings.ln: strings.c private.h
203 strings.o: strings.c private.h
204
205 hash.ln: hash.c private.h
206 hash.o: hash.c private.h
207
208 mdoc.ln: mdoc.c private.h
209 mdoc.o: mdoc.c private.h
210
211 mdocterm.ln: mdocterm.c mmain.h
212 mdocterm.o: mdocterm.c mmain.h
213
214 mdoclint.ln: mdoclint.c mmain.h
215 mdoclint.o: mdoclint.c mmain.h
216
217 mdoctree.ln: mdoctree.c mmain.h
218 mdoctree.o: mdoctree.c mmain.h
219
220 xstd.ln: xstd.c private.h
221 xstd.o: xstd.c private.h
222
223 argv.ln: argv.c private.h
224 argv.o: argv.c private.h
225
226 validate.ln: validate.c private.h
227 validate.o: validate.c private.h
228
229 action.ln: action.c private.h
230 action.o: action.c private.h
231
232 mmain.ln: mmain.c mmain.h
233 mmain.o: mmain.c mmain.h
234
235 private.h: mdoc.h
236
237 mmain.h: mdoc.h
238
239 term.h: mdoc.h
240
241 mdocml-nport-$(VERSION).tar.gz: mdocml-$(VERSION).tar.gz Makefile.netbsd DESCR
242 mkdir -p .dist/mdocml/
243 sed -e "s!@VERSION@!$(VERSION)!" Makefile.netbsd > \
244 .dist/mdocml/Makefile
245 md5 mdocml-$(VERSION).tar.gz > .dist/mdocml/distinfo
246 rmd160 mdocml-$(VERSION).tar.gz >> .dist/mdocml/distinfo
247 sha1 mdocml-$(VERSION).tar.gz >> .dist/mdocml/distinfo
248 install -m 0644 DESCR .dist/mdocml/
249 echo @comment $$NetBSD$$ > .dist/mdocml/PLIST
250 echo bin/mdocterm >> .dist/mdocml/PLIST
251 echo bin/mdoctree >> .dist/mdocml/PLIST
252 echo bin/mdoclint >> .dist/mdocml/PLIST
253 echo lib/libmdoc.a >> .dist/mdocml/PLIST
254 echo include/mdoc.h >> .dist/mdocml/PLIST
255 echo man/man1/mdoctree.1 >> .dist/mdocml/PLIST
256 echo man/man1/mdocterm.1 >> .dist/mdocml/PLIST
257 echo man/man1/mdoclint.1 >> .dist/mdocml/PLIST
258 echo man/man3/mdoc.3 >> .dist/mdocml/PLIST
259 ( cd .dist/ && tar zcf ../$@ mdocml/ )
260 rm -rf .dist/
261
262 mdocml-oport-$(VERSION).tar.gz: mdocml-$(VERSION).tar.gz Makefile.openbsd DESCR
263 mkdir -p .dist/mdocml/pkg
264 sed -e "s!@VERSION@!$(VERSION)!" Makefile.openbsd > \
265 .dist/mdocml/Makefile
266 md5 mdocml-$(VERSION).tar.gz > .dist/mdocml/distinfo
267 rmd160 mdocml-$(VERSION).tar.gz >> .dist/mdocml/distinfo
268 sha1 mdocml-$(VERSION).tar.gz >> .dist/mdocml/distinfo
269 install -m 0644 DESCR .dist/mdocml/pkg/DESCR
270 echo @comment $$OpenBSD$$ > .dist/mdocml/pkg/PLIST
271 echo bin/mdocterm >> .dist/mdocml/pkg/PLIST
272 echo bin/mdoctree >> .dist/mdocml/pkg/PLIST
273 echo bin/mdoclint >> .dist/mdocml/pkg/PLIST
274 echo lib/libmdoc.a >> .dist/mdocml/pkg/PLIST
275 echo include/mdoc.h >> .dist/mdocml/pkg/PLIST
276 echo @man man/man1/mdoctree.1 >> .dist/mdocml/pkg/PLIST
277 echo @man man/man1/mdocterm.1 >> .dist/mdocml/pkg/PLIST
278 echo @man man/man1/mdoclint.1 >> .dist/mdocml/pkg/PLIST
279 echo @man man/man3/mdoc.3 >> .dist/mdocml/pkg/PLIST
280 ( cd .dist/ && tar zcf ../$@ mdocml/ )
281 rm -rf .dist/
282
283 mdocml-$(VERSION).tar.gz: $(INSTALL)
284 mkdir -p .dist/mdocml/mdocml-$(VERSION)/
285 mkdir -p .dist/mdocml/mdocml-$(VERSION)/regress/
286 install -m 0644 $(INSTALL) .dist/mdocml/mdocml-$(VERSION)/
287 install -m 0644 $(REGRESS) .dist/mdocml/mdocml-$(VERSION)/regress/
288 ( cd .dist/mdocml/ && tar zcf ../../$@ mdocml-$(VERSION)/ )
289 rm -rf .dist/
290
291 llib-llibmdoc.ln: $(LIBLNS)
292 $(LINT) $(LINTFLAGS) -Clibmdoc $(LIBLNS)
293
294 llib-lmdoctree.ln: $(TREELNS) llib-llibmdoc.ln
295 $(LINT) $(LINTFLAGS) -Cmdoctree $(TREELNS) llib-llibmdoc.ln
296
297 llib-lmdocterm.ln: $(TERMLNS) llib-llibmdoc.ln
298 $(LINT) $(LINTFLAGS) -Cmdocterm $(TERMLNS) llib-llibmdoc.ln
299
300 libmdoc.a: $(LIBOBJS)
301 $(AR) rs $@ $(LIBOBJS)
302
303 mdocterm: $(TERMOBJS) libmdoc.a
304 $(CC) $(CFLAGS) -o $@ $(TERMOBJS) libmdoc.a
305
306 mdoctree: $(TREEOBJS) libmdoc.a
307 $(CC) $(CFLAGS) -o $@ $(TREEOBJS) libmdoc.a
308
309 mdoclint: $(LINTOBJS) libmdoc.a
310 $(CC) $(CFLAGS) -o $@ $(LINTOBJS) libmdoc.a
311
312 .sgml.html:
313 validate $<
314 sed -e "s!@VERSION@!$(VERSION)!" -e "s!@VDATE@!$(VDATE)!" $< > $@
315