]> git.cameronkatri.com Git - mandoc.git/blob - Makefile
Initial -mandoc auto-switch in place.
[mandoc.git] / Makefile
1 .SUFFIXES: .html .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.7.8
13 VDATE = 31 March 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
59 BINS = mandoc
60 CLEAN = $(BINS) $(LNS) $(LLNS) $(LIBS) $(OBJS) $(HTMLS) $(TARGZS) \
61 tags
62 MAKEFILES = Makefile.netbsd Makefile.openbsd Makefile.freebsd \
63 Makefile
64 INSTALL = $(SRCS) $(HEADS) $(MAKEFILES) DESCR $(MANS) $(SGMLS) \
65 $(STATICS) $(DATAS)
66
67 all: $(BINS)
68
69 lint: $(LLNS)
70
71 clean:
72 rm -f $(CLEAN)
73
74 cleanlint:
75 rm -f $(LNS) $(LLNS)
76
77 dist: mdocml-$(VERSION).tar.gz
78
79 port: mdocml-oport-$(VERSION).tar.gz \
80 mdocml-fport-$(VERSION).tar.gz \
81 mdocml-nport-$(VERSION).tar.gz
82
83 www: $(HTMLS) $(TARGZS)
84
85 installwww: www
86 install -m 0444 $(HTMLS) $(STATICS) $(PREFIX)/
87 install -m 0444 mdocml-$(VERSION).tar.gz $(PREFIX)/snapshots/
88 install -m 0444 mdocml-$(VERSION).tar.gz $(PREFIX)/snapshots/mdocml.tar.gz
89 install -m 0444 mdocml-oport-$(VERSION).tar.gz $(PREFIX)/ports-openbsd/
90 install -m 0444 mdocml-oport-$(VERSION).tar.gz $(PREFIX)/ports-openbsd/mdocml.tar.gz
91 install -m 0444 mdocml-nport-$(VERSION).tar.gz $(PREFIX)/ports-netbsd/
92 install -m 0444 mdocml-nport-$(VERSION).tar.gz $(PREFIX)/ports-netbsd/mdocml.tar.gz
93 install -m 0444 mdocml-fport-$(VERSION).tar.gz $(PREFIX)/ports-freebsd/
94 install -m 0444 mdocml-fport-$(VERSION).tar.gz $(PREFIX)/ports-freebsd/mdocml.tar.gz
95
96 install:
97 mkdir -p $(BINDIR)
98 mkdir -p $(MANDIR)/man1
99 mkdir -p $(MANDIR)/man7
100 $(INSTALL_PROGRAM) mandoc $(BINDIR)
101 $(INSTALL_MAN) mandoc.1 $(MANDIR)/man1
102 $(INSTALL_MAN) mdoc.7 $(MANDIR)/man7
103
104 uninstall:
105 rm -f $(BINDIR)/mandoc
106 rm -f $(MANDIR)/man1/mandoc.1
107 rm -f $(MANDIR)/man7/mdoc.7
108
109 man_macro.ln: man_macro.c libman.h
110 man_macro.o: man_macro.c libman.h
111
112 lib.ln: lib.c lib.in libmdoc.h
113 lib.o: lib.c lib.in libmdoc.h
114
115 att.ln: att.c att.in libmdoc.h
116 att.o: att.c att.in libmdoc.h
117
118 arch.ln: arch.c arch.in libmdoc.h
119 arch.o: arch.c arch.in libmdoc.h
120
121 vol.ln: vol.c vol.in libmdoc.h
122 vol.o: vol.c vol.in libmdoc.h
123
124 ascii.ln: ascii.c ascii.in term.h
125 ascii.o: ascii.c ascii.in term.h
126
127 msec.ln: msec.c msec.in libmdoc.h
128 msec.o: msec.c msec.in libmdoc.h
129
130 st.ln: st.c st.in libmdoc.h
131 st.o: st.c st.in libmdoc.h
132
133 mdoc_macro.ln: mdoc_macro.c libmdoc.h
134 mdoc_macro.o: mdoc_macro.c libmdoc.h
135
136 mdoc_term.ln: mdoc_term.c term.h mdoc.h
137 mdoc_term.o: mdoc_term.c term.h mdoc.h
138
139 mdoc_strings.ln: mdoc_strings.c libmdoc.h
140 mdoc_strings.o: mdoc_strings.c libmdoc.h
141
142 man_hash.ln: man_hash.c libman.h
143 man_hash.o: man_hash.c libman.h
144
145 mdoc_hash.ln: mdoc_hash.c libmdoc.h
146 mdoc_hash.o: mdoc_hash.c libmdoc.h
147
148 mdoc.ln: mdoc.c libmdoc.h
149 mdoc.o: mdoc.c libmdoc.h
150
151 man.ln: man.c libman.h
152 man.o: man.c libman.h
153
154 main.ln: main.c mdoc.h
155 main.o: main.c mdoc.h
156
157 term.ln: term.c term.h man.h mdoc.h
158 term.o: term.c term.h man.h mdoc.h
159
160 mdoc_argv.ln: mdoc_argv.c libmdoc.h
161 mdoc_argv.o: mdoc_argv.c libmdoc.h
162
163 man_validate.ln: man_validate.c libman.h
164 man_validate.o: man_validate.c libman.h
165
166 mdoc_validate.ln: mdoc_validate.c libmdoc.h
167 mdoc_validate.o: mdoc_validate.c libmdoc.h
168
169 mdoc_action.ln: mdoc_action.c libmdoc.h
170 mdoc_action.o: mdoc_action.c libmdoc.h
171
172 libmdoc.h: mdoc.h
173
174 mdocml-nport-$(VERSION).tar.gz: mdocml-$(VERSION).tar.gz Makefile.netbsd DESCR
175 mkdir -p .dist/mdocml/
176 sed -e "s!@VERSION@!$(VERSION)!" Makefile.netbsd > \
177 .dist/mdocml/Makefile
178 md5 mdocml-$(VERSION).tar.gz > .dist/mdocml/distinfo
179 rmd160 mdocml-$(VERSION).tar.gz >> .dist/mdocml/distinfo
180 sha1 mdocml-$(VERSION).tar.gz >> .dist/mdocml/distinfo
181 install -m 0644 DESCR .dist/mdocml/
182 echo @comment $$NetBSD$$ > .dist/mdocml/PLIST
183 echo bin/mandoc >> .dist/mdocml/PLIST
184 echo man/man1/mandoc.1 >> .dist/mdocml/PLIST
185 echo man/man7/mdoc.7 >> .dist/mdocml/PLIST
186 ( cd .dist/ && tar zcf ../$@ mdocml/ )
187 rm -rf .dist/
188
189 mdocml-oport-$(VERSION).tar.gz: mdocml-$(VERSION).tar.gz Makefile.openbsd DESCR
190 mkdir -p .dist/mdocml/pkg
191 sed -e "s!@VERSION@!$(VERSION)!" Makefile.openbsd > \
192 .dist/mdocml/Makefile
193 md5 mdocml-$(VERSION).tar.gz > .dist/mdocml/distinfo
194 rmd160 mdocml-$(VERSION).tar.gz >> .dist/mdocml/distinfo
195 sha1 mdocml-$(VERSION).tar.gz >> .dist/mdocml/distinfo
196 install -m 0644 DESCR .dist/mdocml/pkg/DESCR
197 echo @comment $$OpenBSD$$ > .dist/mdocml/pkg/PLIST
198 echo bin/mandoc >> .dist/mdocml/pkg/PLIST
199 echo @man man/man1/mandoc.1 >> .dist/mdocml/pkg/PLIST
200 echo @man man/man7/mdoc.7 >> .dist/mdocml/pkg/PLIST
201 ( cd .dist/ && tar zcf ../$@ mdocml/ )
202 rm -rf .dist/
203
204 mdocml-fport-$(VERSION).tar.gz: mdocml-$(VERSION).tar.gz Makefile.freebsd DESCR
205 mkdir -p .dist/mdocml
206 sed -e "s!@VERSION@!$(VERSION)!" Makefile.freebsd > \
207 .dist/mdocml/Makefile
208 ( md5 mdocml-$(VERSION).tar.gz; \
209 cksum -a SHA256 mdocml-$(VERSION).tar.gz; \
210 echo -n "SIZE (mdocml-$(VERSION).tar.gz) = "; \
211 ls -l mdocml-$(VERSION).tar.gz | awk '{print $$5}' \
212 ) > .dist/mdocml/distinfo
213 install -m 0644 DESCR .dist/mdocml/pkg-descr
214 ( echo; echo "WWW: http://mdocml.bsd.lv/") >> .dist/mdocml/pkg-descr
215 ( cd .dist/ && tar zcf ../$@ mdocml/ )
216 rm -rf .dist/
217
218 mdocml-$(VERSION).tar.gz: $(INSTALL)
219 mkdir -p .dist/mdocml/mdocml-$(VERSION)/
220 install -m 0644 $(INSTALL) .dist/mdocml/mdocml-$(VERSION)/
221 ( cd .dist/mdocml/ && tar zcf ../../$@ mdocml-$(VERSION)/ )
222 rm -rf .dist/
223
224 llib-llibmdoc.ln: $(MDOCLNS)
225 $(LINT) $(LINTFLAGS) -Clibmdoc $(MDOCLNS)
226
227 llib-llibman.ln: $(MANLNS)
228 $(LINT) $(LINTFLAGS) -Clibman $(MANLNS)
229
230 llib-lmandoc.ln: $(MAINLNS) llib-llibmdoc.ln
231 $(LINT) $(LINTFLAGS) -Cmandoc $(MAINLNS) llib-llibmdoc.ln
232
233 libmdoc.a: $(MDOCOBJS)
234 $(AR) rs $@ $(MDOCOBJS)
235
236 libman.a: $(MANOBJS)
237 $(AR) rs $@ $(MANOBJS)
238
239 mandoc: $(MAINOBJS) libmdoc.a libman.a
240 $(CC) $(CFLAGS) -o $@ $(MAINOBJS) libmdoc.a libman.a
241
242 .sgml.html:
243 validate $<
244 sed -e "s!@VERSION@!$(VERSION)!" -e "s!@VDATE@!$(VDATE)!" $< > $@