]> git.cameronkatri.com Git - mandoc.git/blob - Makefile
Stripping of Xo/Xc macros in main.c (ifdef STRIP_XO).
[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.6.8
13 VDATE = 21 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 # If you want to strip `Xo/Xc' macro pairs, enable this. Really, only
21 # OpenBSD should be doing this while it kicks its cruft.
22 CFLAGS += -DSTRIP_XO
23
24 LIBLNS = macro.ln mdoc.ln hash.ln strings.ln xstd.ln argv.ln \
25 validate.ln action.ln lib.ln att.ln arch.ln vol.ln \
26 msec.ln st.ln
27 LIBOBJS = macro.o mdoc.o hash.o strings.o xstd.o argv.o validate.o \
28 action.o lib.o att.o arch.o vol.o msec.o st.o
29 LIBSRCS = macro.c mdoc.c hash.c strings.c xstd.c argv.c validate.c \
30 action.c lib.c att.c arch.c vol.c msec.c st.c
31
32 MAINLNS = main.ln term.ln ascii.ln terminal.ln tree.ln compat.ln
33 MAINOBJS = main.o term.o ascii.o terminal.o tree.o compat.o
34 MAINSRCS = main.c term.c ascii.c terminal.c tree.c compat.c
35
36 LLNS = llib-llibmdoc.ln llib-lmandoc.ln
37 LNS = $(MAINLNS) $(LIBLNS)
38 LIBS = libmdoc.a
39 OBJS = $(LIBOBJS) $(MAINOBJS)
40 SRCS = $(LIBSRCS) $(MAINSRCS)
41 DATAS = arch.in att.in lib.in msec.in st.in vol.in ascii.in
42 HEADS = mdoc.h private.h term.h
43 SGMLS = index.sgml
44 HTMLS = index.html
45 STATICS = style.css external.png
46 TARGZS = mdocml-$(VERSION).tar.gz \
47 mdocml-oport-$(VERSION).tar.gz \
48 mdocml-nport-$(VERSION).tar.gz
49 MANS = mandoc.1 mdoc.3 mdoc.7 manuals.7
50 BINS = mandoc
51 CLEAN = $(BINS) $(LNS) $(LLNS) $(LIBS) $(OBJS) $(HTMLS) $(TARGZS)
52 INSTALL = $(SRCS) $(HEADS) Makefile DESCR $(MANS) $(SGMLS) \
53 $(STATICS) Makefile.netbsd Makefile.openbsd $(DATAS)
54
55 all: $(BINS)
56
57 lint: $(LLNS)
58
59 clean:
60 rm -f $(CLEAN)
61
62 cleanlint:
63 rm -f $(LNS) $(LLNS)
64
65 dist: mdocml-$(VERSION).tar.gz
66
67 port: mdocml-oport-$(VERSION).tar.gz mdocml-nport-$(VERSION).tar.gz
68
69 www: $(HTMLS) $(TARGZS)
70
71 installwww: www
72 install -m 0444 $(HTMLS) $(STATICS) $(PREFIX)/
73 install -m 0444 mdocml-$(VERSION).tar.gz $(PREFIX)/snapshots/
74 install -m 0444 mdocml-$(VERSION).tar.gz $(PREFIX)/snapshots/mdocml.tar.gz
75 install -m 0444 mdocml-oport-$(VERSION).tar.gz $(PREFIX)/ports-openbsd/
76 install -m 0444 mdocml-oport-$(VERSION).tar.gz $(PREFIX)/ports-openbsd/mdocml.tar.gz
77 install -m 0444 mdocml-nport-$(VERSION).tar.gz $(PREFIX)/ports-netbsd/
78 install -m 0444 mdocml-nport-$(VERSION).tar.gz $(PREFIX)/ports-netbsd/mdocml.tar.gz
79
80 install:
81 mkdir -p $(BINDIR)
82 mkdir -p $(MANDIR)/man1
83 mkdir -p $(MANDIR)/man7
84 $(INSTALL_PROGRAM) mandoc $(BINDIR)
85 $(INSTALL_MAN) mandoc.1 $(MANDIR)/man1
86 $(INSTALL_MAN) mdoc.7 $(MANDIR)/man7
87
88 uninstall:
89 rm -f $(BINDIR)/mandoc
90 rm -f $(MANDIR)/man1/mandoc.1
91 rm -f $(MANDIR)/man7/mdoc.7
92
93 lib.ln: lib.c lib.in private.h
94 lib.o: lib.c lib.in private.h
95
96 att.ln: att.c att.in private.h
97 att.o: att.c att.in private.h
98
99 arch.ln: arch.c arch.in private.h
100 arch.o: arch.c arch.in private.h
101
102 vol.ln: vol.c vol.in private.h
103 vol.o: vol.c vol.in private.h
104
105 ascii.ln: ascii.c ascii.in term.h
106 ascii.o: ascii.c ascii.in term.h
107
108 msec.ln: msec.c msec.in private.h
109 msec.o: msec.c msec.in private.h
110
111 st.ln: st.c st.in private.h
112 st.o: st.c st.in private.h
113
114 macro.ln: macro.c private.h
115 macro.o: macro.c private.h
116
117 term.ln: term.c term.h
118 term.o: term.c term.h
119
120 strings.ln: strings.c private.h
121 strings.o: strings.c private.h
122
123 hash.ln: hash.c private.h
124 hash.o: hash.c private.h
125
126 mdoc.ln: mdoc.c private.h
127 mdoc.o: mdoc.c private.h
128
129 main.ln: main.c mdoc.h
130 main.o: main.c mdoc.h
131
132 terminal.ln: terminal.c term.h
133 terminal.o: terminal.c term.h
134
135 xstd.ln: xstd.c private.h
136 xstd.o: xstd.c private.h
137
138 argv.ln: argv.c private.h
139 argv.o: argv.c private.h
140
141 validate.ln: validate.c private.h
142 validate.o: validate.c private.h
143
144 action.ln: action.c private.h
145 action.o: action.c private.h
146
147 private.h: mdoc.h
148
149 term.h: mdoc.h
150
151 mdocml-nport-$(VERSION).tar.gz: mdocml-$(VERSION).tar.gz Makefile.netbsd DESCR
152 mkdir -p .dist/mdocml/
153 sed -e "s!@VERSION@!$(VERSION)!" Makefile.netbsd > \
154 .dist/mdocml/Makefile
155 md5 mdocml-$(VERSION).tar.gz > .dist/mdocml/distinfo
156 rmd160 mdocml-$(VERSION).tar.gz >> .dist/mdocml/distinfo
157 sha1 mdocml-$(VERSION).tar.gz >> .dist/mdocml/distinfo
158 install -m 0644 DESCR .dist/mdocml/
159 echo @comment $$NetBSD$$ > .dist/mdocml/PLIST
160 echo bin/mandoc >> .dist/mdocml/PLIST
161 echo man/man1/mandoc.1 >> .dist/mdocml/PLIST
162 echo man/man7/mdoc.7 >> .dist/mdocml/PLIST
163 ( cd .dist/ && tar zcf ../$@ mdocml/ )
164 rm -rf .dist/
165
166 mdocml-oport-$(VERSION).tar.gz: mdocml-$(VERSION).tar.gz Makefile.openbsd DESCR
167 mkdir -p .dist/mdocml/pkg
168 sed -e "s!@VERSION@!$(VERSION)!" Makefile.openbsd > \
169 .dist/mdocml/Makefile
170 md5 mdocml-$(VERSION).tar.gz > .dist/mdocml/distinfo
171 rmd160 mdocml-$(VERSION).tar.gz >> .dist/mdocml/distinfo
172 sha1 mdocml-$(VERSION).tar.gz >> .dist/mdocml/distinfo
173 install -m 0644 DESCR .dist/mdocml/pkg/DESCR
174 echo @comment $$OpenBSD$$ > .dist/mdocml/pkg/PLIST
175 echo bin/mandoc >> .dist/mdocml/pkg/PLIST
176 echo @man man/man1/mandoc.1 >> .dist/mdocml/pkg/PLIST
177 echo @man man/man7/mdoc.7 >> .dist/mdocml/pkg/PLIST
178 ( cd .dist/ && tar zcf ../$@ mdocml/ )
179 rm -rf .dist/
180
181 mdocml-$(VERSION).tar.gz: $(INSTALL)
182 mkdir -p .dist/mdocml/mdocml-$(VERSION)/
183 install -m 0644 $(INSTALL) .dist/mdocml/mdocml-$(VERSION)/
184 ( cd .dist/mdocml/ && tar zcf ../../$@ mdocml-$(VERSION)/ )
185 rm -rf .dist/
186
187 llib-llibmdoc.ln: $(LIBLNS)
188 $(LINT) $(LINTFLAGS) -Clibmdoc $(LIBLNS)
189
190 llib-lmandoc.ln: $(MAINLNS) llib-llibmdoc.ln
191 $(LINT) $(LINTFLAGS) -Cmandoc $(MAINLNS) llib-llibmdoc.ln
192
193 libmdoc.a: $(LIBOBJS)
194 $(AR) rs $@ $(LIBOBJS)
195
196 mandoc: $(MAINOBJS) libmdoc.a
197 $(CC) $(CFLAGS) -o $@ $(MAINOBJS) libmdoc.a
198
199 .sgml.html:
200 validate $<
201 sed -e "s!@VERSION@!$(VERSION)!" -e "s!@VDATE@!$(VDATE)!" $< > $@