...
1# Copyright 2023 The cert-manager 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# THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT.
16# Edit https://github.com/cert-manager/makefile-modules/blob/main/modules/repository-base/base/Makefile instead.
17
18# NOTE FOR DEVELOPERS: "How do the Makefiles work and how can I extend them?"
19#
20# Shared Makefile logic lives in the make/_shared/ directory. The source of truth for these files
21# lies outside of this repository, eg. in the cert-manager/makefile-modules repository.
22#
23# Logic specific to this repository must be defined in the make/00_mod.mk and make/02_mod.mk files:
24# - The make/00_mod.mk file is included first and contains variable definitions needed by
25# the shared Makefile logic.
26# - The make/02_mod.mk file is included later, it can make use of most of the shared targets
27# defined in the make/_shared/ directory (all targets defined in 00_mod.mk and 01_mod.mk).
28# This file should be used to define targets specific to this repository.
29
30##################################
31
32# Some modules build their dependencies from variables, we want these to be
33# evalutated at the last possible moment. For this we use second expansion to
34# re-evaluate the generate and verify targets a second time.
35#
36# See https://www.gnu.org/software/make/manual/html_node/Secondary-Expansion.html
37.SECONDEXPANSION:
38
39# For details on some of these "prelude" settings, see:
40# https://clarkgrubb.com/makefile-style-guide
41MAKEFLAGS += --warn-undefined-variables --no-builtin-rules
42SHELL := /usr/bin/env bash
43.SHELLFLAGS := -uo pipefail -c
44.DEFAULT_GOAL := help
45.DELETE_ON_ERROR:
46.SUFFIXES:
47FORCE:
48
49noop: # do nothing
50
51# Set empty value for MAKECMDGOALS to prevent the "warning: undefined variable 'MAKECMDGOALS'"
52# warning from happening when running make without arguments
53MAKECMDGOALS ?=
54
55##################################
56# Host OS and architecture setup #
57##################################
58
59# The reason we don't use "go env GOOS" or "go env GOARCH" is that the "go"
60# binary may not be available in the PATH yet when the Makefiles are
61# evaluated. HOST_OS and HOST_ARCH only support Linux, *BSD and macOS (M1
62# and Intel).
63HOST_OS ?= $(shell uname -s | tr A-Z a-z)
64HOST_ARCH ?= $(shell uname -m)
65
66ifeq (x86_64, $(HOST_ARCH))
67 HOST_ARCH = amd64
68else ifeq (aarch64, $(HOST_ARCH))
69 # linux reports the arm64 arch as aarch64
70 HOST_ARCH = arm64
71endif
72
73##################################
74# Git and versioning information #
75##################################
76
77VERSION ?= $(shell git describe --tags --always --match='v*' --abbrev=14 --dirty)
78IS_PRERELEASE := $(shell git describe --tags --always --match='v*' --abbrev=0 | grep -q '-' && echo true || echo false)
79GITCOMMIT := $(shell git rev-parse HEAD)
80GITEPOCH := $(shell git show -s --format=%ct HEAD)
81
82##################################
83# Global variables and dirs #
84##################################
85
86bin_dir := _bin
87
88# The ARTIFACTS environment variable is set by the CI system to a directory
89# where artifacts should be placed. These artifacts are then uploaded to a
90# storage bucket by the CI system (https://docs.prow.k8s.io/docs/components/pod-utilities/).
91# An example of such an artifact is a jUnit XML file containing test results.
92# If the ARTIFACTS environment variable is not set, we default to a local
93# directory in the _bin directory.
94ARTIFACTS ?= $(bin_dir)/artifacts
95
96$(bin_dir) $(ARTIFACTS) $(bin_dir)/scratch:
97 mkdir -p $@
98
99.PHONY: clean
100## Clean all temporary files
101## @category [shared] Tools
102clean:
103 rm -rf $(bin_dir)
104
105##################################
106# Include all the Makefiles #
107##################################
108
109-include make/00_mod.mk
110-include make/_shared/*/00_mod.mk
111-include make/_shared/*/01_mod.mk
112-include make/02_mod.mk
113-include make/_shared/*/02_mod.mk
View as plain text