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