diff --git a/Makefile b/Makefile index aece405..04df7f5 100644 --- a/Makefile +++ b/Makefile @@ -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) @@ -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 . @@ -35,5 +43,3 @@ clean: serv: (cd docs; python -m SimpleHTTPServer) - -.PHONY: all fmt clean release serv dep $(PLATFORMS)