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

     1  # Copyright 2016 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 edit editor internalError later mem nuke todo
     6  
     7  grep=--include=*.go --include=*.l --include=*.y
     8  
     9  all: editor
    10  	rm -f log-*.c log-*.h
    11  	go vet || true
    12  	golint || true
    13  	make todo
    14  	unused . || true
    15  	maligned
    16  	unconvert -apply
    17  
    18  clean:
    19  	rm -f log-*.c log-*.h *~ cpu.test mem.test /tmp/cc-test-* log*.c
    20  	go clean
    21  
    22  cover:
    23  	t=$(shell tempfile) ; go test -coverprofile $$t && go tool cover -html $$t && unlink $$t
    24  
    25  cpu:
    26  	go test -c -o cpu.test
    27  	./cpu.test -noerr -test.cpuprofile cpu.out
    28  	go tool pprof --lines cpu.test cpu.out
    29  
    30  edit:
    31  	gvim -p Makefile trigraphs.l scanner.l parser.yy all_test.go ast2.go cc.go cpp.go encoding.go etc.go lexer.go model.go &
    32  
    33  editor: parser.go scanner.go trigraphs.go
    34  	rm -f log-*.c log-*.h
    35  	gofmt -l -s -w *.go
    36  	rm -f log-*.c log-*.h
    37  	go test -i
    38  	go test 2>&1 | tee log
    39  	go install
    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:
    49  	go test -c -o mem.test
    50  	./mem.test -test.bench . -test.memprofile mem.out
    51  	go tool pprof --lines --web --alloc_space mem.test mem.out
    52  
    53  nuke: clean
    54  	go clean -i
    55  
    56  parser.go scanner.go trigraphs.go: parser.yy trigraphs.l scanner.l
    57  	rm -f log-*.c log-*.h
    58  	go test -i
    59  	go generate
    60  
    61  todo:
    62  	@grep -n $(grep) ^[[:space:]]*_[[:space:]]*=[[:space:]][[:alpha:]][[:alnum:]]* * || true
    63  	@grep -n $(grep) TODO * || true
    64  	@grep -n $(grep) BUG * || true
    65  	@grep -n $(grep) [^[:alpha:]]println * || true