github.com/jgadling/terraform@v0.3.8-0.20150227214559-abd68c2c87bc/Makefile (about)

     1  TEST?=./...
     2  VETARGS?=-asmdecl -atomic -bool -buildtags -copylocks -methods -nilfunc -printf -rangeloops -shift -structtags -unsafeptr
     3  
     4  default: test
     5  
     6  # bin generates the releaseable binaries for Terraform
     7  bin: generate
     8  	@sh -c "'$(CURDIR)/scripts/build.sh'"
     9  
    10  # dev creates binaries for testing Terraform locally. These are put
    11  # into ./bin/ as well as $GOPATH/bin
    12  dev: generate
    13  	@TF_DEV=1 sh -c "'$(CURDIR)/scripts/build.sh'"
    14  
    15  # test runs the unit tests and vets the code
    16  test: generate
    17  	TF_ACC= go test $(TEST) $(TESTARGS) -timeout=30s -parallel=4
    18  	@$(MAKE) vet
    19  
    20  # testacc runs acceptance tests
    21  testacc: generate
    22  	@if [ "$(TEST)" = "./..." ]; then \
    23  		echo "ERROR: Set TEST to a specific package"; \
    24  		exit 1; \
    25  	fi
    26  	TF_ACC=1 go test $(TEST) -v $(TESTARGS) -timeout 45m
    27  
    28  # testrace runs the race checker
    29  testrace: generate
    30  	TF_ACC= go test -race $(TEST) $(TESTARGS)
    31  
    32  # updatedeps installs all the dependencies that Terraform needs to run
    33  # and build.
    34  updatedeps:
    35  	go get -u github.com/mitchellh/gox
    36  	go get -u golang.org/x/tools/cmd/stringer
    37  	go list ./... \
    38  		| xargs go list -f '{{join .Deps "\n"}}' \
    39  		| grep -v github.com/hashicorp/terraform \
    40  		| sort -u \
    41  		| xargs go get -f -u -v
    42  
    43  cover:
    44  	@go tool cover 2>/dev/null; if [ $$? -eq 3 ]; then \
    45  		go get -u golang.org/x/tools/cmd/cover; \
    46  	fi
    47  	go test $(TEST) -coverprofile=coverage.out
    48  	go tool cover -html=coverage.out
    49  	rm coverage.out
    50  
    51  # vet runs the Go source code static analysis tool `vet` to find
    52  # any common errors.
    53  vet:
    54  	@go tool vet 2>/dev/null ; if [ $$? -eq 3 ]; then \
    55  		go get golang.org/x/tools/cmd/vet; \
    56  	fi
    57  	@echo "go tool vet $(VETARGS) ."
    58  	@go tool vet $(VETARGS) . ; if [ $$? -eq 1 ]; then \
    59  		echo ""; \
    60  		echo "Vet found suspicious constructs. Please check the reported constructs"; \
    61  		echo "and fix them if necessary before submitting the code for reviewal."; \
    62  	fi
    63  
    64  # generate runs `go generate` to build the dynamically generated
    65  # source files.
    66  generate:
    67  	go generate ./...
    68  
    69  .PHONY: bin default generate test updatedeps vet