Skip to content

Commit

Permalink
Update make targets from makego
Browse files Browse the repository at this point in the history
  • Loading branch information
doriable committed Dec 17, 2024
1 parent a899ec9 commit 23ace9d
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion make/go/go.mk
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ GO_BINS ?=
# Settable
GO_TEST_BINS ?=
# Settable
GO_TEST_WASM_BINS ?=
# Settable
GO_GET_PKGS ?=
# Settable
GO_MOD_VERSION ?= 1.22
Expand Down Expand Up @@ -142,7 +144,7 @@ build: prebuild ## Run go build.
pretest::

.PHONY: test
test: pretest installtest ## Run all go tests.
test: pretest installtest installtestwasm ## Run all go tests.
go test $(GO_TEST_FLAGS) $(GOPKGS)

.PHONY: testrace
Expand Down Expand Up @@ -203,3 +205,17 @@ endef

$(foreach gobin,$(sort $(GO_TEST_BINS)),$(eval $(call gotestbinfunc,$(gobin))))
$(foreach gobin,$(sort $(GO_TEST_BINS)),$(eval FILE_IGNORES := $(FILE_IGNORES) $(gobin)/$(notdir $(gobin))))

.PHONY: installtestwasm
installtestwasm::

define gotestwasmfunc
.PHONY: installtestwasm$(notdir $(1))
installtestwasm$(notdir $(1)):
GOOS=wasip1 GOARCH=wasm go build -o $(GOBIN)/$(notdir $(1)).wasm ./$(1)

installtestwasm:: installtestwasm$(notdir $(1))
endef

$(foreach gobin,$(sort $(GO_TEST_WASM_BINS)),$(eval $(call gotestwasmfunc,$(gobin))))
$(foreach gobin,$(sort $(GO_TEST_WASM_BINS)),$(eval FILE_IGNORES := $(FILE_IGNORES) $(gobin)/$(notdir $(gobin))))

0 comments on commit 23ace9d

Please sign in to comment.