$NetBSD: patch-src_Makefile,v 1.1 2022/01/10 02:30:23 khorben Exp $ Set preferences. Add NetBSD support. Don't override CC nor optimisation flags in CFLAGS. Remove sed magic; we'll use nbsed. --- src/Makefile.orig 2021-11-21 15:39:01.000000000 +0000 +++ src/Makefile @@ -31,7 +31,7 @@ UNAME := $(patsubst MS UNAME := $(patsubst MINGW32_NT-%,MSYS2,$(UNAME)) UNAME := $(patsubst MINGW64_NT-%,MSYS2,$(UNAME)) -ifeq (,$(filter $(UNAME),Linux FreeBSD Darwin CYGWIN MSYS2)) +ifeq (,$(filter $(UNAME),Linux FreeBSD NetBSD Darwin CYGWIN MSYS2)) $(error "! Your Operating System ($(UNAME)) is not supported by this Makefile") endif @@ -59,8 +59,6 @@ MODULE_INTERFACE_VERSION := 630 ## Native compiler paths ## -CC := gcc -CXX := g++ AR := ar FIND := find INSTALL := install @@ -69,20 +67,9 @@ SED := sed SED_IN_PLACE := -i ifeq ($(UNAME),Darwin) -CC := clang -CXX := clang++ -# the sed -i option of macOS requires a parameter for the backup file (we just use "") -AR := /usr/bin/ar -SED := /usr/bin/sed -SED_IN_PLACE := -i "" DARWIN_VERSION := $(shell uname -r | cut -d. -f1) endif -ifeq ($(UNAME),FreeBSD) -CC := cc -CXX := c++ -SED := gsed -endif ## ## Version @@ -228,7 +215,6 @@ endif endif ifeq ($(DEBUG),0) -CFLAGS += -O2 ifneq ($(UNAME),Darwin) LFLAGS += -s endif @@ -312,6 +298,13 @@ LFLAGS_NATIVE += -liconv endif endif # FreeBSD +ifeq ($(UNAME),NetBSD) +CFLAGS_NATIVE := $(CFLAGS) +CFLAGS_NATIVE += -I$(OPENCL_HEADERS_KHRONOS)/ +LFLAGS_NATIVE := $(LFLAGS) +LFLAGS_NATIVE += -lpthread +endif # NetBSD + ifeq ($(UNAME),Darwin) export MACOSX_DEPLOYMENT_TARGET=10.9 CFLAGS_NATIVE := $(CFLAGS) @@ -456,10 +449,10 @@ distclean: clean # allow (whitelist) "make install" only on unix-based systems (also disallow cygwin/msys) ifneq ($(findstring install,$(MAKECMDGOALS)),) - ifeq (,$(filter $(UNAME),Linux FreeBSD Darwin)) + ifeq (,$(filter $(UNAME),Linux FreeBSD Darwin NetBSD)) define ERROR_INSTALL_DISALLOWED ! The 'install' target is not allowed on this operating system ($(UNAME)). \ -Only Linux, FreeBSD and Darwin can use the 'install' target +Only Linux, FreeBSD, NetBSD and Darwin can use the 'install' target endef $(error $(ERROR_INSTALL_DISALLOWED)) @@ -637,8 +630,13 @@ endif $(MODULES_DISABLE): ; ifeq ($(SHARED),1) + ifeq ($(UNAME),Darwin) +modules/module_%.$(MODULE_SUFFIX): src/modules/module_%.c $(HASHCAT_LIBRARY) + $(CC) $(CCFLAGS) $(CFLAGS_NATIVE) $^ -o $@ $(LFLAGS_NATIVE) -install_name $(SHARED_FOLDER)/$@ -shared -fPIC -D MODULE_INTERFACE_VERSION_CURRENT=$(MODULE_INTERFACE_VERSION) + else modules/module_%.$(MODULE_SUFFIX): src/modules/module_%.c $(HASHCAT_LIBRARY) $(CC) $(CCFLAGS) $(CFLAGS_NATIVE) $^ -o $@ $(LFLAGS_NATIVE) -shared -fPIC -D MODULE_INTERFACE_VERSION_CURRENT=$(MODULE_INTERFACE_VERSION) + endif else modules/module_%.$(MODULE_SUFFIX): src/modules/module_%.c obj/combined.NATIVE.a $(CC) $(CCFLAGS) $(CFLAGS_NATIVE) $^ -o $@ $(LFLAGS_NATIVE) -shared -fPIC -D MODULE_INTERFACE_VERSION_CURRENT=$(MODULE_INTERFACE_VERSION)