Skip to content

Commit 6cde768

Browse files
committed
Makefile: Set CGO_CFLAGS dynamically on Mac OS X
When Homebrew is available, gssapi header path can be generated automatically using `brew --prefix`. This handles all edge cases.
1 parent 173674e commit 6cde768

1 file changed

Lines changed: 11 additions & 0 deletions

File tree

Makefile

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,17 @@ image-ocp-deployer: image-ocp-cli
7272
$(call build-image,ocp-recycler,$(IMAGE_REGISTRY)/ocp/4.2:recycler,./images/recycler/Dockerfile.rhel,.)
7373
image-ocp-recycler: image-ocp-cli
7474

75+
# macOS system GSSAPI headers lack RFC 5587 types (gss_const_name_t).
76+
# Use Homebrew's heimdal headers when available.
77+
ifeq ($(shell uname),Darwin)
78+
ifneq (,$(shell command -v brew 2>/dev/null))
79+
HEIMDAL_PREFIX := $(shell brew --prefix heimdal 2>/dev/null)
80+
ifneq (,$(HEIMDAL_PREFIX))
81+
export CGO_CFLAGS := $(CGO_CFLAGS) -I$(HEIMDAL_PREFIX)/include
82+
endif
83+
endif
84+
endif
85+
7586
oc: GO_BUILD_PACKAGES :=./cmd/oc
7687
oc: build
7788
.PHONY: oc

0 commit comments

Comments
 (0)