Skip to content

Commit

Permalink
build: cleanup Makefile
Browse files Browse the repository at this point in the history
* remove unnecessary bin target
* remove bin directory during clean
* fix typo
* do not clean entire go build cache (see golang/go#53725)

Signed-off-by: Alexander Yastrebov <[email protected]>
  • Loading branch information
AlexanderYastrebov committed Jul 15, 2023
1 parent 7f36fca commit ff26924
Showing 1 changed file with 14 additions and 17 deletions.
31 changes: 14 additions & 17 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -22,25 +22,21 @@ help: ## Display this help
lib: $(SOURCES) ## build skipper library
go build ./...

.PHONY: bindir
bindir:
mkdir -p bin

.PHONY: skipper
skipper: $(SOURCES) bindir ## build skipper binary
go build -ldflags "-X main.version=$(VERSION) -X main.commit=$(COMMIT_HASH)" -o bin/skipper ./cmd/skipper/*.go
skipper: $(SOURCES) ## build skipper binary
go build -ldflags "-X main.version=$(VERSION) -X main.commit=$(COMMIT_HASH)" -o bin/skipper ./cmd/skipper

.PHONY: eskip
eskip: $(SOURCES) bindir ## build eskip binary
go build -ldflags "-X main.version=$(VERSION) -X main.commit=$(COMMIT_HASH)" -o bin/eskip ./cmd/eskip/*.go
eskip: $(SOURCES) ## build eskip binary
go build -ldflags "-X main.version=$(VERSION) -X main.commit=$(COMMIT_HASH)" -o bin/eskip ./cmd/eskip

.PHONY: webhook
webhook: $(SOURCES) bindir
go build -ldflags "-X main.version=$(VERSION) -X main.commit=$(COMMIT_HASH)" -o bin/webhook ./cmd/webhook/*.go
webhook: $(SOURCES) ## build webhook binary
go build -ldflags "-X main.version=$(VERSION) -X main.commit=$(COMMIT_HASH)" -o bin/webhook ./cmd/webhook

.PHONY: routesrv
routesrv: $(SOURCES) bindir
go build -ldflags "-X main.version=$(VERSION) -X main.commit=$(COMMIT_HASH)" -o bin/routesrv ./cmd/routesrv/*.go
routesrv: $(SOURCES) ## build routesrv binary
go build -ldflags "-X main.version=$(VERSION) -X main.commit=$(COMMIT_HASH)" -o bin/routesrv ./cmd/routesrv

.PHONY: fixlimits
fixlimits:
Expand All @@ -49,7 +45,7 @@ ifeq (LIMIT_FDS, 256)
endif

.PHONY: build
build: $(SOURCES) lib skipper eskip webhook routesrv ## build libe and all binaries
build: $(SOURCES) lib skipper eskip webhook routesrv ## build library and all binaries

build.linux.static: ## build static linux binary for amd64
GOOS=linux GOARCH=amd64 CGO_ENABLED=0 go build -o bin/skipper -ldflags "-extldflags=-static -X main.version=$(VERSION) -X main.commit=$(COMMIT_HASH)" ./cmd/skipper
Expand Down Expand Up @@ -112,11 +108,12 @@ lint: build staticcheck ## run all linters

.PHONY: clean
clean: ## clean temporary files and directories
go clean -i -cache -testcache
rm -rf .coverprofile-all
rm -f ./_test_plugins/*.so
rm -f ./_test_plugins_fail/*.so
go clean -i ./...
rm -rf bin
rm -rf .bin
rm -f _test_plugins/*.so
rm -f _test_plugins_fail/*.so
rm -f .coverprofile-all

.PHONY: deps
deps: ## install dependencies to run everything
Expand Down

0 comments on commit ff26924

Please sign in to comment.