Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
# SPDX-FileCopyrightText: 2024 SAP SE or an SAP affiliate company
# SPDX-License-Identifier: Apache-2.0

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

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

# These definitions are overridable, e.g. to provide fixed version/commit values when
# no .git directory is present or to provide a fixed build date for reproducibility.
Expand Down
14 changes: 9 additions & 5 deletions internal/makefile/makefile.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ func newMakefile(cfg core.Configuration, sr golang.ScanResult) *makefile {
// General
general := category{name: "general"}

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

if isGolang {
// WARNING: DO NOT CHANGE THIS WITHOUT FIRST UNDERSTANDING THE CONSEQUENCES.
// All changes have to be okay'd by Stefan Majewsky to avoid breaking setups.
build.addDefinition("# To add additional flags or values, specify the variable in the environment, e.g. `GO_BUILDFLAGS='-tags experimental' make`.")
build.addDefinition("# To override the default flags or values, specify the variable on the command line, e.g. `make GO_BUILDFLAGS='-tags experimental'`.")
build.addDefinition("GO_BUILDFLAGS :=%s $(GO_BUILDFLAGS)", cfg.Variable("GO_BUILDFLAGS", defaultBuildFlags))
build.addDefinition("GO_LDFLAGS :=%s $(GO_LDFLAGS)", cfg.Variable("GO_LDFLAGS", strings.TrimSpace(defaultLdFlags)))
build.addDefinition("GO_TESTFLAGS :=%s $(GO_TESTFLAGS)", cfg.Variable("GO_TESTFLAGS", ""))
build.addDefinition("GO_TESTENV :=%s $(GO_TESTENV)", cfg.Variable("GO_TESTENV", ""))
build.addDefinition("GO_BUILDENV :=%s $(GO_BUILDENV)", cfg.Variable("GO_BUILDENV", ""))
build.addDefinition("GO_BUILDFLAGS +=%s", cfg.Variable("GO_BUILDFLAGS", defaultBuildFlags))
build.addDefinition("GO_LDFLAGS +=%s", cfg.Variable("GO_LDFLAGS", strings.TrimSpace(defaultLdFlags)))
build.addDefinition("GO_TESTFLAGS +=%s", cfg.Variable("GO_TESTFLAGS", ""))
build.addDefinition("GO_TESTENV +=%s", cfg.Variable("GO_TESTENV", ""))
build.addDefinition("GO_BUILDENV +=%s", cfg.Variable("GO_BUILDENV", ""))
}
if sr.HasBinInfo {
build.addDefinition("")
Expand Down
Loading