2 ## Author......: Jens Steube <jens.steube@gmail.com>
7 ## Detect number of processors
10 NPROCS := $(shell grep -c ^processor /proc/cpuinfo)
17 MAKEFLAGS += -l -j $(NPROCS) -rR --no-print-directory
19 ifneq ($(findstring clean,$(MAKECMDGOALS)),)
24 ## Installation paths (Linux only)
27 INSTALL_FOLDER ?= /opt/test/usr/bin
28 SHARED_FOLDER ?= /opt/test/usr/share/oclHashcat
29 DOCUMENT_FOLDER ?= /opt/test/usr/share/doc/oclHashcat
31 #INSTALL_FOLDER ?= /usr/bin
32 #SHARED_FOLDER ?= /usr/share/oclHashcat
33 #DOCUMENT_FOLDER ?= /usr/share/doc/oclHashcat
39 AMDAPP := deps/amd-app-sdk
40 AMDAPPLIBPATH32 := $(AMDAPP)/lib/x86
41 AMDAPPLIBPATH64 := $(AMDAPP)/lib/x86_64
44 GDK := deps/nvidia-gdk
45 NVAPI := deps/R352-developer
52 OCLLIBPATH32 := $(AMDAPPLIBPATH32)
53 OCLLIBPATH64 := $(AMDAPPLIBPATH64)
55 NVML := $(GDK)/usr/include/nvidia/gdk
58 ## Native compiler paths
66 ## Cross compiler paths
72 CC_WIN_32 := i686-w64-mingw32-gcc
73 CC_WIN_64 := x86_64-w64-mingw32-gcc
75 DLL_WIN_32 := i686-w64-mingw32-dlltool
76 DLL_WIN_64 := x86_64-w64-mingw32-dlltool
82 NOW := $(shell perl -e 'print time')
88 CFLAGS := -O2 -s -pipe -W -Wall -Iinclude/ -std=c99
89 #CFLAGS := -g -pipe -W -Wall -Iinclude/ -std=c99
94 CFLAGS_LINUX := -D_POSIX -DLINUX
95 CFLAGS_WIN := -D_WIN -DWIN -D__MSVCRT__ -D__USE_MINGW_ANSI_STDIO=1
97 CFLAGS_LINUX += -I$(OCL)/include/ -I$(ADL)/include/ -I$(NVML)/
98 CFLAGS_WIN += -I$(OCL)/include/ -I$(ADL)/include/ -I$(NVAPI)/
100 LFLAGS_LINUX := -lpthread -lOpenCL -ldl
101 LFLAGS_WIN := -lpsapi
103 CFLAGS_NATIVE := $(CFLAGS_LINUX)
104 LFLAGS_NATIVE := $(LFLAGS_LINUX)
112 binaries: linux32 linux64 win32 win64
115 rm -f obj/*.o lib/*.a ./*.bin ./*.exe ./*.app *.restore *.out *.pot *.dictstat *.log oclHashcat
119 linux32: oclHashcat32.bin
120 linux64: oclHashcat64.bin
122 win32: oclHashcat32.exe
123 win64: oclHashcat64.exe
126 ## Targets: Linux install
127 ## How to make /usr/bin/install doing recursive??
131 $(INSTALL) -m 755 -d $(DOCUMENT_FOLDER)
132 $(CP) -a docs/* $(DOCUMENT_FOLDER)/
133 $(INSTALL) -m 755 -d $(DOCUMENT_FOLDER)/extra
134 $(CP) -a extra/* $(DOCUMENT_FOLDER)/extra/
135 $(INSTALL) -m 755 -d $(SHARED_FOLDER)
136 $(INSTALL) -m 755 -d $(SHARED_FOLDER)/charsets
137 $(CP) -a charsets/* $(SHARED_FOLDER)/charsets/
138 $(INSTALL) -m 755 -d $(SHARED_FOLDER)/masks
139 $(CP) -a masks/* $(SHARED_FOLDER)/masks/
140 $(INSTALL) -m 755 -d $(SHARED_FOLDER)/rules
141 $(CP) -a rules/* $(SHARED_FOLDER)/rules/
142 $(INSTALL) -m 755 -T hashcat.hcstat $(SHARED_FOLDER)/hashcat.hcstat
143 $(INSTALL) -m 755 -s -T oclHashcat64.bin $(INSTALL_FOLDER)/oclHashcat
146 $(RM) -f $(INSTALL_FOLDER)/oclHashcat
147 $(RM) -rf $(SHARED_FOLDER)
148 $(RM) -rf $(DOCUMENT_FOLDER)
151 ## Targets: Libraries
155 ${DLL_WIN_32} -A -k -l lib/libOpenCL.a -d lib/OpenCL.def
158 ${DLL_WIN_64} -A -k -l lib/libOpenCL64.a -d lib/OpenCL64.def
161 ## native compiled oclHashcat
164 obj/%.oclHashcat.NATIVE.o: src/%.c
165 $(CC_NATIVE) $(CFLAGS) $(CFLAGS_NATIVE) -c -o $@ $<
167 oclHashcat: src/oclHashcat.c obj/ext_OpenCL.oclHashcat.NATIVE.o obj/ext_nvml.oclHashcat.NATIVE.o obj/ext_ADL.oclHashcat.NATIVE.o obj/shared.oclHashcat.NATIVE.o obj/rp_gpu_on_cpu.oclHashcat.NATIVE.o
168 $(CC_NATIVE) $(CFLAGS) $(CFLAGS_NATIVE) -o $@ $^ $(LFLAGS_NATIVE) -DCOMPTIME=$(NOW) -DINSTALL_FOLDER=\"$(INSTALL_FOLDER)\" -DSHARED_FOLDER=\"$(SHARED_FOLDER)\" -DDOCUMENT_FOLDER=\"$(DOCUMENT_FOLDER)\"
171 ## cross compiled oclHashcat for release
174 obj/%.oclHashcat.LINUX.32.o: src/%.c
175 $(CC_LINUX_32) $(CFLAGS) $(CFLAGS_LINUX) $(CFLAGS_32) -c -o $@ $<
177 obj/%.oclHashcat.LINUX.64.o: src/%.c
178 $(CC_LINUX_64) $(CFLAGS) $(CFLAGS_LINUX) $(CFLAGS_64) -c -o $@ $<
180 obj/%.oclHashcat.WIN.32.o: src/%.c
181 $(CC_WIN_32) $(CFLAGS) $(CFLAGS_WIN) $(CFLAGS_32) -c -o $@ $<
183 obj/%.oclHashcat.WIN.64.o: src/%.c
184 $(CC_WIN_64) $(CFLAGS) $(CFLAGS_WIN) $(CFLAGS_64) -c -o $@ $<
186 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
187 $(CC_LINUX_32) $(CFLAGS) $(CFLAGS_LINUX) $(CFLAGS_32) -o $@ $^ -L$(OCLLIBPATH32) $(LFLAGS_LINUX) -DCOMPTIME=$(NOW) -DINSTALL_FOLDER=\"$(INSTALL_FOLDER)\" -DSHARED_FOLDER=\"$(SHARED_FOLDER)\" -DDOCUMENT_FOLDER=\"$(DOCUMENT_FOLDER)\"
189 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
190 $(CC_LINUX_64) $(CFLAGS) $(CFLAGS_LINUX) $(CFLAGS_64) -o $@ $^ -L$(OCLLIBPATH64) $(LFLAGS_LINUX) -DCOMPTIME=$(NOW) -DINSTALL_FOLDER=\"$(INSTALL_FOLDER)\" -DSHARED_FOLDER=\"$(SHARED_FOLDER)\" -DDOCUMENT_FOLDER=\"$(DOCUMENT_FOLDER)\"
192 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 $(NVAPI)/x86/nvapi.lib
193 $(CC_WIN_32) $(CFLAGS) $(CFLAGS_WIN) $(CFLAGS_32) -o $@ $^ -L$(OCLLIBPATH32) $(LFLAGS_WIN) -DCOMPTIME=$(NOW) -static-libgcc
195 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 $(NVAPI)/amd64/nvapi64.lib
196 $(CC_WIN_64) $(CFLAGS) $(CFLAGS_WIN) $(CFLAGS_64) -o $@ $^ -L$(OCLLIBPATH64) $(LFLAGS_WIN) -DCOMPTIME=$(NOW) -static-libgcc