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