2016-02-05 14:18:11 -05:00
|
|
|
TEST?=$(shell go list ./... | grep -v vendor)
|
2015-08-07 02:45:39 -04:00
|
|
|
# Get the current full sha from git
|
|
|
|
GITSHA:=$(shell git rev-parse HEAD)
|
|
|
|
# Get the current local branch name from git (if we can, this may be blank)
|
|
|
|
GITBRANCH:=$(shell git symbolic-ref --short HEAD 2>/dev/null)
|
2013-05-07 14:39:32 -04:00
|
|
|
|
2016-02-05 14:18:11 -05:00
|
|
|
default: deps generate test dev
|
2013-03-23 03:48:20 -04:00
|
|
|
|
2015-08-21 21:37:51 -04:00
|
|
|
ci: deps test
|
2015-08-07 02:45:39 -04:00
|
|
|
|
2016-02-17 23:11:25 -05:00
|
|
|
release: deps test releasebin package
|
2015-08-07 02:45:39 -04:00
|
|
|
|
|
|
|
bin: deps
|
2015-10-14 00:54:01 -04:00
|
|
|
@echo "WARN: 'make bin' is for debug / test builds only. Use 'make release' for release builds."
|
2016-02-24 02:05:37 -05:00
|
|
|
@GO15VENDOREXPERIMENT=1 sh -c "$(CURDIR)/scripts/build.sh"
|
2015-10-07 18:33:01 -04:00
|
|
|
|
|
|
|
releasebin: deps
|
2016-02-17 23:11:25 -05:00
|
|
|
@grep 'const VersionPrerelease = "dev"' version.go > /dev/null ; if [ $$? -eq 0 ]; then \
|
2015-08-07 02:45:39 -04:00
|
|
|
echo "ERROR: You must remove prerelease tags from version.go prior to release."; \
|
|
|
|
exit 1; \
|
|
|
|
fi
|
2016-02-24 02:05:37 -05:00
|
|
|
@GO15VENDOREXPERIMENT=1 sh -c "$(CURDIR)/scripts/build.sh"
|
2013-09-17 07:35:07 -04:00
|
|
|
|
2016-02-17 23:11:25 -05:00
|
|
|
package:
|
|
|
|
$(if $(VERSION),,@echo 'VERSION= needed to release; Use make package skip compilation'; exit 1)
|
|
|
|
@sh -c "$(CURDIR)/scripts/dist.sh $(VERSION)"
|
|
|
|
|
2015-08-07 02:45:39 -04:00
|
|
|
deps:
|
2016-02-05 14:18:11 -05:00
|
|
|
go get github.com/mitchellh/gox
|
|
|
|
go get golang.org/x/tools/cmd/stringer
|
|
|
|
go get golang.org/x/tools/cmd/vet
|
2016-02-24 02:05:37 -05:00
|
|
|
@go version | grep 1.4 ; if [ $$? -eq 0 ]; then \
|
|
|
|
echo "Installing godep and restoring dependencies"; \
|
|
|
|
go get github.com/tools/godep; \
|
|
|
|
godep restore; \
|
|
|
|
fi
|
2015-08-07 02:45:39 -04:00
|
|
|
|
|
|
|
dev: deps
|
|
|
|
@grep 'const VersionPrerelease = ""' version.go > /dev/null ; if [ $$? -eq 0 ]; then \
|
|
|
|
echo "ERROR: You must add prerelease tags to version.go prior to making a dev build."; \
|
|
|
|
exit 1; \
|
|
|
|
fi
|
2016-02-24 02:05:37 -05:00
|
|
|
@PACKER_DEV=1 GO15VENDOREXPERIMENT=1 sh -c "$(CURDIR)/scripts/build.sh"
|
2013-08-13 21:42:08 -04:00
|
|
|
|
2016-02-12 14:37:49 -05:00
|
|
|
fmt:
|
|
|
|
go fmt `go list ./... | grep -v vendor`
|
|
|
|
|
2015-05-26 16:26:22 -04:00
|
|
|
# generate runs `go generate` to build the dynamically generated
|
|
|
|
# source files.
|
2015-08-21 21:37:51 -04:00
|
|
|
generate: deps
|
2016-02-05 14:18:11 -05:00
|
|
|
go generate .
|
|
|
|
go fmt command/plugin.go
|
2015-05-26 16:26:22 -04:00
|
|
|
|
2015-08-21 21:37:51 -04:00
|
|
|
test: deps
|
2016-02-08 23:02:56 -05:00
|
|
|
@go test $(TEST) $(TESTARGS) -timeout=15s
|
2015-08-07 02:45:39 -04:00
|
|
|
@go vet $(TEST) ; if [ $$? -eq 1 ]; then \
|
|
|
|
echo "ERROR: Vet found problems in the code."; \
|
|
|
|
exit 1; \
|
|
|
|
fi
|
2013-07-18 10:26:36 -04:00
|
|
|
|
2015-05-26 16:26:22 -04:00
|
|
|
# testacc runs acceptance tests
|
2015-08-21 21:37:51 -04:00
|
|
|
testacc: deps generate
|
2015-08-07 02:45:39 -04:00
|
|
|
@echo "WARN: Acceptance tests will take a long time to run and may cost money. Ctrl-C if you want to cancel."
|
2016-02-08 23:02:56 -05:00
|
|
|
PACKER_ACC=1 go test -v $(TEST) $(TESTARGS) -timeout=45m
|
2015-05-26 16:26:22 -04:00
|
|
|
|
2015-08-21 21:37:51 -04:00
|
|
|
testrace: deps
|
2016-02-08 23:02:56 -05:00
|
|
|
@go test -race $(TEST) $(TESTARGS) -timeout=15s
|
2013-03-24 17:47:59 -04:00
|
|
|
|
2014-09-02 18:13:55 -04:00
|
|
|
updatedeps:
|
2015-06-15 16:50:01 -04:00
|
|
|
go get -u github.com/mitchellh/gox
|
|
|
|
go get -u golang.org/x/tools/cmd/stringer
|
2016-02-05 14:18:11 -05:00
|
|
|
go get -u golang.org/x/tools/cmd/vet
|
|
|
|
@echo "INFO: Packer deps are managed by godep. See CONTRIBUTING.md"
|
2015-01-30 07:03:25 -05:00
|
|
|
|
2016-02-12 14:37:49 -05:00
|
|
|
# This is used to add new dependencies to packer. If you are submitting a PR
|
|
|
|
# that includes new dependencies you will need to run this.
|
|
|
|
vendor:
|
|
|
|
godep restore
|
|
|
|
godep save
|
|
|
|
|
2015-10-07 18:33:01 -04:00
|
|
|
.PHONY: bin checkversion ci default deps generate releasebin test testacc testrace updatedeps
|