Makefile.am 20.5 KB
Newer Older
Kenton Varda's avatar
Kenton Varda committed
1 2
## Process this file with automake to produce Makefile.in

3 4
ACLOCAL_AMFLAGS = -I m4

Kenton Varda's avatar
Kenton Varda committed
5
AUTOMAKE_OPTIONS = foreign subdir-objects
Kenton Varda's avatar
Kenton Varda committed
6

7 8 9 10
# When running distcheck, verify that we've included all the files needed by
# the cmake build.
distcheck-hook:
	rm -rf distcheck-cmake
11
	(mkdir distcheck-cmake && cd distcheck-cmake && cmake ../$(distdir) && make -j6 check)
12 13
	rm -rf distcheck-cmake

14
AM_CXXFLAGS = -I$(srcdir)/src -I$(builddir)/src -DKJ_HEADER_WARNINGS -DCAPNP_HEADER_WARNINGS -DCAPNP_INCLUDE_DIR='"$(includedir)"' $(PTHREAD_CFLAGS)
15 16

AM_LDFLAGS = $(PTHREAD_CFLAGS)
Kenton Varda's avatar
Kenton Varda committed
17 18 19

EXTRA_DIST =                                                                 \
  README.txt                                                                 \
20
  LICENSE.txt                                                                \
Kenton Varda's avatar
Kenton Varda committed
21 22 23 24 25 26 27 28 29 30
  $(test_capnpc_inputs)                                                      \
  src/capnp/compiler/capnp-test.sh                                           \
  src/capnp/testdata/segmented-packed                                        \
  src/capnp/testdata/errors.capnp.nobuild                                    \
  src/capnp/testdata/short.txt                                               \
  src/capnp/testdata/flat                                                    \
  src/capnp/testdata/binary                                                  \
  src/capnp/testdata/errors.txt                                              \
  src/capnp/testdata/segmented                                               \
  src/capnp/testdata/packed                                                  \
31 32 33 34 35 36
  src/capnp/testdata/pretty.txt                                              \
  CMakeLists.txt                                                             \
  cmake/FindCapnProto.cmake                                                  \
  src/CMakeLists.txt                                                         \
  src/kj/CMakeLists.txt                                                      \
  src/capnp/CMakeLists.txt
Kenton Varda's avatar
Kenton Varda committed
37

38
CLEANFILES = $(test_capnpc_outputs) test_capnpc_middleman distcheck-cmake
Kenton Varda's avatar
Kenton Varda committed
39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59

# 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

60 61 62
maintainer-clean-local:
	-rm -rf build-aux

63 64 65 66 67 68
# 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.
69 70
%.capnp:
	@:
71

72
public_capnpc_inputs =                                         \
73
  src/capnp/c++.capnp                                          \
74 75
  src/capnp/schema.capnp                                       \
  src/capnp/rpc.capnp                                          \
76 77
  src/capnp/rpc-twoparty.capnp                                 \
  src/capnp/persistent.capnp
Kenton Varda's avatar
Kenton Varda committed
78

79 80 81 82
capnpc_inputs =                                                \
  $(public_capnpc_inputs)                                      \
  src/capnp/compiler/lexer.capnp                               \
  src/capnp/compiler/grammar.capnp
83

Kenton Varda's avatar
Kenton Varda committed
84
capnpc_outputs =                                               \
85 86 87
  src/capnp/c++.capnp.c++                                      \
  src/capnp/c++.capnp.h                                        \
  src/capnp/schema.capnp.c++                                   \
88
  src/capnp/schema.capnp.h                                     \
89 90
  src/capnp/rpc.capnp.c++                                      \
  src/capnp/rpc.capnp.h                                        \
91 92
  src/capnp/rpc-twoparty.capnp.c++                             \
  src/capnp/rpc-twoparty.capnp.h                               \
93 94
  src/capnp/persistent.capnp.c++                               \
  src/capnp/persistent.capnp.h                                 \
95 96 97 98
  src/capnp/compiler/lexer.capnp.c++                           \
  src/capnp/compiler/lexer.capnp.h                             \
  src/capnp/compiler/grammar.capnp.c++                         \
  src/capnp/compiler/grammar.capnp.h
Kenton Varda's avatar
Kenton Varda committed
99

