]> git.cameronkatri.com Git - mandoc.git/blob - Makefile
Formatting.
[mandoc.git] / Makefile
1 .SUFFIXES: .html .sgml
2
3 VERSION = 1.3.5
4 VDATE = 25 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 Makefile.port DESCR $(MANS) \
55 $(SGMLS) $(STATICS)
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
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 \
102 regress/test.sh.00 \
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 \
114 regress/test.sh.01 \
115 regress/test.sh.02 \
116 regress/test.escape.00 \
117 regress/test.escape.05
118
119 REGRESS = $(FAIL) $(SUCCEED)
120
121 all: $(BINS)
122
123 lint: $(LLNS)
124
125 clean:
126 rm -f $(CLEAN)
127
128 dist: mdocml-$(VERSION).tar.gz
129
130 port: mdocml-oport-$(VERSION).tar.gz
131
132 www: $(HTMLS) $(TARGZS)
133
134 installwww: www
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
140
141 regress::
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
148
149 install:
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/
163
164 uninstall:
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
174
175 macro.ln: macro.c private.h
176 macro.o: macro.c private.h
177
178 term.ln: term.c term.h
179 term.o: term.c term.h
180
181 strings.ln: strings.c private.h
182 strings.o: strings.c private.h
183
184 hash.ln: hash.c private.h
185 hash.o: hash.c private.h
186
187 mdoc.ln: mdoc.c private.h
188 mdoc.o: mdoc.c private.h
189
190 mdocterm.ln: mdocterm.c mmain.h
191 mdocterm.o: mdocterm.c mmain.h
192
193 mdoclint.ln: mdoclint.c mmain.h
194 mdoclint.o: mdoclint.c mmain.h
195
196 mdoctree.ln: mdoctree.c mmain.h
197 mdoctree.o: mdoctree.c mmain.h
198
199 xstd.ln: xstd.c private.h
200 xstd.o: xstd.c private.h
201
202 argv.ln: argv.c private.h
203 argv.o: argv.c private.h
204
205 validate.ln: validate.c private.h
206 validate.o: validate.c private.h
207
208 action.ln: action.c private.h
209 action.o: action.c private.h
210
211 mmain.ln: mmain.c mmain.h
212 mmain.o: mmain.c mmain.h
213
214 private.h: mdoc.h
215
216 mmain.h: mdoc.h
217
218 term.h: mdoc.h
219
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/ )
239 rm -rf .dist/
240
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)/ )
247 rm -rf .dist/
248
249 llib-llibmdoc.ln: $(LIBLNS)
250 $(LINT) $(LINTFLAGS) -Clibmdoc $(LIBLNS)
251
252 llib-lmdoctree.ln: $(TREELNS) llib-llibmdoc.ln
253 $(LINT) $(LINTFLAGS) -Cmdoctree $(TREELNS) llib-llibmdoc.ln
254
255 llib-lmdocterm.ln: $(TERMLNS) llib-llibmdoc.ln
256 $(LINT) $(LINTFLAGS) -Cmdocterm $(TERMLNS) llib-llibmdoc.ln
257
258 libmdoc.a: $(LIBOBJS)
259 $(AR) rs $@ $(LIBOBJS)
260
261 mdocterm: $(TERMOBJS) libmdoc.a
262 $(CC) $(CFLAGS) -o $@ $(TERMOBJS) libmdoc.a
263
264 mdoctree: $(TREEOBJS) libmdoc.a
265 $(CC) $(CFLAGS) -o $@ $(TREEOBJS) libmdoc.a
266
267 mdoclint: $(LINTOBJS) libmdoc.a
268 $(CC) $(CFLAGS) -o $@ $(LINTOBJS) libmdoc.a
269
270 .sgml.html:
271 validate $<
272 sed -e "s!@VERSION@!$(VERSION)!" -e "s!@VDATE@!$(VDATE)!" $< > $@
273