]> git.cameronkatri.com Git - mandoc.git/blob - Makefile
Version: 1.9.12.
[mandoc.git] / Makefile
1 .SUFFIXES: .html .xml .sgml .1 .3 .7 .md5 .tar.gz .1.txt .3.txt .7.txt .1.sgml .3.sgml .7.sgml
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.9.12
13 VDATE = 31 October 2009
14
15 VFLAGS = -DVERSION="\"$(VERSION)\""
16 CFLAGS += -W -Wall -Wstrict-prototypes -Wno-unused-parameter -Wwrite-strings -g
17 CFLAGS += $(VFLAGS)
18 #CFLAGS += -DOSNAME="\"OpenBSD 4.5\""
19 LINTFLAGS += $(VFLAGS)
20
21 MANDOCFLAGS = -Wall -fstrict
22 MANDOCHTML = -Thtml -Ostyle=style.css,man=%N.%S.html,includes=%I.html
23
24 MDOCLNS = mdoc_macro.ln mdoc.ln mdoc_hash.ln mdoc_strings.ln \
25 mdoc_argv.ln mdoc_validate.ln mdoc_action.ln \
26 lib.ln att.ln arch.ln vol.ln msec.ln st.ln \
27 mandoc.ln
28 MDOCOBJS = mdoc_macro.o mdoc.o mdoc_hash.o mdoc_strings.o \
29 mdoc_argv.o mdoc_validate.o mdoc_action.o lib.o att.o \
30 arch.o vol.o msec.o st.o mandoc.o
31 MDOCSRCS = mdoc_macro.c mdoc.c mdoc_hash.c mdoc_strings.c \
32 mdoc_argv.c mdoc_validate.c mdoc_action.c lib.c att.c \
33 arch.c vol.c msec.c st.c mandoc.c
34
35 MANLNS = man_macro.ln man.ln man_hash.ln man_validate.ln \
36 man_action.ln mandoc.ln man_argv.ln
37 MANOBJS = man_macro.o man.o man_hash.o man_validate.o \
38 man_action.o mandoc.o man_argv.o
39 MANSRCS = man_macro.c man.c man_hash.c man_validate.c \
40 man_action.c mandoc.c man_argv.c
41
42 MAINLNS = main.ln mdoc_term.ln chars.ln term.ln tree.ln \
43 compat.ln man_term.ln html.ln mdoc_html.ln \
44 man_html.ln out.ln
45 MAINOBJS = main.o mdoc_term.o chars.o term.o tree.o compat.o \
46 man_term.o html.o mdoc_html.o man_html.o out.o
47 MAINSRCS = main.c mdoc_term.c chars.c term.c tree.c compat.c \
48 man_term.c html.c mdoc_html.c man_html.c out.c
49
50 LLNS = llib-llibmdoc.ln llib-llibman.ln llib-lmandoc.ln
51 LNS = $(MAINLNS) $(MDOCLNS) $(MANLNS)
52 LIBS = libmdoc.a libman.a
53 OBJS = $(MDOCOBJS) $(MAINOBJS) $(MANOBJS)
54 SRCS = $(MDOCSRCS) $(MAINSRCS) $(MANSRCS)
55 DATAS = arch.in att.in lib.in msec.in st.in \
56 vol.in chars.in
57 HEADS = mdoc.h libmdoc.h man.h libman.h term.h \
58 libmandoc.h html.h chars.h out.h main.h
59 GSGMLS = mandoc.1.sgml mdoc.3.sgml mdoc.7.sgml manuals.7.sgml \
60 mandoc_char.7.sgml man.7.sgml man.3.sgml
61 SGMLS = index.sgml $(GSGMLS)
62 XSLS = ChangeLog.xsl
63 HTMLS = index.html mandoc.1.html mdoc.3.html ChangeLog.html \
64 man.3.html mdoc.7.html man.7.html mandoc_char.7.html \
65 manuals.7.html
66 TEXTS = mandoc.1.txt mdoc.3.txt man.3.txt mdoc.7.txt man.7.txt \
67 mandoc_char.7.txt manuals.7.txt ChangeLog.txt
68 EXAMPLES = example.style.css
69 XMLS = ChangeLog.xml
70 STATICS = index.css style.css external.png
71 MD5S = mdocml-$(VERSION).md5
72 TARGZS = mdocml-$(VERSION).tar.gz
73 MANS = mandoc.1 mdoc.3 mdoc.7 manuals.7 mandoc_char.7 \
74 man.7 man.3
75 BINS = mandoc
76 CLEAN = $(BINS) $(LNS) $(LLNS) $(LIBS) $(OBJS) $(HTMLS) \
77 $(TARGZS) tags $(MD5S) $(XMLS) $(TEXTS) $(GSGMLS)
78 INSTALL = $(SRCS) $(HEADS) Makefile $(MANS) $(SGMLS) $(STATICS) \
79 $(DATAS) $(XSLS) $(EXAMPLES)
80
81 all: $(BINS)
82
83 lint: $(LLNS)
84
85 clean:
86 rm -f $(CLEAN)
87
88 cleanlint:
89 rm -f $(LNS) $(LLNS)
90
91 cleanhtml:
92 rm -f $(HTML) $(GSGMLS)
93
94 dist: mdocml-$(VERSION).tar.gz
95
96 www: all $(HTMLS) $(TEXTS) $(MD5S) $(TARGZS)
97
98 installwww: www
99 install -m 0444 $(HTMLS) $(TEXTS) $(STATICS) $(PREFIX)/
100 install -m 0444 mdocml-$(VERSION).tar.gz $(PREFIX)/snapshots/
101 install -m 0444 mdocml-$(VERSION).md5 $(PREFIX)/snapshots/
102 install -m 0444 mdocml-$(VERSION).tar.gz $(PREFIX)/snapshots/mdocml.tar.gz
103 install -m 0444 mdocml-$(VERSION).md5 $(PREFIX)/snapshots/mdocml.md5
104
105 install:
106 mkdir -p $(BINDIR)
107 mkdir -p $(MANDIR)/man1
108 mkdir -p $(MANDIR)/man7
109 $(INSTALL_PROGRAM) mandoc $(BINDIR)
110 $(INSTALL_MAN) mandoc.1 $(MANDIR)/man1
111 $(INSTALL_MAN) mdoc.7 $(MANDIR)/man7
112
113 uninstall:
114 rm -f $(BINDIR)/mandoc
115 rm -f $(MANDIR)/man1/mandoc.1
116 rm -f $(MANDIR)/man7/mdoc.7
117
118 man_macro.ln: man_macro.c libman.h
119 man_macro.o: man_macro.c libman.h
120
121 lib.ln: lib.c lib.in libmdoc.h
122 lib.o: lib.c lib.in libmdoc.h
123
124 att.ln: att.c att.in libmdoc.h
125 att.o: att.c att.in libmdoc.h
126
127 arch.ln: arch.c arch.in libmdoc.h
128 arch.o: arch.c arch.in libmdoc.h
129
130 vol.ln: vol.c vol.in libmdoc.h
131 vol.o: vol.c vol.in libmdoc.h
132
133 chars.ln: chars.c chars.in chars.h
134 chars.o: chars.c chars.in chars.h
135
136 msec.ln: msec.c msec.in libmdoc.h
137 msec.o: msec.c msec.in libmdoc.h
138
139 st.ln: st.c st.in libmdoc.h
140 st.o: st.c st.in libmdoc.h
141
142 mdoc_macro.ln: mdoc_macro.c libmdoc.h
143 mdoc_macro.o: mdoc_macro.c libmdoc.h
144
145 mdoc_term.ln: mdoc_term.c term.h mdoc.h
146 mdoc_term.o: mdoc_term.c term.h mdoc.h
147
148 mdoc_strings.ln: mdoc_strings.c libmdoc.h
149 mdoc_strings.o: mdoc_strings.c libmdoc.h
150
151 man_hash.ln: man_hash.c libman.h
152 man_hash.o: man_hash.c libman.h
153
154 mdoc_hash.ln: mdoc_hash.c libmdoc.h
155 mdoc_hash.o: mdoc_hash.c libmdoc.h
156
157 mdoc.ln: mdoc.c libmdoc.h
158 mdoc.o: mdoc.c libmdoc.h
159
160 man.ln: man.c libman.h
161 man.o: man.c libman.h
162
163 main.ln: main.c mdoc.h
164 main.o: main.c mdoc.h
165
166 compat.ln: compat.c
167 compat.o: compat.c
168
169 term.ln: term.c term.h man.h mdoc.h chars.h
170 term.o: term.c term.h man.h mdoc.h chars.h
171
172 html.ln: html.c html.h chars.h
173 html.o: html.c html.h chars.h
174
175 mdoc_html.ln: mdoc_html.c html.h mdoc.h
176 mdoc_html.o: mdoc_html.c html.h mdoc.h
177
178 man_html.ln: man_html.c html.h man.h out.h
179 man_html.o: man_html.c html.h man.h out.h
180
181 out.ln: out.c out.h
182 out.o: out.c out.h
183
184 tree.ln: tree.c man.h mdoc.h
185 tree.o: tree.c man.h mdoc.h
186
187 mdoc_argv.ln: mdoc_argv.c libmdoc.h
188 mdoc_argv.o: mdoc_argv.c libmdoc.h
189
190 man_argv.ln: man_argv.c libman.h
191 man_argv.o: man_argv.c libman.h
192
193 man_validate.ln: man_validate.c libman.h
194 man_validate.o: man_validate.c libman.h
195
196 mdoc_validate.ln: mdoc_validate.c libmdoc.h
197 mdoc_validate.o: mdoc_validate.c libmdoc.h
198
199 mdoc_action.ln: mdoc_action.c libmdoc.h
200 mdoc_action.o: mdoc_action.c libmdoc.h
201
202 libmdoc.h: mdoc.h
203
204 ChangeLog.xml:
205 cvs2cl --xml --xml-encoding iso-8859-15 -t --noxmlns -f $@
206
207 ChangeLog.txt:
208 cvs2cl -t -f $@
209
210 ChangeLog.html: ChangeLog.xml ChangeLog.xsl
211 xsltproc -o $@ ChangeLog.xsl ChangeLog.xml
212
213 mdocml-$(VERSION).tar.gz: $(INSTALL)
214 mkdir -p .dist/mdocml/mdocml-$(VERSION)/
215 cp -f $(INSTALL) .dist/mdocml/mdocml-$(VERSION)/
216 ( cd .dist/mdocml/ && tar zcf ../../$@ mdocml-$(VERSION)/ )
217 rm -rf .dist/
218
219 llib-llibmdoc.ln: $(MDOCLNS)
220 $(LINT) -Clibmdoc $(MDOCLNS)
221
222 llib-llibman.ln: $(MANLNS)
223 $(LINT) -Clibman $(MANLNS)
224
225 llib-lmandoc.ln: $(MAINLNS) llib-llibmdoc.ln
226 $(LINT) -Cmandoc $(MAINLNS) llib-llibmdoc.ln
227
228 libmdoc.a: $(MDOCOBJS)
229 $(AR) rs $@ $(MDOCOBJS)
230
231 libman.a: $(MANOBJS)
232 $(AR) rs $@ $(MANOBJS)
233
234 mandoc: $(MAINOBJS) libmdoc.a libman.a
235 $(CC) $(CFLAGS) -o $@ $(MAINOBJS) libmdoc.a libman.a
236
237 .sgml.html:
238 validate --warn $<
239 sed -e "s!@VERSION@!$(VERSION)!" -e "s!@VDATE@!$(VDATE)!" $< > $@
240
241 .1.1.txt .3.3.txt .7.7.txt:
242 ./mandoc $(MANDOCFLAGS) $< | col -b > $@
243
244 .1.1.sgml .3.3.sgml .7.7.sgml:
245 ./mandoc $(MANDOCFLAGS) $(MANDOCHTML) $< > $@
246
247 .tar.gz.md5:
248 md5 $< > $@