100
includecapnpdir = $(includedir)/capnp
Kenton Varda's avatar
Kenton Varda committed
101
includekjdir = $(includedir)/kj
Kenton Varda's avatar
Kenton Varda committed
102
includekjparsedir = $(includekjdir)/parse
103
includekjstddir = $(includekjdir)/std
104
includekjcompatdir = $(includekjdir)/compat
Kenton Varda's avatar
Kenton Varda committed
105

106
dist_includecapnp_DATA = $(public_capnpc_inputs)
107

Kenton Varda's avatar
Kenton Varda committed
108 109 110
pkgconfigdir = $(libdir)/pkgconfig
pkgconfig_DATA = capnp.pc capnp-rpc.pc

Kenton Varda's avatar
Kenton Varda committed
111 112
includekj_HEADERS =                                            \
  src/kj/common.h                                              \
Kenton Varda's avatar
Kenton Varda committed
113
  src/kj/units.h                                               \
Kenton Varda's avatar
Kenton Varda committed
114
  src/kj/memory.h                                              \
Kenton Varda's avatar
Kenton Varda committed
115
  src/kj/refcount.h                                            \
Kenton Varda's avatar
Kenton Varda committed
116
  src/kj/array.h                                               \
117
  src/kj/vector.h                                              \
Kenton Varda's avatar
Kenton Varda committed
118
  src/kj/string.h                                              \
119
  src/kj/string-tree.h                                         \
Kenton Varda's avatar
Kenton Varda committed
120
  src/kj/exception.h                                           \
Kenton Varda's avatar
Kenton Varda committed
121
  src/kj/debug.h                                               \
122
  src/kj/arena.h                                               \
123
  src/kj/miniposix.h                                           \
124
  src/kj/io.h                                                  \
125
  src/kj/tuple.h                                               \
Kenton Varda's avatar
Kenton Varda committed
126
  src/kj/one-of.h                                              \
127
  src/kj/function.h                                            \
Kenton Varda's avatar
Kenton Varda committed
128
  src/kj/mutex.h                                               \
129
  src/kj/thread.h                                              \
130
  src/kj/threadlocal.h                                         \
131
  src/kj/async-prelude.h                                       \
Kenton Varda's avatar
Kenton Varda committed
132
  src/kj/async.h                                               \
Kenton Varda's avatar
Kenton Varda committed
133
  src/kj/async-inl.h                                           \
Kenton Varda's avatar
Kenton Varda committed
134
  src/kj/time.h                                                \
Kenton Varda's avatar
Kenton Varda committed
135
  src/kj/async-unix.h                                          \
136
  src/kj/async-io.h                                            \
137
  src/kj/main.h                                                \
138
  src/kj/test.h                                                \
139
  src/kj/windows-sanity.h
Kenton Varda's avatar
Kenton Varda committed
140 141 142 143

includekjparse_HEADERS =                                       \
  src/kj/parse/common.h                                        \
  src/kj/parse/char.h
Kenton Varda's avatar
Kenton Varda committed
144

145 146 147
includekjstd_HEADERS =                                         \
  src/kj/std/iostream.h

148 149 150
includekjcompat_HEADERS =                                      \
  src/kj/compat/gtest.h

151
includecapnp_HEADERS =                                         \
Kenton Varda's avatar
Kenton Varda committed
152
  src/capnp/c++.capnp.h                                        \
153 154 155 156
  src/capnp/common.h                                           \
  src/capnp/blob.h                                             \
  src/capnp/endian.h                                           \
  src/capnp/layout.h                                           \
157
  src/capnp/orphan.h                                           \
158
  src/capnp/list.h                                             \
Kenton Varda's avatar
Kenton Varda committed
159
  src/capnp/any.h                                              \
160
  src/capnp/message.h                                          \
Kenton Varda's avatar
Kenton Varda committed
161
  src/capnp/capability.h                                       \
Kenton Varda's avatar
Kenton Varda committed
162
  src/capnp/schema.capnp.h                                     \
163
  src/capnp/schema-lite.h                                      \
164 165
  src/capnp/schema.h                                           \
  src/capnp/schema-loader.h                                    \
166
  src/capnp/schema-parser.h                                    \
167
  src/capnp/dynamic.h                                          \
168
  src/capnp/pretty-print.h                                     \
169
  src/capnp/serialize.h                                        \
170
  src/capnp/serialize-async.h                                  \
171
  src/capnp/serialize-packed.h                                 \
