Created
August 30, 2013 15:18
-
-
Save codeslinger/6390932 to your computer and use it in GitHub Desktop.
Makefile for Go projects
This file contains hidden or 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
# vim:set ts=8 ai: | |
GOPATH := $(shell pwd) | |
BASE := github.com/me/myproject | |
TARGETS := target1 target2 target3 | |
PACKAGES := util1 util2 target1 target2 target3 | |
GOTESTOPTS := -v | |
GOGETOPTS := -v | |
all: compile | |
compile: $(TARGETS) | |
$(TARGETS): | |
@GOPATH=$(GOPATH) go install $(BASE)/$@ | |
test: | |
@for pkg in $(PACKAGES); do \ | |
GOPATH=$(GOPATH) go test $(GOTESTOPTS) $(BASE)/$$pkg; \ | |
done | |
deps: | |
@GOPATH=$(GOPATH) go get $(GOGETOPTS) ./... | |
clean: | |
@for file in $(TARGETS); do \ | |
rm -rf $(GOPATH)/bin/$$file; \ | |
done; \ | |
rm -rf $(GOPATH)/pkg/* | |
over: clean all | |
.PHONY: all compile test clean over | |
.PHONY: $(TARGETS) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment