forked from aspenmesh/istio-client-go
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
53 lines (41 loc) · 1.48 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
PACKAGE := github.com/michaelkipper/istio-client-go
ifeq ($(BRANCH_NAME)$(BUILD_ID),)
BUILDER_TAG := istio-client-go-builder
else
BUILDER_TAG := localhost:5000/istio-client-go:${BRANCH_NAME}-${BUILD_ID}
endif
# pkg/apis is the location for CRD APIs.
# pkg/client is auto generated code
# zz_generated.deepcopy.go under pkg/apis/<group>/<version>/ is also generated
# code
DIRS := pkg/apis/networking pkg/apis/networking/v1alpha3 pkg/apis/authentication pkg/apis/authentication/v1alpha1
DEPS_ALL := $(foreach dir, $(DIRS), $(wildcard $(dir)/*.go))
GENERATED_FILES_PATTERN := %zz_generated.deepcopy.go
DEPS := $(filter-out $(GENERATED_FILES_PATTERN), $(DEPS_ALL))
GENERATED_FILES := $(filter $(GENERATED_FILES_PATTERN), $(DEPS_ALL))
BOILERPLATE := aspenmesh-boilerplate.go.txt
GROUP_VERSIONS := "networking:v1alpha3, authentication:v1alpha1"
all: generate-code test
generate-code: dev-setup
./vendor/k8s.io/code-generator/generate-groups.sh all \
$(PACKAGE)/pkg/client \
$(PACKAGE)/pkg/apis \
$(GROUP_VERSIONS) \
--go-header-file $(BOILERPLATE)
# Verify and/or install dev depenedencies
#
dev-setup: Gopkg.toml Gopkg.lock
dep ensure --vendor-only
clean-generated:
rm -rf pkg/client
rm -rf $(GENERATED_FILES)
clean:
rm -rf _build
docker-build:
docker build --target=builder -t $(BUILDER_TAG) \
-f Dockerfile.builder .
test: dev-setup
go build -v -o ${PWD}/_build/example-client ./cmd/example-client/...
print-%:
@echo '$*=$($*)'
.PHONY: all clean-generated dev-setup print-% docker-build