172
  src/capnp/pointer-helpers.h                                  \
173
  src/capnp/generated-header-support.h                         \
174
  src/capnp/rpc-prelude.h                                      \
175
  src/capnp/rpc.h                                              \
176 177
  src/capnp/rpc-twoparty.h                                     \
  src/capnp/rpc.capnp.h                                        \
178
  src/capnp/rpc-twoparty.capnp.h                               \
179
  src/capnp/persistent.capnp.h                                 \
180
  src/capnp/ez-rpc.h
Kenton Varda's avatar
Kenton Varda committed
181

182
if LITE_MODE
183
lib_LTLIBRARIES = libkj.la libkj-test.la libcapnp.la
184
else
185
lib_LTLIBRARIES = libkj.la libkj-test.la libkj-async.la libcapnp.la libcapnp-rpc.la libcapnpc.la
186
endif
Kenton Varda's avatar
Kenton Varda committed
187

188 189 190 191
# Don't include security release in soname -- we want to replace old binaries
# in this case.
SO_VERSION = $(shell echo $(VERSION) | sed -re 's/^([0-9]+[.][0-9]+[.][0-9]+)([.][0-9]+)?(-.*)?$$/\1\3/g')

192
libkj_la_LIBADD = $(PTHREAD_LIBS)
193
libkj_la_LDFLAGS = -release $(SO_VERSION) -no-undefined
194
libkj_la_SOURCES=                                              \
Kenton Varda's avatar
Kenton Varda committed
195
  src/kj/common.c++                                            \
Kenton Varda's avatar
Kenton Varda committed
196
  src/kj/units.c++                                             \
Kenton Varda's avatar
Kenton Varda committed
197
  src/kj/memory.c++                                            \
Kenton Varda's avatar
Kenton Varda committed
198
  src/kj/refcount.c++                                          \
Kenton Varda's avatar
Kenton Varda committed
199 200
  src/kj/array.c++                                             \
  src/kj/string.c++                                            \
201
  src/kj/string-tree.c++                                       \
Kenton Varda's avatar
Kenton Varda committed
202
  src/kj/exception.c++                                         \
Kenton Varda's avatar
Kenton Varda committed
203
  src/kj/debug.c++                                             \
204
  src/kj/arena.c++                                             \
Kenton Varda's avatar
Kenton Varda committed
205
  src/kj/io.c++                                                \
206
  src/kj/mutex.c++                                             \
Kenton Varda's avatar
Kenton Varda committed
207
  src/kj/thread.c++                                            \
208
  src/kj/main.c++                                              \
209 210
  src/kj/parse/char.c++

211 212 213 214
libkj_test_la_LIBADD = libkj.la $(PTHREAD_LIBS)
libkj_test_la_LDFLAGS = -release $(VERSION) -no-undefined
libkj_test_la_SOURCES = src/kj/test.c++

215
if !LITE_MODE
216
libkj_async_la_LIBADD = libkj.la $(PTHREAD_LIBS)
217
libkj_async_la_LDFLAGS = -release $(SO_VERSION) -no-undefined
218 219 220
libkj_async_la_SOURCES=                                        \
  src/kj/async.c++                                             \
  src/kj/async-unix.c++                                        \
221 222
  src/kj/async-io.c++                                          \
  src/kj/time.c++
223 224 225 226 227 228 229 230 231
endif !LITE_MODE

if !LITE_MODE
heavy_sources =                                                \
  src/capnp/schema.c++                                         \
  src/capnp/schema-loader.c++                                  \
  src/capnp/dynamic.c++                                        \
  src/capnp/stringify.c++
endif !LITE_MODE
232

233
libcapnp_la_LIBADD = libkj.la $(PTHREAD_LIBS)
234
libcapnp_la_LDFLAGS = -release $(SO_VERSION) -no-undefined
235
libcapnp_la_SOURCES=                                           \
Kenton Varda's avatar
Kenton Varda committed
236
  src/capnp/c++.capnp.c++                                      \
237 238 239 240 241
  src/capnp/blob.c++                                           \
  src/capnp/arena.h                                            \
  src/capnp/arena.c++                                          \
  src/capnp/layout.c++                                         \
  src/capnp/list.c++                                           \
Kenton Varda's avatar
Kenton Varda committed
242
  src/capnp/any.c++                                            \
243
  src/capnp/message.c++                                        \
