blob: 759677aefe169dd809998c5f9bbf2d4b2315064a [file] [log] [blame]
Jake Farrellb95b0ff2012-03-22 21:49:10 +00001#
2# Licensed to the Apache Software Foundation (ASF) under one
3# or more contributor license agreements. See the NOTICE file
4# distributed with this work for additional information
5# regarding copyright ownership. The ASF licenses this file
6# to you under the Apache License, Version 2.0 (the
7# "License"); you may not use this file except in compliance
8# with the License. You may obtain a copy of the License at
9#
10# http://www.apache.org/licenses/LICENSE-2.0
11#
12# Unless required by applicable law or agreed to in writing,
13# software distributed under the License is distributed on an
14# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15# KIND, either express or implied. See the License for the
16# specific language governing permissions and limitations
17# under the License.
18#
19
jfarrell8fd8c632014-07-10 09:14:51 -040020AUTOMAKE_OPTIONS = serial-tests
21
22SUBDIRS = .
23
24if WITH_TESTS
25SUBDIRS += test
26endif
Jake Farrellb95b0ff2012-03-22 21:49:10 +000027
28#
29# Enumeration of all the public and private modules.
30#
31# We unconditionally install all of them, even if libevent or OpenSSL are
32# not available, but build the respective libraries only if the Deimos headers
33# could be found.
34#
35d_thriftmodules = $(addprefix thrift/, base)
36d_thriftdir = $(D_IMPORT_PREFIX)/thrift
37d_thrift_DATA = $(addprefix src/, $(addsuffix .d, $(d_thriftmodules)))
38
39d_asyncmodules = $(addprefix thrift/async/, base libevent socket ssl)
40d_asyncdir = $(d_thriftdir)/async
41d_async_DATA = $(addprefix src/, $(addsuffix .d, $(d_asyncmodules)))
42
43d_codegenmodules = $(addprefix thrift/codegen/, async_client \
Jens Geyer79f988c2014-10-03 20:42:54 +020044 async_client_pool base client client_pool idlgen processor)
Jake Farrellb95b0ff2012-03-22 21:49:10 +000045d_codegendir = $(d_thriftdir)/codegen
46d_codegen_DATA = $(addprefix src/, $(addsuffix .d, $(d_codegenmodules)))
47
48d_protocolmodules = $(addprefix thrift/protocol/, base binary compact json \
Jens Geyer79f988c2014-10-03 20:42:54 +020049 processor)
Jake Farrellb95b0ff2012-03-22 21:49:10 +000050d_protocoldir = $(d_thriftdir)/protocol
51d_protocol_DATA = $(addprefix src/, $(addsuffix .d, $(d_protocolmodules)))
52
53d_servermodules = $(addprefix thrift/server/, base simple nonblocking \
Jens Geyer79f988c2014-10-03 20:42:54 +020054 taskpool threaded)
Jake Farrellb95b0ff2012-03-22 21:49:10 +000055d_serverdir = $(d_thriftdir)/server
56d_server_DATA = $(addprefix src/, $(addsuffix .d, $(d_servermodules)))
57
58d_servertransportmodules = $(addprefix thrift/server/transport/, base socket ssl)
59d_servertransportdir = $(d_thriftdir)/server/transport
60d_servertransport_DATA = $(addprefix src/, $(addsuffix .d, \
Jens Geyer79f988c2014-10-03 20:42:54 +020061 $(d_servertransportmodules)))
Jake Farrellb95b0ff2012-03-22 21:49:10 +000062
63d_transportmodules = $(addprefix thrift/transport/, base buffered file \
Jens Geyer79f988c2014-10-03 20:42:54 +020064 framed http memory piped range socket ssl zlib)
Jake Farrellb95b0ff2012-03-22 21:49:10 +000065d_transportdir = $(d_thriftdir)/transport
66d_transport_DATA = $(addprefix src/, $(addsuffix .d, $(d_transportmodules)))
67
68d_utilmodules = $(addprefix thrift/util/, awaitable cancellation future \
Jens Geyer79f988c2014-10-03 20:42:54 +020069 hashset)
Jake Farrellb95b0ff2012-03-22 21:49:10 +000070d_utildir = $(d_thriftdir)/util
71d_util_DATA = $(addprefix src/, $(addsuffix .d, $(d_utilmodules)))
72
73d_internalmodules = $(addprefix thrift/internal/, algorithm codegen ctfe \
Jens Geyer79f988c2014-10-03 20:42:54 +020074 endian resource_pool socket ssl ssl_bio traits)
Jake Farrellb95b0ff2012-03-22 21:49:10 +000075d_internaldir = $(d_thriftdir)/internal
76d_internal_DATA = $(addprefix src/, $(addsuffix .d, $(d_internalmodules)))
77
78d_testmodules = $(addprefix thrift/internal/test/, protocol server)
79d_testdir = $(d_internaldir)/test
80d_test_DATA = $(addprefix src/, $(addsuffix .d, $(d_testmodules)))
81
82d_publicmodules = $(d_thriftmodules) $(d_asyncmodules) \
Jens Geyer79f988c2014-10-03 20:42:54 +020083 $(d_codegenmodules) $(d_protocolmodules) $(d_servermodules) \
84 $(d_servertransportmodules) $(d_transportmodules) $(d_utilmodules)
Jake Farrellb95b0ff2012-03-22 21:49:10 +000085d_publicsources = $(addprefix src/, $(addsuffix .d, $(d_publicmodules)))
86
87d_modules = $(d_publicmodules) $(d_internalmodules) $(d_testmodules)
88
89# List modules with external dependencies and remove them from the main list
90d_libevent_dependent_modules = thrift/async/libevent thrift/server/nonblocking
91d_openssl_dependent_modules = thrift/async/ssl thrift/internal/ssl \
Jens Geyer79f988c2014-10-03 20:42:54 +020092 thrift/internal/ssl_bio thrift/transport/ssl thrift/server/transport/ssl
Jake Farrellb95b0ff2012-03-22 21:49:10 +000093d_main_modules = $(filter-out $(d_libevent_dependent_modules) \
Jens Geyer79f988c2014-10-03 20:42:54 +020094 $(d_openssl_dependent_modules),$(d_modules))
Jake Farrellb95b0ff2012-03-22 21:49:10 +000095
96
97d_lib_flags = -w -wi -Isrc -lib
98all_targets =
99
100#
101# libevent-dependent modules.
102#
103if HAVE_DEIMOS_EVENT2
104$(D_EVENT_LIB_NAME): $(addprefix src/, $(addsuffix .d, $(d_libevent_dependent_modules)))
Jens Geyer79f988c2014-10-03 20:42:54 +0200105 $(DMD) -of$(D_EVENT_LIB_NAME) $(d_lib_flags) $^
Jake Farrellb95b0ff2012-03-22 21:49:10 +0000106all_targets += $(D_EVENT_LIB_NAME)
107endif
108
109#
110# OpenSSL-dependent modules.
111#
112if HAVE_DEIMOS_OPENSSL
113$(D_SSL_LIB_NAME): $(addprefix src/, $(addsuffix .d, $(d_openssl_dependent_modules)))
Jens Geyer79f988c2014-10-03 20:42:54 +0200114 $(DMD) -of$(D_SSL_LIB_NAME) $(d_lib_flags) $^
Jake Farrellb95b0ff2012-03-22 21:49:10 +0000115all_targets += $(D_SSL_LIB_NAME)
116endif
117
118#
119# Main library target.
120#
121$(D_LIB_NAME): $(addprefix src/, $(addsuffix .d, $(d_main_modules)))
Jens Geyer79f988c2014-10-03 20:42:54 +0200122 $(DMD) -of$(D_LIB_NAME) $(d_lib_flags) $^
Jake Farrellb95b0ff2012-03-22 21:49:10 +0000123all_targets += $(D_LIB_NAME)
124
125
126#
127# Documentation target (requires Dil).
128#
129docs: $(d_publicsources) src/thrift/index.d
Jens Geyer79f988c2014-10-03 20:42:54 +0200130 dil ddoc docs -hl --kandil $^
Jake Farrellb95b0ff2012-03-22 21:49:10 +0000131
132
133#
134# Hook custom library targets into the automake all/install targets.
135#
136all-local: $(all_targets)
137
138install-exec-local:
Jens Geyer79f988c2014-10-03 20:42:54 +0200139 $(INSTALL_PROGRAM) $(all_targets) $(DESTDIR)$(libdir)
Jake Farrellb95b0ff2012-03-22 21:49:10 +0000140
141
142clean-local:
Jens Geyer79f988c2014-10-03 20:42:54 +0200143 $(RM) -rf docs $(D_LIB_NAME) $(D_EVENT_LIB_NAME) $(D_SSL_LIB_NAME) unittest
Jake Farrellb95b0ff2012-03-22 21:49:10 +0000144
145
146#
147# Unit tests (built both in debug and release mode).
148#
149d_test_flags = -unittest -w -wi -I$(top_srcdir)/lib/d/src
150
151# There just must be some way to reassign a variable without warnings in
152# Automake...
153d_test_modules__ = $(d_modules)
154
155if WITH_D_EVENT_TESTS
156d_test_flags += $(DMD_LIBEVENT_FLAGS)
157d_test_modules_ = $(d_test_modules__)
158else
159d_test_modules_ = $(filter-out $(d_libevent_dependent_modules), $(d_test_modules__))
160endif
161
162if WITH_D_SSL_TESTS
163d_test_flags += $(DMD_OPENSSL_FLAGS)
164d_test_modules = $(d_test_modules_)
165else
166d_test_modules = $(filter-out $(d_openssl_dependent_modules), $(d_test_modules_))
167endif
168
169unittest/emptymain.d: unittest/.directory
Jens Geyer79f988c2014-10-03 20:42:54 +0200170 @echo 'void main(){}' >$@
Jake Farrellb95b0ff2012-03-22 21:49:10 +0000171
172unittest/.directory:
Jens Geyer79f988c2014-10-03 20:42:54 +0200173 mkdir -p unittest || exists unittest
174 touch $@
Jake Farrellb95b0ff2012-03-22 21:49:10 +0000175
176unittest/debug/%: src/%.d $(all_targets) unittest/emptymain.d
Jens Geyer79f988c2014-10-03 20:42:54 +0200177 $(DMD) -gc -of$(subst /,$(DMD_OF_DIRSEP),$@) $(d_test_flags) $^
Jake Farrellb95b0ff2012-03-22 21:49:10 +0000178
179unittest/release/%: src/%.d $(all_targets) unittest/emptymain.d
Jens Geyer79f988c2014-10-03 20:42:54 +0200180 $(DMD) -O -release -of$(subst /,$(DMD_OF_DIRSEP),$@) $(d_test_flags) $^
Jake Farrellb95b0ff2012-03-22 21:49:10 +0000181
182TESTS = $(addprefix unittest/debug/, $(d_test_modules)) \
Jens Geyer79f988c2014-10-03 20:42:54 +0200183 $(addprefix unittest/release/, $(d_test_modules))
Jake Farrellb95b0ff2012-03-22 21:49:10 +0000184
185
186EXTRA_DIST = \
Jens Geyer79f988c2014-10-03 20:42:54 +0200187 src \
188 test \
189 README.md