modernc.org/xcb@v1.0.15/Makefile (about)

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