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