Skip to content

Commit c0873cb

Browse files
authored
Merge pull request #373 from sapcc/revert-variable-changes
revert recent changes to variable assignments
2 parents 5ce89a8 + cc38e71 commit c0873cb

File tree

2 files changed

+15
-10
lines changed

2 files changed

+15
-10
lines changed

Makefile

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

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

5253
# To add additional flags or values, specify the variable in the environment, e.g. `GO_BUILDFLAGS='-tags experimental' make`.
5354
# To override the default flags or values, specify the variable on the command line, e.g. `make GO_BUILDFLAGS='-tags experimental'`.
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)
55+
GO_BUILDFLAGS += -mod vendor
56+
GO_LDFLAGS +=
57+
GO_TESTFLAGS +=
58+
GO_TESTENV +=
59+
GO_BUILDENV +=
5960

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

internal/makefile/makefile.go

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

49+
// WARNING: Do not remove this just because it may be inconvenient to you. Learn to work with it.
50+
general.addDefinition("MAKEFLAGS=--warn-undefined-variables")
4951
general.addDefinition(strings.TrimSpace(`
5052
# /bin/sh is dash on Debian which does not support all features of ash/bash
5153
# to fix that we use /bin/bash only on Debian to not break Alpine
@@ -210,13 +212,15 @@ endif
210212
}
211213

212214
if isGolang {
215+
// WARNING: DO NOT CHANGE THIS WITHOUT FIRST UNDERSTANDING THE CONSEQUENCES.
216+
// All changes have to be okay'd by Stefan Majewsky to avoid breaking setups.
213217
build.addDefinition("# To add additional flags or values, specify the variable in the environment, e.g. `GO_BUILDFLAGS='-tags experimental' make`.")
214218
build.addDefinition("# To override the default flags or values, specify the variable on the command line, e.g. `make GO_BUILDFLAGS='-tags experimental'`.")
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", ""))
219+
build.addDefinition("GO_BUILDFLAGS +=%s", cfg.Variable("GO_BUILDFLAGS", defaultBuildFlags))
220+
build.addDefinition("GO_LDFLAGS +=%s", cfg.Variable("GO_LDFLAGS", strings.TrimSpace(defaultLdFlags)))
221+
build.addDefinition("GO_TESTFLAGS +=%s", cfg.Variable("GO_TESTFLAGS", ""))
222+
build.addDefinition("GO_TESTENV +=%s", cfg.Variable("GO_TESTENV", ""))
223+
build.addDefinition("GO_BUILDENV +=%s", cfg.Variable("GO_BUILDENV", ""))
220224
}
221225
if sr.HasBinInfo {
222226
build.addDefinition("")

0 commit comments

Comments
 (0)