github.com/cznic/memory@v0.0.0-20181122101858-44f9dcde99e8/Makefile (about)

     1  # Copyright 2017 The Memory Authors. All rights reserved.
     2  # Use of this source code is governed by a BSD-style
     3  # license that can be found in the LICENSE file.
     4  
     5  .PHONY:	all clean cover cpu editor internalError later mem nuke todo edit
     6  
     7  grep=--include=*.go --include=*.l --include=*.y --include=*.yy
     8  ngrep='TODOOK\|parser\.go\|scanner\.go\|.*_string\.go'
     9  
    10  all: editor
    11  	go vet 2>&1 | grep -v $(ngrep) || true
    12  	golint 2>&1 | grep -v $(ngrep) || true
    13  	make todo
    14  	unused . || true
    15  	misspell *.go
    16  	gosimple || true
    17  	maligned || true
    18  	unconvert -apply
    19  
    20  clean:
    21  	go clean
    22  	rm -f *~ *.test *.out
    23  
    24  cover:
    25  	t=$(shell tempfile) ; go test -coverprofile $$t && go tool cover -html $$t && unlink $$t
    26  
    27  cpu: clean
    28  	go test -run @ -bench . -cpuprofile cpu.out
    29  	go tool pprof -lines *.test cpu.out
    30  
    31  edit:
    32  	@ 1>/dev/null 2>/dev/null gvim -p Makefile *.go
    33  
    34  editor:
    35  	gofmt -l -s -w *.go
    36  	go test -i
    37  	GOARCH=386 go build
    38  	GOARCH=amd64 go build
    39  	go test 2>&1 | tee log
    40  
    41  internalError:
    42  	egrep -ho '"internal error.*"' *.go | sort | cat -n
    43  
    44  later:
    45  	@grep -n $(grep) LATER * || true
    46  	@grep -n $(grep) MAYBE * || true
    47  
    48  mem: clean
    49  	go test -run @ -bench . -memprofile mem.out -memprofilerate 1 -timeout 24h
    50  	go tool pprof -lines -web -alloc_space *.test mem.out
    51  
    52  nuke: clean
    53  	go clean -i
    54  
    55  todo:
    56  	@grep -nr $(grep) ^[[:space:]]*_[[:space:]]*=[[:space:]][[:alpha:]][[:alnum:]]* * | grep -v $(ngrep) || true
    57  	@grep -nr $(grep) TODO * | grep -v $(ngrep) || true
    58  	@grep -nr $(grep) BUG * | grep -v $(ngrep) || true
    59  	@grep -nr $(grep) [^[:alpha:]]println * | grep -v $(ngrep) || true