7 INCLUDEDIR = $(PREFIX)/include
11 INSTALL_PROGRAM = install -m 0755
12 INSTALL_DATA = install -m 0444
13 INSTALL_LIB = install -m 0644
14 INSTALL_MAN = $(INSTALL_DATA)
16 CFLAGS += -W -Wall -Wstrict-prototypes -Wno-unused-parameter -g
18 LIBLNS = macro.ln mdoc.ln hash.ln strings.ln xstd.ln argv.ln \
21 TREELNS = mdoctree.ln mmain.ln
23 TERMLNS = mdoctree.ln mmain.ln term.ln
25 LINTLNS = mdoclint.ln mmain.ln
27 LNS = $(LIBLNS) $(TREELNS) $(TERMLNS)
29 LLNS = llib-llibmdoc.ln llib-lmdoctree.ln llib-lmdocterm.ln
33 LIBOBJS = macro.o mdoc.o hash.o strings.o xstd.o argv.o \
36 TERMOBJS= mdocterm.o mmain.o term.o
38 TREEOBJS= mdoctree.o mmain.o
40 LINTOBJS= mdoclint.o mmain.o
42 OBJS = $(LIBOBJS) $(TERMOBJS) $(TREEOBJS)
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
47 HEADS = mdoc.h private.h term.h mmain.h
53 STATICS = style.css external.png
55 TARGZS = mdocml-$(VERSION).tar.gz mdocml-oport-$(VERSION).tar.gz \
56 mdocml-nport-$(VERSION).tar.gz
58 MANS = mdoctree.1 mdocterm.1 mdoclint.1 mdoc.3
60 BINS = mdocterm mdoctree mdoclint
62 CLEAN = $(BINS) $(LNS) $(LLNS) $(LIBS) $(OBJS) $(HTMLS) \
65 INSTALL = $(SRCS) $(HEADS) Makefile DESCR $(MANS) $(SGMLS) \
66 $(STATICS) Makefile.netbsd Makefile.openbsd
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 \
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
106 SUCCEED = regress/test.prologue.05 \
107 regress/test.prologue.07 \
108 regress/test.prologue.08 \
109 regress/test.prologue.09 \
110 regress/test.prologue.10 \
111 regress/test.prologue.11 \
112 regress/test.prologue.12 \
113 regress/test.prologue.14 \
114 regress/test.prologue.17 \
115 regress/test.prologue.20 \
117 regress/test.name.00 \
118 regress/test.name.01 \
119 regress/test.name.02 \
120 regress/test.name.03 \
121 regress/test.list.00 \
122 regress/test.list.01 \
123 regress/test.list.02 \
124 regress/test.list.03 \
125 regress/test.list.04 \
126 regress/test.list.05 \
127 regress/test.list.06 \
128 regress/test.list.07 \
131 regress/test.escape.00 \
132 regress/test.escape.05 \
133 regress/test.escape.10 \
134 regress/test.escape.13
136 REGRESS = $(FAIL) $(SUCCEED)
148 dist: mdocml-$(VERSION).tar.gz
150 port: mdocml-oport-$(VERSION).tar.gz mdocml-nport-$(VERSION).tar.gz
152 www: $(HTMLS) $(TARGZS)
155 install -m 0444 $(HTMLS) $(STATICS) $(PREFIX)/
156 install -m 0444 mdocml-$(VERSION).tar.gz $(PREFIX)/snapshots/
157 install -m 0444 mdocml-$(VERSION).tar.gz $(PREFIX)/snapshots/mdocml.tar.gz
158 install -m 0444 mdocml-oport-$(VERSION).tar.gz $(PREFIX)/ports-openbsd/
159 install -m 0444 mdocml-oport-$(VERSION).tar.gz $(PREFIX)/ports-openbsd/mdocml.tar.gz
160 install -m 0444 mdocml-nport-$(VERSION).tar.gz $(PREFIX)/ports-netbsd/
161 install -m 0444 mdocml-nport-$(VERSION).tar.gz $(PREFIX)/ports-netbsd/mdocml.tar.gz
164 @for f in $(FAIL); do \
165 echo "./mdoclint $$f" ; \
166 ./mdoclint $$f 2>/dev/null || continue ; exit 1 ; done
167 @for f in $(SUCCEED); do \
168 echo "./mdoclint $$f" ; \
169 ./mdoclint $$f 2>/dev/null || exit 1 ; done
173 mkdir -p $(INCLUDEDIR)
174 mkdir -p $(LIBDIR)/lib
175 mkdir -p $(MANDIR)/man1
176 mkdir -p $(MANDIR)/man3
177 $(INSTALL_PROGRAM) mdocterm $(BINDIR)
178 $(INSTALL_PROGRAM) mdoctree $(BINDIR)
179 $(INSTALL_PROGRAM) mdoclint $(BINDIR)
180 $(INSTALL_MAN) mdocterm.1 $(MANDIR)/man1
181 $(INSTALL_MAN) mdoctree.1 $(MANDIR)/man1
182 $(INSTALL_MAN) mdoclint.1 $(MANDIR)/man1
183 $(INSTALL_MAN) mdoc.3 $(MANDIR)/man3
184 $(INSTALL_LIB) libmdoc.a $(LIBDIR)
185 $(INSTALL_DATA) mdoc.h $(INCLUDEDIR)
188 rm -f $(BINDIR)/mdocterm
189 rm -f $(BINDIR)/mdoctree
190 rm -f $(BINDIR)/mdoclint
191 rm -f $(MANDIR)/man1/mdocterm.1
192 rm -f $(MANDIR)/man1/mdoctree.1
193 rm -f $(MANDIR)/man1/mdoclint.1
194 rm -f $(MANDIR)/man3/mdoc.3
195 rm -f $(LIBDIR)/libmdoc.a
196 rm -f $(INCLUDEDIR)/mdoc.h
198 macro.ln: macro.c private.h
199 macro.o: macro.c private.h
201 term.ln: term.c term.h
202 term.o: term.c term.h
204 strings.ln: strings.c private.h
205 strings.o: strings.c private.h
207 hash.ln: hash.c private.h
208 hash.o: hash.c private.h
210 mdoc.ln: mdoc.c private.h
211 mdoc.o: mdoc.c private.h
213 mdocterm.ln: mdocterm.c mmain.h
214 mdocterm.o: mdocterm.c mmain.h
216 mdoclint.ln: mdoclint.c mmain.h
217 mdoclint.o: mdoclint.c mmain.h
219 mdoctree.ln: mdoctree.c mmain.h
220 mdoctree.o: mdoctree.c mmain.h
222 xstd.ln: xstd.c private.h
223 xstd.o: xstd.c private.h
225 argv.ln: argv.c private.h
226 argv.o: argv.c private.h
228 validate.ln: validate.c private.h
229 validate.o: validate.c private.h
231 action.ln: action.c private.h
232 action.o: action.c private.h
234 mmain.ln: mmain.c mmain.h
235 mmain.o: mmain.c mmain.h
243 mdocml-nport-$(VERSION).tar.gz: mdocml-$(VERSION).tar.gz Makefile.netbsd DESCR
244 mkdir -p .dist/mdocml/
245 sed -e "s!@VERSION@!$(VERSION)!" Makefile.netbsd > \
246 .dist/mdocml/Makefile
247 md5 mdocml-$(VERSION).tar.gz > .dist/mdocml/distinfo
248 rmd160 mdocml-$(VERSION).tar.gz >> .dist/mdocml/distinfo
249 sha1 mdocml-$(VERSION).tar.gz >> .dist/mdocml/distinfo
250 install -m 0644 DESCR .dist/mdocml/
251 echo @comment $$NetBSD$$ > .dist/mdocml/PLIST
252 echo bin/mdocterm >> .dist/mdocml/PLIST
253 echo bin/mdoctree >> .dist/mdocml/PLIST
254 echo bin/mdoclint >> .dist/mdocml/PLIST
255 echo lib/libmdoc.a >> .dist/mdocml/PLIST
256 echo include/mdoc.h >> .dist/mdocml/PLIST
257 echo man/man1/mdoctree.1 >> .dist/mdocml/PLIST
258 echo man/man1/mdocterm.1 >> .dist/mdocml/PLIST
259 echo man/man1/mdoclint.1 >> .dist/mdocml/PLIST
260 echo man/man3/mdoc.3 >> .dist/mdocml/PLIST
261 ( cd .dist/ && tar zcf ../$@ mdocml/ )
264 mdocml-oport-$(VERSION).tar.gz: mdocml-$(VERSION).tar.gz Makefile.openbsd DESCR
265 mkdir -p .dist/mdocml/pkg
266 sed -e "s!@VERSION@!$(VERSION)!" Makefile.openbsd > \
267 .dist/mdocml/Makefile
268 md5 mdocml-$(VERSION).tar.gz > .dist/mdocml/distinfo
269 rmd160 mdocml-$(VERSION).tar.gz >> .dist/mdocml/distinfo
270 sha1 mdocml-$(VERSION).tar.gz >> .dist/mdocml/distinfo
271 install -m 0644 DESCR .dist/mdocml/pkg/DESCR
272 echo @comment $$OpenBSD$$ > .dist/mdocml/pkg/PLIST
273 echo bin/mdocterm >> .dist/mdocml/pkg/PLIST
274 echo bin/mdoctree >> .dist/mdocml/pkg/PLIST
275 echo bin/mdoclint >> .dist/mdocml/pkg/PLIST
276 echo lib/libmdoc.a >> .dist/mdocml/pkg/PLIST
277 echo include/mdoc.h >> .dist/mdocml/pkg/PLIST
278 echo @man man/man1/mdoctree.1 >> .dist/mdocml/pkg/PLIST
279 echo @man man/man1/mdocterm.1 >> .dist/mdocml/pkg/PLIST
280 echo @man man/man1/mdoclint.1 >> .dist/mdocml/pkg/PLIST
281 echo @man man/man3/mdoc.3 >> .dist/mdocml/pkg/PLIST
282 ( cd .dist/ && tar zcf ../$@ mdocml/ )
285 mdocml-$(VERSION).tar.gz: $(INSTALL)
286 mkdir -p .dist/mdocml/mdocml-$(VERSION)/
287 mkdir -p .dist/mdocml/mdocml-$(VERSION)/regress/
288 install -m 0644 $(INSTALL) .dist/mdocml/mdocml-$(VERSION)/
289 install -m 0644 $(REGRESS) .dist/mdocml/mdocml-$(VERSION)/regress/
290 ( cd .dist/mdocml/ && tar zcf ../../$@ mdocml-$(VERSION)/ )
293 llib-llibmdoc.ln: $(LIBLNS)
294 $(LINT) $(LINTFLAGS) -Clibmdoc $(LIBLNS)
296 llib-lmdoctree.ln: $(TREELNS) llib-llibmdoc.ln
297 $(LINT) $(LINTFLAGS) -Cmdoctree $(TREELNS) llib-llibmdoc.ln
299 llib-lmdocterm.ln: $(TERMLNS) llib-llibmdoc.ln
300 $(LINT) $(LINTFLAGS) -Cmdocterm $(TERMLNS) llib-llibmdoc.ln
302 libmdoc.a: $(LIBOBJS)
303 $(AR) rs $@ $(LIBOBJS)
305 mdocterm: $(TERMOBJS) libmdoc.a
306 $(CC) $(CFLAGS) -o $@ $(TERMOBJS) libmdoc.a
308 mdoctree: $(TREEOBJS) libmdoc.a
309 $(CC) $(CFLAGS) -o $@ $(TREEOBJS) libmdoc.a
311 mdoclint: $(LINTOBJS) libmdoc.a
312 $(CC) $(CFLAGS) -o $@ $(LINTOBJS) libmdoc.a
316 sed -e "s!@VERSION@!$(VERSION)!" -e "s!@VDATE@!$(VDATE)!" $< > $@