2020-09-22 12:13:00 +02:00
|
|
|
# Copyright 2020 Docker Compose CLI authors
|
2020-06-18 16:13:24 +02:00
|
|
|
|
|
|
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
# you may not use this file except in compliance with the License.
|
|
|
|
# You may obtain a copy of the License at
|
|
|
|
|
|
|
|
# http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
|
|
|
|
# Unless required by applicable law or agreed to in writing, software
|
|
|
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
# See the License for the specific language governing permissions and
|
|
|
|
# limitations under the License.
|
2020-05-01 15:27:27 +02:00
|
|
|
|
2020-06-02 11:53:13 +02:00
|
|
|
GOOS?=$(shell go env GOOS)
|
|
|
|
GOARCH?=$(shell go env GOARCH)
|
2020-05-01 15:27:27 +02:00
|
|
|
|
2021-09-02 15:58:46 +02:00
|
|
|
PKG_NAME := github.com/docker/compose/v2
|
2020-05-01 15:27:27 +02:00
|
|
|
|
2020-06-02 11:53:13 +02:00
|
|
|
EXTENSION:=
|
2020-05-04 22:31:59 +02:00
|
|
|
ifeq ($(GOOS),windows)
|
2020-06-02 11:53:13 +02:00
|
|
|
EXTENSION:=.exe
|
2020-05-04 22:31:59 +02:00
|
|
|
endif
|
|
|
|
|
2020-05-20 14:32:56 +02:00
|
|
|
STATIC_FLAGS=CGO_ENABLED=0
|
2020-07-07 15:48:09 +02:00
|
|
|
|
|
|
|
GIT_TAG?=$(shell git describe --tags --match "v[0-9]*")
|
2020-06-25 13:50:16 +02:00
|
|
|
|
2021-05-27 12:10:37 +02:00
|
|
|
LDFLAGS="-s -w -X $(PKG_NAME)/internal.Version=${GIT_TAG}"
|
2020-06-02 11:53:13 +02:00
|
|
|
GO_BUILD=$(STATIC_FLAGS) go build -trimpath -ldflags=$(LDFLAGS)
|
2020-05-04 22:31:59 +02:00
|
|
|
|
2021-03-05 10:50:06 +01:00
|
|
|
COMPOSE_BINARY?=bin/docker-compose
|
|
|
|
COMPOSE_BINARY_WITH_EXTENSION=$(COMPOSE_BINARY)$(EXTENSION)
|
|
|
|
|
2020-09-22 17:13:56 +02:00
|
|
|
WORK_DIR:=$(shell mktemp -d)
|
|
|
|
|
2020-06-15 17:41:59 +02:00
|
|
|
TAGS:=
|
|
|
|
ifdef BUILD_TAGS
|
|
|
|
TAGS=-tags $(BUILD_TAGS)
|
2020-11-18 17:18:15 +01:00
|
|
|
LINT_TAGS=--build-tags $(BUILD_TAGS)
|
2020-06-15 17:41:59 +02:00
|
|
|
endif
|
|
|
|
|
2021-03-04 19:21:42 +01:00
|
|
|
.PHONY: compose-plugin
|
|
|
|
compose-plugin:
|
2021-06-15 08:48:49 +02:00
|
|
|
GOOS=${GOOS} GOARCH=${GOARCH} $(GO_BUILD) $(TAGS) -o $(COMPOSE_BINARY_WITH_EXTENSION) ./cmd
|
2021-03-04 19:21:42 +01:00
|
|
|
|
2020-09-21 12:21:41 +02:00
|
|
|
.PHONY: cross
|
2021-05-27 12:10:37 +02:00
|
|
|
cross:
|
2021-09-30 09:20:24 +02:00
|
|
|
GOOS=linux GOARCH=amd64 $(GO_BUILD) $(TAGS) -o $(COMPOSE_BINARY)-linux-x86_64 ./cmd
|
2022-04-14 13:55:01 +02:00
|
|
|
GOOS=linux GOARCH=ppc64le $(GO_BUILD) $(TAGS) -o $(COMPOSE_BINARY)-linux-ppc64le ./cmd
|
2021-09-30 09:20:24 +02:00
|
|
|
GOOS=linux GOARCH=arm64 $(GO_BUILD) $(TAGS) -o $(COMPOSE_BINARY)-linux-aarch64 ./cmd
|
2021-06-15 08:48:49 +02:00
|
|
|
GOOS=linux GOARM=6 GOARCH=arm $(GO_BUILD) $(TAGS) -o $(COMPOSE_BINARY)-linux-armv6 ./cmd
|
|
|
|
GOOS=linux GOARM=7 GOARCH=arm $(GO_BUILD) $(TAGS) -o $(COMPOSE_BINARY)-linux-armv7 ./cmd
|
2021-06-28 12:36:46 +02:00
|
|
|
GOOS=linux GOARCH=s390x $(GO_BUILD) $(TAGS) -o $(COMPOSE_BINARY)-linux-s390x ./cmd
|
2021-09-30 09:20:24 +02:00
|
|
|
GOOS=darwin GOARCH=amd64 $(GO_BUILD) $(TAGS) -o $(COMPOSE_BINARY)-darwin-x86_64 ./cmd
|
|
|
|
GOOS=darwin GOARCH=arm64 $(GO_BUILD) $(TAGS) -o $(COMPOSE_BINARY)-darwin-aarch64 ./cmd
|
|
|
|
GOOS=windows GOARCH=amd64 $(GO_BUILD) $(TAGS) -o $(COMPOSE_BINARY)-windows-x86_64.exe ./cmd
|
2021-03-22 14:12:57 +01:00
|
|
|
|
2020-09-21 12:21:41 +02:00
|
|
|
.PHONY: test
|
2020-05-01 15:27:27 +02:00
|
|
|
test:
|
2021-01-26 17:35:21 +01:00
|
|
|
go test $(TAGS) -cover $(shell go list $(TAGS) ./... | grep -vE 'e2e')
|
2020-05-01 15:27:27 +02:00
|
|
|
|
2020-09-21 12:21:41 +02:00
|
|
|
.PHONY: lint
|
2020-05-04 23:50:00 +02:00
|
|
|
lint:
|
2020-11-18 17:18:15 +01:00
|
|
|
golangci-lint run $(LINT_TAGS) --timeout 10m0s ./...
|
2020-05-04 23:50:00 +02:00
|
|
|
|
2021-08-31 18:53:24 +02:00
|
|
|
.PHONY: check-license-headers
|
2020-08-17 15:18:47 +02:00
|
|
|
check-license-headers:
|
|
|
|
./scripts/validate/fileheader
|
|
|
|
|
2020-09-21 12:21:41 +02:00
|
|
|
.PHONY: check-go-mod
|
2020-08-18 11:53:17 +02:00
|
|
|
check-go-mod:
|
|
|
|
./scripts/validate/check-go-mod
|