Makefile 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. # Copyright (c) 2016 The mathutil 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. unconvert || true
  13. maligned || true
  14. staticcheck || true
  15. clean:
  16. go clean
  17. rm -f *~ *.test *.out
  18. cover:
  19. t=$(shell tempfile) ; go test -coverprofile $$t && go tool cover -html $$t && unlink $$t
  20. cpu: clean
  21. go test -run @ -bench . -cpuprofile cpu.out
  22. go tool pprof -lines *.test cpu.out
  23. edit:
  24. @ 1>/dev/null 2>/dev/null gvim -p Makefile go.mod builder.json *.go &
  25. editor:
  26. gofmt -l -s -w *.go
  27. go test
  28. go build
  29. internalError:
  30. egrep -ho '"internal error.*"' *.go | sort | cat -n
  31. later:
  32. @grep -n $(grep) LATER * || true
  33. @grep -n $(grep) MAYBE * || true
  34. mem: clean
  35. go test -run @ -bench . -memprofile mem.out -memprofilerate 1 -timeout 24h
  36. go tool pprof -lines -web -alloc_space *.test mem.out
  37. nuke: clean
  38. go clean -i
  39. todo:
  40. @grep -nr $(grep) ^[[:space:]]*_[[:space:]]*=[[:space:]][[:alpha:]][[:alnum:]]* * | grep -v $(ngrep) || true
  41. @grep -nr $(grep) TODO * | grep -v $(ngrep) || true
  42. @grep -nr $(grep) BUG * | grep -v $(ngrep) || true
  43. @grep -nr $(grep) [^[:alpha:]]println * | grep -v $(ngrep) || true