2021-08-29 16:41:41 +02:00
|
|
|
# Copyright 2019 The Libc Authors. All rights reserved.
|
|
|
|
# Use of this source code is governed by a BSD-style
|
|
|
|
# license that can be found in the LICENSE file.
|
|
|
|
|
2023-11-06 15:40:53 +01:00
|
|
|
.PHONY: all bench build_all_targets clean cover cpu editor internalError later mem nuke todo edit work devbench \
|
2021-08-29 16:41:41 +02:00
|
|
|
darwin_amd64 \
|
|
|
|
darwin_arm64 \
|
|
|
|
linux_386 \
|
|
|
|
linux_amd64 \
|
|
|
|
linux_arm \
|
|
|
|
linux_arm64 \
|
|
|
|
|
|
|
|
|
|
|
|
grep=--include=*.go --include=*.l --include=*.y --include=*.yy --include=*.qbe --include=*.ssa
|
|
|
|
ngrep='internalError\|TODOOK'
|
|
|
|
log=log-$(shell go env GOOS)-$(shell go env GOARCH)
|
|
|
|
|
|
|
|
all:
|
|
|
|
date
|
|
|
|
go version 2>&1 | tee $(log)
|
|
|
|
go generate
|
|
|
|
gofmt -l -s -w *.go
|
|
|
|
go install -v ./...
|
2022-08-15 12:35:05 +02:00
|
|
|
go test
|
2021-08-29 16:41:41 +02:00
|
|
|
go test 2>&1 -timeout 1h | tee -a $(log)
|
2022-08-15 12:35:05 +02:00
|
|
|
# go vet -unsafeptr=false 2>&1 | grep -v $(ngrep) || true
|
|
|
|
# golint 2>&1 | grep -v $(ngrep) || true
|
|
|
|
# make todo
|
|
|
|
# misspell *.go
|
|
|
|
# staticcheck || true
|
2021-08-29 16:41:41 +02:00
|
|
|
grep -n 'FAIL\|PASS' $(log)
|
|
|
|
go version
|
|
|
|
date 2>&1 | tee -a $(log)
|
|
|
|
|
2022-11-28 11:19:39 +01:00
|
|
|
build_all_targets:
|
|
|
|
./build_all_targets.sh
|
|
|
|
echo done
|
|
|
|
|
2021-08-29 16:41:41 +02:00
|
|
|
darwin_amd64:
|
2021-11-27 15:26:58 +01:00
|
|
|
@echo "Should be executed only on darwin/amd64."
|
|
|
|
go generate 2>&1 | tee log-generate
|
|
|
|
go build -v ./...
|
2021-08-29 16:41:41 +02:00
|
|
|
|
|
|
|
darwin_arm64:
|
2021-11-27 15:26:58 +01:00
|
|
|
@echo "Should be executed only on darwin/arm64."
|
|
|
|
go generate 2>&1 | tee log-generate
|
|
|
|
go build -v ./...
|
2021-08-29 16:41:41 +02:00
|
|
|
|
2021-09-08 22:12:23 +02:00
|
|
|
# only on freebsd/amd64
|
|
|
|
freebsd_amd64:
|
2021-11-27 15:26:58 +01:00
|
|
|
@echo "Should be executed only on freebsd/amd64."
|
|
|
|
go generate 2>&1 | tee log-generate
|
|
|
|
go build -v ./...
|
|
|
|
|
2022-03-07 11:08:26 +01:00
|
|
|
# only on freebsd/386
|
|
|
|
freebsd_386:
|
|
|
|
@echo "Should be executed only on freebsd/386."
|
|
|
|
go generate 2>&1 | tee log-generate
|
|
|
|
go build -v ./...
|
|
|
|
|
2022-09-28 19:30:40 +02:00
|
|
|
# only on freebsd/arm
|
|
|
|
freebsd_arm:
|
|
|
|
@echo "Should be executed only on freebsd/arm."
|
|
|
|
go generate 2>&1 | tee log-generate
|
|
|
|
go build -v ./...
|
|
|
|
|
2022-11-28 11:19:39 +01:00
|
|
|
freebsd_arm64:
|
|
|
|
go run addport.go freebsd_amd64 freebsd_arm64
|
|
|
|
go build -v ./...
|
|
|
|
|
2021-11-27 15:26:58 +01:00
|
|
|
# only on netbsd/amd64
|
|
|
|
netbsd_amd64:
|
|
|
|
@echo "Should be executed only on netbsd/amd64."
|
|
|
|
go generate 2>&1 | tee log-generate
|
|
|
|
go build -v ./...
|
2021-09-08 22:12:23 +02:00
|
|
|
|
2022-11-28 11:19:39 +01:00
|
|
|
# only on netbsd/arm
|
|
|
|
netbsd_arm:
|
|
|
|
@echo "Should be executed only on netbsd/arm."
|
|
|
|
go generate 2>&1 | tee log-generate
|
|
|
|
go build -v ./...
|
|
|
|
|
2021-08-29 16:41:41 +02:00
|
|
|
linux_amd64:
|
2021-11-27 15:26:58 +01:00
|
|
|
@echo "Should be executed only on linux/amd64."
|
|
|
|
go generate 2>&1 | tee log-generate
|
|
|
|
go build -v ./...
|
2021-08-29 16:41:41 +02:00
|
|
|
|
|
|
|
linux_386:
|
|
|
|
CCGO_CPP=i686-linux-gnu-cpp TARGET_GOOS=linux TARGET_GOARCH=386 go generate
|
|
|
|
GOOS=linux GOARCH=386 go build -v ./...
|
|
|
|
|
|
|
|
linux_arm:
|
2021-11-27 15:26:58 +01:00
|
|
|
CCGO_CPP=arm-linux-gnueabi-cpp TARGET_GOOS=linux TARGET_GOARCH=arm go generate
|
2021-08-29 16:41:41 +02:00
|
|
|
GOOS=linux GOARCH=arm go build -v ./...
|
|
|
|
|
|
|
|
linux_arm64:
|
2021-11-27 15:26:58 +01:00
|
|
|
CCGO_CPP=aarch64-linux-gnu-cpp TARGET_GOOS=linux TARGET_GOARCH=arm64 go generate
|
2021-08-29 16:41:41 +02:00
|
|
|
GOOS=linux GOARCH=arm64 go build -v ./...
|
|
|
|
|
|
|
|
linux_s390x:
|
|
|
|
CCGO_CPP=s390x-linux-gnu-cpp TARGET_GOOS=linux TARGET_GOARCH=s390x go generate
|
|
|
|
GOOS=linux GOARCH=s390x go build -v ./...
|
|
|
|
|
2022-05-02 15:05:18 +02:00
|
|
|
linux_ppc64le:
|
|
|
|
CCGO_CPP=powerpc64le-linux-gnu-cpp TARGET_GOOS=linux TARGET_GOARCH=ppc64le go generate
|
|
|
|
GOOS=linux GOARCH=ppc64le go build -v ./...
|
|
|
|
|
2022-03-07 11:08:26 +01:00
|
|
|
# only on openbsd/amd64
|
|
|
|
openbsd_amd64:
|
|
|
|
@echo "Should be executed only on openbsd/amd64."
|
|
|
|
go generate 2>&1 | tee log-generate
|
|
|
|
go build -v ./...
|
2022-09-28 19:30:40 +02:00
|
|
|
#
|
2022-11-28 11:19:39 +01:00
|
|
|
# only on openbsd/386
|
|
|
|
openbsd_386:
|
|
|
|
@echo "Should be executed only on openbsd/386."
|
|
|
|
go generate 2>&1 | tee log-generate
|
|
|
|
go build -v ./...
|
|
|
|
|
2022-09-28 19:30:40 +02:00
|
|
|
# only on openbsd/arm64
|
|
|
|
openbsd_arm64:
|
|
|
|
@echo "Should be executed only on openbsd/arm64."
|
|
|
|
go generate 2>&1 | tee log-generate
|
|
|
|
go build -v ./...
|
2022-03-07 11:08:26 +01:00
|
|
|
|
2021-08-29 16:41:41 +02:00
|
|
|
windows_amd64:
|
2021-11-27 15:26:58 +01:00
|
|
|
@echo "Should be executed only on windows/amd64."
|
|
|
|
go generate 2>&1 | tee log-generate
|
|
|
|
go build -v ./...
|
2021-08-29 16:41:41 +02:00
|
|
|
|
2022-05-02 15:05:18 +02:00
|
|
|
windows_arm64:
|
|
|
|
@echo "Should be executed only on windows/arm64."
|
|
|
|
go generate 2>&1 | tee log-generate
|
|
|
|
go build -v ./...
|
|
|
|
|
2021-08-29 16:41:41 +02:00
|
|
|
windows_386:
|
2021-11-27 15:26:58 +01:00
|
|
|
@echo "Should be executed only on linux/amd64."
|
2021-08-29 16:41:41 +02:00
|
|
|
CCGO_CPP=i686-w64-mingw32-cpp TARGET_GOOS=windows TARGET_GOARCH=386 go generate
|
|
|
|
GOOS=windows GOARCH=386 go build -v ./...
|
|
|
|
|
2021-12-12 15:47:51 +01:00
|
|
|
all_targets: linux_amd64 linux_386 linux_arm linux_arm64 linux_s390x # windows_amd64 windows_386
|
2021-08-29 16:41:41 +02:00
|
|
|
echo done
|
|
|
|
|
|
|
|
devbench:
|
|
|
|
date 2>&1 | tee log-devbench
|
|
|
|
go test -timeout 24h -dev -run @ -bench . 2>&1 | tee -a log-devbench
|
|
|
|
grep -n 'FAIL\|SKIP' log-devbench || true
|
|
|
|
|
|
|
|
bench:
|
|
|
|
date 2>&1 | tee log-bench
|
|
|
|
go test -timeout 24h -v -run '^[^E]' -bench . 2>&1 | tee -a log-bench
|
|
|
|
grep -n 'FAIL\|SKIP' log-bench || true
|
|
|
|
|
|
|
|
clean:
|
|
|
|
go clean
|
|
|
|
rm -f *~ *.test *.out
|
|
|
|
|
|
|
|
cover:
|
|
|
|
t=$(shell mktemp) ; go test -coverprofile $$t && go tool cover -html $$t && unlink $$t
|
|
|
|
|
|
|
|
cpu: clean
|
|
|
|
go test -run @ -bench . -cpuprofile cpu.out
|
|
|
|
go tool pprof -lines *.test cpu.out
|
|
|
|
|
|
|
|
edit:
|
|
|
|
@touch log
|
2023-11-06 15:40:53 +01:00
|
|
|
@if [ -f "Session.vim" ]; then novim -S & else novim -p Makefile libc.go & fi
|
2021-08-29 16:41:41 +02:00
|
|
|
|
|
|
|
editor:
|
2023-03-06 11:00:53 +01:00
|
|
|
# go generate 2>&1 | tee log
|
2021-08-29 16:41:41 +02:00
|
|
|
gofmt -l -s -w *.go
|
|
|
|
go test -short 2>&1 | tee -a log
|
|
|
|
go install -v ./...
|
|
|
|
|
|
|
|
later:
|
|
|
|
@grep -n $(grep) LATER * || true
|
|
|
|
@grep -n $(grep) MAYBE * || true
|
|
|
|
|
|
|
|
mem: clean
|
|
|
|
go test -v -run ParserCS -memprofile mem.out -timeout 24h
|
|
|
|
go tool pprof -lines -web -alloc_space *.test mem.out
|
|
|
|
|
|
|
|
nuke: clean
|
|
|
|
go clean -i
|
|
|
|
|
|
|
|
todo:
|
|
|
|
@grep -nr $(grep) ^[[:space:]]*_[[:space:]]*=[[:space:]][[:alpha:]][[:alnum:]]* * | grep -v $(ngrep) || true
|
|
|
|
@grep -nr $(grep) 'TODO\|panic' * | grep -v $(ngrep) || true
|
|
|
|
@grep -nr $(grep) BUG * | grep -v $(ngrep) || true
|
|
|
|
@grep -nr $(grep) [^[:alpha:]]println * | grep -v $(ngrep) || true
|
|
|
|
@grep -nir $(grep) 'work.*progress' || true
|
2023-11-06 15:40:53 +01:00
|
|
|
|
|
|
|
work:
|
|
|
|
rm -f go.work*
|
|
|
|
go work init
|
|
|
|
go work use .
|
|
|
|
go work use ../ccgo/v4
|
|
|
|
go work use ../ccgo/v3
|
|
|
|
go work use ../cc/v4
|