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