forked from istio/istio.io
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile.core.mk
153 lines (112 loc) · 4.13 KB
/
Makefile.core.mk
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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
# Get the source directory for this project
ISTIOIO_GO := $(shell dirname $(realpath $(lastword $(MAKEFILE_LIST))))
export ISTIOIO_GO
SHELL := /bin/bash -o pipefail
export GO111MODULE ?= on
export GOPROXY ?= https://proxy.golang.org
export GOSUMDB ?= sum.golang.org
# If GOPATH is not set by the env, set it to a sane value
GOPATH ?= $(shell cd ${ISTIOIO_GO}/../../..; pwd)
export GOPATH
# Set the directory for Istio source.
ISTIO_GO ?= $(GOPATH)/src/istio.io/istio
export ISTIO_GO
# If GOPATH is made up of several paths, use the first one for our targets in this Makefile
GO_TOP := $(shell echo ${GOPATH} | cut -d ':' -f1)
export GO_TOP
GO ?= go
GOARCH_LOCAL := $(TARGET_ARCH)
GOOS_LOCAL := $(TARGET_OS)
# ISTIO_IMAGE_VERSION stores the prefix used by default for the Docker images for Istio.
# For example, a value of 1.6-alpha will assume a default TAG value of 1.6-dev.<SHA>
ISTIO_IMAGE_VERSION ?= 1.6-alpha
export ISTIO_IMAGE_VERSION
# Determine the SHA for the Istio dependency by parsing the go.mod file.
ISTIO_SHA ?= $(shell < ${ISTIOIO_GO}/go.mod grep 'istio.io/istio v' | cut -d'-' -f3)
export ISTIO_SHA
HUB ?= gcr.io/istio-testing
ifeq ($(HUB),)
$(error "HUB cannot be empty")
endif
TAG ?= $(shell echo "${ISTIO_IMAGE_VERSION}.${ISTIO_SHA}")
ifeq ($(TAG),)
$(error "TAG cannot be empty")
endif
# Environment for tests, the directory containing istio and deps binaries.
# Typically same as GOPATH/bin, so tests work seemlessly with IDEs.
export ISTIO_BIN=$(GOBIN)
# Using same package structure as pkg/
export ISTIO_BIN=$(GOBIN)
export ISTIO_OUT:=$(TARGET_OUT)
export ISTIO_OUT_LINUX:=$(TARGET_OUT_LINUX)
export ARTIFACTS ?= $(ISTIO_OUT)
export JUNIT_OUT ?= $(ARTIFACTS)/junit.xml
export REPO_ROOT := $(shell git rev-parse --show-toplevel)
# Make directories needed by the build system
$(shell mkdir -p $(ISTIO_OUT))
$(shell mkdir -p $(dir $(JUNIT_OUT)))
JUNIT_REPORT := $(shell which go-junit-report 2> /dev/null || echo "${ISTIO_BIN}/go-junit-report")
ISTIO_SERVE_DOMAIN ?= localhost
export ISTIO_SERVE_DOMAIN
ifeq ($(CONTEXT),production)
baseurl := "$(URL)"
endif
# Which branch of the Istio source code do we fetch stuff from
SOURCE_BRANCH_NAME ?= master
gen:
@scripts/gen_site.sh
build: gen
@scripts/build_site.sh ""
build_nominify: gen
@scripts/build_site.sh "" -no_minify
opt:
@scripts/opt_site.sh
clean:
@rm -fr resources .htmlproofer tmp generated public out samples install go tests/integration/
lint: clean_public build_nominify lint-copyright-banner lint-python lint-yaml lint-dockerfiles lint-scripts lint-sass lint-typescript lint-go
@scripts/lint_site.sh
lint-en: clean_public build_nominify lint-copyright-banner lint-python lint-yaml lint-dockerfiles lint-scripts lint-sass lint-typescript lint-go
@scripts/lint_site.sh en
lint-fast:
@SKIP_LINK_CHECK=true scripts/lint_site.sh en
snips:
@scripts/gen_snips.sh
serve: gen
@hugo serve --baseURL "http://${ISTIO_SERVE_DOMAIN}:1313/" --bind 0.0.0.0 --disableFastRender
# used by netlify.com when building the site. The tool versions should correspond
# to what is included in the tools repo in docker/build-tools/Dockerfile.
netlify_install:
@npm init -y
@npm install --production --global \
@babel/[email protected] \
@babel/[email protected] \
@babel/[email protected]
@npm install --production --save-dev \
@npm install --save-dev \
@babel/[email protected]
netlify: netlify_install
@scripts/gen_site.sh
@scripts/build_site.sh "$(baseurl)"
netlify_archive: netlify_install archive
archive:
@scripts/build_archive_site.sh "$(baseurl)"
update_ref_docs:
@scripts/grab_reference_docs.sh $(SOURCE_BRANCH_NAME)
update_all: update_ref_docs update_examples
foo2:
hugo version
.PHONY: init
init:
@echo "ISTIO_SHA = ${ISTIO_SHA}"
@echo "HUB = ${HUB}"
@echo "TAG = ${TAG}"
bin/init.sh
include tests/tests.mk
# make lint-yaml seems to fail with pipefail, so remove now.
#SHELL = /bin/bash
include common/Makefile.common.mk
.PHONY: gen build build_nominify opt clean_public clean lint serve netlify_install netlify netlify_archive archive update_ref_docs update_operator_yamls update_examples update_all