From: Dan Fuhry Date: Thu, 15 May 2025 21:42:40 +0000 (-0400) Subject: Makefile: include all .go files from maindirs, exclude vendor/ from target detection X-Git-Url: https://go.fuhry.dev/?a=commitdiff_plain;h=00c1b411f898b4e6fb8d3e40cd38b14f718f6a42;p=runtime.git Makefile: include all .go files from maindirs, exclude vendor/ from target detection --- diff --git a/Makefile b/Makefile index 2c1b756..793b071 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,5 @@ GO = $(shell which go) -GOMAINSRCS = $(shell find . -type f -name main.go | cut -c 3- | paste -s -d ' ' -) +GOMAINSRCS = $(shell find . -type f -name main.go | cut -c 3- | grep -v '^vendor/' | paste -s -d ' ' -) GOMAINDIRS = $(GOMAINSRCS:/main.go=) GOOS ?= $(shell $(GO) env GOOS) GOARCH ?= $(shell $(GO) env GOARCH) @@ -58,8 +58,8 @@ LDFLAGS += -X "go.fuhry.dev/runtime/constants.DeviceTrustTokenName=$(DEVICE_TRUS define GOPROG_template GOMAINS += $(1)/$(2) all: $(1)/$(2) -$(1)/$(2): $(1)/main.go - $(GO) build -ldflags '$$(LDFLAGS)' $$(GOBUILDFLAGS) -o $$@ $$< +$(1)/$(2): $(wildcard $(1)/*.go) + $(GO) build -ldflags '$$(LDFLAGS)' $$(GOBUILDFLAGS) -o $$@ $$^ endef