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 | |
| 20 | SUBDIRS = . 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 | # |
| 29 | d_thriftmodules = $(addprefix thrift/, base) |
| 30 | d_thriftdir = $(D_IMPORT_PREFIX)/thrift |
| 31 | d_thrift_DATA = $(addprefix src/, $(addsuffix .d, $(d_thriftmodules))) |
| 32 | |
| 33 | d_asyncmodules = $(addprefix thrift/async/, base libevent socket ssl) |
| 34 | d_asyncdir = $(d_thriftdir)/async |
| 35 | d_async_DATA = $(addprefix src/, $(addsuffix .d, $(d_asyncmodules))) |
| 36 | |
| 37 | d_codegenmodules = $(addprefix thrift/codegen/, async_client \ |
| 38 | async_client_pool base client client_pool idlgen processor) |
| 39 | d_codegendir = $(d_thriftdir)/codegen |
| 40 | d_codegen_DATA = $(addprefix src/, $(addsuffix .d, $(d_codegenmodules))) |
| 41 | |
| 42 | d_protocolmodules = $(addprefix thrift/protocol/, base binary compact json \ |
| 43 | processor) |
| 44 | d_protocoldir = $(d_thriftdir)/protocol |
| 45 | d_protocol_DATA = $(addprefix src/, $(addsuffix .d, $(d_protocolmodules))) |
| 46 | |
| 47 | d_servermodules = $(addprefix thrift/server/, base simple nonblocking \ |
| 48 | taskpool threaded) |
| 49 | d_serverdir = $(d_thriftdir)/server |
| 50 | d_server_DATA = $(addprefix src/, $(addsuffix .d, $(d_servermodules))) |
| 51 | |
| 52 | d_servertransportmodules = $(addprefix thrift/server/transport/, base socket ssl) |
| 53 | d_servertransportdir = $(d_thriftdir)/server/transport |
| 54 | d_servertransport_DATA = $(addprefix src/, $(addsuffix .d, \ |
| 55 | $(d_servertransportmodules))) |
| 56 | |
| 57 | d_transportmodules = $(addprefix thrift/transport/, base buffered file \ |
| 58 | framed http memory piped range socket ssl zlib) |
| 59 | d_transportdir = $(d_thriftdir)/transport |
| 60 | d_transport_DATA = $(addprefix src/, $(addsuffix .d, $(d_transportmodules))) |
| 61 | |
| 62 | d_utilmodules = $(addprefix thrift/util/, awaitable cancellation future \ |
| 63 | hashset) |
| 64 | d_utildir = $(d_thriftdir)/util |
| 65 | d_util_DATA = $(addprefix src/, $(addsuffix .d, $(d_utilmodules))) |
| 66 | |
| 67 | d_internalmodules = $(addprefix thrift/internal/, algorithm codegen ctfe \ |
| 68 | endian resource_pool socket ssl ssl_bio traits) |
| 69 | d_internaldir = $(d_thriftdir)/internal |
| 70 | d_internal_DATA = $(addprefix src/, $(addsuffix .d, $(d_internalmodules))) |
| 71 | |
| 72 | d_testmodules = $(addprefix thrift/internal/test/, protocol server) |
| 73 | d_testdir = $(d_internaldir)/test |
| 74 | d_test_DATA = $(addprefix src/, $(addsuffix .d, $(d_testmodules))) |
| 75 | |
| 76 | d_publicmodules = $(d_thriftmodules) $(d_asyncmodules) \ |
| 77 | $(d_codegenmodules) $(d_protocolmodules) $(d_servermodules) \ |
| 78 | $(d_servertransportmodules) $(d_transportmodules) $(d_utilmodules) |
| 79 | d_publicsources = $(addprefix src/, $(addsuffix .d, $(d_publicmodules))) |
| 80 | |
| 81 | d_modules = $(d_publicmodules) $(d_internalmodules) $(d_testmodules) |
| 82 | |
| 83 | # List modules with external dependencies and remove them from the main list |
| 84 | d_libevent_dependent_modules = thrift/async/libevent thrift/server/nonblocking |
| 85 | d_openssl_dependent_modules = thrift/async/ssl thrift/internal/ssl \ |
| 86 | thrift/internal/ssl_bio thrift/transport/ssl thrift/server/transport/ssl |
| 87 | d_main_modules = $(filter-out $(d_libevent_dependent_modules) \ |
| 88 | $(d_openssl_dependent_modules),$(d_modules)) |
| 89 | |
| 90 | |
| 91 | d_lib_flags = -w -wi -Isrc -lib |
| 92 | all_targets = |
| 93 | |
| 94 | # |
| 95 | # libevent-dependent modules. |
| 96 | # |
| 97 | if 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) $^ |
| 100 | all_targets += $(D_EVENT_LIB_NAME) |
| 101 | endif |
| 102 | |
| 103 | # |
| 104 | # OpenSSL-dependent modules. |
| 105 | # |
| 106 | if 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) $^ |
| 109 | all_targets += $(D_SSL_LIB_NAME) |
| 110 | endif |
| 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) $^ |
| 117 | all_targets += $(D_LIB_NAME) |
| 118 | |
| 119 | |
| 120 | # |
| 121 | # Documentation target (requires Dil). |
| 122 | # |
| 123 | docs: $(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 | # |
| 130 | all-local: $(all_targets) |
| 131 | |
| 132 | install-exec-local: |
| 133 | $(INSTALL_PROGRAM) $(all_targets) $(DESTDIR)$(libdir) |
| 134 | |
| 135 | |
| 136 | clean-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 | # |
| 143 | d_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... |
| 147 | d_test_modules__ = $(d_modules) |
| 148 | |
| 149 | if WITH_D_EVENT_TESTS |
| 150 | d_test_flags += $(DMD_LIBEVENT_FLAGS) |
| 151 | d_test_modules_ = $(d_test_modules__) |
| 152 | else |
| 153 | d_test_modules_ = $(filter-out $(d_libevent_dependent_modules), $(d_test_modules__)) |
| 154 | endif |
| 155 | |
| 156 | if WITH_D_SSL_TESTS |
| 157 | d_test_flags += $(DMD_OPENSSL_FLAGS) |
| 158 | d_test_modules = $(d_test_modules_) |
| 159 | else |
| 160 | d_test_modules = $(filter-out $(d_openssl_dependent_modules), $(d_test_modules_)) |
| 161 | endif |
| 162 | |
| 163 | unittest/emptymain.d: unittest/.directory |
| 164 | @echo 'void main(){}' >$@ |
| 165 | |
| 166 | unittest/.directory: |
| 167 | mkdir -p unittest || exists unittest |
| 168 | touch $@ |
| 169 | |
| 170 | unittest/debug/%: src/%.d $(all_targets) unittest/emptymain.d |
| 171 | $(DMD) -gc -of$(subst /,$(DMD_OF_DIRSEP),$@) $(d_test_flags) $^ |
| 172 | |
| 173 | unittest/release/%: src/%.d $(all_targets) unittest/emptymain.d |
| 174 | $(DMD) -O -release -of$(subst /,$(DMD_OF_DIRSEP),$@) $(d_test_flags) $^ |
| 175 | |
| 176 | TESTS = $(addprefix unittest/debug/, $(d_test_modules)) \ |
| 177 | $(addprefix unittest/release/, $(d_test_modules)) |
| 178 | |
| 179 | |
| 180 | EXTRA_DIST = \ |
Jake Farrell | 7c7a5e0 | 2012-10-11 00:29:11 +0000 | [diff] [blame] | 181 | src \ |
Roger Meier | 4268dad | 2012-10-22 19:52:40 +0000 | [diff] [blame^] | 182 | test \ |
Jake Farrell | b95b0ff | 2012-03-22 21:49:10 +0000 | [diff] [blame] | 183 | README |