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