From ee19787b5e1720c421d8fc5a9873484602bae5d6 Mon Sep 17 00:00:00 2001 From: Russ Magee Date: Thu, 16 Jun 2022 22:45:25 -0700 Subject: [PATCH] Added support for building garbled binaries (https://github.com/burrowers/garble.git) --- Makefile | 10 +++++++++- logger/Makefile | 8 +++++++- spinsult/Makefile | 7 +++++++ xs/Makefile | 8 +++++++- xsd/Makefile | 8 +++++++- xsnet/Makefile | 8 +++++++- xspasswd/Makefile | 8 +++++++- 7 files changed, 51 insertions(+), 6 deletions(-) diff --git a/Makefile b/Makefile index 3ab910d..3b178e4 100644 --- a/Makefile +++ b/Makefile @@ -10,6 +10,14 @@ else MTAG="-m" endif +# If available, one may build 'garbled' binaries +# See https://github.com/burrowers/garble.git +ifeq ($(GARBLE),y) +GO=garble -literals -tiny -debugdir=garbled +else +GO=go +endif + ifneq ($(VENDOR),) GOBUILDOPTS :=-v -mod vendor VTAG = "-v" @@ -63,7 +71,7 @@ tools: common: - go build . + $(GO) build . go install . diff --git a/logger/Makefile b/logger/Makefile index 0287ffe..cc83cbb 100644 --- a/logger/Makefile +++ b/logger/Makefile @@ -2,8 +2,14 @@ EXE = $(notdir $(shell pwd)) +ifeq ($(GARBLE),y) +GO=garble -literals -tiny -debugdir=garbled +else +GO = go +endif + all: - go build . + $(GO) build . clean: $(RM) $(EXE) $(EXE).exe diff --git a/spinsult/Makefile b/spinsult/Makefile index f645a41..555e232 100644 --- a/spinsult/Makefile +++ b/spinsult/Makefile @@ -1,11 +1,18 @@ .PHONY: info clean lib +ifeq ($(GARBLE),y) +GO = garble -literals -tiny -debugdir=garbled +else +GO = go +endif + all: lib clean: go clean . lib: info + $(GO) build . go install . ifneq ($(MSYSTEM),) diff --git a/xs/Makefile b/xs/Makefile index c3f582b..27d6356 100644 --- a/xs/Makefile +++ b/xs/Makefile @@ -1,11 +1,17 @@ .PHONY: clean all vis lint +ifeq ($(GARBLE),y) +GO = garble -literals -tiny -debugdir=garbled +else +GO = go +endif + EXTPKGS = bytes,errors,flag,fmt,internal,io,log,net,os,path,runtime,time,strings,sync,syscall,binary,encoding EXE = $(notdir $(shell pwd)) all: echo "BUILDOPTS:" $(BUILDOPTS) - go build $(BUILDOPTS) . + $(GO) build $(BUILDOPTS) . clean: $(RM) $(EXE) $(EXE).exe diff --git a/xsd/Makefile b/xsd/Makefile index deef212..6a0ab14 100644 --- a/xsd/Makefile +++ b/xsd/Makefile @@ -1,10 +1,16 @@ .PHONY: clean all vis lint +ifeq ($(GARBLE),y) +GO = garble -literals -tiny -debugdir=garbled +else +GO = go +endif + EXTPKGS = binary,bytes,crypto,encoding,errors,flag,fmt,internal,io,log,net,os,path,runtime,time,strings,sync,syscall EXE = $(notdir $(shell pwd)) all: - go build $(BUILDOPTS) . + $(GO) build $(BUILDOPTS) . clean: $(RM) $(EXE) $(EXE).exe diff --git a/xsnet/Makefile b/xsnet/Makefile index f645a41..150ba25 100644 --- a/xsnet/Makefile +++ b/xsnet/Makefile @@ -1,12 +1,18 @@ .PHONY: info clean lib +ifeq ($(GARBLE),y) +GO = garble -tiny -literals -debugdir=garbled +else +GO = go +endif + all: lib clean: go clean . lib: info - go install . + $(GO) install . ifneq ($(MSYSTEM),) info: diff --git a/xspasswd/Makefile b/xspasswd/Makefile index 1f8e2c6..8e2b657 100644 --- a/xspasswd/Makefile +++ b/xspasswd/Makefile @@ -1,10 +1,16 @@ .PHONY: clean all vis lint +ifeq ($(GARBLE),y) +GO = garble -tiny -literals -debugdir=garbled +else +GO = go +endif + EXTPKGS = bytes,errors,flag,fmt,internal,io,log,net,os,path,runtime,time,strings,sync,syscall,binary,encoding EXE = $(notdir $(shell pwd)) all: - go build $(BUILDOPTS) . + $(GO) build $(BUILDOPTS) . clean: $(RM) $(EXE) $(EXE).exe