modernc.org/gc@v1.0.1-0.20240304020402-f0dba7c97c2b/Makefile (about)

     1  # Copyright 2016 The GC 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 fuzz fuzz2 fuzz-more
     6  
     7  grep=--include=*.go --include=*.l --include=*.y --include=*.yy
     8  ngrep='TODOOK\|.*_string\.go\|testdata/errchk'
     9  
    10  all: editor0 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  	unconvert -apply || true
    18  	maligned || true
    19  
    20  clean:
    21  	go clean
    22  	rm -f *~ *.test *.out gc-fuzz.zip y.output
    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 Checker/StdCh$$ -cpuprofile cpu.out
    29  	go tool pprof -web *.test cpu.out
    30  
    31  edit:
    32  	touch errchk.log log
    33  	@2>/dev/null gvim -p Makefile errchk.log log *.go
    34  
    35  editor0:
    36  	go generate 2>&1 | tee -a log
    37  	go test -i
    38  	go test -run Example | fe
    39  	grep -n Invalid example_test.go || true
    40  
    41  editor:
    42  	@echo $(shell LC_TIME=c date) | tee log
    43  	gofmt -l -s -w *.go
    44  	go test -i
    45  	go test -noerrchk 2>&1 | tee -a log
    46  	@echo $(shell LC_TIME=c date) | tee errchk.log
    47  	go test -run TestErrchk -chk.summary 2>&1 | tee -a errchk.log
    48  	sed -i -e s\\$(shell pwd)\/\\\\ errchk.log
    49  	go build
    50  	grep -n '^TODO\|[^X]TODO' errchk.log | tee -a errchk.log
    51  	go test -run @ -bench . -benchmem | tee -a errchk.log
    52  	git diff errchk.log
    53  
    54  fuzz:
    55  	go-fuzz-build -func FuzzLexer modernc.org/gc-priv
    56  	rm -rf testdata/fuzz/lexer/corpus/ testdata/fuzz/lexer/crashers/ testdata/fuzz/lexer/suppressions/
    57  	-go-fuzz -bin gc-fuzz.zip -workdir testdata/fuzz/lexer/
    58  
    59  fuzz-more:
    60  	-go-fuzz -bin gc-fuzz.zip -workdir testdata/fuzz/lexer/
    61  
    62  fuzz2:
    63  	cat $$(ls testdata/fuzz/lexer/crashers/*.output | head -n 1)
    64  
    65  internalError:
    66  	egrep -ho '"internal error.*"' *.go | sort | cat -n
    67  
    68  later:
    69  	@grep -n $(grep) LATER * || true
    70  	@grep -n $(grep) MAYBE * || true
    71  
    72  mem: clean
    73  	go test -run @ -bench Parser/Std$$ -memprofile mem.out -memprofilerate 1 -timeout 24h
    74  	go tool pprof -lines -web -alloc_space *.test mem.out
    75  
    76  nuke: clean
    77  	go clean -i
    78  
    79  todo:
    80  	@grep -nr $(grep) ^[[:space:]]*_[[:space:]]*=[[:space:]][[:alpha:]][[:alnum:]]* * | grep -v $(ngrep) || true
    81  	@grep -nr $(grep) TODO * | grep -v $(ngrep) || true
    82  	@grep -nr $(grep) BUG * | grep -v $(ngrep) || true
    83  	@grep -nr $(grep) [^[:alpha:]]println * | grep -v $(ngrep) || true