github.com/fluxrad/terraform@v0.6.4-0.20150906191316-06627ccf39fa/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  		| grep -v '/internal/' \
    49  		| sort -u \
    50  		| xargs go get -f -u -v
    51  
    52  cover:
    53  	@go tool cover 2>/dev/null; if [ $$? -eq 3 ]; then \
    54  		go get -u golang.org/x/tools/cmd/cover; \
    55  	fi
    56  	go test $(TEST) -coverprofile=coverage.out
    57  	go tool cover -html=coverage.out
    58  	rm coverage.out
    59  
    60  # vet runs the Go source code static analysis tool `vet` to find
    61  # any common errors.
    62  vet:
    63  	@go tool vet 2>/dev/null ; if [ $$? -eq 3 ]; then \
    64  		go get golang.org/x/tools/cmd/vet; \
    65  	fi
    66  	@echo "go tool vet $(VETARGS) ."
    67  	@go tool vet $(VETARGS) . ; if [ $$? -eq 1 ]; then \
    68  		echo ""; \
    69  		echo "Vet found suspicious constructs. Please check the reported constructs"; \
    70  		echo "and fix them if necessary before submitting the code for review."; \
    71  		exit 1; \
    72  	fi
    73  
    74  # generate runs `go generate` to build the dynamically generated
    75  # source files.
    76  generate:
    77  	go generate ./...
    78  
    79  .PHONY: bin default generate test updatedeps vet