]> git.cameronkatri.com Git - mandoc.git/blob - Makefile
Re-added tree.c (for now).
[mandoc.git] / Makefile
1 VERSION = 1.2.0
2
3 CFLAGS += -W -Wall -Wno-unused-parameter -g
4
5 LIBLNS = macro.ln mdoc.ln hash.ln strings.ln xstd.ln argv.ln \
6 validate.ln action.ln
7
8 BINLNS = mdocml.ln term.ln tree.ln
9
10 LNS = $(LIBLNS) $(BINLNS)
11
12 LLNS = llib-llibmdoc.ln llib-lmdocml.ln
13
14 LIBS = libmdoc.a
15
16 LIBOBJS = macro.o mdoc.o hash.o strings.o xstd.o argv.o \
17 validate.o action.o
18
19 BINOBJS = mdocml.o term.o tree.o
20
21 OBJS = $(LIBOBJS) $(BINOBJS)
22
23 SRCS = macro.c mdoc.c mdocml.c hash.c strings.c xstd.c argv.c \
24 validate.c action.c
25
26 HEADS = mdoc.h private.h
27
28 MANS = mdocml.1 mdoc.3
29
30 BINS = mdocml
31
32 CLEAN = $(BINS) $(LNS) $(LLNS) $(LIBS) $(OBJS)
33
34 INSTALL = $(SRCS) $(HEADS) Makefile Makefile.port DESCR $(MANS)
35
36 FAIL = regress/test.empty \
37 regress/test.prologue.00 \
38 regress/test.prologue.01 \
39 regress/test.prologue.02 \
40 regress/test.prologue.03 \
41 regress/test.prologue.04 \
42 regress/test.prologue.06 \
43 regress/test.prologue.13 \
44 regress/test.prologue.15 \
45 regress/test.prologue.16 \
46 regress/test.prologue.18 \
47 regress/test.prologue.19 \
48 regress/test.prologue.21 \
49 regress/test.prologue.22 \
50 regress/test.prologue.23 \
51 regress/test.prologue.24 \
52 regress/test.prologue.25 \
53 regress/test.prologue.26 \
54 regress/test.prologue.27 \
55 regress/test.prologue.28 \
56 regress/test.prologue.29 \
57 regress/test.prologue.30 \
58 regress/test.prologue.31 \
59 regress/test.prologue.32 \
60 regress/test.prologue.33 \
61 regress/test.sh.01 \
62 regress/test.sh.02 \
63 regress/test.sh.03 \
64 regress/test.name.01 \
65 regress/test.name.02 \
66 regress/test.name.03
67
68 SUCCEED = regress/test.prologue.05 \
69 regress/test.prologue.07 \
70 regress/test.prologue.08 \
71 regress/test.prologue.09 \
72 regress/test.prologue.10 \
73 regress/test.prologue.11 \
74 regress/test.prologue.12 \
75 regress/test.prologue.14 \
76 regress/test.prologue.17 \
77 regress/test.prologue.20 \
78 regress/test.sh.00 \
79 regress/test.name.00 \
80 regress/test.list.00 \
81 regress/test.list.01 \
82 regress/test.list.02 \
83 regress/test.list.03 \
84 regress/test.list.04 \
85 regress/test.list.05 \
86 regress/test.list.06
87
88 all: $(BINS)
89
90 lint: $(LLNS)
91
92 clean:
93 rm -f $(CLEAN)
94
95 dist: mdocml-$(VERSION).tar.gz
96
97 port: mdocml-oport-$(VERSION).tar.gz
98
99 regress:: mdocml
100 @for f in $(FAIL); do \
101 echo "./mdocml $$f" ; \
102 ./mdocml $$f 2>/dev/null || continue ; exit 1 ; done
103 @for f in $(SUCCEED); do \
104 echo "./mdocml $$f" ; \
105 ./mdocml $$f 2>/dev/null || exit 1 ; done
106
107 install:
108 mkdir -p $(PREFIX)/bin/
109 mkdir -p $(PREFIX)/include/mdoc/
110 mkdir -p $(PREFIX)/lib/
111 mkdir -p $(PREFIX)/man/man1/
112 install -m 0755 mdocml $(PREFIX)/bin/
113 install -m 0444 mdocml.1 $(PREFIX)/man/man1/
114 install -m 0444 mdoc.3 $(PREFIX)/man/man3/
115 install -m 0644 libmdoc.a $(PREFIX)/lib/
116 install -m 0444 mdoc.h $(PREFIX)/include/
117
118 install-dist: mdocml-$(VERSION).tar.gz mdocml-oport-$(VERSION).tar.gz
119 install -m 0644 mdocml-$(VERSION).tar.gz $(PREFIX)/
120 install -m 0644 mdocml-$(VERSION).tar.gz $(PREFIX)/mdocml.tar.gz
121 install -m 0644 mdocml-oport-$(VERSION).tar.gz $(PREFIX)/
122 install -m 0644 mdocml-oport-$(VERSION).tar.gz $(PREFIX)/mdocml-oport.tar.gz
123
124 uninstall:
125 rm -f $(PREFIX)/bin/mdocml
126 rm -f $(PREFIX)/man/man1/mdocml.1
127 rm -f $(PREFIX)/man/man3/mdoc.3
128 rm -f $(PREFIX)/lib/libmdoc.a
129 rm -f $(PREFIX)/include/mdoc.h
130
131 macro.ln: macro.c private.h
132
133 macro.o: macro.c private.h
134
135 tree.ln: tree.c mdoc.h
136
137 tree.o: tree.c mdoc.h
138
139 term.ln: term.c mdoc.h
140
141 term.o: term.c mdoc.h
142
143 strings.ln: strings.c private.h
144
145 strings.o: strings.c private.h
146
147 hash.ln: hash.c private.h
148
149 hash.o: hash.c private.h
150
151 mdoc.ln: mdoc.c private.h
152
153 mdoc.o: mdoc.c private.h
154
155 mdocml.ln: mdocml.c mdoc.h
156
157 mdocml.o: mdocml.c mdoc.h
158
159 xstd.ln: xstd.c private.h
160
161 xstd.o: xstd.c private.h
162
163 argv.ln: argv.c private.h
164
165 argv.o: argv.c private.h
166
167 validate.ln: validate.c private.h
168
169 validate.o: validate.c private.h
170
171 action.ln: action.c private.h
172
173 action.o: action.c private.h
174
175 private.h: mdoc.h
176
177 mdocml-oport-$(VERSION).tar.gz: Makefile.port DESCR
178 mkdir -p .dist/mdocml/pkg
179 sed -e "s!@VERSION@!$(VERSION)!" Makefile.port > .dist/mdocml/Makefile
180 md5 mdocml-$(VERSION).tar.gz > .dist/mdocml/distinfo
181 rmd160 mdocml-$(VERSION).tar.gz >> .dist/mdocml/distinfo
182 sha1 mdocml-$(VERSION).tar.gz >> .dist/mdocml/distinfo
183 install -m 0644 DESCR .dist/mdocml/pkg/DESCR
184 echo @comment $$OpenBSD$$ > .dist/mdocml/pkg/PLIST
185 echo bin/mdocml >> .dist/mdocml/pkg/PLIST
186 echo lib/libmdoc.a >> .dist/mdocml/pkg/PLIST
187 echo include/mdoc.h >> .dist/mdocml/pkg/PLIST
188 echo @man man/man1/mdocml.1 >> .dist/mdocml/pkg/PLIST
189 echo @man man/man3/mdoc.3 >> .dist/mdocml/pkg/PLIST
190 ( cd .dist/ && tar zcf ../$@ mdocml/ )
191 rm -rf .dist/
192
193 mdocml-$(VERSION).tar.gz: $(INSTALL)
194 mkdir -p .dist/mdocml/mdocml-$(VERSION)/
195 install -m 0644 $(INSTALL) .dist/mdocml/mdocml-$(VERSION)/
196 ( cd .dist/mdocml/ && tar zcf ../../$@ mdocml-$(VERSION)/ )
197 rm -rf .dist/
198
199 llib-llibmdoc.ln: $(LIBLNS)
200 $(LINT) $(LINTFLAGS) -Clibmdoc $(LIBLNS)
201
202 llib-lmdocml.ln: $(BINLNS) llib-llibmdoc.ln
203 $(LINT) $(LINTFLAGS) -Cmdocml $(BINLNS) llib-llibmdoc.ln
204
205 libmdoc.a: $(LIBOBJS)
206 $(AR) rs $@ $(LIBOBJS)
207
208 mdocml: $(BINOBJS) libmdoc.a
209 $(CC) $(CFLAGS) -o $@ $(BINOBJS) libmdoc.a -lcurses
210