github.com/dahs81/otto@v0.2.1-0.20160126165905-6400716cf085/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 Otto
     7  bin: generate
     8  	@sh -c "'$(CURDIR)/scripts/build.sh'"
     9  
    10  # dev creates binaries for testing Otto locally. These are put
    11  # into ./bin/ as well as $GOPATH/bin
    12  dev: generate
    13  	@OTTO_DEV=1 sh -c "'$(CURDIR)/scripts/build.sh'"
    14  
    15  # test runs the unit tests and vets the code
    16  test: generate
    17  	go test $(TEST) $(TESTARGS) -timeout=30s -parallel=4
    18  	@$(MAKE) vet
    19  
    20  # testrace runs the race checker
    21  testrace: generate
    22  	go test -race $(TEST) $(TESTARGS)
    23  
    24  # testacc runs acceptance tests
    25  testacc: generate
    26  	@if [ "$(TEST)" = "./..." ]; then \
    27  		echo "ERROR: Set TEST to a specific package. For example,"; \
    28  		echo "  make testacc TEST=./builtin/app/go"; \
    29  		exit 1; \
    30  	fi
    31  	OTTO_ACC=1 go test $(TEST) -v $(TESTARGS) -timeout 90m
    32  
    33  # updatedeps installs all the dependencies that Otto needs to run
    34  # and build.
    35  updatedeps:
    36  	go get -u github.com/mitchellh/gox
    37  	go get -u golang.org/x/tools/cmd/stringer
    38  	go get -u github.com/jteeuwen/go-bindata/...
    39  	go list ./... \
    40  		| xargs go list -f '{{join .Deps "\n"}}' \
    41  		| grep -v github.com/hashicorp/otto \
    42  		| sort -u \
    43  		| xargs go get -f -u -v
    44  
    45  cover:
    46  	@go tool cover 2>/dev/null; if [ $$? -eq 3 ]; then \
    47  		go get -u golang.org/x/tools/cmd/cover; \
    48  	fi
    49  	go test $(TEST) -coverprofile=coverage.out
    50  	go tool cover -html=coverage.out
    51  	rm coverage.out
    52  
    53  # vet runs the Go source code static analysis tool `vet` to find
    54  # any common errors.
    55  vet:
    56  	@go tool vet 2>/dev/null ; if [ $$? -eq 3 ]; then \
    57  		go get golang.org/x/tools/cmd/vet; \
    58  	fi
    59  	@echo "go tool vet $(VETARGS) ."
    60  	@go tool vet $(VETARGS) . ; if [ $$? -eq 1 ]; then \
    61  		echo ""; \
    62  		echo "Vet found suspicious constructs. Please check the reported constructs"; \
    63  		echo "and fix them if necessary before submitting the code for review."; \
    64  	fi
    65  
    66  # generate runs `go generate` to build the dynamically generated
    67  # source files.
    68  generate:
    69  	find . -type f -name '.DS_Store' -delete
    70  	go generate ./...
    71  
    72  .PHONY: bin default generate test updatedeps vet