1 В избранное 0 Ответвления 0

OSCHINA-MIRROR/vcs-all-in-one-git-sizer

Присоединиться к Gitlife
Откройте для себя и примите участие в публичных проектах с открытым исходным кодом с участием более 10 миллионов разработчиков. Приватные репозитории также полностью бесплатны :)
Присоединиться бесплатно
Клонировать/Скачать
Makefile 3.1 КБ
Копировать Редактировать Web IDE Исходные данные Просмотреть построчно История
Michael Haggerty Отправлено 04.12.2019 16:20 707176a
PACKAGE := github.com/github/git-sizer
GO111MODULES := 1
export GO111MODULES
GO := $(CURDIR)/script/go
GOFMT := $(CURDIR)/script/gofmt
GO_LDFLAGS := -X main.BuildVersion=$(shell git describe --tags --always --dirty || echo unknown)
GOFLAGS := -ldflags "$(GO_LDFLAGS)"
ifdef USE_ISATTY
GOFLAGS := $(GOFLAGS) --tags isatty
endif
GO_SRCS := $(sort $(shell $(GO) list -f ' \
{{$$ip := .Dir}} \
{{range .GoFiles }}{{printf "%s/%s\n" $$ip .}}{{end}} \
{{range .CgoFiles }}{{printf "%s/%s\n" $$ip .}}{{end}} \
{{range .TestGoFiles }}{{printf "%s/%s\n" $$ip .}}{{end}} \
{{range .XTestGoFiles}}{{printf "%s/%s\n" $$ip .}}{{end}} \
' ./...))
.PHONY: all
all: bin/git-sizer
.PHONY: bin/git-sizer
bin/git-sizer:
mkdir -p bin
$(GO) build $(GOFLAGS) -o $@ $(PACKAGE)
# Cross-compile for a bunch of common platforms. Note that this
# doesn't work with USE_ISATTY:
.PHONY: common-platforms
common-platforms:
# Create releases for a bunch of common platforms. Note that this
# doesn't work with USE_ISATTY, and VERSION must be set on the command
# line; e.g.,
#
# make releases VERSION=1.2.3
.PHONY: releases
releases:
# Define rules for a bunch of common platforms that are supported by go; see
# https://golang.org/doc/install/source#environment
# You can compile for any other platform in that list by running
# make GOOS=foo GOARCH=bar
define PLATFORM_template =
.PHONY: bin/git-sizer-$(1)-$(2)$(3)
bin/git-sizer-$(1)-$(2)$(3):
mkdir -p bin
GOOS=$(1) GOARCH=$(2) $$(GO) build $$(GOFLAGS) -ldflags "-X main.ReleaseVersion=$$(VERSION)" -o $$@ $$(PACKAGE)
common-platforms: bin/git-sizer-$(1)-$(2)$(3)
# Note that releases don't include code from vendor (they're only used
# for testing), so no license info is needed from those projects.
.PHONY: releases/git-sizer-$$(VERSION)-$(1)-$(2).zip
releases/git-sizer-$$(VERSION)-$(1)-$(2).zip: bin/git-sizer-$(1)-$(2)$(3)
if test -z "$$(VERSION)"; then echo "Please set VERSION to make releases"; exit 1; fi
mkdir -p releases/tmp-$$(VERSION)-$(1)-$(2)
cp README.md LICENSE.md releases/tmp-$$(VERSION)-$(1)-$(2)
cp bin/git-sizer-$(1)-$(2)$(3) releases/tmp-$$(VERSION)-$(1)-$(2)/git-sizer$(3)
cp $$$$($$(GO) list -f '{{.Dir}}' github.com/spf13/pflag)/LICENSE \
releases/tmp-$$(VERSION)-$(1)-$(2)/LICENSE-spf13-pflag
rm -f $$@
zip -j $$@ releases/tmp-$$(VERSION)-$(1)-$(2)/*
rm -rf releases/tmp-$$(VERSION)-$(1)-$(2)
releases: releases/git-sizer-$$(VERSION)-$(1)-$(2).zip
endef
$(eval $(call PLATFORM_template,linux,amd64))
$(eval $(call PLATFORM_template,linux,386))
$(eval $(call PLATFORM_template,darwin,386))
$(eval $(call PLATFORM_template,darwin,amd64))
$(eval $(call PLATFORM_template,windows,amd64,.exe))
$(eval $(call PLATFORM_template,windows,386,.exe))
.PHONY: test
test: bin/git-sizer gotest
.PHONY: gotest
gotest:
$(GO) test -timeout 60s $(GOFLAGS) ./...
.PHONY: gofmt
gofmt:
$(GOFMT) -l -w $(GO_SRCS) | sed -e 's/^/Fixing /'
.PHONY: goimports
goimports:
goimports -l -w -e $(GO_SRCS)
.PHONY: govet
govet:
$(GO) vet ./...
.PHONY: clean
clean:
rm -rf bin
# List all of this project's Go sources:
.PHONY: srcs
srcs:
@printf "%s\n" $(GO_SRCS)

Опубликовать ( 0 )

Вы можете оставить комментарий после Вход в систему

1
https://api.gitlife.ru/oschina-mirror/vcs-all-in-one-git-sizer.git
git@api.gitlife.ru:oschina-mirror/vcs-all-in-one-git-sizer.git
oschina-mirror
vcs-all-in-one-git-sizer
vcs-all-in-one-git-sizer
master