]> git.cameronkatri.com Git - mandoc.git/blob - Makefile
*** empty log message ***
[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 = tree.ln mdocml.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 = tree.o mdocml.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 tree.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
86 all: $(BINS)
87
88 lint: $(LLNS)
89
90 clean:
91 rm -f $(CLEAN)
92
93 dist: mdocml-$(VERSION).tar.gz
94
95 port: mdocml-oport-$(VERSION).tar.gz
96
97 regress::
98 @for f in $(FAIL); do \
99 echo "./mdocml $$f" ; \
100 ./mdocml $$f 2>/dev/null || continue ; exit 1 ; done
101 @for f in $(SUCCEED); do \
102 echo "./mdocml $$f" ; \
103 ./mdocml $$f 2>/dev/null || exit 1 ; done
104
105 install:
106 mkdir -p $(PREFIX)/bin/
107 mkdir -p $(PREFIX)/include/mdoc/
108 mkdir -p $(PREFIX)/lib/
109 mkdir -p $(PREFIX)/man/man1/
110 install -m 0755 mdocml $(PREFIX)/bin/
111 install -m 0444 mdocml.1 $(PREFIX)/man/man1/
112 install -m 0444 mdoc.3 $(PREFIX)/man/man3/
113 install -m 0644 libmdoc.a $(PREFIX)/lib/
114 install -m 0444 mdoc.h $(PREFIX)/include/
115
116 install-dist: mdocml-$(VERSION).tar.gz mdocml-oport-$(VERSION).tar.gz
117 install -m 0644 mdocml-$(VERSION).tar.gz $(PREFIX)/
118 install -m 0644 mdocml-$(VERSION).tar.gz $(PREFIX)/mdocml.tar.gz
119 install -m 0644 mdocml-oport-$(VERSION).tar.gz $(PREFIX)/
120 install -m 0644 mdocml-oport-$(VERSION).tar.gz $(PREFIX)/mdocml-oport.tar.gz
121
122 uninstall:
123 rm -f $(PREFIX)/bin/mdocml
124 rm -f $(PREFIX)/man/man1/mdocml.1
125 rm -f $(PREFIX)/man/man3/mdoc.3
126 rm -f $(PREFIX)/lib/libmdoc.a
127 rm -f $(PREFIX)/include/mdoc.h
128
129 macro.ln: macro.c private.h
130
131 macro.o: macro.c private.h
132
133 strings.ln: strings.c private.h
134
135 strings.o: strings.c private.h
136
137 tree.ln: tree.c mdoc.h
138
139 tree.o: tree.c mdoc.h
140
141 hash.ln: hash.c private.h
142
143 hash.o: hash.c private.h
144
145 mdoc.ln: mdoc.c private.h
146
147 mdoc.o: mdoc.c private.h
148
149 mdocml.ln: mdocml.c mdoc.h
150
151 mdocml.o: mdocml.c mdoc.h
152
153 xstd.ln: xstd.c private.h
154
155 xstd.o: xstd.c private.h
156
157 argv.ln: argv.c private.h
158
159 argv.o: argv.c private.h
160
161 validate.ln: validate.c private.h
162
163 validate.o: validate.c private.h
164
165 action.ln: action.c private.h
166
167 action.o: action.c private.h
168
169 private.h: mdoc.h
170
171 mdocml-oport-$(VERSION).tar.gz: Makefile.port DESCR
172 mkdir -p .dist/mdocml/pkg
173 sed -e "s!@VERSION@!$(VERSION)!" Makefile.port > .dist/mdocml/Makefile
174 md5 mdocml-$(VERSION).tar.gz > .dist/mdocml/distinfo
175 rmd160 mdocml-$(VERSION).tar.gz >> .dist/mdocml/distinfo
176 sha1 mdocml-$(VERSION).tar.gz >> .dist/mdocml/distinfo
177 install -m 0644 DESCR .dist/mdocml/pkg/DESCR
178 echo @comment $$OpenBSD$$ > .dist/mdocml/pkg/PLIST
179 echo bin/mdocml >> .dist/mdocml/pkg/PLIST
180 echo lib/libmdoc.a >> .dist/mdocml/pkg/PLIST
181 echo include/mdoc.h >> .dist/mdocml/pkg/PLIST
182 echo @man man/man1/mdocml.1 >> .dist/mdocml/pkg/PLIST
183 echo @man man/man3/mdoc.3 >> .dist/mdocml/pkg/PLIST
184 ( cd .dist/ && tar zcf ../$@ mdocml/ )
185 rm -rf .dist/
186
187 mdocml-$(VERSION).tar.gz: $(INSTALL)
188 mkdir -p .dist/mdocml/mdocml-$(VERSION)/
189 install -m 0644 $(INSTALL) .dist/mdocml/mdocml-$(VERSION)/
190 ( cd .dist/mdocml/ && tar zcf ../../$@ mdocml-$(VERSION)/ )
191 rm -rf .dist/
192
193 llib-llibmdoc.ln: $(LIBLNS)
194 $(LINT) $(LINTFLAGS) -Clibmdoc $(LIBLNS)
195
196 llib-lmdocml.ln: $(BINLNS) llib-llibmdoc.ln
197 $(LINT) $(LINTFLAGS) -Cmdocml $(BINLNS) llib-llibmdoc.ln
198
199 libmdoc.a: $(LIBOBJS)
200 $(AR) rs $@ $(LIBOBJS)
201
202 mdocml: $(BINOBJS) libmdoc.a
203 $(CC) $(CFLAGS) -o $@ $(BINOBJS) libmdoc.a
204