source: code/trunk/vendor/modernc.org/cc/v3/Makefile@ 822

Last change on this file since 822 was 822, checked in by yakumo.izuru, 22 months ago

Prefer immortal.run over runit and rc.d, use vendored modules
for convenience.

Signed-off-by: Izuru Yakumo <yakumo.izuru@…>

File size: 4.0 KB
Line 
1# Copyright 2019 The CC 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 bench clean cover cpu editor internalError later mem nuke todo edit devbench
6
7grep=--include=*.go --include=*.l --include=*.y --include=*.yy
8ngrep='internalError\|TODOOK\|lexer\.go\|ast.go\|trigraphs\.go\|.*_string\.go\|stringer\.go\|testdata\/gcc'
9testlog=testdata/testlog-$(shell echo $$GOOS)-$(shell echo $$GOARCH)-on-$(shell go env GOOS)-$(shell go env GOARCH)
10
11all: lexer.go
12 LC_ALL=C make all_log 2>&1 | tee log
13
14all_log:
15 date
16 go version
17 uname -a
18 ./unconvert.sh
19 gofmt -l -s -w *.go
20 GOOS=darwin GOARCH=amd64 go build
21 GOOS=darwin GOARCH=arm64 go build
22 GOOS=linux GOARCH=386 go build
23 GOOS=linux GOARCH=amd64 go build
24 GOOS=linux GOARCH=arm go build
25 GOOS=windows GOARCH=386 go build
26 GOOS=windows GOARCH=amd64 go build
27 go vet | grep -v $(ngrep) || true
28 golint | grep -v $(ngrep) || true
29 misspell *.go
30 staticcheck | grep -v 'lexer\.go' || true
31 pcregrep -nM 'FAIL|false|<nil>|:\n}' ast_test.go || true
32
33test:
34 go version | tee $(testlog)
35 uname -a | tee -a $(testlog)
36 go test -v -timeout 24h | tee -a $(testlog)
37 grep -ni fail $(testlog) | tee -a $(testlog) || true
38 LC_ALL=C date | tee -a $(testlog)
39 grep -ni --color=always fail $(testlog) || true
40
41test_linux_amd64:
42 GOOS=linux GOARCH=amd64 make test
43
44test_linux_386:
45 GOOS=linux GOARCH=386 make test
46
47test_linux_arm:
48 GOOS=linux GOARCH=arm make test
49
50test_linux_arm64:
51 GOOS=linux GOARCH=arm64 make test
52
53test_windows_amd64:
54 go version
55 go test -v -timeout 24h
56
57test_windows386:
58 go version
59 go test -v -timeout 24h
60
61build_all_targets:
62 GOOS=darwin GOARCH=amd64 go build -v ./...
63 GOOS=darwin GOARCH=arm64 go build -v ./...
64 GOOS=freebsd GOARCH=386 go build -v ./...
65 GOOS=freebsd GOARCH=amd64 go build -v ./...
66 GOOS=freebsd GOARCH=arm go build -v ./...
67 GOOS=freebsd GOARCH=arm64 go build -v ./...
68 GOOS=linux GOARCH=386 go build -v ./...
69 GOOS=linux GOARCH=amd64 go build -v ./...
70 GOOS=linux GOARCH=arm go build -v ./...
71 GOOS=linux GOARCH=arm64 go build -v ./...
72 GOOS=linux GOARCH=ppc64le go build -v ./...
73 GOOS=linux GOARCH=riscv64 go build -v ./...
74 GOOS=linux GOARCH=s390x go build -v ./...
75 GOOS=netbsd GOARCH=amd64 go build -v ./...
76 GOOS=netbsd GOARCH=arm go build -v ./...
77 GOOS=netbsd GOARCH=386 go build -v ./...
78 GOOS=openbsd GOARCH=amd64 go build -v ./...
79 GOOS=openbsd GOARCH=arm64 go build -v ./...
80 GOOS=openbsd GOARCH=386 go build -v ./...
81 GOOS=windows GOARCH=386 go build -v ./...
82 GOOS=windows GOARCH=amd64 go build -v ./...
83 GOOS=windows GOARCH=arm64 go build -v ./...
84
85devbench:
86 date 2>&1 | tee log-devbench
87 go test -timeout 24h -dev -run @ -bench . 2>&1 | tee -a log-devbench
88 grep -n 'FAIL\|SKIP' log-devbench || true
89
90bench:
91 date 2>&1 | tee log-bench
92 go test -timeout 24h -v -run '^[^E]' -bench . 2>&1 | tee -a log-bench
93 grep -n 'FAIL\|SKIP' log-bench || true
94
95clean:
96 go clean
97 rm -f *~ *.test *.out
98
99cover:
100 t=$(shell mktemp) ; go test -coverprofile $$t && go tool cover -html $$t && unlink $$t
101
102cpu: clean
103 go test -run @ -bench . -cpuprofile cpu.out
104 go tool pprof -lines *.test cpu.out
105
106edit:
107 @touch log
108 @if [ -f "Session.vim" ]; then gvim -S & else gvim -p Makefile *.go & fi
109
110editor: lexer.go
111 gofmt -l -s -w *.go
112 go test -o /dev/null -c
113 go install 2>&1 | tee log
114
115ast.go lexer.go stringer.go: lexer.l parser.yy enum.go
116 go generate
117
118later:
119 @grep -n $(grep) LATER * || true
120 @grep -n $(grep) MAYBE * || true
121
122mem: clean
123 # go test -v -run ParserCS -csmith 2m -memprofile mem.out -timeout 24h
124 # go test -v -run @ -bench BenchmarkScanner -memprofile mem.out -timeout 24h
125 go test -v -run TestTranslateSQLite -memprofile mem.out -timeout 24h
126 go tool pprof -lines -web -alloc_space *.test mem.out
127
128nuke: clean
129 go clean -i
130
131todo:
132 @grep -nr $(grep) ^[[:space:]]*_[[:space:]]*=[[:space:]][[:alpha:]][[:alnum:]]* * | grep -v $(ngrep) || true
133 @grep -nr $(grep) 'TODO\|panic' * | grep -v $(ngrep) || true
134 @grep -nr $(grep) BUG * | grep -v $(ngrep) || true
135 @grep -nr $(grep) [^[:alpha:]]println * | grep -v $(ngrep) || true
Note: See TracBrowser for help on using the repository browser.