github.com/gnolang/gno@v0.0.0-20240520182011-228e9d0192ce/misc/Makefile (about) 1 .PHONY: help 2 help: 3 @echo "Available make commands:" 4 @cat Makefile | grep '^[a-z][^:]*:' | cut -d: -f1 | sort | sed 's/^/ /' 5 6 # command to run dependency utilities, like goimports. 7 rundep=go run -modfile ../misc/devdeps/go.mod 8 9 ######################################## 10 # Environment variables 11 # You can overwrite any of the following by passing a different value on the 12 # command line, ie. `CGO_ENABLED=1 make test`. 13 14 # disable cgo by default. cgo requires some additional dependencies in some 15 # cases, and is not strictly required by any tm2 code. 16 CGO_ENABLED ?= 0 17 export CGO_ENABLED 18 # flags for `make fmt`. -w will write the result to the destination files. 19 GOFMT_FLAGS ?= -w 20 # flags for `make imports`. 21 GOIMPORTS_FLAGS ?= $(GOFMT_FLAGS) 22 # test suite flags. 23 GOTEST_FLAGS ?= -v -p 1 -timeout=30m 24 # when running `make tidy`, use it to check that the go.mods are up-to-date. 25 VERIFY_MOD_SUMS ?= false 26 27 ######################################## 28 # Dev tools 29 .PHONY: lint 30 lint: 31 $(rundep) github.com/golangci/golangci-lint/cmd/golangci-lint run --config ../.github/golangci.yml ./... 32 33 .PHONY: fmt 34 fmt: 35 $(rundep) mvdan.cc/gofumpt $(GOFMT_FLAGS) . 36 37 ######################################## 38 # Test suite 39 .PHONY: test 40 test: _test.genstd 41 42 .PHONY: _test.genstd 43 _test.genstd: 44 go test ./genstd/... $(GOTEST_FLAGS) 45 46 .PHONY: tidy 47 tidy: 48 # Give execute permissions 49 chmod +x ./mod_tidy.sh 50 # Tidy go mods 51 VERIFY_MOD_SUMS=$(VERIFY_MOD_SUMS) ./mod_tidy.sh