2015-12-04 14:47:52 +00:00
|
|
|
##
|
|
|
|
## Author......: Jens Steube <jens.steube@gmail.com>
|
|
|
|
## License.....: MIT
|
|
|
|
##
|
|
|
|
|
|
|
|
##
|
2015-12-06 12:09:17 +00:00
|
|
|
## Detect number of processors
|
2015-12-04 14:47:52 +00:00
|
|
|
##
|
|
|
|
|
2015-12-06 12:09:17 +00:00
|
|
|
NPROCS := $(shell grep -c ^processor /proc/cpuinfo)
|
2015-12-04 14:47:52 +00:00
|
|
|
OS := $(shell uname)
|
|
|
|
|
|
|
|
##
|
|
|
|
## Makefile flags
|
|
|
|
##
|
|
|
|
|
2015-12-06 12:09:17 +00:00
|
|
|
MAKEFLAGS += -l -j $(NPROCS) -rR --no-print-directory
|
2015-12-04 14:47:52 +00:00
|
|
|
|
|
|
|
ifneq ($(findstring clean,$(MAKECMDGOALS)),)
|
|
|
|
MAKEFLAGS += -j 1
|
|
|
|
endif
|
|
|
|
|
|
|
|
##
|
2015-12-13 11:21:36 +00:00
|
|
|
## Installation paths (Linux only)
|
|
|
|
##
|
|
|
|
|
|
|
|
INSTALL_FOLDER ?= /opt/test/usr/bin
|
|
|
|
SHARED_FOLDER ?= /opt/test/usr/share/oclHashcat
|
|
|
|
DOCUMENT_FOLDER ?= /opt/test/usr/share/doc/oclHashcat
|
|
|
|
|
|
|
|
#INSTALL_FOLDER ?= /usr/bin
|
|
|
|
#SHARED_FOLDER ?= /usr/share/oclHashcat
|
|
|
|
#DOCUMENT_FOLDER ?= /usr/share/doc/oclHashcat
|
|
|
|
|
|
|
|
##
|
|
|
|
## Library paths
|
2015-12-04 14:47:52 +00:00
|
|
|
##
|
|
|
|
|
2015-12-09 14:55:06 +00:00
|
|
|
CUDA := deps/cuda-7.5
|
|
|
|
CUDALIBPATH32 := deps/NVIDIA-Linux-x86_64-352.21/32
|
|
|
|
CUDALIBPATH64 := deps/NVIDIA-Linux-x86_64-352.21
|
2015-12-04 14:47:52 +00:00
|
|
|
|
2015-12-15 11:04:22 +00:00
|
|
|
OCL := $(CUDA)
|
|
|
|
OCLLIBPATH32 := $(CUDALIBPATH32)
|
|
|
|
OCLLIBPATH64 := $(CUDALIBPATH64)
|
|
|
|
|
2015-12-09 14:55:06 +00:00
|
|
|
ADL := deps/adl-sdk
|
2015-12-04 14:47:52 +00:00
|
|
|
|
2015-12-09 14:55:06 +00:00
|
|
|
GDK := deps/nvidia-gdk
|
|
|
|
NVAPI := deps/R352-developer
|
2015-12-04 14:47:52 +00:00
|
|
|
|
|
|
|
NVMLINCPATH := $(GDK)/usr/include/nvidia/gdk/
|
|
|
|
NVMLLIBPATH32 := $(CUDALIBPATH32)
|
|
|
|
NVMLLIBPATH64 := $(CUDALIBPATH64)
|
|
|
|
|
|
|
|
CLCOMPILE_PATH := tools/clcompile
|
|
|
|
RULES_OPTIMIZE_PATH := tools/rules_optimize
|
|
|
|
|
|
|
|
##
|
|
|
|
## 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
|
|
|
|
|
|
|
|
DLL_WIN_32 := i686-w64-mingw32-dlltool
|
|
|
|
DLL_WIN_64 := x86_64-w64-mingw32-dlltool
|
|
|
|
|
|
|
|
CLCOMPILE := $(CLCOMPILE_PATH)/clcompile.bin
|
|
|
|
|
|
|
|
BIN := .
|
|
|
|
|
2015-12-13 11:21:36 +00:00
|
|
|
INSTALL := install
|
|
|
|
CP := cp
|
|
|
|
|
2015-12-04 14:47:52 +00:00
|
|
|
##
|
|
|
|
## Misc stuff
|
|
|
|
##
|
|
|
|
|
|
|
|
NOW := $(shell perl -e 'print time')
|
|
|
|
|
|
|
|
##
|
|
|
|
## Compiler flags
|
|
|
|
##
|
|
|
|
|
|
|
|
CFLAGS := -O2 -s -pipe -W -Wall -Iinclude/ -std=c99
|
|
|
|
#CFLAGS := -g -pipe -W -Wall -Iinclude/ -std=c99
|
|
|
|
|
|
|
|
CFLAGS_32 := -m32
|
|
|
|
CFLAGS_64 := -m64
|
|
|
|
|
|
|
|
CFLAGS_LINUX := -D_POSIX -DLINUX
|
|
|
|
CFLAGS_WIN := -D_WIN -DWIN -D__MSVCRT__ -D__USE_MINGW_ANSI_STDIO=1
|
|
|
|
|
2015-12-15 11:04:22 +00:00
|
|
|
CFLAGS_LINUX += -I$(OCL)/include/ -I$(ADL)/include/ -I$(GDK)/usr/include/nvidia/gdk/
|
|
|
|
CFLAGS_WIN += -I$(OCL)/include/ -I$(ADL)/include/ -I$(NVAPI)/
|
2015-12-04 14:47:52 +00:00
|
|
|
|
2015-12-15 19:34:07 +00:00
|
|
|
LFLAGS_LINUX := -lpthread -lOpenCL -ldl
|
2015-12-15 11:04:22 +00:00
|
|
|
LFLAGS_WIN := -lpsapi -L./lib
|
2015-12-04 14:47:52 +00:00
|
|
|
|
|
|
|
##
|
|
|
|
## Targets: Global
|
|
|
|
##
|
|
|
|
|
2015-12-15 11:04:22 +00:00
|
|
|
all: binaries_all
|
2015-12-04 14:47:52 +00:00
|
|
|
|
|
|
|
binaries_all: linux32 linux64 win32 win64 rules_optimize
|
|
|
|
|
|
|
|
release: binaries
|
|
|
|
|
|
|
|
linux: linux32 linux64 rules_optimize
|
|
|
|
|
|
|
|
windows: win32 win64 rules_optimize
|
|
|
|
|
|
|
|
clean: clean_bin
|
|
|
|
|
2015-12-15 11:04:22 +00:00
|
|
|
clean_all: clean_bin clean_clcompile
|
2015-12-04 14:47:52 +00:00
|
|
|
|
|
|
|
clean_bin:
|
|
|
|
rm -f obj/*.o lib/*.a $(BIN)/*.bin $(BIN)/*.exe $(BIN)/*.app *.restore *.out *.pot *.dictstat *.log
|
|
|
|
rm -rf *Hashcat.induct
|
|
|
|
rm -rf *Hashcat.outfiles
|
|
|
|
$(MAKE) -C $(RULES_OPTIMIZE_PATH) clean
|
|
|
|
|
|
|
|
clean_clcompile:
|
|
|
|
rm -f ${CLCOMPILE_PATH}/clcompile.bin
|
|
|
|
|
|
|
|
${CLCOMPILE}: ${CLCOMPILE_PATH}/clcompile.c
|
2015-12-15 11:04:22 +00:00
|
|
|
$(CC_LINUX_64) $(CFLAGS) -o $@ -I$(CFLAGS_LINUX) $< -L$(OCLLIBPATH64) $(LFLAGS_LINUX)
|
2015-12-04 14:47:52 +00:00
|
|
|
|
|
|
|
rules_optimize:
|
|
|
|
$(MAKE) -C $(RULES_OPTIMIZE_PATH)
|
|
|
|
|
2015-12-15 11:04:22 +00:00
|
|
|
linux32: oclHashcat32.bin
|
|
|
|
linux64: oclHashcat64.bin
|
2015-12-04 14:47:52 +00:00
|
|
|
|
2015-12-15 11:04:22 +00:00
|
|
|
win32: oclHashcat32.exe
|
|
|
|
win64: oclHashcat64.exe
|
2015-12-04 14:47:52 +00:00
|
|
|
|
2015-12-13 11:21:36 +00:00
|
|
|
##
|
|
|
|
## Targets: Linux install
|
|
|
|
## We need some better native compilation logic here, fixing it to 64 bit for now and AMD kernels
|
|
|
|
## How to make /usr/bin/install doing recursive??
|
|
|
|
##
|
|
|
|
|
|
|
|
install: linux64 amd_all
|
|
|
|
$(INSTALL) -m 755 -d $(DOCUMENT_FOLDER)
|
|
|
|
$(CP) -a docs/* $(DOCUMENT_FOLDER)/
|
|
|
|
$(INSTALL) -m 755 -d $(DOCUMENT_FOLDER)/extra
|
|
|
|
$(CP) -a extra/* $(DOCUMENT_FOLDER)/extra/
|
|
|
|
$(INSTALL) -m 755 -d $(SHARED_FOLDER)
|
|
|
|
$(INSTALL) -m 755 -d $(SHARED_FOLDER)/charsets
|
|
|
|
$(CP) -a charsets/* $(SHARED_FOLDER)/charsets/
|
|
|
|
$(INSTALL) -m 755 -d $(SHARED_FOLDER)/masks
|
|
|
|
$(CP) -a masks/* $(SHARED_FOLDER)/masks/
|
|
|
|
$(INSTALL) -m 755 -d $(SHARED_FOLDER)/rules
|
|
|
|
$(CP) -a rules/* $(SHARED_FOLDER)/rules/
|
|
|
|
$(INSTALL) -m 755 -T hashcat.hcstat $(SHARED_FOLDER)/hashcat.hcstat
|
|
|
|
$(INSTALL) -m 755 -s -T oclHashcat64.bin $(INSTALL_FOLDER)/oclHashcat
|
|
|
|
|
|
|
|
|
|
|
|
uninstall:
|
|
|
|
$(RM) -f $(INSTALL_FOLDER)/oclHashcat
|
|
|
|
$(RM) -rf $(SHARED_FOLDER)
|
|
|
|
$(RM) -rf $(DOCUMENT_FOLDER)
|
|
|
|
|
2015-12-04 14:47:52 +00:00
|
|
|
##
|
|
|
|
## Targets: Libraries
|
|
|
|
##
|
|
|
|
|
|
|
|
lib/libOpenCL.a:
|
|
|
|
${DLL_WIN_32} -A -k -l lib/libOpenCL.a -d lib/OpenCL.def
|
|
|
|
|
|
|
|
lib/libOpenCL64.a:
|
|
|
|
${DLL_WIN_64} -A -k -l lib/libOpenCL64.a -d lib/OpenCL64.def
|
|
|
|
|
|
|
|
##
|
|
|
|
## oclHashcat
|
|
|
|
##
|
|
|
|
|
|
|
|
obj/%.oclHashcat.LINUX.32.o: src/%.c
|
2015-12-15 11:04:22 +00:00
|
|
|
$(CC_LINUX_32) $(CFLAGS) $(CFLAGS_LINUX) $(CFLAGS_32) $(CFLAGS_LINUX) -c -o $@ $<
|
2015-12-04 14:47:52 +00:00
|
|
|
|
|
|
|
obj/%.oclHashcat.LINUX.64.o: src/%.c
|
2015-12-15 11:04:22 +00:00
|
|
|
$(CC_LINUX_64) $(CFLAGS) $(CFLAGS_LINUX) $(CFLAGS_64) $(CFLAGS_LINUX) -c -o $@ $<
|
2015-12-04 14:47:52 +00:00
|
|
|
|
|
|
|
obj/%.oclHashcat.WIN.32.o: src/%.c
|
2015-12-15 11:04:22 +00:00
|
|
|
$(CC_WIN_32) $(CFLAGS) $(CFLAGS_WIN) $(CFLAGS_32) $(CFLAGS_WIN) -c -o $@ $<
|
2015-12-04 14:47:52 +00:00
|
|
|
|
|
|
|
obj/%.oclHashcat.WIN.64.o: src/%.c
|
2015-12-15 11:04:22 +00:00
|
|
|
$(CC_WIN_64) $(CFLAGS) $(CFLAGS_WIN) $(CFLAGS_64) $(CFLAGS_WIN) -c -o $@ $<
|
2015-12-04 14:47:52 +00:00
|
|
|
|
2015-12-15 11:04:22 +00:00
|
|
|
oclHashcat32.bin: src/oclHashcat.c obj/ext_OpenCL.oclHashcat.LINUX.32.o obj/ext_nvml.oclHashcat.LINUX.32.o obj/ext_ADL.oclHashcat.LINUX.32.o obj/shared.oclHashcat.LINUX.32.o obj/rp_gpu_on_cpu.oclHashcat.LINUX.32.o
|
|
|
|
$(CC_LINUX_32) $(CFLAGS) $(CFLAGS_LINUX) $(CFLAGS_32) $(CFLAGS_LINUX) -o $@ -DCOMPTIME=$(NOW) $^ -L$(OCLLIBPATH32) $(LFLAGS_LINUX) -L$(NVMLLIBPATH32) -DINSTALL_FOLDER=\"$(INSTALL_FOLDER)\" -DSHARED_FOLDER=\"$(SHARED_FOLDER)\" -DDOCUMENT_FOLDER=\"$(DOCUMENT_FOLDER)\"
|
2015-12-04 14:47:52 +00:00
|
|
|
|
2015-12-15 11:04:22 +00:00
|
|
|
oclHashcat64.bin: src/oclHashcat.c obj/ext_OpenCL.oclHashcat.LINUX.64.o obj/ext_nvml.oclHashcat.LINUX.64.o obj/ext_ADL.oclHashcat.LINUX.64.o obj/shared.oclHashcat.LINUX.64.o obj/rp_gpu_on_cpu.oclHashcat.LINUX.64.o
|
|
|
|
$(CC_LINUX_64) $(CFLAGS) $(CFLAGS_LINUX) $(CFLAGS_64) $(CFLAGS_LINUX) -o $@ -DCOMPTIME=$(NOW) $^ -L$(OCLLIBPATH64) $(LFLAGS_LINUX) -L$(NVMLLIBPATH64) -DINSTALL_FOLDER=\"$(INSTALL_FOLDER)\" -DSHARED_FOLDER=\"$(SHARED_FOLDER)\" -DDOCUMENT_FOLDER=\"$(DOCUMENT_FOLDER)\"
|
2015-12-04 14:47:52 +00:00
|
|
|
|
2015-12-15 11:04:22 +00:00
|
|
|
oclHashcat32.exe: src/oclHashcat.c obj/ext_OpenCL.oclHashcat.WIN.32.o obj/ext_nvapi.oclHashcat.WIN.32.o obj/ext_ADL.oclHashcat.WIN.32.o obj/shared.oclHashcat.WIN.32.o obj/rp_gpu_on_cpu.oclHashcat.WIN.32.o lib/libOpenCL.a /usr/i686-w64-mingw32/lib/CRT_glob.o
|
|
|
|
$(CC_WIN_32) $(CFLAGS) $(CFLAGS_WIN) $(CFLAGS_32) $(CFLAGS_WIN) -o $@ -DCOMPTIME=$(NOW) $^ -L$(OCLLIBPATH32) $(LFLAGS_WIN) -static-libgcc $(NVAPI)/x86/nvapi.lib
|
2015-12-04 14:47:52 +00:00
|
|
|
|
2015-12-15 11:04:22 +00:00
|
|
|
oclHashcat64.exe: src/oclHashcat.c obj/ext_OpenCL.oclHashcat.WIN.64.o obj/ext_nvapi.oclHashcat.WIN.64.o obj/ext_ADL.oclHashcat.WIN.64.o obj/shared.oclHashcat.WIN.64.o obj/rp_gpu_on_cpu.oclHashcat.WIN.64.o lib/libOpenCL64.a /usr/x86_64-w64-mingw32/lib/CRT_glob.o
|
|
|
|
$(CC_WIN_64) $(CFLAGS) $(CFLAGS_WIN) $(CFLAGS_64) $(CFLAGS_WIN) -o $@ -DCOMPTIME=$(NOW) $^ -L$(OCLLIBPATH64) $(LFLAGS_WIN) -static-libgcc $(NVAPI)/amd64/nvapi64.lib
|