1.DEFAULT_GOAL	:= build
2
3#------------------------------------------------------------------------------
4# Variables
5#------------------------------------------------------------------------------
6
7SHELL 	:= /bin/bash
8BINDIR	:= bin
9PKG 		:= github.com/envoyproxy/go-control-plane
10
11.PHONY: build
12build:
13	@go build ./pkg/... ./envoy/...
14
15# TODO(mattklein123): See the note in TestLinearConcurrentSetWatch() for why we set -parallel here
16# This should be removed.
17.PHONY: test
18test:
19	@go test -race -v -timeout 30s -parallel 100 ./pkg/...
20
21.PHONY: cover
22cover:
23	@build/coverage.sh
24
25.PHONY: format
26format:
27	@goimports -local $(PKG) -w -l pkg
28
29.PHONY: examples
30examples:
31	@pushd examples/dyplomat && go build ./... && popd
32
33#-----------------
34#-- integration
35#-----------------
36.PHONY: $(BINDIR)/test $(BINDIR)/upstream integration integration.ads integration.xds integration.rest integration.xds.mux
37
38$(BINDIR)/upstream:
39	@go build -race -o $@ internal/upstream/main.go
40
41$(BINDIR)/test:
42	@go build -race -o $@ pkg/test/main/main.go
43
44integration: integration.xds integration.ads integration.rest integration.xds.mux
45
46integration.ads: $(BINDIR)/test $(BINDIR)/upstream
47	env XDS=ads build/integration.sh
48
49integration.xds: $(BINDIR)/test $(BINDIR)/upstream
50	env XDS=xds build/integration.sh
51
52integration.rest: $(BINDIR)/test $(BINDIR)/upstream
53	env XDS=rest build/integration.sh
54
55integration.xds.mux: $(BINDIR)/test $(BINDIR)/upstream
56	env XDS=xds build/integration.sh -mux
57
58#--------------------------------------
59#-- example xDS control plane server
60#--------------------------------------
61.PHONY: $(BINDIR)/example example
62
63$(BINDIR)/example:
64	@go build -race -o $@ internal/example/main/main.go
65
66example: $(BINDIR)/example
67	@build/example.sh
68
69.PHONY: docker_tests
70docker_tests:
71	docker build --pull -f Dockerfile.ci . -t gcp_ci && \
72	docker run -v $$(pwd):/go-control-plane $$(tty -s && echo "-it" || echo) gcp_ci /bin/bash -c /go-control-plane/build/do_ci.sh
73