1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
## Process this file with automake to produce Makefile.in
ACLOCAL_AMFLAGS = -I m4
AUTOMAKE_OPTIONS = foreign subdir-objects
# Always include gtest in distributions.
DIST_SUBDIRS = $(subdirs)
# Build gtest before we build Cap'n Proto tests. We don't add gtest to SUBDIRS
# because then "make check" would also build and run all of gtest's own tests,
# which takes a lot of time and is generally not useful to us. Also, we don't
# want "make install" to recurse into gtest since we don't want to overwrite
# the installed version of gtest if there is one (and, actually, gtest doesn't
# even support "make install" anyway). So we define a rule such that it will
# only be built when needed.
gtest/lib/libgtest.la:
@echo "Making lib/libgtest.a lib/libgtest_main.a in gtest"
@cd gtest && $(MAKE) $(AM_MAKEFLAGS) lib/libgtest.la lib/libgtest_main.la
gtest/lib/libgtest_main.la: gtest/lib/libgtest.la
@:
# We would like to clean gtest when "make clean" is invoked. But we have to
# be careful because clean-local is also invoked during "make distclean", but
# "make distclean" already recurses into gtest because it's listed among the
# DIST_SUBDIRS. distclean will delete gtest/Makefile, so if we then try to
# cd to the directory again and "make clean" it will fail. So, check that the
# Makefile exists before recursing.
clean-local:
@if test -e gtest/Makefile; then \
echo "Making clean in gtest"; \
cd gtest && $(MAKE) $(AM_MAKEFLAGS) clean; \
fi
AM_CXXFLAGS = -I$(srcdir)/src -I$(builddir)/src $(PTHREAD_CFLAGS)
AM_LDFLAGS = $(PTHREAD_CFLAGS)
EXTRA_DIST = \
README.txt \
LICENSE.txt \
$(test_capnpc_inputs)
CLEANFILES = $(test_capnpc_outputs) test_capnpc_middleman
# Deletes all the files generated by autoreconf.
MAINTAINERCLEANFILES = \
aclocal.m4 \
config.guess \
config.sub \
configure \
depcomp \
install-sh \
ltmain.sh \
Makefile.in \
missing \
mkinstalldirs \
config.h.in \
stamp.h.in \
m4/ltsugar.m4 \
m4/libtool.m4 \
m4/ltversion.m4 \
m4/lt~obsolete.m4 \
m4/ltoptions.m4
maintainer-clean-local:
-rm -rf build-aux
# gmake defines an implicit rule building n from n.o. Unfortunately, this triggers on our .capnp
# files because they generate .capnp.c++ which is compiled to .capnp.o. In addition to being
# nonsense, this leads to cyclic dependency issues and could even cause the .capnp files to be
# unexpectedly overwritten! We need to cancel the implicit rule by declaring an explicit one.
#
# I want the hours of my life back that I spent figuring this out.
%.capnp:
@:
public_capnpc_inputs = \
src/capnp/c++.capnp \
src/capnp/schema.capnp
capnpc_inputs = \
$(public_capnpc_inputs) \
src/capnp/compiler/lexer.capnp \
src/capnp/compiler/grammar.capnp
capnpc_outputs = \
src/capnp/c++.capnp.c++ \
src/capnp/c++.capnp.h \
src/capnp/schema.capnp.c++ \
src/capnp/schema.capnp.h \
src/capnp/compiler/lexer.capnp.c++ \
src/capnp/compiler/lexer.capnp.h \
src/capnp/compiler/grammar.capnp.c++ \
src/capnp/compiler/grammar.capnp.h
includecapnpdir = $(includedir)/capnp
includekjdir = $(includedir)/kj
includekjparsedir = $(includekjdir)/parse
dist_includecapnp_DATA = $(public_capnpc_inputs)
includekj_HEADERS = \
src/kj/common.h \
src/kj/units.h \
src/kj/memory.h \
src/kj/array.h \
src/kj/vector.h \
src/kj/string.h \
src/kj/string-tree.h \
src/kj/exception.h \
src/kj/debug.h \
src/kj/arena.h \
src/kj/io.h \
src/kj/tuple.h \
src/kj/function.h \
src/kj/mutex.h \
src/kj/thread.h \
src/kj/main.h
includekjparse_HEADERS = \
src/kj/parse/common.h \
src/kj/parse/char.h
includecapnp_HEADERS = \
src/capnp/c++.capnp.h \
src/capnp/common.h \
src/capnp/blob.h \
src/capnp/endian.h \
src/capnp/layout.h \
src/capnp/orphan.h \
src/capnp/list.h \
src/capnp/message.h \
src/capnp/schema.capnp.h \
src/capnp/schema.h \
src/capnp/schema-loader.h \
src/capnp/schema-parser.h \
src/capnp/dynamic.h \
src/capnp/pretty-print.h \
src/capnp/serialize.h \
src/capnp/serialize-packed.h \
src/capnp/generated-header-support.h
lib_LTLIBRARIES = libkj.la libcapnp.la libcapnpc.la
libkj_la_LIBADD = $(PTHREAD_LIBS)
libkj_la_LDFLAGS = -release $(VERSION) -export-dynamic -no-undefined
libkj_la_SOURCES= \
src/kj/common.c++ \
src/kj/units.c++ \
src/kj/memory.c++ \
src/kj/array.c++ \
src/kj/string.c++ \
src/kj/string-tree.c++ \
src/kj/exception.c++ \
src/kj/debug.c++ \
src/kj/arena.c++ \
src/kj/io.c++ \
src/kj/mutex.c++ \
src/kj/thread.c++ \
src/kj/main.c++ \
src/kj/parse/char.c++
libcapnp_la_LIBADD = $(PTHREAD_LIBS) libkj.la
libcapnp_la_LDFLAGS = -release $(VERSION) -export-dynamic -no-undefined
libcapnp_la_SOURCES= \
src/capnp/c++.capnp.c++ \
src/capnp/blob.c++ \
src/capnp/arena.h \
src/capnp/arena.c++ \
src/capnp/layout.c++ \
src/capnp/list.c++ \
src/capnp/message.c++ \
src/capnp/schema.capnp.c++ \
src/capnp/schema.c++ \
src/capnp/schema-loader.c++ \
src/capnp/dynamic.c++ \
src/capnp/stringify.c++ \
src/capnp/serialize.c++ \
src/capnp/serialize-packed.c++
libcapnpc_la_LIBADD = $(PTHREAD_LIBS) libcapnp.la
libcapnpc_la_LDFLAGS = -release $(VERSION) -export-dynamic -no-undefined
libcapnpc_la_SOURCES= \
src/capnp/compiler/md5.h \
src/capnp/compiler/md5.c++ \
src/capnp/compiler/error-reporter.h \
src/capnp/compiler/error-reporter.c++ \
src/capnp/compiler/lexer.capnp.h \
src/capnp/compiler/lexer.capnp.c++ \
src/capnp/compiler/lexer.h \
src/capnp/compiler/lexer.c++ \
src/capnp/compiler/grammar.capnp.h \
src/capnp/compiler/grammar.capnp.c++ \
src/capnp/compiler/parser.h \
src/capnp/compiler/parser.c++ \
src/capnp/compiler/node-translator.h \
src/capnp/compiler/node-translator.c++ \
src/capnp/compiler/compiler.h \
src/capnp/compiler/compiler.c++ \
src/capnp/schema-parser.c++
bin_PROGRAMS = capnp capnpc-capnp capnpc-c++
capnp_LDADD = $(PTHREAD_LIBS) libcapnpc.la libcapnp.la libkj.la
capnp_SOURCES = \
src/capnp/compiler/module-loader.h \
src/capnp/compiler/module-loader.c++ \
src/capnp/compiler/capnp.c++
capnpc_capnp_LDADD = $(PTHREAD_LIBS) libcapnp.la libkj.la
capnpc_capnp_SOURCES = src/capnp/compiler/capnpc-capnp.c++
capnpc_c___LDADD = $(PTHREAD_LIBS) libcapnp.la libkj.la
capnpc_c___SOURCES = src/capnp/compiler/capnpc-c++.c++
# Symlink capnpc -> capnp. The capnp binary will behave like the old capnpc
# binary (i.e. like "capnp compile") when invoked via this symlink.
install-exec-hook:
ln -s capnp $(DESTDIR)$(bindir)/capnpc
uninstall-hook:
rm $(DESTDIR)$(bindir)/capnpc
# Source files intentionally not included in the dist at this time:
# src/capnp/serialize-snappy*
# src/capnp/benchmark/...
# src/capnp/compiler/...
# Tests ==============================================================
test_capnpc_inputs = \
src/capnp/test.capnp \
src/capnp/test-import.capnp
test_capnpc_outputs = \
src/capnp/test.capnp.c++ \
src/capnp/test.capnp.h \
src/capnp/test-import.capnp.c++ \
src/capnp/test-import.capnp.h
if USE_EXTERNAL_CAPNP
test_capnpc_middleman: $(test_capnpc_inputs)
$(CAPNP) compile --src-prefix=$(srcdir)/src -o$(CAPNPC_CXX):src -I$(srcdir)/src $^
touch test_capnpc_middleman
else
test_capnpc_middleman: capnp$(EXEEXT) capnpc-c++$(EXEEXT) $(test_capnpc_inputs)
echo $^ | (read CAPNP CAPNPC_CXX SOURCES && ./$$CAPNP compile --src-prefix=$(srcdir)/src -o./$$CAPNPC_CXX:src -I$(srcdir)/src $$SOURCES)
touch test_capnpc_middleman
endif
$(test_capnpc_outputs): test_capnpc_middleman
BUILT_SOURCES = $(test_capnpc_outputs)
check_PROGRAMS = capnp-test
capnp_test_LDADD = gtest/lib/libgtest.la gtest/lib/libgtest_main.la libcapnpc.la libcapnp.la libkj.la
capnp_test_CPPFLAGS = -Igtest/include -I$(srcdir)/gtest/include
capnp_test_SOURCES = \
src/kj/common-test.c++ \
src/kj/memory-test.c++ \
src/kj/array-test.c++ \
src/kj/string-test.c++ \
src/kj/string-tree-test.c++ \
src/kj/exception-test.c++ \
src/kj/debug-test.c++ \
src/kj/arena-test.c++ \
src/kj/units-test.c++ \
src/kj/tuple-test.c++ \
src/kj/function-test.c++ \
src/kj/mutex-test.c++ \
src/kj/parse/common-test.c++ \
src/kj/parse/char-test.c++ \
src/capnp/blob-test.c++ \
src/capnp/endian-test.c++ \
src/capnp/endian-fallback-test.c++ \
src/capnp/endian-reverse-test.c++ \
src/capnp/layout-test.c++ \
src/capnp/message-test.c++ \
src/capnp/schema-test.c++ \
src/capnp/schema-loader-test.c++ \
src/capnp/dynamic-test.c++ \
src/capnp/stringify-test.c++ \
src/capnp/encoding-test.c++ \
src/capnp/orphan-test.c++ \
src/capnp/serialize-test.c++ \
src/capnp/serialize-packed-test.c++ \
src/capnp/test-util.c++ \
src/capnp/test-util.h \
src/capnp/compiler/lexer-test.c++ \
src/capnp/compiler/md5-test.c++
nodist_capnp_test_SOURCES = $(test_capnpc_outputs)
TESTS = capnp-test