k8s.io/registry.k8s.io@v0.3.1/Makefile (about) 1 # Copyright 2022 The Kubernetes 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 # Old-skool build tools. 16 # Simple makefile to build archeio quickly and reproducibly 17 # 18 # Common uses: 19 # - building: `make build` 20 # - cleaning up and starting over: `make clean` 21 # 22 ################################################################################ 23 # ========================== Capture Environment =============================== 24 # get the repo root and output path 25 REPO_ROOT:=${CURDIR} 26 OUT_DIR=$(REPO_ROOT)/bin 27 # record the source commit in the binary, overridable 28 COMMIT?=$(shell git rev-parse HEAD 2>/dev/null) 29 ################################################################################ 30 # ========================= Setup Go With Gimme ================================ 31 # go version to use for build etc. 32 # setup correct go version with gimme 33 PATH:=$(shell . hack/tools/setup-go.sh && echo "$${PATH}") 34 # go1.9+ can autodetect GOROOT, but if some other tool sets it ... 35 GOROOT:= 36 # enable modules 37 GO111MODULE=on 38 # disable CGO by default for static binaries 39 CGO_ENABLED=0 40 export PATH GOROOT GO111MODULE CGO_ENABLED 41 # work around broken PATH export 42 SPACE:=$(subst ,, ) 43 SHELL:=env PATH=$(subst $(SPACE),\$(SPACE),$(PATH)) $(SHELL) 44 ################################################################################ 45 # ============================== OPTIONS ======================================= 46 # the output binary name, overridden when cross compiling 47 ARCHEIO_BINARY_NAME?=archeio 48 GERANOS_BINARY_NAME?=geranos 49 # build flags for the archeio binary 50 # - reproducible builds: -trimpath 51 # - smaller binaries: -w (trim debugger data, but not panics) 52 GO_BUILD_FLAGS?=-trimpath -ldflags="-w" 53 ARCHEIO_BUILD_FLAGS?=$(GO_BUILD_FLAGS) 54 GERANOS_BUILD_FLAGS?=$(GO_BUILD_FLAGS) 55 ################################################################################ 56 # ================================= Building =================================== 57 # standard "make" target -> builds 58 all: build 59 # builds archeio, outputs to $(OUT_DIR) 60 archeio: 61 go build -v -o "$(OUT_DIR)/$(ARCHEIO_BINARY_NAME)" $(ARCHEIO_BUILD_FLAGS) ./cmd/archeio 62 # builds geranos, outputs to $(OUT_DIR) 63 geranos: 64 go build -v -o "$(OUT_DIR)/$(GERANOS_BINARY_NAME)" $(GERANOS_BUILD_FLAGS) ./cmd/geranos 65 # alias for building binaries 66 build: archeio geranos 67 # build images to local tarball 68 images: 69 hack/make-rules/images.sh 70 # push images 71 push-images: 72 PUSH=true hack/make-rules/images.sh 73 # build image for archeio 74 archeio-image: 75 IMAGES=cmd/archeio hack/make-rules/images.sh 76 # deploy to registry-sandbox staging services 77 deploy: 78 hack/make-rules/deploy.sh 79 80 ################################################################################ 81 # ================================= Testing ==================================== 82 # unit tests (hermetic) 83 unit: 84 MODE=unit hack/make-rules/test.sh 85 # integration tests 86 integration: 87 MODE=integration hack/make-rules/test.sh 88 # unit + integration tests 89 test: 90 hack/make-rules/test.sh 91 # e2e tests 92 e2e-test: 93 hack/make-rules/e2e-test.sh 94 # e2e tests, but against a local instance instead of staging 95 # useful for developing the tests if staging is broken, otherwise use e2e-test 96 e2e-test-local: 97 hack/make-rules/e2e-test-local.sh 98 ################################################################################ 99 # ================================= Cleanup ==================================== 100 # standard cleanup target 101 clean: 102 rm -rf "$(OUT_DIR)/" 103 ################################################################################ 104 # ============================== Auto-Update =================================== 105 # update generated code, gofmt, etc. 106 update: 107 hack/make-rules/update.sh 108 tidy: 109 hack/make-rules/tidy.sh 110 # gofmt 111 gofmt: 112 hack/make-rules/gofmt.sh 113 ################################################################################ 114 # ================================== Linting =================================== 115 # run linters, ensure generated code, etc. 116 verify: 117 hack/make-rules/verify.sh 118 # verify generated files, subset of verify 119 verify-generated: 120 hack/make-rules/verify-generated.sh 121 # code linters 122 lint: 123 hack/make-rules/lint.sh 124 # shell linter 125 shellcheck: 126 hack/make-rules/shellcheck.sh 127 ################################################################################# 128 .PHONY: all archeio geranos build unit integration test e2e-test clean update gofmt verify verify-generated lint shellcheck