Skip to content

Commit 5ce89a8

Browse files
Merge pull request #368 from sapcc/update_variables_overrides
2 parents ec3355f + d3da286 commit 5ce89a8

File tree

2 files changed

+10
-12
lines changed

2 files changed

+10
-12
lines changed

Makefile

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
# SPDX-FileCopyrightText: 2024 SAP SE or an SAP affiliate company
77
# SPDX-License-Identifier: Apache-2.0
88

9-
MAKEFLAGS=--warn-undefined-variables
109
# /bin/sh is dash on Debian which does not support all features of ash/bash
1110
# to fix that we use /bin/bash only on Debian to not break Alpine
1211
ifneq (,$(wildcard /etc/os-release)) # check file existence
@@ -52,11 +51,11 @@ prepare-static-check: FORCE install-golangci-lint install-modernize install-shel
5251

5352
# To add additional flags or values, specify the variable in the environment, e.g. `GO_BUILDFLAGS='-tags experimental' make`.
5453
# To override the default flags or values, specify the variable on the command line, e.g. `make GO_BUILDFLAGS='-tags experimental'`.
55-
GO_BUILDFLAGS += -mod vendor
56-
GO_LDFLAGS +=
57-
GO_TESTFLAGS +=
58-
GO_TESTENV +=
59-
GO_BUILDENV +=
54+
GO_BUILDFLAGS := -mod vendor $(GO_BUILDFLAGS)
55+
GO_LDFLAGS := $(GO_LDFLAGS)
56+
GO_TESTFLAGS := $(GO_TESTFLAGS)
57+
GO_TESTENV := $(GO_TESTENV)
58+
GO_BUILDENV := $(GO_BUILDENV)
6059

6160
# These definitions are overridable, e.g. to provide fixed version/commit values when
6261
# no .git directory is present or to provide a fixed build date for reproducibility.

internal/makefile/makefile.go

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@ func newMakefile(cfg core.Configuration, sr golang.ScanResult) *makefile {
4646
// General
4747
general := category{name: "general"}
4848

49-
general.addDefinition("MAKEFLAGS=--warn-undefined-variables")
5049
general.addDefinition(strings.TrimSpace(`
5150
# /bin/sh is dash on Debian which does not support all features of ash/bash
5251
# to fix that we use /bin/bash only on Debian to not break Alpine
@@ -213,11 +212,11 @@ endif
213212
if isGolang {
214213
build.addDefinition("# To add additional flags or values, specify the variable in the environment, e.g. `GO_BUILDFLAGS='-tags experimental' make`.")
215214
build.addDefinition("# To override the default flags or values, specify the variable on the command line, e.g. `make GO_BUILDFLAGS='-tags experimental'`.")
216-
build.addDefinition("GO_BUILDFLAGS +=%s", cfg.Variable("GO_BUILDFLAGS", defaultBuildFlags))
217-
build.addDefinition("GO_LDFLAGS +=%s", cfg.Variable("GO_LDFLAGS", strings.TrimSpace(defaultLdFlags)))
218-
build.addDefinition("GO_TESTFLAGS +=%s", cfg.Variable("GO_TESTFLAGS", ""))
219-
build.addDefinition("GO_TESTENV +=%s", cfg.Variable("GO_TESTENV", ""))
220-
build.addDefinition("GO_BUILDENV +=%s", cfg.Variable("GO_BUILDENV", ""))
215+
build.addDefinition("GO_BUILDFLAGS :=%s $(GO_BUILDFLAGS)", cfg.Variable("GO_BUILDFLAGS", defaultBuildFlags))
216+
build.addDefinition("GO_LDFLAGS :=%s $(GO_LDFLAGS)", cfg.Variable("GO_LDFLAGS", strings.TrimSpace(defaultLdFlags)))
217+
build.addDefinition("GO_TESTFLAGS :=%s $(GO_TESTFLAGS)", cfg.Variable("GO_TESTFLAGS", ""))
218+
build.addDefinition("GO_TESTENV :=%s $(GO_TESTENV)", cfg.Variable("GO_TESTENV", ""))
219+
build.addDefinition("GO_BUILDENV :=%s $(GO_BUILDENV)", cfg.Variable("GO_BUILDENV", ""))
221220
}
222221
if sr.HasBinInfo {
223222
build.addDefinition("")

0 commit comments

Comments
 (0)