github.com/fanyang01/ql@v1.1.1-0.20170406094456-9cac60d33e9d/Makefile (about) 1 # Copyright (c) 2014 The ql 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 --exclude=ql.y 8 ngrep='TODOOK\|parser\.go\|scanner\.go\|.*_string\.go' 9 10 all: editor scanner.go parser.go 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 18 go install ./... 19 20 bench: all 21 go test -run NONE -bench . 22 23 clean: 24 go clean 25 rm -f *~ y.go y.tab.c *.out *.test 26 27 coerce.go: helper/helper.go 28 if [ -f coerce.go ] ; then rm coerce.go ; fi 29 go run helper/helper.go | gofmt > $@ 30 31 cover: 32 t=$(shell tempfile) ; go test -coverprofile $$t && go tool cover -html $$t && unlink $$t 33 34 cpu: clean 35 go test -run @ -bench . -cpuprofile cpu.out 36 go tool pprof -lines *.test cpu.out 37 38 edit: 39 @ 1>/dev/null 2>/dev/null gvim -p Makefile *.l *.y *.go testdata.ql testdata.log 40 41 editor: ql.y scanner.go parser.go coerce.go 42 gofmt -s -l -w *.go 43 go test -i 44 go test 2>&1 | tee log 45 46 internalError: 47 egrep -ho '"internal error.*"' *.go | sort | cat -n 48 49 later: 50 @grep -n $(grep) LATER * || true 51 @grep -n $(grep) MAYBE * || true 52 53 mem: clean 54 go test -run @ -bench . -memprofile mem.out -memprofilerate 1 -timeout 24h 55 go tool pprof -lines -web -alloc_space *.test mem.out 56 57 nuke: clean 58 go clean -i 59 60 parser.go: parser.y 61 a=$(shell tempfile) ; \ 62 goyacc -o /dev/null -xegen $$a $< ; \ 63 goyacc -cr -o $@ -xe $$a $< ; \ 64 rm -f $$a 65 sed -i -e 's|//line.*||' -e 's/yyEofCode/yyEOFCode/' $@ 66 67 ql.y: doc.go 68 sed -n '1,/^package/ s/^\/\/ //p' < $< \ 69 | ebnf2y -o $@ -oe $*.ebnf -start StatementList -pkg $* -p _ 70 goyacc -cr -o /dev/null $@ 71 72 scanner.go: scanner.l parser.go 73 golex -o $@ $< 74 75 todo: 76 @grep -nr $(grep) ^[[:space:]]*_[[:space:]]*=[[:space:]][[:alpha:]][[:alnum:]]* * || true 77 @grep -nr $(grep) TODO * || true 78 @grep -nr $(grep) BUG * || true 79 @grep -nr $(grep) [^[:alpha:]]println * || true