1
0
mirror of https://github.com/hashcat/hashcat.git synced 2024-11-26 18:08:20 +00:00

Add checks for clock_gettime() support in Makefile

This commit is contained in:
Gabriele Gristina 2017-12-26 14:09:30 +01:00
parent 4f8343b8b1
commit 43ce4f6135
3 changed files with 8 additions and 2 deletions

View File

@ -6,7 +6,7 @@
#ifndef _TIMER_H #ifndef _TIMER_H
#define _TIMER_H #define _TIMER_H
#if defined(__APPLE__) #if defined(__APPLE__) && defined(MISSING_CLOCK_GETTIME)
#include <sys/time.h> #include <sys/time.h>
#include <mach/clock.h> #include <mach/clock.h>
#include <mach/mach.h> #include <mach/mach.h>

View File

@ -92,6 +92,7 @@ ifeq ($(UNAME),Darwin)
CC := clang CC := clang
# the sed -i option of macOS requires a parameter for the backup file (we just use "") # the sed -i option of macOS requires a parameter for the backup file (we just use "")
SED_IN_PLACE := -i "" SED_IN_PLACE := -i ""
PROD_VERS := $(shell sw_vers -productVersion | cut -d. -f2)
endif endif
ifeq ($(UNAME),FreeBSD) ifeq ($(UNAME),FreeBSD)
@ -215,6 +216,11 @@ endif # FreeBSD
ifeq ($(UNAME),Darwin) ifeq ($(UNAME),Darwin)
export MACOSX_DEPLOYMENT_TARGET=10.9 export MACOSX_DEPLOYMENT_TARGET=10.9
CFLAGS_NATIVE := $(CFLAGS) CFLAGS_NATIVE := $(CFLAGS)
ifeq ($(shell test $(PROD_VERS) -le 11; echo $$?), 0)
CFLAGS_NATIVE += -DMISSING_CLOCK_GETTIME
endif
LFLAGS_NATIVE := $(LFLAGS) LFLAGS_NATIVE := $(LFLAGS)
LFLAGS_NATIVE += -framework OpenCL LFLAGS_NATIVE += -framework OpenCL
LFLAGS_NATIVE += -lpthread LFLAGS_NATIVE += -lpthread

View File

@ -33,7 +33,7 @@ inline double hc_timer_get (hc_timer_t a)
inline void hc_timer_set (hc_timer_t* a) inline void hc_timer_set (hc_timer_t* a)
{ {
#if defined (__APPLE__) #if defined(__APPLE__) && defined(MISSING_CLOCK_GETTIME)
// taken from proxmark3/client/util_posix // taken from proxmark3/client/util_posix
static uint64_t clock_start_time = 0; static uint64_t clock_start_time = 0;
static mach_timebase_info_data_t timebase_info = {0, 0}; static mach_timebase_info_data_t timebase_info = {0, 0};