]> git.cameronkatri.com Git - mandoc.git/blob - Makefile
Lint-check (removed unused variable).
[mandoc.git] / Makefile
1 .SUFFIXES: .html .xml .sgml .1.txt .3.txt .7.txt .1 .3 .7 .md5 .tar.gz
2
3 BINDIR = $(PREFIX)/bin
4 INCLUDEDIR = $(PREFIX)/include
5 LIBDIR = $(PREFIX)/lib
6 MANDIR = $(PREFIX)/man
7 INSTALL_PROGRAM = install -m 0755
8 INSTALL_DATA = install -m 0444
9 INSTALL_LIB = install -m 0644
10 INSTALL_MAN = $(INSTALL_DATA)
11
12 VERSION = 1.8.0
13 VDATE = 14 July 2009
14
15 VFLAGS = -DVERSION=\"$(VERSION)\"
16 CFLAGS += -W -Wall -Wstrict-prototypes -Wno-unused-parameter -g
17 CFLAGS += $(VFLAGS)
18 LINTFLAGS += $(VFLAGS)
19
20 MDOCLNS = mdoc_macro.ln mdoc.ln mdoc_hash.ln mdoc_strings.ln \
21 mdoc_argv.ln mdoc_validate.ln mdoc_action.ln \
22 lib.ln att.ln arch.ln vol.ln msec.ln st.ln \
23 mandoc.ln
24 MDOCOBJS = mdoc_macro.o mdoc.o mdoc_hash.o mdoc_strings.o \
25 mdoc_argv.o mdoc_validate.o mdoc_action.o lib.o att.o \
26 arch.o vol.o msec.o st.o mandoc.o
27 MDOCSRCS = mdoc_macro.c mdoc.c mdoc_hash.c mdoc_strings.c \
28 mdoc_argv.c mdoc_validate.c mdoc_action.c lib.c att.c \
29 arch.c vol.c msec.c st.c mandoc.c
30
31 MANLNS = man_macro.ln man.ln man_hash.ln man_validate.ln \
32 man_action.ln mandoc.ln
33 MANOBJS = man_macro.o man.o man_hash.o man_validate.o \
34 man_action.o mandoc.o
35 MANSRCS = man_macro.c man.c man_hash.c man_validate.c \
36 man_action.c mandoc.c
37
38 MAINLNS = main.ln mdoc_term.ln ascii.ln term.ln tree.ln \
39 compat.ln man_term.ln
40 MAINOBJS = main.o mdoc_term.o ascii.o term.o tree.o compat.o \
41 man_term.o
42 MAINSRCS = main.c mdoc_term.c ascii.c term.c tree.c compat.c \
43 man_term.c
44
45 LLNS = llib-llibmdoc.ln llib-llibman.ln llib-lmandoc.ln
46 LNS = $(MAINLNS) $(MDOCLNS) $(MANLNS)
47 LIBS = libmdoc.a libman.a
48 OBJS = $(MDOCOBJS) $(MAINOBJS) $(MANOBJS)
49 SRCS = $(MDOCSRCS) $(MAINSRCS) $(MANSRCS)
50 DATAS = arch.in att.in lib.in msec.in st.in vol.in ascii.in
51 HEADS = mdoc.h libmdoc.h man.h libman.h term.h libmandoc.h
52 SGMLS = index.sgml
53 XSLS = ChangeLog.xsl
54 HTMLS = index.html ChangeLog.html
55 XMLS = ChangeLog.xml
56 STATICS = style.css external.png
57 MD5S = mdocml-$(VERSION).md5 \
58 mdocml-oport-$(VERSION).md5 \
59 mdocml-fport-$(VERSION).md5 \
60 mdocml-nport-$(VERSION).md5
61 TARGZS = mdocml-$(VERSION).tar.gz \
62 mdocml-oport-$(VERSION).tar.gz \
63 mdocml-fport-$(VERSION).tar.gz \
64 mdocml-nport-$(VERSION).tar.gz
65 MANS = mandoc.1 mdoc.3 mdoc.7 manuals.7 mandoc_char.7 \
66 man.7 man.3
67 TEXTS = mandoc.1.txt mdoc.3.txt mdoc.7.txt manuals.7.txt \
68 mandoc_char.7.txt man.7.txt man.3.txt
69 BINS = mandoc
70 CLEAN = $(BINS) $(LNS) $(LLNS) $(LIBS) $(OBJS) $(HTMLS) \
71 $(TARGZS) tags $(TEXTS) ChangeLog.html $(MD5S) \
72 $(XMLS)
73 MAKEFILES = Makefile.netbsd Makefile.openbsd Makefile.freebsd \
74 Makefile
75 INSTALL = $(SRCS) $(HEADS) $(MAKEFILES) DESCR $(MANS) $(SGMLS) \
76 $(STATICS) $(DATAS) $(XSLS)
77
78 all: $(BINS)
79
80 lint: $(LLNS)
81
82 clean:
83 rm -f $(CLEAN)
84
85 cleanlint:
86 rm -f $(LNS) $(LLNS)
87
88 dist: mdocml-$(VERSION).tar.gz
89
90 html: $(HTMLS)
91
92 www: all $(HTMLS) $(MD5S) $(TARGZS) $(TEXTS)
93
94 installwww: www
95 install -m 0444 $(TEXTS) $(HTMLS) $(STATICS) $(PREFIX)/
96 install -m 0444 mdocml-$(VERSION).tar.gz $(PREFIX)/snapshots/
97 install -m 0444 mdocml-$(VERSION).md5 $(PREFIX)/snapshots/
98 install -m 0444 mdocml-$(VERSION).tar.gz $(PREFIX)/snapshots/mdocml.tar.gz
99 install -m 0444 mdocml-$(VERSION).md5 $(PREFIX)/snapshots/mdocml.md5
100 install -m 0444 mdocml-oport-$(VERSION).tar.gz $(PREFIX)/ports-openbsd/
101 install -m 0444 mdocml-oport-$(VERSION).tar.gz $(PREFIX)/ports-openbsd/mdocml.tar.gz
102 install -m 0444 mdocml-oport-$(VERSION).md5 $(PREFIX)/ports-openbsd/
103 install -m 0444 mdocml-oport-$(VERSION).md5 $(PREFIX)/ports-openbsd/mdocml.md5
104 install -m 0444 mdocml-nport-$(VERSION).tar.gz $(PREFIX)/ports-netbsd/
105 install -m 0444 mdocml-nport-$(VERSION).tar.gz $(PREFIX)/ports-netbsd/mdocml.tar.gz
106 install -m 0444 mdocml-nport-$(VERSION).md5 $(PREFIX)/ports-netbsd/
107 install -m 0444 mdocml-nport-$(VERSION).md5 $(PREFIX)/ports-netbsd/mdocml.md5
108 install -m 0444 mdocml-fport-$(VERSION).tar.gz $(PREFIX)/ports-freebsd/
109 install -m 0444 mdocml-fport-$(VERSION).tar.gz $(PREFIX)/ports-freebsd/mdocml.tar.gz
110 install -m 0444 mdocml-fport-$(VERSION).md5 $(PREFIX)/ports-freebsd/
111 install -m 0444 mdocml-fport-$(VERSION).md5 $(PREFIX)/ports-freebsd/mdocml.md5
112
113 install:
114 mkdir -p $(BINDIR)
115 mkdir -p $(MANDIR)/man1
116 mkdir -p $(MANDIR)/man7
117 $(INSTALL_PROGRAM) mandoc $(BINDIR)
118 $(INSTALL_MAN) mandoc.1 $(MANDIR)/man1
119 $(INSTALL_MAN) mdoc.7 $(MANDIR)/man7
120
121 uninstall:
122 rm -f $(BINDIR)/mandoc
123 rm -f $(MANDIR)/man1/mandoc.1
124 rm -f $(MANDIR)/man7/mdoc.7
125
126 man_macro.ln: man_macro.c libman.h
127 man_macro.o: man_macro.c libman.h
128
129 lib.ln: lib.c lib.in libmdoc.h
130 lib.o: lib.c lib.in libmdoc.h
131
132 att.ln: att.c att.in libmdoc.h
133 att.o: att.c att.in libmdoc.h
134
135 arch.ln: arch.c arch.in libmdoc.h
136 arch.o: arch.c arch.in libmdoc.h
137
138 vol.ln: vol.c vol.in libmdoc.h
139 vol.o: vol.c vol.in libmdoc.h
140
141 ascii.ln: ascii.c ascii.in term.h
142 ascii.o: ascii.c ascii.in term.h
143
144 msec.ln: msec.c msec.in libmdoc.h
145 msec.o: msec.c msec.in libmdoc.h
146
147 st.ln: st.c st.in libmdoc.h
148 st.o: st.c st.in libmdoc.h
149
150 mdoc_macro.ln: mdoc_macro.c libmdoc.h
151 mdoc_macro.o: mdoc_macro.c libmdoc.h
152
153 mdoc_term.ln: mdoc_term.c term.h mdoc.h
154 mdoc_term.o: mdoc_term.c term.h mdoc.h
155
156 mdoc_strings.ln: mdoc_strings.c libmdoc.h
157 mdoc_strings.o: mdoc_strings.c libmdoc.h
158
159 man_hash.ln: man_hash.c libman.h
160 man_hash.o: man_hash.c libman.h
161
162 mdoc_hash.ln: mdoc_hash.c libmdoc.h
163 mdoc_hash.o: mdoc_hash.c libmdoc.h
164
165 mdoc.ln: mdoc.c libmdoc.h
166 mdoc.o: mdoc.c libmdoc.h
167
168 man.ln: man.c libman.h
169 man.o: man.c libman.h
170
171 main.ln: main.c mdoc.h
172 main.o: main.c mdoc.h
173
174 compat.ln: compat.c
175 compat.o: compat.c
176
177 term.ln: term.c term.h man.h mdoc.h
178 term.o: term.c term.h man.h mdoc.h
179
180 mdoc_argv.ln: mdoc_argv.c libmdoc.h
181 mdoc_argv.o: mdoc_argv.c libmdoc.h
182
183 man_validate.ln: man_validate.c libman.h
184 man_validate.o: man_validate.c libman.h
185
186 mdoc_validate.ln: mdoc_validate.c libmdoc.h
187 mdoc_validate.o: mdoc_validate.c libmdoc.h
188
189 mdoc_action.ln: mdoc_action.c libmdoc.h
190 mdoc_action.o: mdoc_action.c libmdoc.h
191
192 libmdoc.h: mdoc.h
193
194 ChangeLog.xml:
195 cvs2cl --xml --xml-encoding iso-8859-15 --noxmlns -f $@
196
197 ChangeLog.html: ChangeLog.xml ChangeLog.xsl
198 xsltproc -o $@ ChangeLog.xsl ChangeLog.xml
199
200 mdocml-nport-$(VERSION).tar.gz: mdocml-$(VERSION).tar.gz Makefile.netbsd DESCR
201 mkdir -p .dist/mdocml/
202 sed -e "s!@VERSION@!$(VERSION)!" Makefile.netbsd > \
203 .dist/mdocml/Makefile
204 md5 mdocml-$(VERSION).tar.gz > .dist/mdocml/distinfo
205 rmd160 mdocml-$(VERSION).tar.gz >> .dist/mdocml/distinfo
206 sha1 mdocml-$(VERSION).tar.gz >> .dist/mdocml/distinfo
207 install -m 0644 DESCR .dist/mdocml/
208 echo @comment $$NetBSD$$ > .dist/mdocml/PLIST
209 echo bin/mandoc >> .dist/mdocml/PLIST
210 echo man/man1/mandoc.1 >> .dist/mdocml/PLIST
211 echo man/man7/mdoc.7 >> .dist/mdocml/PLIST
212 ( cd .dist/ && tar zcf ../$@ mdocml/ )
213 rm -rf .dist/
214
215 mdocml-oport-$(VERSION).tar.gz: mdocml-$(VERSION).tar.gz Makefile.openbsd DESCR
216 mkdir -p .dist/mdocml/pkg
217 sed -e "s!@VERSION@!$(VERSION)!" Makefile.openbsd > \
218 .dist/mdocml/Makefile
219 md5 mdocml-$(VERSION).tar.gz > .dist/mdocml/distinfo
220 rmd160 mdocml-$(VERSION).tar.gz >> .dist/mdocml/distinfo
221 sha1 mdocml-$(VERSION).tar.gz >> .dist/mdocml/distinfo
222 install -m 0644 DESCR .dist/mdocml/pkg/DESCR
223 echo @comment $$OpenBSD$$ > .dist/mdocml/pkg/PLIST
224 echo bin/mandoc >> .dist/mdocml/pkg/PLIST
225 echo @man man/man1/mandoc.1 >> .dist/mdocml/pkg/PLIST
226 echo @man man/man7/mdoc.7 >> .dist/mdocml/pkg/PLIST
227 ( cd .dist/ && tar zcf ../$@ mdocml/ )
228 rm -rf .dist/
229
230 mdocml-fport-$(VERSION).tar.gz: mdocml-$(VERSION).tar.gz Makefile.freebsd DESCR
231 mkdir -p .dist/mdocml
232 sed -e "s!@VERSION@!$(VERSION)!" Makefile.freebsd > \
233 .dist/mdocml/Makefile
234 ( md5 mdocml-$(VERSION).tar.gz; \
235 cksum -a SHA256 mdocml-$(VERSION).tar.gz; \
236 echo -n "SIZE (mdocml-$(VERSION).tar.gz) = "; \
237 ls -l mdocml-$(VERSION).tar.gz | awk '{print $$5}' \
238 ) > .dist/mdocml/distinfo
239 install -m 0644 DESCR .dist/mdocml/pkg-descr
240 ( echo; echo "WWW: http://mdocml.bsd.lv/") >> .dist/mdocml/pkg-descr
241 ( cd .dist/ && tar zcf ../$@ mdocml/ )
242 rm -rf .dist/
243
244 mdocml-$(VERSION).tar.gz: $(INSTALL)
245 mkdir -p .dist/mdocml/mdocml-$(VERSION)/
246 install -m 0644 $(INSTALL) .dist/mdocml/mdocml-$(VERSION)/
247 ( cd .dist/mdocml/ && tar zcf ../../$@ mdocml-$(VERSION)/ )
248 rm -rf .dist/
249
250 llib-llibmdoc.ln: $(MDOCLNS)
251 $(LINT) -Clibmdoc $(MDOCLNS)
252
253 llib-llibman.ln: $(MANLNS)
254 $(LINT) -Clibman $(MANLNS)
255
256 llib-lmandoc.ln: $(MAINLNS) llib-llibmdoc.ln
257 $(LINT) -Cmandoc $(MAINLNS) llib-llibmdoc.ln
258
259 libmdoc.a: $(MDOCOBJS)
260 $(AR) rs $@ $(MDOCOBJS)
261
262 libman.a: $(MANOBJS)
263 $(AR) rs $@ $(MANOBJS)
264
265 mandoc: $(MAINOBJS) libmdoc.a libman.a
266 $(CC) $(CFLAGS) -o $@ $(MAINOBJS) libmdoc.a libman.a
267
268 .sgml.html:
269 validate $<
270 sed -e "s!@VERSION@!$(VERSION)!" -e "s!@VDATE@!$(VDATE)!" $< > $@
271
272 .1.1.txt:
273 ./mandoc -Wall,error -fstrict $< | col -b > $@
274
275 .3.3.txt:
276 ./mandoc -Wall,error -fstrict $< | col -b > $@
277
278 .7.7.txt:
279 ./mandoc -Wall,error -fstrict $< | col -b > $@
280
281 .tar.gz.md5:
282 md5 $< > $@