SOURCEDIR=. SOURCES := $(shell find $(SOURCEDIR) -name '*.go') BINARY=maputnik DESKTOP_VERSION := 1.1.1 EDITOR_VERSION := $(shell node -p "require('../package.json').version") GOPATH := $(if $(GOPATH),$(GOPATH),$(HOME)/go) GOBIN := $(if $(GOBIN),$(GOBIN),$(HOME)/go/bin) all: $(BINARY) $(BINARY): $(GOBIN)/gox $(SOURCES) version.go rice-box.go $(GOBIN)/gox -osarch "windows/amd64 linux/amd64 darwin/amd64" -output "bin/{{.OS}}/${BINARY}" # Copy the current release into ./editor/maputnik so it can be # embedded in the binary editor/pull_release: mkdir -p editor cp -r ../dist/* editor $(GOBIN)/gox: go install github.com/mitchellh/gox@v1.0.1 $(GOBIN)/rice: go install github.com/GeertJohan/go.rice/rice@v1.0.3 # Embed the current version numbers in the executable by writing version.go .PHONY: version.go version.go: @echo "// DO NOT EDIT: Autogenerated by Makefile\n" > version.go @echo "package main\n" >> version.go @echo "const DesktopVersion = \"$(DESKTOP_VERSION)\"" >> version.go @echo "const EditorVersion = \"$(EDITOR_VERSION)\"" >> version.go rice-box.go: $(GOBIN)/rice editor/pull_release $(GOBIN)/rice embed-go .PHONY: clean clean: rm -rf editor && rm -f rice-box.go && rm -rf bin