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