Kenton Varda's avatar
Kenton Varda committed
244
  src/capnp/schema.capnp.c++                                   \
245
  src/capnp/serialize.c++                                      \
246 247 248 249
  src/capnp/serialize-packed.c++                               \
  $(heavy_sources)

if !LITE_MODE
250

251
libcapnp_rpc_la_LIBADD = libcapnp.la libkj-async.la libkj.la $(PTHREAD_LIBS)
252
libcapnp_rpc_la_LDFLAGS = -release $(SO_VERSION) -no-undefined
253
libcapnp_rpc_la_SOURCES=                                       \
254 255 256
  src/capnp/serialize-async.c++                                \
  src/capnp/capability.c++                                     \
  src/capnp/dynamic-capability.c++                             \
257 258
  src/capnp/rpc.c++                                            \
  src/capnp/rpc.capnp.c++                                      \
259
  src/capnp/rpc-twoparty.c++                                   \
260
  src/capnp/rpc-twoparty.capnp.c++                             \
261
  src/capnp/persistent.capnp.c++                               \
262
  src/capnp/ez-rpc.c++
263

264
libcapnpc_la_LIBADD = libcapnp.la libkj.la $(PTHREAD_LIBS)
265
libcapnpc_la_LDFLAGS = -release $(SO_VERSION) -no-undefined
266
libcapnpc_la_SOURCES=                                          \
267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282
  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++                              \
283
  src/capnp/schema-parser.c++
Kenton Varda's avatar
Kenton Varda committed
284

285
bin_PROGRAMS = capnp capnpc-capnp capnpc-c++
286

287
capnp_LDADD = libcapnpc.la libcapnp.la libkj.la $(PTHREAD_LIBS)
288 289 290 291
capnp_SOURCES =                                                \
  src/capnp/compiler/module-loader.h                           \
  src/capnp/compiler/module-loader.c++                         \
  src/capnp/compiler/capnp.c++
292

293
capnpc_capnp_LDADD = libcapnp.la libkj.la $(PTHREAD_LIBS)
294 295
capnpc_capnp_SOURCES = src/capnp/compiler/capnpc-capnp.c++

296
capnpc_c___LDADD = libcapnp.la libkj.la $(PTHREAD_LIBS)
297 298
capnpc_c___SOURCES = src/capnp/compiler/capnpc-c++.c++

Kenton Varda's avatar
Kenton Varda committed
299 300
# Symlink capnpc -> capnp.  The capnp binary will behave like the old capnpc
# binary (i.e. like "capnp compile") when invoked via this symlink.
301 302 303 304
#
# Also attempt to run ldconfig, because otherwise users get confused.  If
# it fails (e.g. because the platform doesn't have it, or because the
# user doesn't have root privileges), don't worry about it.
Kenton Varda's avatar
Kenton Varda committed
305
install-exec-hook:
306
	ln -sf capnp $(DESTDIR)$(bindir)/capnpc
307
	ldconfig < /dev/null > /dev/null 2>&1 || true
Kenton Varda's avatar
Kenton Varda committed
308 309

uninstall-hook:
310
	rm -f $(DESTDIR)$(bindir)/capnpc
Kenton Varda's avatar
Kenton Varda committed
311

312 313 314 315 316 317 318
else LITE_MODE

install-exec-hook:
	ldconfig < /dev/null > /dev/null 2>&1 || true

endif LITE_MODE

Kenton Varda's avatar
Kenton Varda committed
319
# Source files intentionally not included in the dist at this time:
320 321 322
#  src/capnp/serialize-snappy*
#  src/capnp/benchmark/...
#  src/capnp/compiler/...
Kenton Varda's avatar
Kenton Varda committed
323 324 325

# Tests ==============================================================

Kenton Varda's avatar
Kenton Varda committed
326
test_capnpc_inputs =                                           \
327
  src/capnp/test.capnp                                         \
328 329
  src/capnp/test-import.capnp                                  \
  src/capnp/test-import2.capnp
Kenton Varda's avatar
Kenton Varda committed
330

Kenton Varda's avatar
Kenton Varda committed
331
test_capnpc_outputs =                                          \
332 333 334
  src/capnp/test.capnp.c++                                     \
  src/capnp/test.capnp.h                                       \
  src/capnp/test-import.capnp.c++                              \
