modernc.org/cc@v1.0.1/v2/Makefile (about)

     1  # Copyright 2017 The CC 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\|trigraphs\.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  	misspell *.go
    15  	staticcheck || true
    16  	maligned || true
    17  	grep -n 'FAIL\|PASS' log
    18  	go version
    19  	date
    20  
    21  clean:
    22  	go clean
    23  	rm -f *~ *.test *.out
    24  
    25  cover:
    26  	t=$(shell tempfile) ; go test -coverprofile $$t && go tool cover -html $$t && unlink $$t
    27  
    28  cpu: clean
    29  	go test -run @ -bench . -cpuprofile cpu.out
    30  	go tool pprof -lines *.test cpu.out
    31  
    32  edit:
    33  	touch log
    34  	gvim -p Makefile *.l *.yy *_test.go log ast2.go cc.go cpp.go encoding.go enum.go etc.go lexer.go model.go operand.go type.go
    35  
    36  editor: ast.go parser.go scanner.go trigraphs.go stringer.go
    37  	go version
    38  	./unconvert.sh
    39  	gofmt -l -s -w *.go
    40  	#TODO GOOS=linux GOARCH=arm go build
    41  	#TODO GOOS=linux GOARCH=386 go build
    42  	GOOS=linux GOARCH=amd64 go build
    43  	#TODO GOOS=windows GOARCH=386 go build
    44  	#TODO GOOS=windows GOARCH=amd64 go build
    45  	go test -i
    46  	go test -short 2>&1 | tee log
    47  	go install
    48  
    49  internalError:
    50  	egrep -ho '"internal error.*"' *.go | sort | cat -n
    51  
    52  later:
    53  	@grep -n $(grep) LATER * || true
    54  	@grep -n $(grep) MAYBE * || true
    55  
    56  mem: clean
    57  	go test -run @ -bench . -memprofile mem.out -memprofilerate 1 -timeout 24h
    58  	go tool pprof -lines -web -alloc_space *.test mem.out
    59  
    60  nuke: clean
    61  	go clean -i
    62  
    63  todo:
    64  	@grep -nr $(grep) ^[[:space:]]*_[[:space:]]*=[[:space:]][[:alpha:]][[:alnum:]]* * | grep -v $(ngrep) || true
    65  	@grep -nr $(grep) TODO * | grep -v $(ngrep) || true
    66  	@grep -nr $(grep) BUG * | grep -v $(ngrep) || true
    67  	@grep -nr $(grep) [^[:alpha:]]println * | grep -v $(ngrep) || true
    68  
    69  ast.go parser.go scanner.go trigraphs.go stringer.go: parser.yy scanner.l trigraphs.l enum.go
    70  	go generate