Add checks for clock_gettime() support in Makefile

pull/1480/head
Gabriele Gristina 6 years ago
parent 4f8343b8b1
commit 43ce4f6135

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

@ -92,6 +92,7 @@ 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)
@ -215,6 +216,11 @@ endif # FreeBSD
ifeq ($(UNAME),Darwin)
export MACOSX_DEPLOYMENT_TARGET=10.9
CFLAGS_NATIVE := $(CFLAGS)
ifeq ($(shell test $(PROD_VERS) -le 11; echo $$?), 0)
CFLAGS_NATIVE += -DMISSING_CLOCK_GETTIME
endif
LFLAGS_NATIVE := $(LFLAGS)
LFLAGS_NATIVE += -framework OpenCL
LFLAGS_NATIVE += -lpthread

@ -33,7 +33,7 @@ inline double hc_timer_get (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
static uint64_t clock_start_time = 0;
static mach_timebase_info_data_t timebase_info = {0, 0};

Loading…
Cancel
Save