add FreeBSD Makefile target
[hashcat.git] / src / Makefile
index 6b0a413..a36bf34 100644 (file)
@@ -17,7 +17,7 @@ UNAME                    := $(shell uname -s)
 # we need to strip the windows version number to be able to build hashcat on cygwin hosts
 UNAME                    := $(patsubst CYGWIN_NT-%,CYGWIN_NT-,$(UNAME))
 
-ifeq (,$(filter $(UNAME),Linux Darwin CYGWIN_NT-))
+ifeq (,$(filter $(UNAME),Linux Darwin CYGWIN_NT- FreeBSD))
 $(error "! Your Operating System ($(UNAME)) is not supported by $(PROG_NAME) Makefile")
 endif
 
@@ -63,6 +63,9 @@ FIND                     := find
 INSTALL                  := install
 RM                       := rm
 SED                      := sed
+ifeq ($(UNAME),Darwin,FreeBSD)
+SED                      := gsed
+endif
 
 ##
 ## Cross compiler paths
@@ -81,13 +84,13 @@ CC_WIN_64                := x86_64-w64-mingw32-gcc
 COMPTIME                 := $(shell date +%s)
 
 VERSION_EXPORT           := $Format:%D$
-VERSION_TAG              := $(shell test -d .git && git describe --tags --dirty=+ || echo "$(VERSION_EXPORT)"|cut -d, -f2|sed -r 's|.* (\w+/)?([^ ]+)|\2|')
+VERSION_TAG              := $(shell test -d .git && git describe --tags --dirty=+ || echo "$(VERSION_EXPORT)"|cut -d, -f2|$(SED) -r 's|.* (\w+/)?([^ ]+)|\2|')
 
 ##
 ## Compiler flags
 ##
 
-CFLAGS                   := -pipe -W -Wall -std=c99 -Iinclude/ -IOpenCL/ -I$(OPENCL_HEADERS_KHRONOS)/
+CFLAGS                   += -pipe -W -Wall -std=c99 -Iinclude/ -IOpenCL/ -I$(OPENCL_HEADERS_KHRONOS)/
 
 ifndef DEBUG
 CFLAGS                   += -O2
@@ -106,10 +109,10 @@ BINARY_NATIVE            := $(PROG_NAME)
 
 ifeq ($(UNAME),Darwin)
 export MACOSX_DEPLOYMENT_TARGET=10.9
-BINARY_NATIVE            := $(BINARY_NATIVE).app
 CFLAGS_NATIVE            := -D_POSIX -DDARWIN
 CFLAGS_NATIVE            += $(CFLAGS)
 LFLAGS_NATIVE            := -lpthread
+LFLAGS_NATIVE            += $(LDFLAGS)
 endif # darwin
 
 ifeq ($(UNAME),Linux)
@@ -120,8 +123,16 @@ endif
 CFLAGS_NATIVE            += $(CFLAGS)
 LFLAGS_NATIVE            := -lpthread -ldl
 CFLAGS_NATIVE            += -DHAVE_HWMON
+LFLAGS_NATIVE            += $(LDFLAGS)
 endif # linux
 
+ifeq ($(UNAME),FreeBSD)
+CFLAGS_NATIVE            := -D_POSIX
+CFLAGS_NATIVE            += $(CFLAGS)
+LFLAGS_NATIVE            := -lpthread
+LFLAGS_NATIVE            += $(LDFLAGS)
+endif # freebsd
+
 ##
 ## Cross compilation target
 ##
@@ -178,7 +189,7 @@ native: hashcat
 binaries: linux32 linux64 win32 win64
 
 clean:
-       $(RM) -f obj/*.o *.bin *.exe *.app *.restore *.out *.pot *.dictstat *.log hashcat core
+       $(RM) -f obj/*.o *.bin *.exe *.restore *.out *.pot *.dictstat *.log hashcat core
        $(RM) -rf *.induct
        $(RM) -rf *.outfiles
        $(RM) -rf *.dSYM