Skip to content

Commit

Permalink
godep in makefile
Browse files Browse the repository at this point in the history
  • Loading branch information
lanrat committed Dec 12, 2017
1 parent f6222de commit e44dc2a
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,15 @@ BUILD_FLAGS := -ldflags "-X main.git_date=$(GIT_DATE) -X main.git_hash=$(GIT_HAS
PLATFORMS := linux/amd64 linux/386 linux/arm darwin/amd64 windows/amd64 windows/386 openbsd/amd64
SOURCES := $(shell find . -maxdepth 1 -type f -name "*.go")
ALL_SOURCES = $(shell find . -type f -name '*.go' -not -path "./vendor/*")
DEP_EXISTS := $(shell command -v dep 2> /dev/null)

temp = $(subst /, ,$@)
os = $(word 1, $(temp))
arch = $(word 2, $(temp))
ext = $(shell if [ "$(os)" = "windows" ]; then echo ".exe"; fi)

.PHONY: all release fmt clean serv dep godep $(PLATFORMS)

all: certgraph

release: $(PLATFORMS)
Expand All @@ -24,8 +27,13 @@ $(PLATFORMS): $(SOURCES)
CGO_ENABLED=0 GOOS=$(os) GOARCH=$(arch) go build $(BUILD_FLAGS) -o 'build/bin/$(os)/$(arch)/certgraph$(ext)' $(SOURCES)
mkdir -p build/$(GIT_DATE)/; cd build/bin/$(os)/$(arch)/; zip -r ../../../$(GIT_DATE)/certgraph-$(os)-$(arch)-$(GIT_DATE).zip .; cd ../../../

dep:
dep ensure
dep: godep
dep ensure -v

godep:
ifndef DEP_EXISTS
go get -u github.com/golang/dep/cmd/dep
endif

fmt:
gofmt -s -w -l .
Expand All @@ -35,5 +43,3 @@ clean:

serv:
(cd docs; python -m SimpleHTTPServer)

.PHONY: all fmt clean release serv dep $(PLATFORMS)

0 comments on commit e44dc2a

Please sign in to comment.