github.com/crossplane/upjet@v1.3.0/Makefile (about)

     1  
     2  # SPDX-FileCopyrightText: 2023 The Crossplane Authors <https://crossplane.io>
     3  #
     4  # SPDX-License-Identifier: Apache-2.0
     5  
     6  # ====================================================================================
     7  # Setup Project
     8  
     9  PROJECT_NAME := upjet
    10  PROJECT_REPO := github.com/crossplane/$(PROJECT_NAME)
    11  
    12  # GOLANGCILINT_VERSION is inherited from build submodule by default.
    13  # Uncomment below if you need to override the version.
    14  GOLANGCILINT_VERSION ?= 1.55.2
    15  GO_REQUIRED_VERSION ?= 1.21
    16  
    17  PLATFORMS ?= linux_amd64 linux_arm64
    18  # -include will silently skip missing files, which allows us
    19  # to load those files with a target in the Makefile. If only
    20  # "include" was used, the make command would fail and refuse
    21  # to run a target until the include commands succeeded.
    22  -include build/makelib/common.mk
    23  
    24  # ====================================================================================
    25  # Setup Go
    26  
    27  # Set a sane default so that the nprocs calculation below is less noisy on the initial
    28  # loading of this file
    29  NPROCS ?= 1
    30  
    31  # each of our test suites starts a kube-apiserver and running many test suites in
    32  # parallel can lead to high CPU utilization. by default we reduce the parallelism
    33  # to half the number of CPU cores.
    34  GO_TEST_PARALLEL := $(shell echo $$(( $(NPROCS) / 2 )))
    35  
    36  GO_LDFLAGS += -X $(GO_PROJECT)/pkg/version.Version=$(VERSION)
    37  GO_SUBDIRS += pkg
    38  GO111MODULE = on
    39  -include build/makelib/golang.mk
    40  
    41  # ====================================================================================
    42  # Targets
    43  
    44  # run `make help` to see the targets and options
    45  
    46  # We want submodules to be set up the first time `make` is run.
    47  # We manage the build/ folder and its Makefiles as a submodule.
    48  # The first time `make` is run, the includes of build/*.mk files will
    49  # all fail, and this target will be run. The next time, the default as defined
    50  # by the includes will be run instead.
    51  fallthrough: submodules
    52  	@echo Initial setup complete. Running make again . . .
    53  	@make
    54  
    55  # Update the submodules, such as the common build scripts.
    56  submodules:
    57  	@git submodule sync
    58  	@git submodule update --init --recursive
    59  
    60  # NOTE(hasheddan): the build submodule currently overrides XDG_CACHE_HOME in
    61  # order to force the Helm 3 to use the .work/helm directory. This causes Go on
    62  # Linux machines to use that directory as the build cache as well. We should
    63  # adjust this behavior in the build submodule because it is also causing Linux
    64  # users to duplicate their build cache, but for now we just make it easier to
    65  # identify its location in CI so that we cache between builds.
    66  go.cachedir:
    67  	@go env GOCACHE
    68  
    69  go.mod.cachedir:
    70  	@go env GOMODCACHE
    71  
    72  .PHONY: reviewable submodules fallthrough go.mod.cachedir go.cachedir