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