Makefile.am 20.9 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

111
noinst_HEADERS = \
Tom Lee's avatar
Tom Lee committed
112
  src/kj/miniposix.h
113

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

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

147 148 149
includekjstd_HEADERS =                                         \
  src/kj/std/iostream.h

150 151 152
includekjcompat_HEADERS =                                      \
  src/kj/compat/gtest.h

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

186
if LITE_MODE
187
lib_LTLIBRARIES = libkj.la libkj-test.la libcapnp.la
188
else
189
lib_LTLIBRARIES = libkj.la libkj-test.la libkj-async.la libcapnp.la libcapnp-rpc.la libcapnpc.la
190
endif
Kenton Varda's avatar
Kenton Varda committed
191

192 193
# Don't include security release in soname -- we want to replace old binaries
# in this case.
194
SO_VERSION = $(shell echo $(VERSION) | sed -e 's/^\([0-9]*[.][0-9]*[.][0-9]*\)\([.][0-9]*\)*\(-.*\)*$$/\1\3/g')
195

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

215 216 217 218
libkj_test_la_LIBADD = libkj.la $(PTHREAD_LIBS)
libkj_test_la_LDFLAGS = -release $(VERSION) -no-undefined
libkj_test_la_SOURCES = src/kj/test.c++

219
if !LITE_MODE
220
libkj_async_la_LIBADD = libkj.la $(PTHREAD_LIBS)
221
libkj_async_la_LDFLAGS = -release $(SO_VERSION) -no-undefined
222 223 224
libkj_async_la_SOURCES=                                        \
  src/kj/async.c++                                             \
  src/kj/async-unix.c++                                        \
225 226
  src/kj/async-io.c++                                          \
  src/kj/time.c++
227 228 229 230 231 232 233 234 235
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
236

237
libcapnp_la_LIBADD = libkj.la $(PTHREAD_LIBS)
238
libcapnp_la_LDFLAGS = -release $(SO_VERSION) -no-undefined
239
libcapnp_la_SOURCES=                                           \
Kenton Varda's avatar
Kenton Varda committed
240
  src/capnp/c++.capnp.c++                                      \
241 242 243 244 245
  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
246
  src/capnp/any.c++                                            \
247
  src/capnp/message.c++                                        \
Kenton Varda's avatar
Kenton Varda committed
248
  src/capnp/schema.capnp.c++                                   \
249
  src/capnp/serialize.c++                                      \
250 251 252 253
  src/capnp/serialize-packed.c++                               \
  $(heavy_sources)

if !LITE_MODE
254

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

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

291
bin_PROGRAMS = capnp capnpc-capnp capnpc-c++
292

293
capnp_LDADD = libcapnpc.la libcapnp.la libkj.la $(PTHREAD_LIBS)
294 295 296 297
capnp_SOURCES =                                                \
  src/capnp/compiler/module-loader.h                           \
  src/capnp/compiler/module-loader.c++                         \
  src/capnp/compiler/capnp.c++
298

299
capnpc_capnp_LDADD = libcapnp.la libkj.la $(PTHREAD_LIBS)
300 301
capnpc_capnp_SOURCES = src/capnp/compiler/capnpc-capnp.c++

302
capnpc_c___LDADD = libcapnp.la libkj.la $(PTHREAD_LIBS)
303 304
capnpc_c___SOURCES = src/capnp/compiler/capnpc-c++.c++

Kenton Varda's avatar
Kenton Varda committed
305 306
# Symlink capnpc -> capnp.  The capnp binary will behave like the old capnpc
# binary (i.e. like "capnp compile") when invoked via this symlink.
307 308 309 310
#
# 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
311
install-exec-hook:
312
	ln -sf capnp $(DESTDIR)$(bindir)/capnpc
313
	ldconfig < /dev/null > /dev/null 2>&1 || true
Kenton Varda's avatar
Kenton Varda committed
314 315

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

318 319 320 321 322 323 324
else LITE_MODE

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

endif LITE_MODE

Kenton Varda's avatar
Kenton Varda committed
325
# Source files intentionally not included in the dist at this time:
326 327 328
#  src/capnp/serialize-snappy*
#  src/capnp/benchmark/...
#  src/capnp/compiler/...
Kenton Varda's avatar
Kenton Varda committed
329 330 331

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

Kenton Varda's avatar
Kenton Varda committed
332
test_capnpc_inputs =                                           \
333
  src/capnp/test.capnp                                         \
334 335
  src/capnp/test-import.capnp                                  \
  src/capnp/test-import2.capnp
Kenton Varda's avatar
Kenton Varda committed
336

Kenton Varda's avatar
Kenton Varda committed
337
test_capnpc_outputs =                                          \
338 339 340
  src/capnp/test.capnp.c++                                     \
  src/capnp/test.capnp.h                                       \
  src/capnp/test-import.capnp.c++                              \
341 342 343
  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
344

345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360
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

361
BUILT_SOURCES = $(test_capnpc_outputs)
362

363 364 365 366
if LITE_MODE

check_PROGRAMS = capnp-test
compiler_tests =
367
capnp_test_LDADD = libcapnp.la libkj-test.la libkj.la
368 369 370

else !LITE_MODE

371
check_PROGRAMS = capnp-test capnp-evolution-test
372 373 374 375 376 377
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++                                   \
378
  src/kj/std/iostream-test.c++                                 \
379
  src/capnp/capability-test.c++                                \
380
  src/capnp/membrane-test.c++                                  \
381 382
  src/capnp/schema-test.c++                                    \
  src/capnp/schema-loader-test.c++                             \
383
  src/capnp/schema-parser-test.c++                             \
384 385 386
  src/capnp/dynamic-test.c++                                   \
  src/capnp/stringify-test.c++                                 \
  src/capnp/serialize-async-test.c++                           \
387
  src/capnp/serialize-text-test.c++                            \
388 389 390 391 392
  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++
393
capnp_test_LDADD = libcapnpc.la libcapnp-rpc.la libcapnp.la libkj-async.la libkj-test.la libkj.la
394 395 396

endif !LITE_MODE

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

435
if !LITE_MODE
436 437
capnp_evolution_test_LDADD = libcapnpc.la libcapnp.la libkj.la
capnp_evolution_test_SOURCES = src/capnp/compiler/evolution-test.c++
438
endif !LITE_MODE
439

440 441 442
if LITE_MODE
TESTS = capnp-test
else !LITE_MODE
443
TESTS = capnp-test capnp-evolution-test src/capnp/compiler/capnp-test.sh
444
endif !LITE_MODE