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