1
0
mirror of https://github.com/hashcat/hashcat.git synced 2024-11-26 09:58:16 +00:00

Building: Replaced linking of CRT_glob.o with the use of int _dowildcard

This commit is contained in:
Jens Steube 2017-02-09 10:42:35 +01:00
parent 9aabc20248
commit 79513ce226
4 changed files with 7 additions and 140 deletions

View File

@ -50,6 +50,7 @@
- Building: Add SHARED variable to Makefile to choose if hashcat is build as static or shared binary (using libhashcat.so/hashcat.dll)
- Building: Removed the use of RPATH on linker level
- Building: Replaced linking of CRT_glob.o with the use of int _dowildcard
- Events: Improved the maximum event message handling. event_log () will now also internally make sure that the message is properly terminated
- Files: Do several file and folder checks on startup rather than when they are actually used to avoid related error after eventual intense operations
- Helper: Added functions to check existence, type, read- and write-permissions and rewrite sources to use them instead of stat()

View File

@ -258,16 +258,6 @@ LFLAGS_CROSS_WIN64 := $(LFLAGS)
LFLAGS_CROSS_WIN64 += -Wl,--dynamicbase -Wl,--nxcompat
LFLAGS_CROSS_WIN64 += -lpsapi
##
## Windows CRT file globbing
##
CRT_GLOB_32 :=
CRT_GLOB_64 :=
CRT_GLOB_INCLUDE_FOLDER := $(dir $(lastword $(MAKEFILE_LIST)))
include $(CRT_GLOB_INCLUDE_FOLDER)/win_file_globbing.mk
##
## Objects
##
@ -277,19 +267,11 @@ OBJS_ALL := affinity autotune benchmark bitmap bitops combinator
NATIVE_STATIC_OBJS := $(foreach OBJ,$(OBJS_ALL),obj/$(OBJ).NATIVE.STATIC.o)
NATIVE_SHARED_OBJS := $(foreach OBJ,$(OBJS_ALL),obj/$(OBJ).NATIVE.SHARED.o)
ifeq ($(UNAME),CYGWIN)
NATIVE_STATIC_OBJS += $(CRT_GLOB)
endif # CYGWIN
ifeq ($(UNAME),MSYS2)
NATIVE_STATIC_OBJS += $(CRT_GLOB)
endif # MSYS2
LINUX_32_OBJS := $(foreach OBJ,$(OBJS_ALL),obj/$(OBJ).LINUX.32.o)
LINUX_64_OBJS := $(foreach OBJ,$(OBJS_ALL),obj/$(OBJ).LINUX.64.o)
WIN_32_OBJS := $(foreach OBJ,$(OBJS_ALL),obj/$(OBJ).WIN.32.o) $(CRT_GLOB_32)
WIN_64_OBJS := $(foreach OBJ,$(OBJS_ALL),obj/$(OBJ).WIN.64.o) $(CRT_GLOB_64)
WIN_32_OBJS := $(foreach OBJ,$(OBJS_ALL),obj/$(OBJ).WIN.32.o)
WIN_64_OBJS := $(foreach OBJ,$(OBJS_ALL),obj/$(OBJ).WIN.64.o)
##
## Targets: Native Compilation

View File

