]> go.fuhry.dev Git - runtime.git/commitdiff
Makefile: fix on GNU make 3.81 (macos)
authorDan Fuhry <dan@fuhry.com>
Thu, 25 Apr 2024 04:05:36 +0000 (00:05 -0400)
committerDan Fuhry <dan@fuhry.com>
Thu, 25 Apr 2024 04:05:49 +0000 (00:05 -0400)
Makefile
sase/ws_proxy_client/Makefile

index 6192578b3fda227e6c5d0bfb239b5102fb02f6d9..2c1b756d7fc75b2fd0d8bdaf9fc28f6ec99f830f 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -1,9 +1,10 @@
+GO = $(shell which go)
 GOMAINSRCS = $(shell find . -type f -name main.go | cut -c 3- | paste -s -d ' ' -)
 GOMAINDIRS = $(GOMAINSRCS:/main.go=)
-GOOS ?= $(shell go env GOOS)
-GOARCH ?= $(shell go env GOARCH)
+GOOS ?= $(shell $(GO) env GOOS)
+GOARCH ?= $(shell $(GO) env GOARCH)
 
-ifeq ($(GOOS)/$(GOARCH),$(shell env - go env GOOS)/$(shell env - go env GOARCH))
+ifeq ($(GOOS)/$(GOARCH),$(shell env - $(GO) env GOOS)/$(shell env - $(GO) env GOARCH))
 NATIVE_BUILD := 1
 else
 NATIVE_BUILD := 0
@@ -54,17 +55,17 @@ LDFLAGS += -X "go.fuhry.dev/runtime/constants.RootCAName=$(ROOT_CA_NAME)"
 LDFLAGS += -X "go.fuhry.dev/runtime/constants.IntCAName=$(INT_CA_NAME)"
 LDFLAGS += -X "go.fuhry.dev/runtime/constants.DeviceTrustTokenName=$(DEVICE_TRUST_TOKEN_NAME)"
 
-define GOPROG_template =
+define GOPROG_template
 GOMAINS += $(1)/$(2)
 all: $(1)/$(2)
 $(1)/$(2): $(1)/main.go
-       go build -ldflags '$$(LDFLAGS)' $$(GOBUILDFLAGS) -o $$@ $$<
+       $(GO) build -ldflags '$$(LDFLAGS)' $$(GOBUILDFLAGS) -o $$@ $$<
 
 endef
 
 $(foreach maindir,$(GOMAINDIRS),$(eval $(call GOPROG_template,$(maindir),$(shell basename $(maindir)))))
 
-.PHONY: $(GOMAINDIRS) clean all
+.PHONY: clean all list
 
 clean:
        if test -z "$(GOMAINS)"; then \
@@ -75,3 +76,6 @@ clean:
                exit 1; \
        fi
        rm -fv $(GOMAINS)
+
+list:
+       @LC_ALL=C $(MAKE) -pRrq -f $(firstword $(MAKEFILE_LIST)) : 2>/dev/null | awk -v RS= -F: '/(^|\n)# Files(\n|$$)/,/(^|\n)# Finished Make data base/ {if ($$1 !~ "^[#.]") {print $$1}}' | sort | grep -E -v -e '^[^[:alnum:]]' -e '^$@$$'
index bfab546680fcc33425b290802e322f105589be5c..de40e1d7857a588440b79d4dc0a659d000a25162 100644 (file)
@@ -1,6 +1,6 @@
 GOSRC = $(wildcard *.go)
 GOEXE = $(shell basename `pwd`)
-GOBUILDFLAGS := -buildmode=pie -trimpath
+GOBUILDFLAGS := -buildmode=pie -trimpath -tags=pkcs11
 
 all: $(GOEXE)