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