istio
/
Makefile
69 строк · 2.2 Кб
1# WARNING: DO NOT EDIT, THIS FILE IS PROBABLY A COPY
2#
3# The original version of this file is located in the https://github.com/istio/common-files repo.
4# If you're looking at this file in a different repo and want to make a change, please go to the
5# common-files repo, make the change there and check it in. Then come back to this repo and run
6# "make update-common".
7
8# Copyright Istio Authors
9#
10# Licensed under the Apache License, Version 2.0 (the "License");
11# you may not use this file except in compliance with the License.
12# You may obtain a copy of the License at
13#
14# http://www.apache.org/licenses/LICENSE-2.0
15#
16# Unless required by applicable law or agreed to in writing, software
17# distributed under the License is distributed on an "AS IS" BASIS,
18# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19# See the License for the specific language governing permissions and
20# limitations under the License.
21
22SHELL := /bin/bash
23
24# allow optional per-repo overrides
25-include Makefile.overrides.mk
26
27# Set the environment variable BUILD_WITH_CONTAINER to use a container
28# to build the repo. The only dependencies in this mode are to have make and
29# docker. If you'd rather build with a local tool chain instead, you'll need to
30# figure out all the tools you need in your environment to make that work.
31export BUILD_WITH_CONTAINER ?= 0
32
33ifeq ($(BUILD_WITH_CONTAINER),1)
34
35# An export free of arguments in a Makefile places all variables in the Makefile into the
36# environment. This is needed to allow overrides from Makefile.overrides.mk.
37export
38
39RUN = ./common/scripts/run.sh
40
41MAKE_DOCKER = $(RUN) make --no-print-directory -e -f Makefile.core.mk
42
43%:
44@$(MAKE_DOCKER) $@
45
46default:
47@$(MAKE_DOCKER)
48
49shell:
50@$(RUN) /bin/bash
51
52.PHONY: default shell
53
54else
55
56# If we are not in build container, we need a workaround to get environment properly set
57# Write to file, then include
58$(shell mkdir -p out)
59$(shell $(shell pwd)/common/scripts/setup_env.sh envfile > out/.env)
60include out/.env
61# An export free of arguments in a Makefile places all variables in the Makefile into the
62# environment. This behavior may be surprising to many that use shell often, which simply
63# displays the existing environment
64export
65
66export GOBIN ?= $(GOPATH)/bin
67include Makefile.core.mk
68
69endif
70