4 VDATE = 25 February 2009
6 CFLAGS += -W -Wall -Wstrict-prototypes -Wno-unused-parameter -g
8 LIBLNS = macro.ln mdoc.ln hash.ln strings.ln xstd.ln argv.ln \
11 TREELNS = mdoctree.ln mmain.ln
13 TERMLNS = mdoctree.ln mmain.ln term.ln
15 LINTLNS = mdoclint.ln mmain.ln
17 LNS = $(LIBLNS) $(TREELNS) $(TERMLNS)
19 LLNS = llib-llibmdoc.ln llib-lmdoctree.ln llib-lmdocterm.ln
23 LIBOBJS = macro.o mdoc.o hash.o strings.o xstd.o argv.o \
26 TERMOBJS= mdocterm.o mmain.o term.o
28 TREEOBJS= mdoctree.o mmain.o
30 LINTOBJS= mdoclint.o mmain.o
32 OBJS = $(LIBOBJS) $(TERMOBJS) $(TREEOBJS)
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
37 HEADS = mdoc.h private.h term.h mmain.h
43 STATICS = style.css external.png
45 TARGZS = mdocml-$(VERSION).tar.gz mdocml-oport-$(VERSION).tar.gz
47 MANS = mdoctree.1 mdocterm.1 mdoclint.1 mdoc.3
49 BINS = mdocterm mdoctree mdoclint
51 CLEAN = $(BINS) $(LNS) $(LLNS) $(LIBS) $(OBJS) $(HTMLS) \
54 INSTALL = $(SRCS) $(HEADS) Makefile Makefile.port DESCR $(MANS) \
57 FAIL = regress/test.empty \
58 regress/test.prologue.00 \
59 regress/test.prologue.01 \
60 regress/test.prologue.02 \
61 regress/test.prologue.03 \
62 regress/test.prologue.04 \
63 regress/test.prologue.06 \
64 regress/test.prologue.13 \
65 regress/test.prologue.15 \
66 regress/test.prologue.16 \
67 regress/test.prologue.18 \
68 regress/test.prologue.19 \
69 regress/test.prologue.21 \
70 regress/test.prologue.22 \
71 regress/test.prologue.23 \
72 regress/test.prologue.24 \
73 regress/test.prologue.25 \
74 regress/test.prologue.26 \
75 regress/test.prologue.27 \
76 regress/test.prologue.28 \
77 regress/test.prologue.29 \
78 regress/test.prologue.30 \
79 regress/test.prologue.31 \
80 regress/test.prologue.32 \
81 regress/test.prologue.33 \
83 regress/test.escape.01 \
84 regress/test.escape.02 \
85 regress/test.escape.03 \
86 regress/test.escape.04 \
87 regress/test.escape.06 \
88 regress/test.escape.07 \
89 regress/test.escape.08 \
90 regress/test.escape.09
92 SUCCEED = regress/test.prologue.05 \
93 regress/test.prologue.07 \
94 regress/test.prologue.08 \
95 regress/test.prologue.09 \
96 regress/test.prologue.10 \
97 regress/test.prologue.11 \
98 regress/test.prologue.12 \
99 regress/test.prologue.14 \
100 regress/test.prologue.17 \
101 regress/test.prologue.20 \
103 regress/test.name.00 \
104 regress/test.name.01 \
105 regress/test.name.02 \
106 regress/test.name.03 \
107 regress/test.list.00 \
108 regress/test.list.01 \
109 regress/test.list.02 \
110 regress/test.list.03 \
111 regress/test.list.04 \
112 regress/test.list.05 \
113 regress/test.list.06 \
116 regress/test.escape.00 \
117 regress/test.escape.05
119 REGRESS = $(FAIL) $(SUCCEED)
128 dist: mdocml-$(VERSION).tar.gz
130 port: mdocml-oport-$(VERSION).tar.gz
132 www: $(HTMLS) $(TARGZS)
135 install -m 0444 $(HTMLS) $(STATICS) $(PREFIX)/
136 install -m 0444 mdocml-$(VERSION).tar.gz $(PREFIX)/snapshots/
137 install -m 0444 mdocml-oport-$(VERSION).tar.gz $(PREFIX)/ports-openbsd/
138 install -m 0444 mdocml-$(VERSION).tar.gz $(PREFIX)/snapshots/mdocml.tar.gz
139 install -m 0444 mdocml-oport-$(VERSION).tar.gz $(PREFIX)/ports-openbsd/mdocml.tar.gz
142 @for f in $(FAIL); do \
143 echo "./mdoclint $$f" ; \
144 ./mdoclint $$f 2>/dev/null || continue ; exit 1 ; done
145 @for f in $(SUCCEED); do \
146 echo "./mdoclint $$f" ; \
147 ./mdoclint $$f 2>/dev/null || exit 1 ; done
150 mkdir -p $(PREFIX)/bin/
151 mkdir -p $(PREFIX)/include/mdoc/
152 mkdir -p $(PREFIX)/lib/
153 mkdir -p $(PREFIX)/man/man1/
154 install -m 0755 mdocterm $(PREFIX)/bin/
155 install -m 0755 mdoctree $(PREFIX)/bin/
156 install -m 0755 mdoclint $(PREFIX)/bin/
157 install -m 0444 mdocterm.1 $(PREFIX)/man/man1/
158 install -m 0444 mdoctree.1 $(PREFIX)/man/man1/
159 install -m 0444 mdoclint.1 $(PREFIX)/man/man1/
160 install -m 0444 mdoc.3 $(PREFIX)/man/man3/
161 install -m 0644 libmdoc.a $(PREFIX)/lib/
162 install -m 0444 mdoc.h $(PREFIX)/include/
165 rm -f $(PREFIX)/bin/mdocterm
166 rm -f $(PREFIX)/bin/mdoctree
167 rm -f $(PREFIX)/bin/mdoclint
168 rm -f $(PREFIX)/man/man1/mdocterm.1
169 rm -f $(PREFIX)/man/man1/mdoctree.1
170 rm -f $(PREFIX)/man/man1/mdoclint.1
171 rm -f $(PREFIX)/man/man3/mdoc.3
172 rm -f $(PREFIX)/lib/libmdoc.a
173 rm -f $(PREFIX)/include/mdoc.h
175 macro.ln: macro.c private.h
176 macro.o: macro.c private.h
178 term.ln: term.c term.h
179 term.o: term.c term.h
181 strings.ln: strings.c private.h
182 strings.o: strings.c private.h
184 hash.ln: hash.c private.h
185 hash.o: hash.c private.h
187 mdoc.ln: mdoc.c private.h
188 mdoc.o: mdoc.c private.h
190 mdocterm.ln: mdocterm.c mmain.h
191 mdocterm.o: mdocterm.c mmain.h
193 mdoclint.ln: mdoclint.c mmain.h
194 mdoclint.o: mdoclint.c mmain.h
196 mdoctree.ln: mdoctree.c mmain.h
197 mdoctree.o: mdoctree.c mmain.h
199 xstd.ln: xstd.c private.h
200 xstd.o: xstd.c private.h
202 argv.ln: argv.c private.h
203 argv.o: argv.c private.h
205 validate.ln: validate.c private.h
206 validate.o: validate.c private.h
208 action.ln: action.c private.h
209 action.o: action.c private.h
211 mmain.ln: mmain.c mmain.h
212 mmain.o: mmain.c mmain.h
220 mdocml-oport-$(VERSION).tar.gz: mdocml-$(VERSION).tar.gz Makefile.port DESCR
221 mkdir -p .dist/mdocml/pkg
222 sed -e "s!@VERSION@!$(VERSION)!" Makefile.port > \
223 .dist/mdocml/Makefile
224 md5 mdocml-$(VERSION).tar.gz > .dist/mdocml/distinfo
225 rmd160 mdocml-$(VERSION).tar.gz >> .dist/mdocml/distinfo
226 sha1 mdocml-$(VERSION).tar.gz >> .dist/mdocml/distinfo
227 install -m 0644 DESCR .dist/mdocml/pkg/DESCR
228 echo @comment $$OpenBSD$$ > .dist/mdocml/pkg/PLIST
229 echo bin/mdocterm >> .dist/mdocml/pkg/PLIST
230 echo bin/mdoctree >> .dist/mdocml/pkg/PLIST
231 echo bin/mdoclint >> .dist/mdocml/pkg/PLIST
232 echo lib/libmdoc.a >> .dist/mdocml/pkg/PLIST
233 echo include/mdoc.h >> .dist/mdocml/pkg/PLIST
234 echo @man man/man1/mdoctree.1 >> .dist/mdocml/pkg/PLIST
235 echo @man man/man1/mdocterm.1 >> .dist/mdocml/pkg/PLIST
236 echo @man man/man1/mdoclint.1 >> .dist/mdocml/pkg/PLIST
237 echo @man man/man3/mdoc.3 >> .dist/mdocml/pkg/PLIST
238 ( cd .dist/ && tar zcf ../$@ mdocml/ )
241 mdocml-$(VERSION).tar.gz: $(INSTALL)
242 mkdir -p .dist/mdocml/mdocml-$(VERSION)/
243 mkdir -p .dist/mdocml/mdocml-$(VERSION)/regress/
244 install -m 0644 $(INSTALL) .dist/mdocml/mdocml-$(VERSION)/
245 install -m 0644 $(REGRESS) .dist/mdocml/mdocml-$(VERSION)/regress/
246 ( cd .dist/mdocml/ && tar zcf ../../$@ mdocml-$(VERSION)/ )
249 llib-llibmdoc.ln: $(LIBLNS)
250 $(LINT) $(LINTFLAGS) -Clibmdoc $(LIBLNS)
252 llib-lmdoctree.ln: $(TREELNS) llib-llibmdoc.ln
253 $(LINT) $(LINTFLAGS) -Cmdoctree $(TREELNS) llib-llibmdoc.ln
255 llib-lmdocterm.ln: $(TERMLNS) llib-llibmdoc.ln
256 $(LINT) $(LINTFLAGS) -Cmdocterm $(TERMLNS) llib-llibmdoc.ln
258 libmdoc.a: $(LIBOBJS)
259 $(AR) rs $@ $(LIBOBJS)
261 mdocterm: $(TERMOBJS) libmdoc.a
262 $(CC) $(CFLAGS) -o $@ $(TERMOBJS) libmdoc.a
264 mdoctree: $(TREEOBJS) libmdoc.a
265 $(CC) $(CFLAGS) -o $@ $(TREEOBJS) libmdoc.a
267 mdoclint: $(LINTOBJS) libmdoc.a
268 $(CC) $(CFLAGS) -o $@ $(LINTOBJS) libmdoc.a
272 sed -e "s!@VERSION@!$(VERSION)!" -e "s!@VDATE@!$(VDATE)!" $< > $@