github.com/gnolang/gno@v0.0.0-20240520182011-228e9d0192ce/tm2/pkg/amino/tools.mk (about) 1 ### 2 # Find OS and Go environment 3 # GO contains the Go binary 4 # FS contains the OS file separator 5 ### 6 ifeq ($(OS),Windows_NT) 7 GO := $(shell where go.exe 2> NUL) 8 FS := "\\" 9 else 10 GO := $(shell command -v go 2> /dev/null) 11 FS := "/" 12 endif 13 14 ifeq ($(GO),) 15 $(error could not find go. Is it in PATH? $(GO)) 16 endif 17 18 all: tools 19 20 tools: go-fuzz go-fuzz-build 21 22 TOOLS_DESTDIR ?= $(GOPATH)/bin 23 24 GOFUZZ = $(TOOLS_DESTDIR)/go-fuzz 25 GOFUZZ_BUILD = $(TOOLS_DESTDIR)/go-fuzz-build 26 27 # Install the runsim binary with a temporary workaround of entering an outside 28 # directory as the "go get" command ignores the -mod option and will pollute the 29 # go.{mod, sum} files. 30 # 31 # ref: https://github.com/golang/go/issues/30515 32 go-fuzz: $(GOFUZZ) 33 $(GOFUZZ): 34 @echo "Installing go-fuzz..." 35 @(cd /tmp && go get -u github.com/dvyukov/go-fuzz/go-fuzz) 36 37 go-fuzz-build: $(GOFUZZ_BUILD) 38 $(GOFUZZ_BUILD): 39 @echo "Installing go-fuzz-build..." 40 @(cd /tmp && go get -u github.com/dvyukov/go-fuzz/go-fuzz-build) 41 42 tools-clean: 43 rm -f $(GOFUZZ_BUILD) $(GOFUZZ) 44 rm -f tools-stamp 45 46 .PHONY: all tools tools-clean