Makefile 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  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 build_all_targets
  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.mod builder.json *.go &
  27. editor:
  28. gofmt -l -s -w *.go
  29. build_all_targets:
  30. GOOS=darwin GOARCH=amd64 go build
  31. GOOS=darwin GOARCH=amd64 staticcheck
  32. GOOS=darwin GOARCH=arm64 go build
  33. GOOS=darwin GOARCH=arm64 staticcheck
  34. GOOS=freebsd GOARCH=386 go build
  35. GOOS=freebsd GOARCH=386 staticcheck
  36. GOOS=freebsd GOARCH=amd64 go build
  37. GOOS=freebsd GOARCH=amd64 staticcheck
  38. GOOS=freebsd GOARCH=arm go build
  39. GOOS=freebsd GOARCH=arm staticcheck
  40. GOOS=freebsd GOARCH=arm64 go build
  41. GOOS=freebsd GOARCH=arm64 staticcheck
  42. GOOS=illumos GOARCH=amd64 go build
  43. GOOS=illumos GOARCH=amd64 staticcheck
  44. GOOS=linux GOARCH=386 go build
  45. GOOS=linux GOARCH=386 staticcheck
  46. GOOS=linux GOARCH=amd64 go build
  47. GOOS=linux GOARCH=amd64 staticcheck
  48. GOOS=linux GOARCH=arm go build
  49. GOOS=linux GOARCH=arm staticcheck
  50. GOOS=linux GOARCH=arm64 go build
  51. GOOS=linux GOARCH=arm64 staticcheck
  52. GOOS=linux GOARCH=loong64 go build
  53. GOOS=linux GOARCH=loong64 staticcheck
  54. GOOS=linux GOARCH=mips go build
  55. GOOS=linux GOARCH=mips staticcheck
  56. GOOS=linux GOARCH=mips64le go build
  57. GOOS=linux GOARCH=mips64le staticcheck
  58. GOOS=linux GOARCH=mipsle go build
  59. GOOS=linux GOARCH=mipsle staticcheck
  60. GOOS=linux GOARCH=ppc64le go build
  61. GOOS=linux GOARCH=ppc64le staticcheck
  62. GOOS=linux GOARCH=riscv64 go build
  63. GOOS=linux GOARCH=riscv64 staticcheck
  64. GOOS=linux GOARCH=s390x go build
  65. GOOS=linux GOARCH=s390x staticcheck
  66. GOOS=netbsd GOARCH=386 go build
  67. GOOS=netbsd GOARCH=386 staticcheck
  68. GOOS=netbsd GOARCH=amd64 go build
  69. GOOS=netbsd GOARCH=amd64 staticcheck
  70. GOOS=netbsd GOARCH=arm go build
  71. GOOS=netbsd GOARCH=arm staticcheck
  72. GOOS=openbsd GOARCH=386 go build
  73. GOOS=openbsd GOARCH=386 staticcheck
  74. GOOS=openbsd GOARCH=amd64 go build
  75. GOOS=openbsd GOARCH=amd64 staticcheck
  76. GOOS=openbsd GOARCH=arm64 go build
  77. GOOS=openbsd GOARCH=arm64 staticcheck
  78. GOOS=windows GOARCH=386 go build
  79. GOOS=windows GOARCH=386 staticcheck
  80. GOOS=windows GOARCH=amd64 go build
  81. GOOS=windows GOARCH=amd64 staticcheck
  82. GOOS=windows GOARCH=arm64 go build
  83. GOOS=windows GOARCH=arm64 staticcheck
  84. internalError:
  85. egrep -ho '"internal error.*"' *.go | sort | cat -n
  86. later:
  87. @grep -n $(grep) LATER * || true
  88. @grep -n $(grep) MAYBE * || true
  89. mem: clean
  90. go test -run @ -bench . -memprofile mem.out -memprofilerate 1 -timeout 24h
  91. go tool pprof -lines -web -alloc_space *.test mem.out
  92. nuke: clean
  93. go clean -i
  94. todo:
  95. @grep -nr $(grep) ^[[:space:]]*_[[:space:]]*=[[:space:]][[:alpha:]][[:alnum:]]* * | grep -v $(ngrep) || true
  96. @grep -nr $(grep) TODO * | grep -v $(ngrep) || true
  97. @grep -nr $(grep) BUG * | grep -v $(ngrep) || true
  98. @grep -nr $(grep) [^[:alpha:]]println * | grep -v $(ngrep) || true