-
Notifications
You must be signed in to change notification settings - Fork 173
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improve Makefile, add multiple targets
Adds targets to do things like: * build * install * vendor Signed-off-by: Eli Uriegas <eli.uriegas@docker.com>
- Loading branch information
1 parent
16cf268
commit 7e25da7
Showing
2 changed files
with
31 additions
and
6 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
vendor/ | ||
_vendor-*/ | ||
dist/ | ||
dist/ | ||
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,7 +1,32 @@ | ||
.PHONY: default clean | ||
DEP="$(shell go env GOPATH)/bin/dep" | ||
PREFIX?=/usr/local/bin | ||
LDFLAGS:=-ldflags '-X main.version=$(shell git rev-parse --abbrev-ref HEAD) -X main.commit=$(shell git rev-parse HEAD) -X "main.goversion=$(shell go version)"' | ||
|
||
default: | ||
go install -ldflags '-X main.version=$(shell git rev-parse --abbrev-ref HEAD) -X main.commit=$(shell git rev-parse HEAD) -X "main.goversion=$(shell go version)"' github.com/fossas/fossa-cli/cmd/fossa | ||
all: build | ||
|
||
$(DEP): ## Grab golang/dep utility | ||
go get github.com/golang/dep/cmd/dep | ||
|
||
.PHONY: build | ||
build: bin/fossa | ||
|
||
bin/fossa: | ||
mkdir -p $$(dirname $@) | ||
go build -o $@ $(LDFLAGS) github.com/fossas/fossa-cli/cmd/fossa | ||
|
||
$(PREFIX)/fossa: bin/fossa | ||
mv $< $@ | ||
|
||
vendor: $(DEP) | ||
$< ensure -v -update | ||
|
||
.PHONY: install | ||
install: $(PREFIX)/fossa | ||
|
||
.PHONY: uninstall | ||
uninstall: | ||
rm $(PREFIX)/fossa | ||
|
||
.PHONY: clean | ||
clean: | ||
rm -f $(GOPATH)/bin/fossa | ||
rm -f bin/fossa |