@ -20,6 +20,10 @@
#include "interface.h"
#include "event.h"
#if defined(__MINGW64__) || defined(__MINGW32__)
int _dowildcard = -1;
#endif
static void main_log_clear_line (MAYBE_UNUSED const int prev_len, MAYBE_UNUSED FILE *fp)
{
#if defined (_WIN)

View File

@ -1,120 +0,0 @@
##
## Author......: See docs/credits.txt
## License.....: MIT
##
# MinGW's CRT GLOB (for windows builds only)
EGREP := egrep
MG := $(MAKECMDGOALS)
CRT_GLOB_FILE_NAME ?= CRT_glob.o
# we can skip the CRT_glob.o check/search if we do not build windows binaries
IS_WIN_BUILD32 := $(filter binaries,$(MG))$(filter win32,$(MG))$(filter hashcat32.exe,$(MG))
IS_WIN_BUILD64 := $(filter binaries,$(MG))$(filter win64,$(MG))$(filter hashcat64.exe,$(MG))
##
## win32
##
ifneq (,$(IS_WIN_BUILD32))
ifeq ($(UNAME),CYGWIN)
$(error Cross-compiling on $(UNAME) is not supported, please use the native target)
endif
ifeq ($(UNAME),MSYS2)
$(error Cross-compiling on $(UNAME) is not supported, please use the native target)
endif
# entering this code path means: we need to check for CRT_glob.o since we try to build binaries for windows operating systems
CRT_GLOB_LIB_PATH_32 ?= /usr/i686-w64-mingw32/lib/
CRT_GLOB_LIB_SYSROOT_32 := $(shell $(CC_WIN_32) --verbose 2>&1 | $(EGREP) -m 1 -o '(with-sysroot="[^"]"|with-sysroot=[^ ]*)' | $(SED) 's/^with-sysroot="\?\([^"]*\)"\?$$/\1/')
ifneq (,$(CRT_GLOB_LIB_SYSROOT_32))
CRT_GLOB_LIB_PATH_32 := $(CRT_GLOB_LIB_SYSROOT_32)
endif
CRT_GLOB_32 := $(shell $(FIND) "$(CRT_GLOB_LIB_PATH_32)" -name $(CRT_GLOB_FILE_NAME) -print -quit)
ifeq (,$(CRT_GLOB_32))
define WARNING_MESSAGE=
! The MinGW CRT GLOB library for 32-bit compilation was not found on your system. Please make sure that $(CRT_GLOB_FILE_NAME) exists
! ATTENTION: File globbing will be disabled
endef
$(warning $(WARNING_MESSAGE))
endif
endif
##
## win64
##
ifneq (,$(IS_WIN_BUILD64))
ifeq ($(UNAME),CYGWIN)
$(error Cross-compiling on $(UNAME) is not supported, please use the native target)
endif
ifeq ($(UNAME),MSYS2)
$(error Cross-compiling on $(UNAME) is not supported, please use the native target)
endif
# entering this code path means: we need to check for CRT_glob.o since we try to build binaries for windows operating systems
CRT_GLOB_LIB_PATH_64 ?= /usr/x86_64-w64-mingw32/lib/
CRT_GLOB_LIB_SYSROOT_64 := $(shell $(CC_WIN_64) --verbose 2>&1 | $(EGREP) -m 1 -o '(with-sysroot="[^"]"|with-sysroot=[^ ]*)' | $(SED) 's/^with-sysroot="\?\([^"]*\)"\?$$/\1/')
ifneq (,$(CRT_GLOB_LIB_SYSROOT_64))
CRT_GLOB_LIB_PATH_64 := $(CRT_GLOB_LIB_SYSROOT_64)
endif
CRT_GLOB_64 := $(shell $(FIND) "$(CRT_GLOB_LIB_PATH_64)" -name $(CRT_GLOB_FILE_NAME) -print -quit)
ifeq (,$(CRT_GLOB_64))
define WARNING_MESSAGE=
! The MinGW CRT GLOB library for 64-bit compilation was not found on your system. Please make sure that $(CRT_GLOB_FILE_NAME) exists
! ATTENTION: File globbing will be disabled
endef
$(warning $(WARNING_MESSAGE))
endif
endif
##
## win native
##
IS_WIN_BUILD_NATIVE := $(filter MSYS2,$(UNAME))
ifneq (,$(IS_WIN_BUILD_NATIVE))
# entering this code path means: we need to check for CRT_glob.o since we try to build binaries for windows operating systems
CRT_GLOB := $(shell $(FIND) / -name $(CRT_GLOB_FILE_NAME) -print -quit)
ifeq (,$(CRT_GLOB))
define WARNING_MESSAGE=
! The MinGW CRT GLOB library was not found on your system. Please make sure that $(CRT_GLOB_FILE_NAME) exists
! ATTENTION: File globbing will be disabled
endef
$(warning $(WARNING_MESSAGE))
endif
endif