github.com/yoctocloud/packer@v0.6.2-0.20160520224004-e11a0a18423f/Makefile (about)

     1  TEST?=$(shell go list ./... | grep -v vendor)
     2  VET?=$(shell ls -d */ | grep -v vendor | grep -v website)
     3  # Get the current full sha from git
     4  GITSHA:=$(shell git rev-parse HEAD)
     5  # Get the current local branch name from git (if we can, this may be blank)
     6  GITBRANCH:=$(shell git symbolic-ref --short HEAD 2>/dev/null)
     7  
     8  default: deps generate test dev
     9  
    10  ci: deps test
    11  
    12  release: deps test releasebin package
    13  
    14  bin: deps
    15  	@echo "WARN: 'make bin' is for debug / test builds only. Use 'make release' for release builds."
    16  	@GO15VENDOREXPERIMENT=1 sh -c "$(CURDIR)/scripts/build.sh"
    17  
    18  releasebin: deps
    19  	@grep 'const VersionPrerelease = "dev"' version/version.go > /dev/null ; if [ $$? -eq 0 ]; then \
    20  		echo "ERROR: You must remove prerelease tags from version/version.go prior to release."; \
    21  		exit 1; \
    22  	fi
    23  	@GO15VENDOREXPERIMENT=1 sh -c "$(CURDIR)/scripts/build.sh"
    24  
    25  package:
    26  	$(if $(VERSION),,@echo 'VERSION= needed to release; Use make package skip compilation'; exit 1)
    27  	@sh -c "$(CURDIR)/scripts/dist.sh $(VERSION)"
    28  
    29  deps:
    30  	go get github.com/mitchellh/gox
    31  	go get golang.org/x/tools/cmd/stringer
    32  	@go version | grep 1.4 ; if [ $$? -eq 0 ]; then \
    33  		echo "Installing godep and restoring dependencies"; \
    34  		go get github.com/tools/godep; \
    35  		godep restore; \
    36  	fi
    37  
    38  dev: deps
    39  	@grep 'const VersionPrerelease = ""' version/version.go > /dev/null ; if [ $$? -eq 0 ]; then \
    40  		echo "ERROR: You must add prerelease tags to version/version.go prior to making a dev build."; \
    41  		exit 1; \
    42  	fi
    43  	@PACKER_DEV=1 GO15VENDOREXPERIMENT=1 sh -c "$(CURDIR)/scripts/build.sh"
    44  
    45  fmt:
    46  	go fmt `go list ./... | grep -v vendor`
    47  
    48  # Install js-beautify with npm install -g js-beautify
    49  fmt-examples:
    50  	find examples -name *.json | xargs js-beautify -r -s 2 -n -eol "\n"
    51  
    52  # generate runs `go generate` to build the dynamically generated
    53  # source files.
    54  generate: deps
    55  	go generate .
    56  	go fmt command/plugin.go
    57  
    58  test: deps
    59  	@go test $(TEST) $(TESTARGS) -timeout=2m
    60  	@go tool vet $(VET)  ; if [ $$? -eq 1 ]; then \
    61  		echo "ERROR: Vet found problems in the code."; \
    62  		exit 1; \
    63  	fi
    64  
    65  # testacc runs acceptance tests
    66  testacc: deps generate
    67  	@echo "WARN: Acceptance tests will take a long time to run and may cost money. Ctrl-C if you want to cancel."
    68  	PACKER_ACC=1 go test -v $(TEST) $(TESTARGS) -timeout=45m
    69  
    70  testrace: deps
    71  	@go test -race $(TEST) $(TESTARGS) -timeout=2m
    72  
    73  updatedeps:
    74  	go get -u github.com/mitchellh/gox
    75  	go get -u golang.org/x/tools/cmd/stringer
    76  	@echo "INFO: Packer deps are managed by godep. See CONTRIBUTING.md"
    77  
    78  # This is used to add new dependencies to packer. If you are submitting a PR
    79  # that includes new dependencies you will need to run this.
    80  vendor:
    81  	godep restore
    82  	godep save
    83  
    84  .PHONY: bin checkversion ci default deps fmt fmt-examples generate releasebin test testacc testrace updatedeps