proxmark3/tools/mfd_aes_brute/Makefile
İlteriş Yağıztegin Eroğlu 87400b6156 don't define _POSIX_C_SOURCE in mfd_aes_brute.c if macos
unistd.h in macos has this snippet:

 #if __DARWIN_C_LEVEL >= __DARWIN_C_FULL
 #define _SC_NPROCESSORS_CONF            57
 #define _SC_NPROCESSORS_ONLN            58
 #endif /* __DARWIN_C_LEVEL >= __DARWIN_C_FULL */

__DARWIN_C_FULL is 900000L.

If _POSIX_C_SOURCE gets defined without __DARWIN_C_SOURCE being defined,
__DARWIN_C_LEVEL will be assigned to __DARWIN_C_ANSI, which is 010000L.

Thus this definition will remove _SC_NPROCESSORS_CONF.

If we don't define _POSIX_C_SOURCE, __DARWIN_C_LEVEL will be equal to
__DARWIN_C_FULL, and _SC_NPROCESSORS_CONF will be available.

This commit also includes homebrew and macports prefix definitions for mfd_aes_brute.

Signed-off-by: İlteriş Yağıztegin Eroğlu <ilteris@asenkron.com.tr>
2022-01-31 15:41:06 +03:00

36 lines
1,022 B
Makefile

MYSRCPATHS = ../../common ../../common/mbedtls
MYSRCS = util_posix.c
MYINCLUDES = -I../../include -I../../common -I../../common/mbedtls
MYCFLAGS = -march=native -Ofast -msse2 -msse -maes
MYDEFS =
MYLDLIBS = -lcrypto
ifneq ($(SKIPPTHREAD),1)
MYLDLIBS += -lpthread
endif
BINS = brute_key mfd_aes_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)
MYLDFLAGS += -L$(BREW_PREFIX)/opt/openssl@3/lib -L$(BREW_PREFIX)/opt/openssl@1.1/lib
endif
ifeq ($(USE_MACPORTS),1)
MYLDFLAGS += -L$(MACPORTS_PREFIX)/lib/openssl-3 -L$(MACPORTS_PREFIX)/lib/openssl-1.1
endif
brute_key : $(OBJDIR)/brute_key.o $(MYOBJS)
mfd_aes_brute : $(OBJDIR)/mfd_aes_brute.o $(MYOBJS)