Skip to content

Commit

Permalink
build(Makefile): Build to GOPATH instead of local directory
Browse files Browse the repository at this point in the history
  • Loading branch information
elldritch committed Mar 13, 2018
1 parent 4fde932 commit 6600859
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
DEP="$(shell go env GOPATH)/bin/dep"
BIN="$(shell go env GOPATH)/bin"
DEP="$(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)"'

Expand All @@ -8,13 +9,13 @@ $(DEP): ## Grab golang/dep utility
go get github.com/golang/dep/cmd/dep

.PHONY: build
build: bin/fossa
build: $(BIN)/fossa

bin/fossa:
$(BIN)/fossa:
mkdir -p $$(dirname $@)
go build -o $@ $(LDFLAGS) github.com/fossas/fossa-cli/cmd/fossa

$(PREFIX)/fossa: bin/fossa
$(PREFIX)/fossa: $(BIN)/fossa
mv $< $@

vendor: $(DEP)
Expand All @@ -29,4 +30,4 @@ uninstall:

.PHONY: clean
clean:
rm -f bin/fossa
rm -f $(BIN)/fossa

0 comments on commit 6600859

Please sign in to comment.