Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

make variables to build FIPS binary #186

Merged
merged 1 commit into from
Apr 10, 2024
Merged
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
15 changes: 13 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#! /usr/bin/make
#(C) Copyright 2022-2023 Hewlett Packard Enterprise Development LP
#(C) Copyright 2022-2024 Hewlett Packard Enterprise Development LP
# Inspiration from https://github.com/rightscale/go-boilerplate/blob/master/Makefile

NAME=$(shell find cmd -name ".gitkeep_provider" -exec dirname {} \; | sort -u | sed -e 's|cmd/||')
Expand All @@ -8,6 +8,13 @@ ifeq ("$(GOARCH)","")
GOARCH="amd64"
endif

GOFLAGS_OTHER= CGO_ENABLED=0

FIPS_BUILD ?= 0
ifeq ("$(FIPS_BUILD)","1")
GOFLAGS_OTHER= CGO_ENABLED=1 GOLANG_FIPS=1
endif

# version shouldn't have 'v' prefix for >= 0.13
VERSION=$(shell cat ./version)
# Change DUMMY_PROVIDER below to reflect the name of the service under development. The
Expand Down Expand Up @@ -47,7 +54,11 @@ GOOS='$(GOOSALT)'
LOCALIZATION_FILES := $(shell find . -name \*.toml | grep -v vendor | grep -v ./bin)

$(NAME): $(shell find . -name \*.go)
CGO_ENABLED=0 GOOS=$(GOOS) GOARCH=$(GOARCH) go build $(TAGS) -ldflags "$(VFLAG)" -o build/$@ .
GOOS=$(GOOS) GOARCH=$(GOARCH) $(GOFLAGS_OTHER) go build $(TAGS) -ldflags "$(VFLAG)" -o build/$@ .
ifeq ("$(FIPS_BUILD)", "1")
echo "Verifying if the binary is FIPS capable"
go tool nm build/$@ | grep -i strictfips
endif

default: all
.PHONY: default
Expand Down
Loading