github.com/openebs/api@v1.12.0/Makefile (about) 1 # Copyright © 2020 The OpenEBS Authors 2 # 3 # Licensed under the Apache License, Version 2.0 (the "License"); 4 # you may not use this file except in compliance with the License. 5 # You may obtain a copy of the License at 6 # 7 # http://www.apache.org/licenses/LICENSE-2.0 8 # 9 # Unless required by applicable law or agreed to in writing, software 10 # distributed under the License is distributed on an "AS IS" BASIS, 11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 # See the License for the specific language governing permissions and 13 # limitations under the License. 14 15 # Get the currently used golang install path (in GOPATH/bin, unless GOBIN is set) 16 GOBIN := $(or $(shell go env GOBIN 2>/dev/null), $(shell go env GOPATH 2>/dev/null)/bin) 17 18 # find or download controller-gen 19 controller-gen: 20 ifneq ($(shell controller-gen --version 2> /dev/null), Version: v0.2.9) 21 @(cd /tmp; GO111MODULE=on go get sigs.k8s.io/controller-tools/cmd/controller-gen@v0.2.9) 22 CONTROLLER_GEN=$(GOBIN)/controller-gen 23 else 24 CONTROLLER_GEN=$(shell which controller-gen) 25 endif 26 27 # Generate code, CRDs and documentation 28 ALL_CRDS=config/crds/all-crds.yaml 29 generate: generate-crds 30 31 generate-crds: controller-gen 32 # Generate manifests e.g. CRD, RBAC etc. 33 $(CONTROLLER_GEN) crd paths="./pkg/apis/cstor" output:crd:artifacts:config=config/crds/bases 34 # merge all crds into a single file 35 cat config/crds/bases/*.yaml >> $(ALL_CRDS) 36 37 .PHONY: kubegen 38 # code generation for custom resources 39 kubegen: 40 ./hack/update-codegen.sh 41 42 .PHONY: verify_kubegen 43 verify_kubegen: 44 ./hack/verify-codegen.sh 45 46 .PHONY: generated_files 47 generated_files: kubegen protobuf 48 49 # deps ensures fresh go.mod and go.sum. 50 .PHONY: deps 51 deps: 52 @go mod tidy 53 @go mod verify 54 55 .PHONY: test 56 test: 57 go test ./...