Jake Farrell | b95b0ff | 2012-03-22 21:49:10 +0000 | [diff] [blame] | 1 | # |
| 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 | |
jfarrell | 8fd8c63 | 2014-07-10 09:14:51 -0400 | [diff] [blame] | 20 | AUTOMAKE_OPTIONS = serial-tests |
| 21 | |
| 22 | SUBDIRS = . |
| 23 | |
| 24 | if WITH_TESTS |
| 25 | SUBDIRS += test |
| 26 | endif |
Jake Farrell | b95b0ff | 2012-03-22 21:49:10 +0000 | [diff] [blame] | 27 | |
| 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 | # |
| 35 | d_thriftmodules = $(addprefix thrift/, base) |
| 36 | d_thriftdir = $(D_IMPORT_PREFIX)/thrift |
| 37 | d_thrift_DATA = $(addprefix src/, $(addsuffix .d, $(d_thriftmodules))) |
| 38 | |
| 39 | d_asyncmodules = $(addprefix thrift/async/, base libevent socket ssl) |
| 40 | d_asyncdir = $(d_thriftdir)/async |
| 41 | d_async_DATA = $(addprefix src/, $(addsuffix .d, $(d_asyncmodules))) |
| 42 | |
| 43 | d_codegenmodules = $(addprefix thrift/codegen/, async_client \ |
Jens Geyer | 79f988c | 2014-10-03 20:42:54 +0200 | [diff] [blame^] | 44 | async_client_pool base client client_pool idlgen processor) |
Jake Farrell | b95b0ff | 2012-03-22 21:49:10 +0000 | [diff] [blame] | 45 | d_codegendir = $(d_thriftdir)/codegen |
| 46 | d_codegen_DATA = $(addprefix src/, $(addsuffix .d, $(d_codegenmodules))) |
| 47 | |
| 48 | d_protocolmodules = $(addprefix thrift/protocol/, base binary compact json \ |
Jens Geyer | 79f988c | 2014-10-03 20:42:54 +0200 | [diff] [blame^] | 49 | processor) |
Jake Farrell | b95b0ff | 2012-03-22 21:49:10 +0000 | [diff] [blame] | 50 | d_protocoldir = $(d_thriftdir)/protocol |
| 51 | d_protocol_DATA = $(addprefix src/, $(addsuffix .d, $(d_protocolmodules))) |
| 52 | |
| 53 | d_servermodules = $(addprefix thrift/server/, base simple nonblocking \ |
Jens Geyer | 79f988c | 2014-10-03 20:42:54 +0200 | [diff] [blame^] | 54 | taskpool threaded) |
Jake Farrell | b95b0ff | 2012-03-22 21:49:10 +0000 | [diff] [blame] | 55 | d_serverdir = $(d_thriftdir)/server |
| 56 | d_server_DATA = $(addprefix src/, $(addsuffix .d, $(d_servermodules))) |
| 57 | |
| 58 | d_servertransportmodules = $(addprefix thrift/server/transport/, base socket ssl) |
| 59 | d_servertransportdir = $(d_thriftdir)/server/transport |
| 60 | d_servertransport_DATA = $(addprefix src/, $(addsuffix .d, \ |
Jens Geyer | 79f988c | 2014-10-03 20:42:54 +0200 | [diff] [blame^] | 61 | $(d_servertransportmodules))) |
Jake Farrell | b95b0ff | 2012-03-22 21:49:10 +0000 | [diff] [blame] | 62 | |
| 63 | d_transportmodules = $(addprefix thrift/transport/, base buffered file \ |
Jens Geyer | 79f988c | 2014-10-03 20:42:54 +0200 | [diff] [blame^] | 64 | framed http memory piped range socket ssl zlib) |
Jake Farrell | b95b0ff | 2012-03-22 21:49:10 +0000 | [diff] [blame] | 65 | d_transportdir = $(d_thriftdir)/transport |
| 66 | d_transport_DATA = $(addprefix src/, $(addsuffix .d, $(d_transportmodules))) |
| 67 | |
| 68 | d_utilmodules = $(addprefix thrift/util/, awaitable cancellation future \ |
Jens Geyer | 79f988c | 2014-10-03 20:42:54 +0200 | [diff] [blame^] | 69 | hashset) |
Jake Farrell | b95b0ff | 2012-03-22 21:49:10 +0000 | [diff] [blame] | 70 | d_utildir = $(d_thriftdir)/util |
| 71 | d_util_DATA = $(addprefix src/, $(addsuffix .d, $(d_utilmodules))) |
| 72 | |
| 73 | d_internalmodules = $(addprefix thrift/internal/, algorithm codegen ctfe \ |
Jens Geyer | 79f988c | 2014-10-03 20:42:54 +0200 | [diff] [blame^] | 74 | endian resource_pool socket ssl ssl_bio traits) |
Jake Farrell | b95b0ff | 2012-03-22 21:49:10 +0000 | [diff] [blame] | 75 | d_internaldir = $(d_thriftdir)/internal |
| 76 | d_internal_DATA = $(addprefix src/, $(addsuffix .d, $(d_internalmodules))) |
| 77 | |
| 78 | d_testmodules = $(addprefix thrift/internal/test/, protocol server) |
| 79 | d_testdir = $(d_internaldir)/test |
| 80 | d_test_DATA = $(addprefix src/, $(addsuffix .d, $(d_testmodules))) |
| 81 | |
| 82 | d_publicmodules = $(d_thriftmodules) $(d_asyncmodules) \ |
Jens Geyer | 79f988c | 2014-10-03 20:42:54 +0200 | [diff] [blame^] | 83 | $(d_codegenmodules) $(d_protocolmodules) $(d_servermodules) \ |
| 84 | $(d_servertransportmodules) $(d_transportmodules) $(d_utilmodules) |
Jake Farrell | b95b0ff | 2012-03-22 21:49:10 +0000 | [diff] [blame] | 85 | d_publicsources = $(addprefix src/, $(addsuffix .d, $(d_publicmodules))) |
| 86 | |
| 87 | d_modules = $(d_publicmodules) $(d_internalmodules) $(d_testmodules) |
| 88 | |
| 89 | # List modules with external dependencies and remove them from the main list |
| 90 | d_libevent_dependent_modules = thrift/async/libevent thrift/server/nonblocking |
| 91 | d_openssl_dependent_modules = thrift/async/ssl thrift/internal/ssl \ |
Jens Geyer | 79f988c | 2014-10-03 20:42:54 +0200 | [diff] [blame^] | 92 | thrift/internal/ssl_bio thrift/transport/ssl thrift/server/transport/ssl |
Jake Farrell | b95b0ff | 2012-03-22 21:49:10 +0000 | [diff] [blame] | 93 | d_main_modules = $(filter-out $(d_libevent_dependent_modules) \ |
Jens Geyer | 79f988c | 2014-10-03 20:42:54 +0200 | [diff] [blame^] | 94 | $(d_openssl_dependent_modules),$(d_modules)) |
Jake Farrell | b95b0ff | 2012-03-22 21:49:10 +0000 | [diff] [blame] | 95 | |
| 96 | |
| 97 | d_lib_flags = -w -wi -Isrc -lib |
| 98 | all_targets = |
| 99 | |
| 100 | # |
| 101 | # libevent-dependent modules. |
| 102 | # |
| 103 | if HAVE_DEIMOS_EVENT2 |
| 104 | $(D_EVENT_LIB_NAME): $(addprefix src/, $(addsuffix .d, $(d_libevent_dependent_modules))) |
Jens Geyer | 79f988c | 2014-10-03 20:42:54 +0200 | [diff] [blame^] | 105 | $(DMD) -of$(D_EVENT_LIB_NAME) $(d_lib_flags) $^ |
Jake Farrell | b95b0ff | 2012-03-22 21:49:10 +0000 | [diff] [blame] | 106 | all_targets += $(D_EVENT_LIB_NAME) |
| 107 | endif |
| 108 | |
| 109 | # |
| 110 | # OpenSSL-dependent modules. |
| 111 | # |
| 112 | if HAVE_DEIMOS_OPENSSL |
| 113 | $(D_SSL_LIB_NAME): $(addprefix src/, $(addsuffix .d, $(d_openssl_dependent_modules))) |
Jens Geyer | 79f988c | 2014-10-03 20:42:54 +0200 | [diff] [blame^] | 114 | $(DMD) -of$(D_SSL_LIB_NAME) $(d_lib_flags) $^ |
Jake Farrell | b95b0ff | 2012-03-22 21:49:10 +0000 | [diff] [blame] | 115 | all_targets += $(D_SSL_LIB_NAME) |
| 116 | endif |
| 117 | |
| 118 | # |
| 119 | # Main library target. |
| 120 | # |
| 121 | $(D_LIB_NAME): $(addprefix src/, $(addsuffix .d, $(d_main_modules))) |
Jens Geyer | 79f988c | 2014-10-03 20:42:54 +0200 | [diff] [blame^] | 122 | $(DMD) -of$(D_LIB_NAME) $(d_lib_flags) $^ |
Jake Farrell | b95b0ff | 2012-03-22 21:49:10 +0000 | [diff] [blame] | 123 | all_targets += $(D_LIB_NAME) |
| 124 | |
| 125 | |
| 126 | # |
| 127 | # Documentation target (requires Dil). |
| 128 | # |
| 129 | docs: $(d_publicsources) src/thrift/index.d |
Jens Geyer | 79f988c | 2014-10-03 20:42:54 +0200 | [diff] [blame^] | 130 | dil ddoc docs -hl --kandil $^ |
Jake Farrell | b95b0ff | 2012-03-22 21:49:10 +0000 | [diff] [blame] | 131 | |
| 132 | |
| 133 | # |
| 134 | # Hook custom library targets into the automake all/install targets. |
| 135 | # |
| 136 | all-local: $(all_targets) |
| 137 | |
| 138 | install-exec-local: |
Jens Geyer | 79f988c | 2014-10-03 20:42:54 +0200 | [diff] [blame^] | 139 | $(INSTALL_PROGRAM) $(all_targets) $(DESTDIR)$(libdir) |
Jake Farrell | b95b0ff | 2012-03-22 21:49:10 +0000 | [diff] [blame] | 140 | |
| 141 | |
| 142 | clean-local: |
Jens Geyer | 79f988c | 2014-10-03 20:42:54 +0200 | [diff] [blame^] | 143 | $(RM) -rf docs $(D_LIB_NAME) $(D_EVENT_LIB_NAME) $(D_SSL_LIB_NAME) unittest |
Jake Farrell | b95b0ff | 2012-03-22 21:49:10 +0000 | [diff] [blame] | 144 | |
| 145 | |
| 146 | # |
| 147 | # Unit tests (built both in debug and release mode). |
| 148 | # |
| 149 | d_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... |
| 153 | d_test_modules__ = $(d_modules) |
| 154 | |
| 155 | if WITH_D_EVENT_TESTS |
| 156 | d_test_flags += $(DMD_LIBEVENT_FLAGS) |
| 157 | d_test_modules_ = $(d_test_modules__) |
| 158 | else |
| 159 | d_test_modules_ = $(filter-out $(d_libevent_dependent_modules), $(d_test_modules__)) |
| 160 | endif |
| 161 | |
| 162 | if WITH_D_SSL_TESTS |
| 163 | d_test_flags += $(DMD_OPENSSL_FLAGS) |
| 164 | d_test_modules = $(d_test_modules_) |
| 165 | else |
| 166 | d_test_modules = $(filter-out $(d_openssl_dependent_modules), $(d_test_modules_)) |
| 167 | endif |
| 168 | |
| 169 | unittest/emptymain.d: unittest/.directory |
Jens Geyer | 79f988c | 2014-10-03 20:42:54 +0200 | [diff] [blame^] | 170 | @echo 'void main(){}' >$@ |
Jake Farrell | b95b0ff | 2012-03-22 21:49:10 +0000 | [diff] [blame] | 171 | |
| 172 | unittest/.directory: |
Jens Geyer | 79f988c | 2014-10-03 20:42:54 +0200 | [diff] [blame^] | 173 | mkdir -p unittest || exists unittest |
| 174 | touch $@ |
Jake Farrell | b95b0ff | 2012-03-22 21:49:10 +0000 | [diff] [blame] | 175 | |
| 176 | unittest/debug/%: src/%.d $(all_targets) unittest/emptymain.d |
Jens Geyer | 79f988c | 2014-10-03 20:42:54 +0200 | [diff] [blame^] | 177 | $(DMD) -gc -of$(subst /,$(DMD_OF_DIRSEP),$@) $(d_test_flags) $^ |
Jake Farrell | b95b0ff | 2012-03-22 21:49:10 +0000 | [diff] [blame] | 178 | |
| 179 | unittest/release/%: src/%.d $(all_targets) unittest/emptymain.d |
Jens Geyer | 79f988c | 2014-10-03 20:42:54 +0200 | [diff] [blame^] | 180 | $(DMD) -O -release -of$(subst /,$(DMD_OF_DIRSEP),$@) $(d_test_flags) $^ |
Jake Farrell | b95b0ff | 2012-03-22 21:49:10 +0000 | [diff] [blame] | 181 | |
| 182 | TESTS = $(addprefix unittest/debug/, $(d_test_modules)) \ |
Jens Geyer | 79f988c | 2014-10-03 20:42:54 +0200 | [diff] [blame^] | 183 | $(addprefix unittest/release/, $(d_test_modules)) |
Jake Farrell | b95b0ff | 2012-03-22 21:49:10 +0000 | [diff] [blame] | 184 | |
| 185 | |
| 186 | EXTRA_DIST = \ |
Jens Geyer | 79f988c | 2014-10-03 20:42:54 +0200 | [diff] [blame^] | 187 | src \ |
| 188 | test \ |
| 189 | README.md |