Makefile (5093B)
1 # Copyright 2019 The Libc 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 build_all_targets clean cover cpu editor internalError later mem nuke todo edit devbench \ 6 darwin_amd64 \ 7 darwin_arm64 \ 8 linux_386 \ 9 linux_amd64 \ 10 linux_arm \ 11 linux_arm64 \ 12 13 14 grep=--include=*.go --include=*.l --include=*.y --include=*.yy --include=*.qbe --include=*.ssa 15 ngrep='internalError\|TODOOK' 16 log=log-$(shell go env GOOS)-$(shell go env GOARCH) 17 18 all: 19 date 20 go version 2>&1 | tee $(log) 21 go generate 22 gofmt -l -s -w *.go 23 go install -v ./... 24 go test 25 go test 2>&1 -timeout 1h | tee -a $(log) 26 # go vet -unsafeptr=false 2>&1 | grep -v $(ngrep) || true 27 # golint 2>&1 | grep -v $(ngrep) || true 28 # make todo 29 # misspell *.go 30 # staticcheck || true 31 grep -n 'FAIL\|PASS' $(log) 32 go version 33 date 2>&1 | tee -a $(log) 34 35 build_all_targets: 36 ./build_all_targets.sh 37 echo done 38 39 darwin_amd64: 40 @echo "Should be executed only on darwin/amd64." 41 go generate 2>&1 | tee log-generate 42 go build -v ./... 43 44 darwin_arm64: 45 @echo "Should be executed only on darwin/arm64." 46 go generate 2>&1 | tee log-generate 47 go build -v ./... 48 49 # only on freebsd/amd64 50 freebsd_amd64: 51 @echo "Should be executed only on freebsd/amd64." 52 go generate 2>&1 | tee log-generate 53 go build -v ./... 54 55 # only on freebsd/386 56 freebsd_386: 57 @echo "Should be executed only on freebsd/386." 58 go generate 2>&1 | tee log-generate 59 go build -v ./... 60 61 # only on freebsd/arm 62 freebsd_arm: 63 @echo "Should be executed only on freebsd/arm." 64 go generate 2>&1 | tee log-generate 65 go build -v ./... 66 67 freebsd_arm64: 68 go run addport.go freebsd_amd64 freebsd_arm64 69 go build -v ./... 70 71 # only on netbsd/amd64 72 netbsd_amd64: 73 @echo "Should be executed only on netbsd/amd64." 74 go generate 2>&1 | tee log-generate 75 go build -v ./... 76 77 # only on netbsd/arm 78 netbsd_arm: 79 @echo "Should be executed only on netbsd/arm." 80 go generate 2>&1 | tee log-generate 81 go build -v ./... 82 83 linux_amd64: 84 @echo "Should be executed only on linux/amd64." 85 go generate 2>&1 | tee log-generate 86 go build -v ./... 87 88 linux_386: 89 CCGO_CPP=i686-linux-gnu-cpp TARGET_GOOS=linux TARGET_GOARCH=386 go generate 90 GOOS=linux GOARCH=386 go build -v ./... 91 92 linux_arm: 93 CCGO_CPP=arm-linux-gnueabi-cpp TARGET_GOOS=linux TARGET_GOARCH=arm go generate 94 GOOS=linux GOARCH=arm go build -v ./... 95 96 linux_arm64: 97 CCGO_CPP=aarch64-linux-gnu-cpp TARGET_GOOS=linux TARGET_GOARCH=arm64 go generate 98 GOOS=linux GOARCH=arm64 go build -v ./... 99 100 linux_s390x: 101 CCGO_CPP=s390x-linux-gnu-cpp TARGET_GOOS=linux TARGET_GOARCH=s390x go generate 102 GOOS=linux GOARCH=s390x go build -v ./... 103 104 linux_ppc64le: 105 CCGO_CPP=powerpc64le-linux-gnu-cpp TARGET_GOOS=linux TARGET_GOARCH=ppc64le go generate 106 GOOS=linux GOARCH=ppc64le go build -v ./... 107 108 # only on openbsd/amd64 109 openbsd_amd64: 110 @echo "Should be executed only on openbsd/amd64." 111 go generate 2>&1 | tee log-generate 112 go build -v ./... 113 # 114 # only on openbsd/386 115 openbsd_386: 116 @echo "Should be executed only on openbsd/386." 117 go generate 2>&1 | tee log-generate 118 go build -v ./... 119 120 # only on openbsd/arm64 121 openbsd_arm64: 122 @echo "Should be executed only on openbsd/arm64." 123 go generate 2>&1 | tee log-generate 124 go build -v ./... 125 126 windows_amd64: 127 @echo "Should be executed only on windows/amd64." 128 go generate 2>&1 | tee log-generate 129 go build -v ./... 130 131 windows_arm64: 132 @echo "Should be executed only on windows/arm64." 133 go generate 2>&1 | tee log-generate 134 go build -v ./... 135 136 windows_386: 137 @echo "Should be executed only on linux/amd64." 138 CCGO_CPP=i686-w64-mingw32-cpp TARGET_GOOS=windows TARGET_GOARCH=386 go generate 139 GOOS=windows GOARCH=386 go build -v ./... 140 141 all_targets: linux_amd64 linux_386 linux_arm linux_arm64 linux_s390x # windows_amd64 windows_386 142 echo done 143 144 devbench: 145 date 2>&1 | tee log-devbench 146 go test -timeout 24h -dev -run @ -bench . 2>&1 | tee -a log-devbench 147 grep -n 'FAIL\|SKIP' log-devbench || true 148 149 bench: 150 date 2>&1 | tee log-bench 151 go test -timeout 24h -v -run '^[^E]' -bench . 2>&1 | tee -a log-bench 152 grep -n 'FAIL\|SKIP' log-bench || true 153 154 clean: 155 go clean 156 rm -f *~ *.test *.out 157 158 cover: 159 t=$(shell mktemp) ; go test -coverprofile $$t && go tool cover -html $$t && unlink $$t 160 161 cpu: clean 162 go test -run @ -bench . -cpuprofile cpu.out 163 go tool pprof -lines *.test cpu.out 164 165 edit: 166 @touch log 167 @if [ -f "Session.vim" ]; then gvim -S & else gvim -p Makefile *.go & fi 168 169 editor: 170 # go generate 2>&1 | tee log 171 gofmt -l -s -w *.go 172 go test -short 2>&1 | tee -a log 173 go install -v ./... 174 175 later: 176 @grep -n $(grep) LATER * || true 177 @grep -n $(grep) MAYBE * || true 178 179 mem: clean 180 go test -v -run ParserCS -memprofile mem.out -timeout 24h 181 go tool pprof -lines -web -alloc_space *.test mem.out 182 183 nuke: clean 184 go clean -i 185 186 todo: 187 @grep -nr $(grep) ^[[:space:]]*_[[:space:]]*=[[:space:]][[:alpha:]][[:alnum:]]* * | grep -v $(ngrep) || true 188 @grep -nr $(grep) 'TODO\|panic' * | grep -v $(ngrep) || true 189 @grep -nr $(grep) BUG * | grep -v $(ngrep) || true 190 @grep -nr $(grep) [^[:alpha:]]println * | grep -v $(ngrep) || true 191 @grep -nir $(grep) 'work.*progress' || true