Makefile 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. # Copyright 2017 The Memory 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. .PHONY: all clean cover cpu editor internalError later mem nuke todo edit
  5. grep=--include=*.go --include=*.l --include=*.y --include=*.yy
  6. ngrep='TODOOK\|parser\.go\|scanner\.go\|.*_string\.go'
  7. all: editor
  8. go vet 2>&1 | grep -v $(ngrep) || true
  9. golint 2>&1 | grep -v $(ngrep) || true
  10. make todo
  11. misspell *.go
  12. maligned || true
  13. unconvert -apply
  14. staticcheck | grep -v 'lexer\.go' || true
  15. grep -n 'FAIL\|PASS' log
  16. date
  17. clean:
  18. go clean
  19. rm -f *~ *.test *.out
  20. cover:
  21. t=$(shell tempfile) ; go test -coverprofile $$t && go tool cover -html $$t && unlink $$t
  22. cpu: clean
  23. go test -run @ -bench . -cpuprofile cpu.out
  24. go tool pprof -lines *.test cpu.out
  25. edit:
  26. @ 1>/dev/null 2>/dev/null gvim -p Makefile *.go &
  27. editor:
  28. gofmt -l -s -w *.go
  29. GOOS=darwin GOARCH=amd64 go build
  30. GOOS=darwin GOARCH=arm64 go build
  31. GOOS=freebsd GOARCH=386 go build
  32. GOOS=freebsd GOARCH=amd64 go build
  33. GOOS=freebsd GOARCH=arm go build
  34. GOOS=freebsd GOARCH=arm64 go build
  35. GOOS=illumos GOARCH=amd64 go build
  36. GOOS=linux GOARCH=386 go build
  37. GOOS=linux GOARCH=amd64 go build
  38. GOOS=linux GOARCH=arm go build
  39. GOOS=linux GOARCH=arm64 go build
  40. GOOS=linux GOARCH=mips go build
  41. GOOS=linux GOARCH=mips64le go build
  42. GOOS=linux GOARCH=mipsle go build
  43. GOOS=linux GOARCH=riscv64 go build
  44. GOOS=linux GOARCH=s390x go build
  45. GOOS=netbsd GOARCH=386 go build
  46. GOOS=netbsd GOARCH=amd64 go build
  47. GOOS=netbsd GOARCH=arm go build
  48. GOOS=openbsd GOARCH=386 go build
  49. GOOS=openbsd GOARCH=amd64 go build
  50. GOOS=openbsd GOARCH=arm64 go build
  51. GOOS=windows GOARCH=386 go build
  52. GOOS=windows GOARCH=amd64 go build
  53. internalError:
  54. egrep -ho '"internal error.*"' *.go | sort | cat -n
  55. later:
  56. @grep -n $(grep) LATER * || true
  57. @grep -n $(grep) MAYBE * || true
  58. mem: clean
  59. go test -run @ -bench . -memprofile mem.out -memprofilerate 1 -timeout 24h
  60. go tool pprof -lines -web -alloc_space *.test mem.out
  61. nuke: clean
  62. go clean -i
  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