blob: 04c06393f6acdbb310b1cf6070e3f0c390263887 [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
20SUBDIRS = . test
21
22#
23# Enumeration of all the public and private modules.
24#
25# We unconditionally install all of them, even if libevent or OpenSSL are
26# not available, but build the respective libraries only if the Deimos headers
27# could be found.
28#
29d_thriftmodules = $(addprefix thrift/, base)
30d_thriftdir = $(D_IMPORT_PREFIX)/thrift
31d_thrift_DATA = $(addprefix src/, $(addsuffix .d, $(d_thriftmodules)))
32
33d_asyncmodules = $(addprefix thrift/async/, base libevent socket ssl)
34d_asyncdir = $(d_thriftdir)/async
35d_async_DATA = $(addprefix src/, $(addsuffix .d, $(d_asyncmodules)))
36
37d_codegenmodules = $(addprefix thrift/codegen/, async_client \
38 async_client_pool base client client_pool idlgen processor)
39d_codegendir = $(d_thriftdir)/codegen
40d_codegen_DATA = $(addprefix src/, $(addsuffix .d, $(d_codegenmodules)))
41
42d_protocolmodules = $(addprefix thrift/protocol/, base binary compact json \
43 processor)
44d_protocoldir = $(d_thriftdir)/protocol
45d_protocol_DATA = $(addprefix src/, $(addsuffix .d, $(d_protocolmodules)))
46
47d_servermodules = $(addprefix thrift/server/, base simple nonblocking \
48 taskpool threaded)
49d_serverdir = $(d_thriftdir)/server
50d_server_DATA = $(addprefix src/, $(addsuffix .d, $(d_servermodules)))
51
52d_servertransportmodules = $(addprefix thrift/server/transport/, base socket ssl)
53d_servertransportdir = $(d_thriftdir)/server/transport
54d_servertransport_DATA = $(addprefix src/, $(addsuffix .d, \
55 $(d_servertransportmodules)))
56
57d_transportmodules = $(addprefix thrift/transport/, base buffered file \
58 framed http memory piped range socket ssl zlib)
59d_transportdir = $(d_thriftdir)/transport
60d_transport_DATA = $(addprefix src/, $(addsuffix .d, $(d_transportmodules)))
61
62d_utilmodules = $(addprefix thrift/util/, awaitable cancellation future \
63 hashset)
64d_utildir = $(d_thriftdir)/util
65d_util_DATA = $(addprefix src/, $(addsuffix .d, $(d_utilmodules)))
66
67d_internalmodules = $(addprefix thrift/internal/, algorithm codegen ctfe \
68 endian resource_pool socket ssl ssl_bio traits)
69d_internaldir = $(d_thriftdir)/internal
70d_internal_DATA = $(addprefix src/, $(addsuffix .d, $(d_internalmodules)))
71
72d_testmodules = $(addprefix thrift/internal/test/, protocol server)
73d_testdir = $(d_internaldir)/test
74d_test_DATA = $(addprefix src/, $(addsuffix .d, $(d_testmodules)))
75
76d_publicmodules = $(d_thriftmodules) $(d_asyncmodules) \
77 $(d_codegenmodules) $(d_protocolmodules) $(d_servermodules) \
78 $(d_servertransportmodules) $(d_transportmodules) $(d_utilmodules)
79d_publicsources = $(addprefix src/, $(addsuffix .d, $(d_publicmodules)))
80
81d_modules = $(d_publicmodules) $(d_internalmodules) $(d_testmodules)
82
83# List modules with external dependencies and remove them from the main list
84d_libevent_dependent_modules = thrift/async/libevent thrift/server/nonblocking
85d_openssl_dependent_modules = thrift/async/ssl thrift/internal/ssl \
86 thrift/internal/ssl_bio thrift/transport/ssl thrift/server/transport/ssl
87d_main_modules = $(filter-out $(d_libevent_dependent_modules) \
88 $(d_openssl_dependent_modules),$(d_modules))
89
90
91d_lib_flags = -w -wi -Isrc -lib
92all_targets =
93
94#
95# libevent-dependent modules.
96#
97if HAVE_DEIMOS_EVENT2
98$(D_EVENT_LIB_NAME): $(addprefix src/, $(addsuffix .d, $(d_libevent_dependent_modules)))
99 $(DMD) -of$(D_EVENT_LIB_NAME) $(d_lib_flags) $^
100all_targets += $(D_EVENT_LIB_NAME)
101endif
102
103#
104# OpenSSL-dependent modules.
105#
106if HAVE_DEIMOS_OPENSSL
107$(D_SSL_LIB_NAME): $(addprefix src/, $(addsuffix .d, $(d_openssl_dependent_modules)))
108 $(DMD) -of$(D_SSL_LIB_NAME) $(d_lib_flags) $^
109all_targets += $(D_SSL_LIB_NAME)
110endif
111
112#
113# Main library target.
114#
115$(D_LIB_NAME): $(addprefix src/, $(addsuffix .d, $(d_main_modules)))
116 $(DMD) -of$(D_LIB_NAME) $(d_lib_flags) $^
117all_targets += $(D_LIB_NAME)
118
119
120#
121# Documentation target (requires Dil).
122#
123docs: $(d_publicsources) src/thrift/index.d
124 dil ddoc docs -hl --kandil $^
125
126
127#
128# Hook custom library targets into the automake all/install targets.
129#
130all-local: $(all_targets)
131
132install-exec-local:
133 $(INSTALL_PROGRAM) $(all_targets) $(DESTDIR)$(libdir)
134
135
136clean-local:
137 $(RM) -rf docs $(D_LIB_NAME) $(D_EVENT_LIB_NAME) $(D_SSL_LIB_NAME) unittest
138
139
140#
141# Unit tests (built both in debug and release mode).
142#
143d_test_flags = -unittest -w -wi -I$(top_srcdir)/lib/d/src
144
145# There just must be some way to reassign a variable without warnings in
146# Automake...
147d_test_modules__ = $(d_modules)
148
149if WITH_D_EVENT_TESTS
150d_test_flags += $(DMD_LIBEVENT_FLAGS)
151d_test_modules_ = $(d_test_modules__)
152else
153d_test_modules_ = $(filter-out $(d_libevent_dependent_modules), $(d_test_modules__))
154endif
155
156if WITH_D_SSL_TESTS
157d_test_flags += $(DMD_OPENSSL_FLAGS)
158d_test_modules = $(d_test_modules_)
159else
160d_test_modules = $(filter-out $(d_openssl_dependent_modules), $(d_test_modules_))
161endif
162
163unittest/emptymain.d: unittest/.directory
164 @echo 'void main(){}' >$@
165
166unittest/.directory:
167 mkdir -p unittest || exists unittest
168 touch $@
169
170unittest/debug/%: src/%.d $(all_targets) unittest/emptymain.d
171 $(DMD) -gc -of$(subst /,$(DMD_OF_DIRSEP),$@) $(d_test_flags) $^
172
173unittest/release/%: src/%.d $(all_targets) unittest/emptymain.d
174 $(DMD) -O -release -of$(subst /,$(DMD_OF_DIRSEP),$@) $(d_test_flags) $^
175
176TESTS = $(addprefix unittest/debug/, $(d_test_modules)) \
177 $(addprefix unittest/release/, $(d_test_modules))
178
179
180EXTRA_DIST = \
Jake Farrell7c7a5e02012-10-11 00:29:11 +0000181 src \
Roger Meier4268dad2012-10-22 19:52:40 +0000182 test \
Roger Meier16fcad02014-03-16 21:12:11 +0100183 README.md