2015-12-04 14:47:52 +00:00
|
|
|
##
|
2016-09-11 20:20:15 +00:00
|
|
|
## Author......: See docs/credits.txt
|
2015-12-04 14:47:52 +00:00
|
|
|
## License.....: MIT
|
|
|
|
##
|
|
|
|
|
2017-01-31 10:44:58 +00:00
|
|
|
SHARED := 0
|
2017-07-14 12:18:59 +00:00
|
|
|
DEBUG := 0
|
2017-11-07 09:28:16 +00:00
|
|
|
PRODUCTION := 0
|
2017-01-31 10:44:58 +00:00
|
|
|
|
2018-01-24 14:04:02 +00:00
|
|
|
##
|
|
|
|
## Native compiler paths
|
|
|
|
##
|
|
|
|
|
|
|
|
CC := gcc
|
|
|
|
FIND := find
|
|
|
|
INSTALL := install
|
|
|
|
RM := rm
|
|
|
|
SED := sed
|
|
|
|
SED_IN_PLACE := -i
|
|
|
|
|
|
|
|
ifeq ($(UNAME),Darwin)
|
|
|
|
CC := clang
|
|
|
|
# the sed -i option of macOS requires a parameter for the backup file (we just use "")
|
|
|
|
SED_IN_PLACE := -i ""
|
|
|
|
PROD_VERS := $(shell sw_vers -productVersion | cut -d. -f2)
|
|
|
|
endif
|
|
|
|
|
|
|
|
ifeq ($(UNAME),FreeBSD)
|
|
|
|
CC := cc
|
|
|
|
SED := gsed
|
|
|
|
endif
|
|
|
|
|
|
|
|
##
|
|
|
|
## Cross compiler paths
|
|
|
|
##
|
|
|
|
|
|
|
|
CC_LINUX_32 := gcc
|
|
|
|
CC_LINUX_64 := gcc
|
|
|
|
|
|
|
|
CC_WIN_32 := i686-w64-mingw32-gcc
|
|
|
|
CC_WIN_64 := x86_64-w64-mingw32-gcc
|
|
|
|
|
|
|
|
##
|
|
|
|
## Misc stuff
|
|
|
|
##
|
|
|
|
|
|
|
|
COMPTIME := $(shell date +%s)
|
|
|
|
|
|
|
|
# the following variable value will be automatically replaced by the "git archive" command
|
|
|
|
# (which is automatically run for every github release)
|
|
|
|
# the value will be something like this: "tag: vX.Y.Z, refs/pull/K/head" or "HEAD -> master, tag: vX.Y.Z"
|
|
|
|
|
|
|
|
VERSION_EXPORT := $Format:%D$
|
|
|
|
VERSION_TAG := $(shell test -d .git && git describe --tags --dirty=+ || echo "$(VERSION_EXPORT)" | $(SED) 's/.*: v\([\.0-9]*\).*/v\1/')
|
|
|
|
|
|
|
|
SONAME_VERSION := $(shell echo "$(VERSION_TAG)" | $(SED) 's/^v\([\.0-9]\+\)-.*/\1/')
|
|
|
|
SONAME_VERSION_MAJOR := $(shell echo "$(SONAME_VERSION)" | $(SED) 's/^\([0-9]\+\)\..*/\1/')
|
|
|
|
|
2016-01-20 19:55:09 +00:00
|
|
|
##
|
|
|
|
## Detect Operating System
|
|
|
|
##
|
|
|
|
|
2016-10-30 12:54:24 +00:00
|
|
|
UNAME := $(shell uname -s)
|
2016-06-11 06:08:22 +00:00
|
|
|
|
|
|
|
# we need to strip the windows version number to be able to build hashcat on cygwin hosts
|
2016-10-30 12:54:24 +00:00
|
|
|
UNAME := $(patsubst CYGWIN_NT-%,CYGWIN,$(UNAME))
|
2016-01-20 19:55:09 +00:00
|
|
|
|
2016-10-30 12:54:24 +00:00
|
|
|
# same for msys
|
|
|
|
UNAME := $(patsubst MSYS_NT-%,MSYS2,$(UNAME))
|
|
|
|
UNAME := $(patsubst MINGW32_NT-%,MSYS2,$(UNAME))
|
|
|
|
UNAME := $(patsubst MINGW64_NT-%,MSYS2,$(UNAME))
|
|
|
|
|
|
|
|
ifeq (,$(filter $(UNAME),Linux FreeBSD Darwin CYGWIN MSYS2))
|
2016-12-29 19:40:07 +00:00
|
|
|
$(error "! Your Operating System ($(UNAME)) is not supported by this Makefile")
|
2016-01-20 19:55:09 +00:00
|
|
|
endif
|
|
|
|
|
|
|
|
ifeq ($(DEBUG),1)
|
|
|
|
$(warning "## Detected Operating System : $(UNAME)")
|
|
|
|
endif
|
|
|
|
|
2015-12-04 14:47:52 +00:00
|
|
|
##
|
|
|
|
## Makefile flags
|
|
|
|
##
|
|
|
|
|
2016-10-30 12:54:24 +00:00
|
|
|
MAKEFLAGS += -l -j -rR --no-print-directory
|
2015-12-04 14:47:52 +00:00
|
|
|
|
|
|
|
ifneq ($(findstring clean,$(MAKECMDGOALS)),)
|
2016-10-30 12:54:24 +00:00
|
|
|
MAKEFLAGS += -j 1
|
2015-12-04 14:47:52 +00:00
|
|
|
endif
|
|
|
|
|
|
|
|
##
|
2015-12-13 11:21:36 +00:00
|
|
|
## Installation paths (Linux only)
|
|
|
|
##
|
|
|
|
|
2016-10-30 12:54:24 +00:00
|
|
|
DESTDIR ?=
|
|
|
|
PREFIX ?= /usr/local
|
2015-12-13 11:21:36 +00:00
|
|
|
|
2016-10-30 12:54:24 +00:00
|
|
|
INSTALL_FOLDER ?= $(PREFIX)/bin
|
2018-01-18 11:09:51 +00:00
|
|
|
INCLUDE_ROOT_FOLDER ?= $(PREFIX)/include
|
|
|
|
INCLUDE_FOLDER ?= $(INCLUDE_ROOT_FOLDER)/hashcat
|
2016-12-29 19:40:07 +00:00
|
|
|
LIBRARY_FOLDER ?= $(PREFIX)/lib
|
2017-11-06 11:46:56 +00:00
|
|
|
SHARED_ROOT_FOLDER ?= $(PREFIX)/share
|
|
|
|
SHARED_FOLDER ?= $(SHARED_ROOT_FOLDER)/hashcat
|
|
|
|
DOCUMENT_FOLDER ?= $(SHARED_ROOT_FOLDER)/doc/hashcat
|
2016-12-29 19:40:07 +00:00
|
|
|
|
|
|
|
##
|
|
|
|
## Filenames for library and frontend
|
|
|
|
##
|
|
|
|
|
|
|
|
HASHCAT_FRONTEND := hashcat
|
2018-01-24 14:04:02 +00:00
|
|
|
HASHCAT_LIBNAME := libhashcat.so
|
|
|
|
HASHCAT_LIBRARY := $(HASHCAT_LIBNAME).$(SONAME_VERSION)
|
|
|
|
HASHCAT_SONAME := $(HASHCAT_LIBNAME).$(SONAME_VERSION_MAJOR)
|
2016-12-29 19:40:07 +00:00
|
|
|
|
|
|
|
ifeq ($(UNAME),CYGWIN)
|
|
|
|
HASHCAT_FRONTEND := hashcat.exe
|
|
|
|
HASHCAT_LIBRARY := hashcat.dll
|
|
|
|
endif # CYGWIN
|
|
|
|
|
|
|
|
ifeq ($(UNAME),MSYS2)
|
|
|
|
HASHCAT_FRONTEND := hashcat.exe
|
|
|
|
HASHCAT_LIBRARY := hashcat.dll
|
|
|
|
endif # MSYS2
|
2015-12-13 11:21:36 +00:00
|
|
|
|
2015-12-15 17:58:02 +00:00
|
|
|
##
|
2016-05-10 17:07:07 +00:00
|
|
|
## Dependencies
|
2016-06-11 08:52:00 +00:00
|
|
|
## You may ignore them if you're compiling only a native binary and
|
|
|
|
## You have your own headers somewhere, for example: apt-get install opencl-headers
|
2015-12-15 17:58:02 +00:00
|
|
|
##
|
|
|
|
|
2016-10-30 12:54:24 +00:00
|
|
|
OPENCL_HEADERS_KHRONOS := deps/OpenCL-Headers
|
2016-01-03 12:17:14 +00:00
|
|
|
|
2017-04-19 10:58:25 +00:00
|
|
|
## To compile win-iconv with mingw clone from here: https://github.com/win-iconv/win-iconv
|
2017-04-14 14:36:28 +00:00
|
|
|
##
|
2017-04-19 10:58:25 +00:00
|
|
|
## Then patch the makefile withe the patches from tools/win-iconv-*.diff and run make install
|
2017-04-14 14:36:28 +00:00
|
|
|
##
|
|
|
|
|
2017-04-19 10:58:25 +00:00
|
|
|
WIN_ICONV_32 := /opt/win-iconv-32
|
|
|
|
WIN_ICONV_64 := /opt/win-iconv-64
|
2017-04-14 14:36:28 +00:00
|
|
|
|
2015-12-04 14:47:52 +00:00
|
|
|
##
|
2016-10-30 21:47:48 +00:00
|
|
|
## General compiler and linker options
|
2015-12-04 14:47:52 +00:00
|
|
|
##
|
|
|
|
|
2017-03-05 02:51:46 +00:00
|
|
|
CFLAGS += -pipe -std=gnu99 -Iinclude/ -Iinclude/lzma_sdk/ -IOpenCL/
|
2017-01-04 09:33:20 +00:00
|
|
|
|
|
|
|
ifeq ($(PRODUCTION),0)
|
2016-10-30 19:37:02 +00:00
|
|
|
CFLAGS += -W
|
|
|
|
CFLAGS += -Wall
|
|
|
|
CFLAGS += -Wextra
|
|
|
|
CFLAGS += -Wfloat-equal
|
|
|
|
CFLAGS += -Wundef
|
|
|
|
CFLAGS += -Wshadow
|
|
|
|
CFLAGS += -Wmissing-declarations
|
|
|
|
CFLAGS += -Wmissing-prototypes
|
2016-10-30 19:39:27 +00:00
|
|
|
CFLAGS += -Wpointer-arith
|
2016-10-30 19:45:44 +00:00
|
|
|
CFLAGS += -Wstrict-prototypes
|
2016-10-30 20:56:56 +00:00
|
|
|
CFLAGS += -Waggregate-return
|
|
|
|
CFLAGS += -Wswitch-enum
|
|
|
|
CFLAGS += -Winit-self
|
|
|
|
CFLAGS += -Werror-implicit-function-declaration
|
|
|
|
CFLAGS += -Wformat
|
2016-11-02 22:40:14 +00:00
|
|
|
CFLAGS += -ftrapv
|
2017-04-10 20:35:01 +00:00
|
|
|
CFLAGS += -Wwrite-strings
|
2016-10-30 21:47:48 +00:00
|
|
|
|
|
|
|
# the following compiler options produce warnings that should be fixed at some time
|
|
|
|
|
2017-09-28 03:00:44 +00:00
|
|
|
CFLAGS += -Wno-cast-align
|
|
|
|
CFLAGS += -Wno-cast-qual
|
|
|
|
CFLAGS += -Wno-conversion
|
|
|
|
CFLAGS += -Wno-padded
|
|
|
|
CFLAGS += -Wno-pedantic
|
|
|
|
CFLAGS += -Wno-sizeof-pointer-memaccess
|
|
|
|
#CFLAGS += -Wno-reserved-id-macro //clang specific
|
|
|
|
#CFLAGS += -Wno-used-but-marked-unused // ^^
|
2017-01-04 09:33:20 +00:00
|
|
|
endif
|
2016-10-30 19:37:02 +00:00
|
|
|
|
2017-10-20 09:58:31 +00:00
|
|
|
# default Linux and freebsd thread stack size is 2MB
|
|
|
|
# default Windows thread stack size is 1MB
|
2017-10-20 11:36:47 +00:00
|
|
|
# default macOS thread stack size is 512kB
|
2017-09-21 12:17:16 +00:00
|
|
|
# unfortunately, this option isn't supported by older GCC and clang versions
|
2016-10-30 20:58:22 +00:00
|
|
|
|
2016-10-30 21:47:48 +00:00
|
|
|
#CFLAGS += -Wstack-usage=524288
|
2016-10-30 20:58:22 +00:00
|
|
|
|
2016-12-06 19:39:04 +00:00
|
|
|
LFLAGS := $(LDFLAGS)
|
2016-03-06 11:03:08 +00:00
|
|
|
|
2017-01-31 10:44:58 +00:00
|
|
|
ifeq ($(DEBUG),0)
|
2016-10-30 12:54:24 +00:00
|
|
|
CFLAGS += -O2
|
|
|
|
LFLAGS += -s
|
2017-02-11 13:18:42 +00:00
|
|
|
else
|
2017-01-31 10:44:58 +00:00
|
|
|
ifeq ($(DEBUG),1)
|
2017-10-27 07:08:56 +00:00
|
|
|
CFLAGS += -DDEBUG -Og -ggdb
|
2017-02-11 13:18:42 +00:00
|
|
|
else
|
2016-03-06 11:03:08 +00:00
|
|
|
ifeq ($(DEBUG),2)
|
2017-10-27 07:08:56 +00:00
|
|
|
CFLAGS += -DDEBUG -Og -ggdb
|
2016-10-30 12:54:24 +00:00
|
|
|
CFLAGS += -fsanitize=address -fno-omit-frame-pointer
|
2016-01-20 19:55:09 +00:00
|
|
|
endif
|
2016-10-10 09:27:50 +00:00
|
|
|
endif
|
2017-01-31 10:44:58 +00:00
|
|
|
endif
|
2016-10-10 09:27:50 +00:00
|
|
|
|
2016-01-03 17:50:02 +00:00
|
|
|
##
|
|
|
|
## Native compilation target
|
|
|
|
##
|
|
|
|
|
2016-01-20 19:55:09 +00:00
|
|
|
ifeq ($(UNAME),Linux)
|
2016-10-30 12:54:24 +00:00
|
|
|
CFLAGS_NATIVE := $(CFLAGS)
|
|
|
|
CFLAGS_NATIVE += -I$(OPENCL_HEADERS_KHRONOS)/
|
|
|
|
CFLAGS_NATIVE += -DWITH_HWMON
|
|
|
|
LFLAGS_NATIVE := $(LFLAGS)
|
2017-04-14 14:36:28 +00:00
|
|
|
LFLAGS_NATIVE += -lpthread
|
2017-04-19 08:51:28 +00:00
|
|
|
LFLAGS_NATIVE += -ldl
|
2016-10-30 12:54:24 +00:00
|
|
|
endif # Linux
|
2016-01-03 17:50:02 +00:00
|
|
|
|
2016-07-05 18:58:28 +00:00
|
|
|
ifeq ($(UNAME),FreeBSD)
|
2016-12-30 13:19:00 +00:00
|
|
|
ifndef PORTNAME
|
2016-10-30 12:54:24 +00:00
|
|
|
CFLAGS_NATIVE := $(CFLAGS)
|
2016-12-30 13:19:00 +00:00
|
|
|
CFLAGS_NATIVE += -I$(OPENCL_HEADERS_KHRONOS)/
|
2016-12-30 13:41:15 +00:00
|
|
|
LFLAGS_NATIVE := $(LFLAGS)
|
2017-04-19 08:51:28 +00:00
|
|
|
LFLAGS_NATIVE += -lpthread
|
2016-12-30 13:41:15 +00:00
|
|
|
endif
|
2016-10-30 12:54:24 +00:00
|
|
|
endif # FreeBSD
|
2016-10-13 15:27:09 +00:00
|
|
|
|
2016-10-30 12:54:24 +00:00
|
|
|
ifeq ($(UNAME),Darwin)
|
|
|
|
export MACOSX_DEPLOYMENT_TARGET=10.9
|
|
|
|
CFLAGS_NATIVE := $(CFLAGS)
|
2017-12-26 13:09:30 +00:00
|
|
|
|
|
|
|
ifeq ($(shell test $(PROD_VERS) -le 11; echo $$?), 0)
|
|
|
|
CFLAGS_NATIVE += -DMISSING_CLOCK_GETTIME
|
|
|
|
endif
|
|
|
|
|
2016-10-30 12:54:24 +00:00
|
|
|
LFLAGS_NATIVE := $(LFLAGS)
|
2016-10-30 13:31:17 +00:00
|
|
|
LFLAGS_NATIVE += -framework OpenCL
|
2016-10-30 12:54:24 +00:00
|
|
|
LFLAGS_NATIVE += -lpthread
|
2017-04-14 16:54:34 +00:00
|
|
|
LFLAGS_NATIVE += -liconv
|
2016-10-30 12:54:24 +00:00
|
|
|
endif # Darwin
|
|
|
|
|
|
|
|
ifeq ($(UNAME),CYGWIN)
|
|
|
|
CFLAGS_NATIVE := $(CFLAGS)
|
|
|
|
CFLAGS_NATIVE += -I$(OPENCL_HEADERS_KHRONOS)/
|
|
|
|
CFLAGS_NATIVE += -DWITH_HWMON
|
|
|
|
LFLAGS_NATIVE := $(LFLAGS)
|
|
|
|
LFLAGS_NATIVE += -Wl,--dynamicbase -Wl,--nxcompat
|
|
|
|
LFLAGS_NATIVE += -lpsapi
|
2017-04-14 14:36:28 +00:00
|
|
|
LFLAGS_NATIVE += -liconv
|
2016-10-30 12:54:24 +00:00
|
|
|
endif # CYGWIN
|
|
|
|
|
|
|
|
ifeq ($(UNAME),MSYS2)
|
|
|
|
CFLAGS_NATIVE := $(CFLAGS)
|
|
|
|
CFLAGS_NATIVE += -I$(OPENCL_HEADERS_KHRONOS)/
|
|
|
|
CFLAGS_NATIVE += -DWITH_HWMON
|
|
|
|
LFLAGS_NATIVE := $(LFLAGS)
|
|
|
|
LFLAGS_NATIVE += -Wl,--dynamicbase -Wl,--nxcompat
|
|
|
|
LFLAGS_NATIVE += -lpsapi
|
2017-04-14 14:36:28 +00:00
|
|
|
LFLAGS_NATIVE += -liconv
|
2016-10-30 12:54:24 +00:00
|
|
|
endif # MSYS2
|
|
|
|
|
|
|
|
##
|
|
|
|
## Cross compilation targets
|
|
|
|
##
|
|
|
|
|
|
|
|
CFLAGS_CROSS_LINUX32 := $(CFLAGS)
|
|
|
|
CFLAGS_CROSS_LINUX32 += -I$(OPENCL_HEADERS_KHRONOS)/
|
|
|
|
CFLAGS_CROSS_LINUX32 += -m32
|
|
|
|
CFLAGS_CROSS_LINUX32 += -DWITH_HWMON
|
|
|
|
CFLAGS_CROSS_LINUX64 := $(CFLAGS)
|
|
|
|
CFLAGS_CROSS_LINUX64 += -I$(OPENCL_HEADERS_KHRONOS)/
|
|
|
|
CFLAGS_CROSS_LINUX64 += -m64
|
|
|
|
CFLAGS_CROSS_LINUX64 += -DWITH_HWMON
|
|
|
|
CFLAGS_CROSS_WIN32 := $(CFLAGS)
|
2017-12-10 00:40:45 +00:00
|
|
|
CFLAGS_CROSS_WIN32 += -D__MINGW_USE_VC2005_COMPAT #hack to get 64-bit time_t
|
2016-10-30 12:54:24 +00:00
|
|
|
CFLAGS_CROSS_WIN32 += -I$(OPENCL_HEADERS_KHRONOS)/
|
2017-04-19 10:58:25 +00:00
|
|
|
CFLAGS_CROSS_WIN32 += -I$(WIN_ICONV_32)/include/
|
2016-10-30 12:54:24 +00:00
|
|
|
CFLAGS_CROSS_WIN32 += -m32
|
|
|
|
CFLAGS_CROSS_WIN32 += -DWITH_HWMON
|
|
|
|
CFLAGS_CROSS_WIN64 := $(CFLAGS)
|
|
|
|
CFLAGS_CROSS_WIN64 += -I$(OPENCL_HEADERS_KHRONOS)/
|
2017-04-19 10:58:25 +00:00
|
|
|
CFLAGS_CROSS_WIN64 += -I$(WIN_ICONV_64)/include/
|
2016-10-30 12:54:24 +00:00
|
|
|
CFLAGS_CROSS_WIN64 += -m64
|
|
|
|
CFLAGS_CROSS_WIN64 += -DWITH_HWMON
|
|
|
|
|
|
|
|
LFLAGS_CROSS_LINUX32 := $(LFLAGS)
|
2017-04-19 08:51:28 +00:00
|
|
|
LFLAGS_CROSS_LINUX32 += -lpthread
|
|
|
|
LFLAGS_CROSS_LINUX32 += -ldl
|
2016-10-30 12:54:24 +00:00
|
|
|
LFLAGS_CROSS_LINUX64 := $(LFLAGS)
|
2017-04-19 08:51:28 +00:00
|
|
|
LFLAGS_CROSS_LINUX64 += -lpthread
|
|
|
|
LFLAGS_CROSS_LINUX64 += -ldl
|
2016-10-30 12:54:24 +00:00
|
|
|
LFLAGS_CROSS_WIN32 := $(LFLAGS)
|
|
|
|
LFLAGS_CROSS_WIN32 += -Wl,--dynamicbase -Wl,--nxcompat
|
|
|
|
LFLAGS_CROSS_WIN32 += -lpsapi
|
|
|
|
LFLAGS_CROSS_WIN64 := $(LFLAGS)
|
|
|
|
LFLAGS_CROSS_WIN64 += -Wl,--dynamicbase -Wl,--nxcompat
|
|
|
|
LFLAGS_CROSS_WIN64 += -lpsapi
|
|
|
|
|
2016-01-20 19:55:09 +00:00
|
|
|
##
|
|
|
|
## Objects
|
|
|
|
##
|
|
|
|
|
2017-12-01 14:19:10 +00:00
|
|
|
OBJS_ALL := affinity autotune benchmark bitmap bitops combinator common convert cpt cpu_aes cpu_crc32 cpu_des cpu_md4 cpu_md5 cpu_sha1 cpu_sha256 debugfile dictstat dispatch dynloader event ext_ADL ext_nvapi ext_nvml ext_OpenCL ext_sysfs ext_lzma lzma_sdk/Alloc lzma_sdk/Lzma2Dec lzma_sdk/LzmaDec filehandling folder hashcat hashes hlfmt hwmon induct interface locking logfile loopback memory monitor mpsp opencl outfile_check outfile pidfile potfile restore rp rp_cpu rp_kernel_on_cpu rp_kernel_on_cpu_optimized selftest shared status stdout straight terminal thread timer tuningdb usage user_options wordlist
|
2016-01-20 19:55:09 +00:00
|
|
|
|
2017-01-24 15:07:59 +00:00
|
|
|
NATIVE_STATIC_OBJS := $(foreach OBJ,$(OBJS_ALL),obj/$(OBJ).NATIVE.STATIC.o)
|
2016-10-30 12:54:24 +00:00
|
|
|
NATIVE_SHARED_OBJS := $(foreach OBJ,$(OBJS_ALL),obj/$(OBJ).NATIVE.SHARED.o)
|
2016-01-20 19:55:09 +00:00
|
|
|
|
2016-10-30 12:54:24 +00:00
|
|
|
LINUX_32_OBJS := $(foreach OBJ,$(OBJS_ALL),obj/$(OBJ).LINUX.32.o)
|
|
|
|
LINUX_64_OBJS := $(foreach OBJ,$(OBJS_ALL),obj/$(OBJ).LINUX.64.o)
|
2016-06-07 10:39:41 +00:00
|
|
|
|
2017-02-09 09:42:35 +00:00
|
|
|
WIN_32_OBJS := $(foreach OBJ,$(OBJS_ALL),obj/$(OBJ).WIN.32.o)
|
|
|
|
WIN_64_OBJS := $(foreach OBJ,$(OBJS_ALL),obj/$(OBJ).WIN.64.o)
|
2016-06-07 10:39:41 +00:00
|
|
|
|
2015-12-04 14:47:52 +00:00
|
|
|
##
|
2016-12-29 19:40:07 +00:00
|
|
|
## Targets: Native Compilation
|
2015-12-04 14:47:52 +00:00
|
|
|
##
|
|
|
|
|
2017-01-27 22:12:44 +00:00
|
|
|
default: $(HASHCAT_FRONTEND)
|
2015-12-04 14:47:52 +00:00
|
|
|
|
2016-01-02 16:42:47 +00:00
|
|
|
clean:
|
2018-01-24 14:04:02 +00:00
|
|
|
$(RM) -f obj/*.o obj/lzma_sdk/*.o *.bin *.exe *.so.* *.dll *.pid hashcat core
|
2016-01-02 23:40:31 +00:00
|
|
|
$(RM) -rf *.induct
|
|
|
|
$(RM) -rf *.outfiles
|
2016-01-20 19:55:09 +00:00
|
|
|
$(RM) -rf *.dSYM
|
2016-01-13 17:16:56 +00:00
|
|
|
$(RM) -rf kernels
|
2015-12-04 14:47:52 +00:00
|
|
|
|
2017-04-06 09:39:29 +00:00
|
|
|
distclean: clean
|
|
|
|
$(RM) -f *.restore *.pot *.out *.log
|
|
|
|
|
2016-12-29 19:40:07 +00:00
|
|
|
##
|
|
|
|
## Targets: Cross Compilation (for binary release version)
|
|
|
|
##
|
|
|
|
|
|
|
|
binaries: linux32 linux64 win32 win64
|
|
|
|
|
2016-05-10 17:07:07 +00:00
|
|
|
linux32: hashcat32.bin
|
|
|
|
linux64: hashcat64.bin
|
2015-12-04 14:47:52 +00:00
|
|
|
|
2016-05-10 17:07:07 +00:00
|
|
|
win32: hashcat32.exe
|
|
|
|
win64: hashcat64.exe
|
2015-12-04 14:47:52 +00:00
|
|
|
|
2015-12-13 11:21:36 +00:00
|
|
|
##
|
|
|
|
## Targets: Linux install
|
|
|
|
## How to make /usr/bin/install doing recursive??
|
|
|
|
##
|
|
|
|
|
2018-01-26 07:20:12 +00:00
|
|
|
# allow (whitelist) "make install" only on unix-based systems (also disallow cygwin/msys)
|
|
|
|
|
|
|
|
ifneq ($(findstring install,$(MAKECMDGOALS)),)
|
|
|
|
ifeq (,$(filter $(UNAME),Linux FreeBSD Darwin))
|
|
|
|
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
|
|
|
|
endef
|
|
|
|
|
|
|
|
$(error $(ERROR_INSTALL_DISALLOWED))
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
|
2017-01-27 13:59:05 +00:00
|
|
|
ifeq ($(SHARED),1)
|
2018-01-18 11:09:51 +00:00
|
|
|
install: install_docs install_shared install_include install_library install_hashcat
|
2017-01-27 13:59:05 +00:00
|
|
|
else
|
2018-01-18 11:09:51 +00:00
|
|
|
install: install_docs install_shared install_hashcat
|
2017-01-27 13:59:05 +00:00
|
|
|
endif
|
2016-12-29 19:40:07 +00:00
|
|
|
|
2017-11-06 11:46:56 +00:00
|
|
|
# we need this extra target to make sure that for parallel builds (i.e. 2+ Makefile targets could possible run at the same time)
|
|
|
|
# the root folder of the shared directory is created first (and is a dependency for the targets that depend on it)
|
|
|
|
|
2018-01-18 11:09:51 +00:00
|
|
|
install_make_include_root:
|
2018-01-26 15:29:03 +00:00
|
|
|
$(INSTALL) -m 755 -d $(DESTDIR)$(INCLUDE_ROOT_FOLDER)
|
2018-01-18 11:09:51 +00:00
|
|
|
|
2017-11-06 11:46:56 +00:00
|
|
|
install_make_share_root:
|
2018-01-26 15:29:03 +00:00
|
|
|
$(INSTALL) -m 755 -d $(DESTDIR)$(SHARED_ROOT_FOLDER)
|
2017-11-06 11:46:56 +00:00
|
|
|
|
|
|
|
install_docs: install_make_share_root
|
2018-01-26 15:29:03 +00:00
|
|
|
$(INSTALL) -m 755 -d $(DESTDIR)$(DOCUMENT_FOLDER)
|
|
|
|
$(INSTALL) -m 755 -d $(DESTDIR)$(DOCUMENT_FOLDER)/docs
|
|
|
|
$(INSTALL) -m 755 -d $(DESTDIR)$(DOCUMENT_FOLDER)/charsets
|
|
|
|
$(INSTALL) -m 755 -d $(DESTDIR)$(DOCUMENT_FOLDER)/masks
|
|
|
|
$(INSTALL) -m 755 -d $(DESTDIR)$(DOCUMENT_FOLDER)/rules
|
|
|
|
$(INSTALL) -m 755 -d $(DESTDIR)$(DOCUMENT_FOLDER)/extra
|
|
|
|
$(INSTALL) -m 755 -d $(DESTDIR)$(DOCUMENT_FOLDER)/extra/tab_completion
|
|
|
|
$(INSTALL) -m 644 example.dict $(DESTDIR)$(DOCUMENT_FOLDER)/
|
|
|
|
$(INSTALL) -m 644 example0.hash $(DESTDIR)$(DOCUMENT_FOLDER)/
|
|
|
|
$(INSTALL) -m 644 example400.hash $(DESTDIR)$(DOCUMENT_FOLDER)/
|
|
|
|
$(INSTALL) -m 644 example500.hash $(DESTDIR)$(DOCUMENT_FOLDER)/
|
|
|
|
$(INSTALL) -m 755 example0.sh $(DESTDIR)$(DOCUMENT_FOLDER)/
|
|
|
|
$(INSTALL) -m 755 example400.sh $(DESTDIR)$(DOCUMENT_FOLDER)/
|
|
|
|
$(INSTALL) -m 755 example500.sh $(DESTDIR)$(DOCUMENT_FOLDER)/
|
|
|
|
$(INSTALL) -m 644 extra/tab_completion/hashcat.sh $(DESTDIR)$(DOCUMENT_FOLDER)/extra/tab_completion/
|
|
|
|
$(INSTALL) -m 644 extra/tab_completion/howto.txt $(DESTDIR)$(DOCUMENT_FOLDER)/extra/tab_completion/
|
|
|
|
$(INSTALL) -m 755 extra/tab_completion/install $(DESTDIR)$(DOCUMENT_FOLDER)/extra/tab_completion/
|
|
|
|
$(FIND) docs/ -type d -exec $(INSTALL) -m 755 -d $(DESTDIR)$(DOCUMENT_FOLDER)/{} \;
|
|
|
|
$(FIND) docs/ -type f -exec $(INSTALL) -m 644 {} $(DESTDIR)$(DOCUMENT_FOLDER)/{} \;
|
|
|
|
$(FIND) charsets/ -type d -exec $(INSTALL) -m 755 -d $(DESTDIR)$(DOCUMENT_FOLDER)/{} \;
|
|
|
|
$(FIND) charsets/ -type f -exec $(INSTALL) -m 644 {} $(DESTDIR)$(DOCUMENT_FOLDER)/{} \;
|
|
|
|
$(FIND) masks/ -type d -exec $(INSTALL) -m 755 -d $(DESTDIR)$(DOCUMENT_FOLDER)/{} \;
|
|
|
|
$(FIND) masks/ -type f -exec $(INSTALL) -m 644 {} $(DESTDIR)$(DOCUMENT_FOLDER)/{} \;
|
|
|
|
$(FIND) rules/ -type d -exec $(INSTALL) -m 755 -d $(DESTDIR)$(DOCUMENT_FOLDER)/{} \;
|
|
|
|
$(FIND) rules/ -type f -exec $(INSTALL) -m 644 {} $(DESTDIR)$(DOCUMENT_FOLDER)/{} \;
|
|
|
|
$(SED) $(SED_IN_PLACE) 's/\.\/hashcat/hashcat/' $(DESTDIR)$(DOCUMENT_FOLDER)/example0.sh
|
|
|
|
$(SED) $(SED_IN_PLACE) 's/\.\/hashcat/hashcat/' $(DESTDIR)$(DOCUMENT_FOLDER)/example400.sh
|
|
|
|
$(SED) $(SED_IN_PLACE) 's/\.\/hashcat/hashcat/' $(DESTDIR)$(DOCUMENT_FOLDER)/example500.sh
|
2015-12-13 11:21:36 +00:00
|
|
|
|
2017-11-06 11:46:56 +00:00
|
|
|
install_shared: install_make_share_root
|
2018-01-26 15:29:03 +00:00
|
|
|
$(INSTALL) -m 755 -d $(DESTDIR)$(SHARED_FOLDER)
|
|
|
|
$(INSTALL) -m 644 hashcat.hctune $(DESTDIR)$(SHARED_FOLDER)/
|
|
|
|
$(INSTALL) -m 644 hashcat.hcstat2 $(DESTDIR)$(SHARED_FOLDER)/
|
|
|
|
$(INSTALL) -m 755 -d $(DESTDIR)$(SHARED_FOLDER)/OpenCL
|
|
|
|
$(FIND) OpenCL/ -type d -mindepth 1 -execdir $(INSTALL) -m 755 -d $(DESTDIR)$(SHARED_FOLDER)/OpenCL/{} \;
|
|
|
|
$(FIND) OpenCL/ -type f -mindepth 1 -execdir $(INSTALL) -m 644 {} $(DESTDIR)$(SHARED_FOLDER)/OpenCL/{} \;
|
2018-01-18 11:09:51 +00:00
|
|
|
|
|
|
|
install_include: install_make_include_root
|
2018-01-26 15:29:03 +00:00
|
|
|
$(INSTALL) -m 755 -d $(DESTDIR)$(INCLUDE_FOLDER)
|
|
|
|
$(FIND) include/ -type d -mindepth 1 -execdir $(INSTALL) -m 755 -d $(DESTDIR)$(INCLUDE_FOLDER)/{} \;
|
|
|
|
$(FIND) include/ -type f -mindepth 1 -execdir $(INSTALL) -m 644 {} $(DESTDIR)$(INCLUDE_FOLDER)/{} \;
|
2015-12-13 11:21:36 +00:00
|
|
|
|
2016-12-29 19:40:07 +00:00
|
|
|
install_library: $(HASHCAT_LIBRARY)
|
2018-01-26 15:29:03 +00:00
|
|
|
$(INSTALL) -m 755 -d $(DESTDIR)$(LIBRARY_FOLDER)
|
|
|
|
$(INSTALL) -m 755 $(HASHCAT_LIBRARY) $(DESTDIR)$(LIBRARY_FOLDER)/
|
2016-01-02 16:42:47 +00:00
|
|
|
|
2016-12-29 19:40:07 +00:00
|
|
|
install_hashcat: $(HASHCAT_FRONTEND)
|
2018-01-26 15:29:03 +00:00
|
|
|
$(INSTALL) -m 755 -d $(DESTDIR)$(INSTALL_FOLDER)
|
|
|
|
$(INSTALL) -m 755 $(HASHCAT_FRONTEND) $(DESTDIR)$(INSTALL_FOLDER)/
|
2016-10-13 15:27:09 +00:00
|
|
|
|
2016-12-29 19:40:07 +00:00
|
|
|
uninstall:
|
|
|
|
$(RM) -f $(DESTDIR)$(INSTALL_FOLDER)/$(HASHCAT_FRONTEND)
|
|
|
|
$(RM) -f $(DESTDIR)$(LIBRARY_FOLDER)/$(HASHCAT_LIBRARY)
|
2018-01-18 11:09:51 +00:00
|
|
|
$(RM) -rf $(DESTDIR)$(INCLUDE_FOLDER)
|
2016-12-29 19:40:07 +00:00
|
|
|
$(RM) -rf $(DESTDIR)$(SHARED_FOLDER)
|
|
|
|
$(RM) -rf $(DESTDIR)$(DOCUMENT_FOLDER)
|
2016-10-13 15:27:09 +00:00
|
|
|
|
|
|
|
##
|
2016-12-29 19:40:07 +00:00
|
|
|
## native compiled hashcat library and frontend
|
2016-10-13 15:27:09 +00:00
|
|
|
##
|
|
|
|
|
2017-01-24 15:07:59 +00:00
|
|
|
obj/%.NATIVE.STATIC.o: src/%.c
|
|
|
|
$(CC) -c $(CFLAGS_NATIVE) $< -o $@
|
|
|
|
|
2016-10-13 15:27:09 +00:00
|
|
|
obj/%.NATIVE.SHARED.o: src/%.c
|
2017-01-24 15:07:59 +00:00
|
|
|
$(CC) -c $(CFLAGS_NATIVE) $< -o $@ -fpic
|
2016-10-13 15:27:09 +00:00
|
|
|
|
2016-12-29 19:40:07 +00:00
|
|
|
$(HASHCAT_LIBRARY): $(NATIVE_SHARED_OBJS)
|
2018-01-24 14:04:02 +00:00
|
|
|
$(CC) $^ $(LFLAGS_NATIVE) -o $@ -shared -Wl,-soname,$(HASHCAT_SONAME)
|
2017-01-24 15:07:59 +00:00
|
|
|
|
2017-01-27 08:58:01 +00:00
|
|
|
ifeq ($(SHARED),1)
|
|
|
|
$(HASHCAT_FRONTEND): src/main.c $(HASHCAT_LIBRARY)
|
2018-01-24 14:04:02 +00:00
|
|
|
$(CC) $(CFLAGS_NATIVE) $^ $(HASHCAT_LIBRARY) $(LFLAGS_NATIVE) -DCOMPTIME=$(COMPTIME) -DVERSION_TAG=\"$(VERSION_TAG)\" -DINSTALL_FOLDER=\"$(INSTALL_FOLDER)\" -DSHARED_FOLDER=\"$(SHARED_FOLDER)\" -DDOCUMENT_FOLDER=\"$(DOCUMENT_FOLDER)\" -o $@
|
2017-01-27 08:58:01 +00:00
|
|
|
else
|
|
|
|
$(HASHCAT_FRONTEND): src/main.c $(NATIVE_STATIC_OBJS)
|
2017-02-07 10:56:48 +00:00
|
|
|
$(CC) $(CFLAGS_NATIVE) $^ $(LFLAGS_NATIVE) -DCOMPTIME=$(COMPTIME) -DVERSION_TAG=\"$(VERSION_TAG)\" -DINSTALL_FOLDER=\"$(INSTALL_FOLDER)\" -DSHARED_FOLDER=\"$(SHARED_FOLDER)\" -DDOCUMENT_FOLDER=\"$(DOCUMENT_FOLDER)\" -o $@
|
2017-01-27 08:58:01 +00:00
|
|
|
endif
|
2016-01-02 16:42:47 +00:00
|
|
|
|
|
|
|
##
|
2016-12-29 19:40:07 +00:00
|
|
|
## cross compiled hashcat
|
2015-12-04 14:47:52 +00:00
|
|
|
##
|
|
|
|
|
2016-01-20 19:55:09 +00:00
|
|
|
obj/%.LINUX.32.o: src/%.c
|
2016-10-30 12:54:24 +00:00
|
|
|
$(CC_LINUX_32) $(CFLAGS_CROSS_LINUX32) -c -o $@ $<
|
2015-12-04 14:47:52 +00:00
|
|
|
|
2016-01-20 19:55:09 +00:00
|
|
|
obj/%.LINUX.64.o: src/%.c
|
2016-10-30 12:54:24 +00:00
|
|
|
$(CC_LINUX_64) $(CFLAGS_CROSS_LINUX64) -c -o $@ $<
|
2015-12-04 14:47:52 +00:00
|
|
|
|
2016-01-20 19:55:09 +00:00
|
|
|
obj/%.WIN.32.o: src/%.c
|
2016-10-30 12:54:24 +00:00
|
|
|
$(CC_WIN_32) $(CFLAGS_CROSS_WIN32) -c -o $@ $<
|
2015-12-04 14:47:52 +00:00
|
|
|
|
2016-01-20 19:55:09 +00:00
|
|
|
obj/%.WIN.64.o: src/%.c
|
2016-10-30 12:54:24 +00:00
|
|
|
$(CC_WIN_64) $(CFLAGS_CROSS_WIN64) -c -o $@ $<
|
2015-12-04 14:47:52 +00:00
|
|
|
|
2016-09-30 20:52:44 +00:00
|
|
|
hashcat32.bin: src/main.c $(LINUX_32_OBJS)
|
2016-10-30 12:54:24 +00:00
|
|
|
$(CC_LINUX_32) $(CFLAGS_CROSS_LINUX32) -o $@ $^ $(LFLAGS_CROSS_LINUX32) -DCOMPTIME=$(COMPTIME) -DVERSION_TAG=\"$(VERSION_TAG)\" -DINSTALL_FOLDER=\"$(INSTALL_FOLDER)\" -DSHARED_FOLDER=\"$(SHARED_FOLDER)\" -DDOCUMENT_FOLDER=\"$(DOCUMENT_FOLDER)\"
|
2015-12-04 14:47:52 +00:00
|
|
|
|
2016-09-30 20:52:44 +00:00
|
|
|
hashcat64.bin: src/main.c $(LINUX_64_OBJS)
|
2016-10-30 12:54:24 +00:00
|
|
|
$(CC_LINUX_64) $(CFLAGS_CROSS_LINUX64) -o $@ $^ $(LFLAGS_CROSS_LINUX64) -DCOMPTIME=$(COMPTIME) -DVERSION_TAG=\"$(VERSION_TAG)\" -DINSTALL_FOLDER=\"$(INSTALL_FOLDER)\" -DSHARED_FOLDER=\"$(SHARED_FOLDER)\" -DDOCUMENT_FOLDER=\"$(DOCUMENT_FOLDER)\"
|
2015-12-04 14:47:52 +00:00
|
|
|
|
2017-04-19 10:58:25 +00:00
|
|
|
hashcat32.exe: src/main.c $(WIN_32_OBJS) $(WIN_ICONV_32)/lib/libiconv.a
|
2016-10-30 12:54:24 +00:00
|
|
|
$(CC_WIN_32) $(CFLAGS_CROSS_WIN32) -o $@ $^ $(LFLAGS_CROSS_WIN32) -DCOMPTIME=$(COMPTIME) -DVERSION_TAG=\"$(VERSION_TAG)\"
|
2015-12-04 14:47:52 +00:00
|
|
|
|
2017-04-19 10:58:25 +00:00
|
|
|
hashcat64.exe: src/main.c $(WIN_64_OBJS) $(WIN_ICONV_64)/lib/libiconv.a
|
2016-10-30 12:54:24 +00:00
|
|
|
$(CC_WIN_64) $(CFLAGS_CROSS_WIN64) -o $@ $^ $(LFLAGS_CROSS_WIN64) -DCOMPTIME=$(COMPTIME) -DVERSION_TAG=\"$(VERSION_TAG)\"
|
2016-12-28 13:05:26 +00:00
|
|
|
|
|
|
|
hashcat32.dll: src/main.c $(WIN_32_OBJS)
|
|
|
|
$(CC_WIN_32) $(CFLAGS_CROSS_WIN32) -o $@ $^ $(LFLAGS_CROSS_WIN32) -DCOMPTIME=$(COMPTIME) -DVERSION_TAG=\"$(VERSION_TAG)\" -shared
|
|
|
|
|
|
|
|
hashcat64.dll: src/main.c $(WIN_64_OBJS)
|
|
|
|
$(CC_WIN_64) $(CFLAGS_CROSS_WIN64) -o $@ $^ $(LFLAGS_CROSS_WIN64) -DCOMPTIME=$(COMPTIME) -DVERSION_TAG=\"$(VERSION_TAG)\" -shared
|