From e8adf630012339f4c28fabaa79d4e3c3bd8d3509 Mon Sep 17 00:00:00 2001 From: Jeffery To Date: Wed, 27 Jun 2018 03:05:11 +0800 Subject: [PATCH] golang: Allow additional arguments when compiling Go packages This updates GoPackage/Build/Compile in golang-package.mk to accept additional arguments that are passed to the go command line. Signed-off-by: Jeffery To --- lang/golang/golang-package.mk | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/lang/golang/golang-package.mk b/lang/golang/golang-package.mk index a42bc6417..3c4aeab14 100644 --- a/lang/golang/golang-package.mk +++ b/lang/golang/golang-package.mk @@ -211,6 +211,7 @@ define GoPackage/Build/Configure ) endef +# $(1) additional arguments for go command line (optional) define GoPackage/Build/Compile ( \ cd $(GO_PKG_BUILD_DIR) ; \ @@ -228,7 +229,7 @@ define GoPackage/Build/Compile done ; \ \ if [ "$(GO_PKG_GO_GENERATE)" = 1 ]; then \ - go generate -v $$$$targets ; \ + go generate -v $(1) $$$$targets ; \ fi ; \ \ if [ "$(GO_PKG_SOURCE_ONLY)" != 1 ]; then \ @@ -238,7 +239,14 @@ define GoPackage/Build/Compile esac ; \ trimpath="all=-trimpath=$(GO_PKG_BUILD_DIR)" ; \ ldflags="all=-linkmode external -extldflags '$(TARGET_LDFLAGS)'" ; \ - go install $$$$installsuffix -gcflags "$$$$trimpath" -asmflags "$$$$trimpath" -ldflags "$$$$ldflags" -v $$$$targets ; \ + go install \ + $$$$installsuffix \ + -gcflags "$$$$trimpath" \ + -asmflags "$$$$trimpath" \ + -ldflags "$$$$ldflags" \ + -v \ + $(1) \ + $$$$targets ; \ retval=$$$$? ; \ \ if [ "$$$$retval" -eq 0 ] && [ -z "$(call GoPackage/has_binaries)" ]; then \