-
Notifications
You must be signed in to change notification settings - Fork 206
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
makefile: unify the makefiles for contrib components
Unify the makefiles for contrib components by use the same template. Also refine the global makefile targets to make them symmetric. Signed-off-by: Jiang Liu <gerry@linux.alibaba.com>
- Loading branch information
Showing
7 changed files
with
122 additions
and
74 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,27 @@ | ||
GIT_COMMIT := $(shell git rev-list -1 HEAD) | ||
BUILD_TIME := $(shell date -u +%Y%m%d.%H%M) | ||
PACKAGES ?= $(shell go list ./... | grep -v /vendor/) | ||
GOARCH ?= amd64 | ||
GOPROXY ?= https://goproxy.io | ||
|
||
all:clear build | ||
ifdef GOPROXY | ||
PROXY := GOPROXY=${GOPROXY} | ||
endif | ||
|
||
.PHONY: build | ||
build: | ||
GOOS=linux GOARCH=${GOARCH} go build -v -o bin/ctr-remote ./cmd/main.go | ||
.PHONY: all build release test clean | ||
|
||
.PHONY: clear | ||
clear: | ||
rm -f bin/* | ||
all: build | ||
|
||
build: | ||
@CGO_ENABLED=0 ${PROXY} GOOS=linux GOARCH=${GOARCH} go build -v -o bin/ctr-remote ./cmd/main.go | ||
|
||
.PHONY: static-release | ||
static-release: | ||
GOOS=linux GOARCH=${GOARCH} go build -ldflags '-s -w -extldflags "-static"' -v -o bin/ctr-remote ./cmd/main.go | ||
release: | ||
@CGO_ENABLED=0 ${PROXY} GOOS=linux GOARCH=${GOARCH} go build -ldflags '-s -w -extldflags "-static"' -v -o bin/ctr-remote ./cmd/main.go | ||
|
||
.PHONY: test | ||
test: build | ||
go vet $(PACKAGES) | ||
golangci-lint run | ||
go test -v -cover ${PACKAGES} | ||
|
||
clean: | ||
rm -f bin/* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,27 @@ | ||
GIT_COMMIT := $(shell git rev-list -1 HEAD) | ||
BUILD_TIME := $(shell date -u +%Y%m%d.%H%M) | ||
PACKAGES ?= $(shell go list ./... | grep -v /vendor/) | ||
GOARCH ?= amd64 | ||
GOPROXY ?= https://goproxy.io | ||
|
||
all:clear build | ||
ifdef GOPROXY | ||
PROXY := GOPROXY=${GOPROXY} | ||
endif | ||
|
||
.PHONY: build | ||
build: | ||
GOOS=linux GOARCH=${GOARCH} go build -v -o bin/nydus_graphdriver . | ||
.PHONY: all build release test clean | ||
|
||
.PHONY: clear | ||
clear: | ||
rm -f bin/* | ||
all: build | ||
|
||
build: | ||
@CGO_ENABLED=0 ${PROXY} GOOS=linux GOARCH=${GOARCH} go build -v -o bin/nydus_graphdriver . | ||
|
||
.PHONY: static-release | ||
static-release: | ||
GOOS=linux GOARCH=${GOARCH} go build -ldflags '-s -w -extldflags "-static"' -v -o bin/nydus_graphdriver . | ||
release: | ||
@CGO_ENABLED=0 ${PROXY} GOOS=linux GOARCH=${GOARCH} go build -ldflags '-s -w -extldflags "-static"' -v -o bin/nydus_graphdriver . | ||
|
||
.PHONY: test | ||
test: build | ||
go vet $(PACKAGES) | ||
golangci-lint run | ||
go test -v -cover ${PACKAGES} | ||
|
||
clean: | ||
rm -f bin/* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,27 @@ | ||
all:clear build | ||
|
||
GIT_COMMIT := $(shell git rev-parse --verify HEAD --short=7) | ||
BUILD_TIME := $(shell date -u +%Y%m%d.%H%M) | ||
PACKAGES ?= $(shell go list ./... | grep -v /vendor/) | ||
GOARCH ?= amd64 | ||
GOPROXY ?= https://goproxy.io | ||
|
||
.PHONY: build | ||
build: | ||
GOOS=linux GOARCH=${GOARCH} go build -ldflags="-s -w -X 'main.Version=${GIT_COMMIT}' -X 'main.BuildTime=${BUILD_TIME}'" -v -o bin/nydus-overlayfs ./cmd/main.go | ||
ifdef GOPROXY | ||
PROXY := GOPROXY=${GOPROXY} | ||
endif | ||
|
||
.PHONY: clear | ||
clear: | ||
rm -f bin/* | ||
.PHONY: all build release test clean | ||
|
||
all: build | ||
|
||
.PHONY: static-release | ||
static-release: | ||
GOOS=linux GOARCH=${GOARCH} go build -ldflags '-s -w -extldflags "-static"' -v -o bin/nydus-overlayfs ./cmd/main.go | ||
build: | ||
@CGO_ENABLED=0 ${PROXY} GOOS=linux GOARCH=${GOARCH} go build -ldflags="-s -w -X 'main.Version=${GIT_COMMIT}' -X 'main.BuildTime=${BUILD_TIME}'" -v -o bin/nydus-overlayfs ./cmd/main.go | ||
|
||
release: | ||
@CGO_ENABLED=0 ${PROXY} GOOS=linux GOARCH=${GOARCH} go build -ldflags '-s -w -extldflags "-static"' -v -o bin/nydus-overlayfs ./cmd/main.go | ||
|
||
.PHONY: test | ||
test: build | ||
go vet $(PACKAGES) | ||
golangci-lint run | ||
go test -v -cover ${PACKAGES} | ||
|
||
clean: | ||
rm -f bin/* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,30 @@ | ||
GIT_COMMIT := $(shell git rev-list -1 HEAD) | ||
BUILD_TIME := $(shell date -u +%Y%m%d.%H%M) | ||
CURRENT_DIR := $(shell dirname $(realpath $(firstword $(MAKEFILE_LIST)))) | ||
PACKAGES ?= $(shell go list ./... | grep -v /vendor/) | ||
GOARCH ?= amd64 | ||
#GOPROXY ?= https://goproxy.io | ||
GOPROXY ?= https://goproxy.io | ||
|
||
ifdef GOPROXY | ||
PROXY := GOPROXY=${GOPROXY} | ||
endif | ||
|
||
.PHONY: build | ||
.PHONY: all build release test clean build-smoke | ||
|
||
all: build | ||
|
||
build: | ||
@CGO_ENABLED=0 ${PROXY} GOOS=linux GOARCH=${GOARCH} go build -ldflags '-X main.versionGitCommit=${GIT_COMMIT} -X main.versionBuildTime=${BUILD_TIME}' -gcflags=all="-N -l" -o ./cmd ./cmd/nydusify.go | ||
|
||
.PHONY: static-release | ||
static-release: | ||
@CGO_ENABLED=0 ${PROXY} GOOS=linux GOARCH=${GOARCH} go build -ldflags '-X main.versionGitCommit=${GIT_COMMIT} -X main.versionBuildTime=${BUILD_TIME}' -o ./cmd ./cmd/nydusify.go | ||
release: | ||
@CGO_ENABLED=0 ${PROXY} GOOS=linux GOARCH=${GOARCH} go build -ldflags '-X main.versionGitCommit=${GIT_COMMIT} -X main.versionBuildTime=${BUILD_TIME} -s -w -extldflags "-static"' -o ./cmd ./cmd/nydusify.go | ||
|
||
.PHONY: test | ||
test: build build-smoke | ||
@go vet $(PACKAGES) | ||
golangci-lint run | ||
@go test -count=1 -v -timeout 20m -race ./pkg/... | ||
|
||
clean: | ||
rm -f cmd/nydusify | ||
|
||
build-smoke: | ||
${PROXY} go test -race -v -c -o ./nydusify-smoke ./tests |