modernc.org/xdmcp@v1.0.17/Makefile (about)

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