Files
Tom HarknessandClaude Opus 4.8 ac6e003c16 tools: find brew OpenSSL via installed keg, not the alias
brew's "openssl" alias follows the newest major (now openssl@4), so
`brew --prefix openssl` returns a prefix that isn't installed on setups
with only openssl@3, and the build fails with evp.h / des.h not found.
Probe the candidate kegs and use the first that actually has the headers.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-11-09 15:54:17 +11:00

34 lines
1.2 KiB
Makefile

MYCFLAGS = -D_GNU_SOURCE -O3 -Wno-deprecated-declarations
MYLDLIBS = -lcrypto -lpthread
BINS = mfulc_des_brute
INSTALLTOOLS = $(BINS)
include ../../Makefile.host
# checking platform can be done only after Makefile.host
ifneq (,$(findstring MINGW,$(platform)))
# Mingw uses by default Microsoft printf, we want the GNU printf (e.g. for %z)
# and setting _ISOC99_SOURCE sets internally __USE_MINGW_ANSI_STDIO=1
MYCFLAGS += -D_ISOC99_SOURCE
endif
# OS X needs linking to openssl
ifeq ($(USE_BREW),1)
# brew's openssl alias can point at an uninstalled major (e.g. openssl@4);
# pick the newest keg that actually has the headers.
OPENSSL_PREFIX := $(shell for f in openssl openssl@3 openssl@1.1; do \
p=$$(brew --prefix $$f 2>/dev/null); \
[ -f "$$p/include/openssl/evp.h" ] && { echo $$p; break; }; \
done)
MYCFLAGS += -I$(OPENSSL_PREFIX)/include
MYLDFLAGS += -L$(OPENSSL_PREFIX)/lib
endif
ifeq ($(USE_MACPORTS),1)
MYCFLAGS += -I$(MACPORTS_PREFIX)/include/openssl-3 -I$(MACPORTS_PREFIX)/include/openssl-1.1
MYLDFLAGS += -L$(MACPORTS_PREFIX)/lib/openssl-3 -L$(MACPORTS_PREFIX)/lib/openssl-1.1
endif
mfulc_des_brute : $(OBJDIR)/mfulc_des_brute.o $(MYOBJS)