modernc.org/xau@v1.0.16/Makefile (about)

     1  # Copyright 2021 The Xau-Go 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 generate
     6  
     7  grep=--include=*.go
     8  ngrep='TODOOK\|internalError\|testdata\|scanner.go\|parser.go\|ast.go\|assets.go\|TODO-'
     9  
    10  
    11  all:
    12  	@LC_ALL=C date
    13  	@go version 2>&1 | tee log
    14  	@gofmt -l -s -w *.go
    15  	@go install -v ./...
    16  	@go test -i
    17  	@go test 2>&1 -timeout 1h | tee -a log
    18  	@go vet 2>&1 | grep -v $(ngrep) || true
    19  	@golint 2>&1 | grep -v $(ngrep) || true
    20  	@make todo
    21  	@misspell *.go
    22  	@staticcheck | grep -v 'scanner\.go' || true
    23  	@maligned || true
    24  	@grep -n --color=always 'FAIL\|PASS' log 
    25  	LC_ALL=C date 2>&1 | tee -a log
    26  
    27  generate:
    28  	go generate 2>&1 | tee log-generate
    29  	go build -v ./...
    30  
    31  build_all_targets:
    32  	GOOS=darwin GOARCH=amd64 go build -v ./...
    33  	GOOS=darwin GOARCH=amd64 go test -c -o /dev/null
    34  	GOOS=darwin GOARCH=arm64 go build -v ./...
    35  	GOOS=darwin GOARCH=arm64 go test -c -o /dev/null
    36  	GOOS=linux GOARCH=386 go build -v ./...
    37  	GOOS=linux GOARCH=386 go test -c -o /dev/null
    38  	GOOS=linux GOARCH=amd64 go build -v ./...
    39  	GOOS=linux GOARCH=amd64 go test -c -o /dev/null
    40  	GOOS=linux GOARCH=arm go build -v ./...
    41  	GOOS=linux GOARCH=arm go test -c -o /dev/null
    42  	GOOS=linux GOARCH=arm64 go build -v ./...
    43  	GOOS=linux GOARCH=arm64 go test -c -o /dev/null
    44  
    45  darwin_amd64:
    46  	@echo "Should be executed only on darwin/amd64."
    47  	make generate
    48  
    49  darwin_arm64:
    50  	@echo "Should be executed only on darwin/amd64."
    51  	make generate
    52  
    53  linux_amd64:
    54  	@echo "Should be executed only on linux/amd64."
    55  	make generate
    56  
    57  linux_386:
    58  	@echo "Should be executed only on linux/386."
    59  	make generate
    60  
    61  linux_arm:
    62  	@echo "Should be executed only on linux/arm."
    63  	make generate
    64  
    65  linux_arm64:
    66  	@echo "Should be executed only on linux/arm64."
    67  	make generate
    68  
    69  devbench:
    70  	date 2>&1 | tee log-devbench
    71  	go test -timeout 24h -dev -run @ -bench . 2>&1 | tee -a log-devbench
    72  	grep -n 'FAIL\|SKIP' log-devbench || true
    73  
    74  bench:
    75  	date 2>&1 | tee log-bench
    76  	go test -timeout 24h -v -run '^[^E]' -bench . 2>&1 | tee -a log-bench
    77  	grep -n 'FAIL\|SKIP' log-bench || true
    78  
    79  clean:
    80  	go clean
    81  	rm -f *~ *.test *.out
    82  
    83  cover:
    84  	t=$(shell mktemp) ; go test -coverprofile $$t && go tool cover -html $$t && unlink $$t
    85  
    86  cpu: clean
    87  	go test -run @ -bench . -cpuprofile cpu.out
    88  	go tool pprof -lines *.test cpu.out
    89  
    90  edit:
    91  	@touch log
    92  	@if [ -f "Session.vim" ]; then gvim -S & else gvim -p Makefile *.go & fi
    93  
    94  editor:
    95  	gofmt -l -s -w *.go
    96  	nilness .
    97  	GO111MODULE=off go install -v 2>&1 | tee log-install
    98  
    99  later:
   100  	@grep -n $(grep) LATER * || true
   101  	@grep -n $(grep) MAYBE * || true
   102  
   103  mem: clean
   104  	go test -run @ -dev -bench . -memprofile mem.out -timeout 24h
   105  	go tool pprof -lines -web -alloc_space *.test mem.out
   106  
   107  nuke: clean
   108  	go clean -i
   109  
   110  todo:
   111  	@grep -nr $(grep) ^[[:space:]]*_[[:space:]]*=[[:space:]][[:alpha:]][[:alnum:]]* * | grep -v $(ngrep) || true
   112  	@grep -nrw $(grep) 'TODO\|panic' * | grep -v $(ngrep) || true
   113  	@grep -nr $(grep) BUG * | grep -v $(ngrep) || true
   114  	@grep -nr $(grep) [^[:alpha:]]println * | grep -v $(ngrep) || true
   115  	@grep -nir $(grep) 'work.*progress' || true