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