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
20LIB_D_DIR = $(top_srcdir)/lib/d
21
22GEN_SRC = gen-d/share/SharedService.d gen-d/share/shared_types.d \
23	gen-d/tutorial/tutorial_types.d gen-d/tutorial/Calculator.d
24
25$(GEN_SRC): $(top_srcdir)/tutorial/tutorial.thrift
26	$(top_builddir)/compiler/cpp/thrift --gen d -r $<
27
28server: server.d $(GEN_SRC)
29	$(DMD) -I${LIB_D_DIR}/src -L-L${LIB_D_DIR} -L-lthriftd server.d ${GEN_SRC}
30
31client: client.d $(GEN_SRC)
32	$(DMD) -I${LIB_D_DIR}/src -L-L${LIB_D_DIR} -L-lthriftd client.d ${GEN_SRC}
33
34PROGS = server client
35
36if WITH_D_EVENT_TESTS
37async_client: async_client.d $(GEN_SRC)
38	$(DMD) -I${LIB_D_DIR}/src -L-L${LIB_D_DIR} -L-lthriftd-event -L-lthriftd -L-levent async_client.d ${GEN_SRC}
39
40PROGS += async_client
41endif
42
43all-local: $(PROGS)
44
45clean:
46	$(RM) -f $(PROGS)
47	$(RM) -r gen-d/
48	find . -type f -name '*.o' | xargs rm -f
49
50dist-hook:
51	$(RM) -f $(distdir)/$(PROGS)
52	$(RM) -r $(distdir)/gen-d/
53	find $(destdir) -type f -name '*.o' | xargs rm -f
54