github.com/tkak/terraform@v0.5.4-0.20150712180941-7f738dc27225/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  quickdev: generate
    16  	@TF_QUICKDEV=1 TF_DEV=1 sh -c "'$(CURDIR)/scripts/build.sh'"
    17  
    18  release: updatedeps
    19  	gox -build-toolchain
    20  	@$(MAKE) bin
    21  
    22  # test runs the unit tests and vets the code
    23  test: generate
    24  	TF_ACC= go test $(TEST) $(TESTARGS) -timeout=30s -parallel=4
    25  	@$(MAKE) vet
    26  
    27  # testacc runs acceptance tests
    28  testacc: generate
    29  	@if [ "$(TEST)" = "./..." ]; then \
    30  		echo "ERROR: Set TEST to a specific package. For example,"; \
    31  		echo "  make testacc TEST=./builtin/providers/aws"; \
    32  		exit 1; \
    33  	fi
    34  	TF_ACC=1 go test $(TEST) -v $(TESTARGS) -timeout 90m
    35  
    36  # testrace runs the race checker
    37  testrace: generate
    38  	TF_ACC= go test -race $(TEST) $(TESTARGS)
    39  
    40  # updatedeps installs all the dependencies that Terraform needs to run
    41  # and build.
    42  updatedeps:
    43  	go get -u github.com/mitchellh/gox
    44  	go get -u golang.org/x/tools/cmd/stringer
    45  	go list ./... \
    46  		| xargs go list -f '{{join .Deps "\n"}}' \
    47  		| grep -v github.com/hashicorp/terraform \
    48  		| sort -u \
    49  		| xargs go get -f -u -v
    50  
    51  cover:
    52  	@go tool cover 2>/dev/null; if [ $$? -eq 3 ]; then \
    53  		go get -u golang.org/x/tools/cmd/cover; \
    54  	fi
    55  	go test $(TEST) -coverprofile=coverage.out
    56  	go tool cover -html=coverage.out
    57  	rm coverage.out
    58  
    59  # vet runs the Go source code static analysis tool `vet` to find
    60  # any common errors.
    61  vet:
    62  	@go tool vet 2>/dev/null ; if [ $$? -eq 3 ]; then \
    63  		go get golang.org/x/tools/cmd/vet; \
    64  	fi
    65  	@echo "go tool vet $(VETARGS) ."
    66  	@go tool vet $(VETARGS) . ; if [ $$? -eq 1 ]; then \
    67  		echo ""; \
    68  		echo "Vet found suspicious constructs. Please check the reported constructs"; \
    69  		echo "and fix them if necessary before submitting the code for review."; \
    70  		exit 1; \
    71  	fi
    72  
    73  # generate runs `go generate` to build the dynamically generated
    74  # source files.
    75  generate:
    76  	go generate ./...
    77  
    78  .PHONY: bin default generate test updatedeps vet