335 336 337
  src/capnp/test-import.capnp.h                                \
  src/capnp/test-import2.capnp.c++                             \
  src/capnp/test-import2.capnp.h
Kenton Varda's avatar
Kenton Varda committed
338

339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354
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

355
BUILT_SOURCES = $(test_capnpc_outputs)
356

357 358 359 360
if LITE_MODE

check_PROGRAMS = capnp-test
compiler_tests =
361
capnp_test_LDADD = libcapnp.la libkj-test.la libkj.la
362 363 364

else !LITE_MODE

365
check_PROGRAMS = capnp-test capnp-evolution-test
366 367 368 369 370 371
heavy_tests =                                                  \
  src/kj/async-test.c++                                        \
  src/kj/async-unix-test.c++                                   \
  src/kj/async-io-test.c++                                     \
  src/kj/parse/common-test.c++                                 \
  src/kj/parse/char-test.c++                                   \
372
  src/kj/std/iostream-test.c++                                 \
373 374 375 376 377 378 379 380 381 382 383
  src/capnp/capability-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/serialize-async-test.c++                           \
  src/capnp/rpc-test.c++                                       \
  src/capnp/rpc-twoparty-test.c++                              \
  src/capnp/ez-rpc-test.c++                                    \
  src/capnp/compiler/lexer-test.c++                            \
  src/capnp/compiler/md5-test.c++
384
capnp_test_LDADD = libcapnpc.la libcapnp-rpc.la libcapnp.la libkj-async.la libkj-test.la libkj.la
385 386 387

endif !LITE_MODE

388
capnp_test_CPPFLAGS = -Wno-deprecated-declarations
389
capnp_test_SOURCES =                                           \
Kenton Varda's avatar
Kenton Varda committed
390
  src/kj/common-test.c++                                       \
Kenton Varda's avatar
Kenton Varda committed
391
  src/kj/memory-test.c++                                       \
Kenton Varda's avatar
Kenton Varda committed
392
  src/kj/refcount-test.c++                                     \
Kenton Varda's avatar
Kenton Varda committed
393
  src/kj/array-test.c++                                        \
Kenton Varda's avatar
Kenton Varda committed
394
  src/kj/string-test.c++                                       \
395
  src/kj/string-tree-test.c++                                  \
396
  src/kj/exception-test.c++                                    \
Kenton Varda's avatar
Kenton Varda committed
397
  src/kj/debug-test.c++                                        \
398
  src/kj/arena-test.c++                                        \
Kenton Varda's avatar
Kenton Varda committed
399
  src/kj/units-test.c++                                        \
400
  src/kj/tuple-test.c++                                        \
Kenton Varda's avatar
Kenton Varda committed
401
  src/kj/one-of-test.c++                                       \
402
  src/kj/function-test.c++                                     \
403
  src/kj/io-test.c++                                           \
404
  src/kj/mutex-test.c++                                        \
405 406
  src/kj/threadlocal-test.c++                                  \
  src/kj/threadlocal-pthread-test.c++                          \
Kenton Varda's avatar
Kenton Varda committed
407
  src/kj/test-test.c++                                         \
408
  src/capnp/common-test.c++                                    \
409 410 411 412 413
  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++                                    \
Kenton Varda's avatar
Kenton Varda committed
414
  src/capnp/any-test.c++                                       \
415 416
  src/capnp/message-test.c++                                   \
  src/capnp/encoding-test.c++                                  \
417
  src/capnp/orphan-test.c++                                    \
418 419
  src/capnp/serialize-test.c++                                 \
  src/capnp/serialize-packed-test.c++                          \
420
  src/capnp/fuzz-test.c++                                      \
421
  src/capnp/test-util.c++                                      \
422
  src/capnp/test-util.h                                        \
423
  $(heavy_tests)
424
nodist_capnp_test_SOURCES = $(test_capnpc_outputs)
Kenton Varda's avatar
Kenton Varda committed
425

426
if !LITE_MODE
427 428
capnp_evolution_test_LDADD = libcapnpc.la libcapnp.la libkj.la
capnp_evolution_test_SOURCES = src/capnp/compiler/evolution-test.c++
429
endif !LITE_MODE
430

431 432 433
if LITE_MODE
TESTS = capnp-test
else !LITE_MODE
434
TESTS = capnp-test capnp-evolution-test src/capnp/compiler/capnp-test.sh
435
endif !LITE_MODE