blob: 6bc97f582c5244349ed8a8da50241460119d1e1b [file] [log] [blame]
Jens Geyerf4598682014-05-08 23:18:44 +02001#
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
Nobuaki Sukegawaef0a8fa2015-05-10 20:21:17 +090020BUILT_SOURCES = gopath
taozle5c302e02017-07-23 15:21:44 +020021if GOVERSION_LT_17
22COMPILER_EXTRAFLAG=",legacy_context"
23endif
Nobuaki Sukegawaef0a8fa2015-05-10 20:21:17 +090024
taozle5c302e02017-07-23 15:21:44 +020025THRIFTCMD = $(THRIFT) -out src/gen --gen go:thrift_import=thrift$(COMPILER_EXTRAFLAG)
Jens Geyerf4598682014-05-08 23:18:44 +020026THRIFTTEST = $(top_srcdir)/test/ThriftTest.thrift
27
Roger Meier41ad4342015-03-24 22:30:40 +010028precross: bin/testclient bin/testserver
Jens Geyerf4598682014-05-08 23:18:44 +020029
30ThriftTest.thrift: $(THRIFTTEST)
Jens Geyer79f988c2014-10-03 20:42:54 +020031 grep -v list.*map.*list.*map $(THRIFTTEST) > ThriftTest.thrift
Jens Geyerf4598682014-05-08 23:18:44 +020032
D. Can Celasun4f77ab82017-09-21 15:21:00 +020033.PHONY: gopath
34
Jens Geyerf4598682014-05-08 23:18:44 +020035# Thrift for GO has problems with complex map keys: THRIFT-2063
jfarrell8fd8c632014-07-10 09:14:51 -040036gopath: $(THRIFT) ThriftTest.thrift
Jens Geyer79f988c2014-10-03 20:42:54 +020037 mkdir -p src/gen
38 $(THRIFTCMD) ThriftTest.thrift
39 $(THRIFTCMD) ../StressTest.thrift
taozlec0d384a2017-07-17 18:40:42 +020040 GOPATH=`pwd` $(GO) get golang.org/x/net/context
James E. King, III0ad20bd2017-09-30 15:44:16 -070041 GOPATH=`pwd` $(GO) get github.com/golang/mock/gomock || true
42 sed -i 's/\"context\"/\"golang.org\/x\/net\/context\"/g' src/github.com/golang/mock/gomock/controller.go || true
43 GOPATH=`pwd` $(GO) get github.com/golang/mock/gomock
44 ln -nfs ../../../lib/go/thrift src/thrift
Jens Geyer79f988c2014-10-03 20:42:54 +020045 touch gopath
Jens Geyerf4598682014-05-08 23:18:44 +020046
47bin/testclient: gopath
Jens Geyer79f988c2014-10-03 20:42:54 +020048 GOPATH=`pwd` $(GO) install bin/testclient
Jens Geyerf4598682014-05-08 23:18:44 +020049
50bin/testserver: gopath
Jens Geyer79f988c2014-10-03 20:42:54 +020051 GOPATH=`pwd` $(GO) install bin/testserver
Jens Geyerf4598682014-05-08 23:18:44 +020052
53bin/stress: gopath
Jens Geyer79f988c2014-10-03 20:42:54 +020054 GOPATH=`pwd` $(GO) install bin/stress
Jens Geyerf4598682014-05-08 23:18:44 +020055
56clean-local:
Jens Geyer8b470022015-06-19 21:22:57 +020057 $(RM) -r src/gen src/github.com/golang src/thrift bin pkg gopath ThriftTest.thrift
Jens Geyerf4598682014-05-08 23:18:44 +020058
Roger Meier41ad4342015-03-24 22:30:40 +010059check_PROGRAMS: bin/testclient bin/testserver bin/stress
60
taozle5c302e02017-07-23 15:21:44 +020061check: gopath genmock
Jens Geyer79f988c2014-10-03 20:42:54 +020062 GOPATH=`pwd` $(GO) test -v common/...
Jens Geyerf4598682014-05-08 23:18:44 +020063
64genmock: gopath
Jens Geyer8b470022015-06-19 21:22:57 +020065 GOPATH=`pwd` $(GO) install github.com/golang/mock/mockgen
Jens Geyer79f988c2014-10-03 20:42:54 +020066 GOPATH=`pwd` bin/mockgen -destination=src/common/mock_handler.go -package=common gen/thrifttest ThriftTest
Jens Geyerf4598682014-05-08 23:18:44 +020067
jfarrell8fd8c632014-07-10 09:14:51 -040068EXTRA_DIST = \
Jens Geyer79f988c2014-10-03 20:42:54 +020069 src/bin \
70 src/common