gitlab.com/cznic/ccir@v1.0.0/Makefile (about)

     1  # Copyright 2017 The CCIR 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  	find -name \*.c -or -name \*.h | xargs -n1 indent -linux -l -1
    36  	find -name \*.c~ -or -name \*.h~ | xargs rm
    37  	gofmt -l -s -w .
    38  	go test -i
    39  	go test 2>&1 | tee log
    40  	go install
    41  
    42  internalError:
    43  	egrep -ho '"internal error.*"' *.go | sort | cat -n
    44  
    45  later:
    46  	@grep -n $(grep) LATER * || true
    47  	@grep -n $(grep) MAYBE * || true
    48  
    49  mem: clean
    50  	go test -run @ -bench . -memprofile mem.out -memprofilerate 1 -timeout 24h
    51  	go tool pprof -lines -web -alloc_space *.test mem.out
    52  
    53  nuke: clean
    54  	go clean -i
    55  
    56  todo:
    57  	@grep -nr $(grep) ^[[:space:]]*_[[:space:]]*=[[:space:]][[:alpha:]][[:alnum:]]* * | grep -v $(ngrep) || true
    58  	@grep -n $(grep) TODO * | grep -v $(ngrep) || true
    59  	@grep -n $(grep) BUG * | grep -v $(ngrep) || true
    60  	@grep -nr $(grep) [^[:alpha:]]println * | grep -v $(ngrep) || true