diff --git a/Makefile b/Makefile index ddf25f72..15342d8d 100644 --- a/Makefile +++ b/Makefile @@ -207,7 +207,7 @@ qemu/config-host.h-timestamp: unicorn: $(LIBRARY) $(ARCHIVE) -$(LIBRARY): qemu/config-host.h-timestamp uc.o list.o +$(LIBRARY): qemu/config-host.h-timestamp ifeq ($(UNICORN_SHARED),yes) ifeq ($(V),0) $(call log,GEN,$(LIBRARY)) @@ -219,7 +219,7 @@ else endif endif -$(ARCHIVE): qemu/config-host.h-timestamp uc.o list.o +$(ARCHIVE): qemu/config-host.h-timestamp ifeq ($(UNICORN_STATIC),yes) ifeq ($(V),0) $(call log,GEN,$(ARCHIVE)) diff --git a/bindings/Makefile b/bindings/Makefile index ed958f75..14e88df8 100644 --- a/bindings/Makefile +++ b/bindings/Makefile @@ -9,7 +9,13 @@ SAMPLE := $(SAMPLE:sample_batch_reg=) SAMPLE := $(SAMPLE:sample_x86_32_gdt_and_seg_regs=) SAMPLE := $(SAMPLE:shellcode=) +UNAME_S := $(shell uname -s) +ifeq ($(UNAME_S), Linux) +ENV_VARS = LD_PRELOAD=librt.so LD_LIBRARY_PATH=../ DYLD_LIBRARY_PATH=../ +else ENV_VARS = LD_LIBRARY_PATH=../ DYLD_LIBRARY_PATH=../ +endif + .PHONY: build install python c clean check test diff --git a/install-cmocka-linux.sh b/install-cmocka-linux.sh index 46b405a4..d3eb6959 100755 --- a/install-cmocka-linux.sh +++ b/install-cmocka-linux.sh @@ -1,7 +1,8 @@ #!/bin/sh set -ex -mkdir cmocka -wget https://cmocka.org/files/1.1/cmocka-1.1.0.tar.xz -O /tmp/cmocka-1.1.0.tar.xz +mkdir -p cmocka +#wget https://cmocka.org/files/1.1/cmocka-1.1.0.tar.xz -O /tmp/cmocka-1.1.0.tar.xz +wget --no-check-certificate http://cmocka.org/files/1.1/cmocka-1.1.0.tar.xz -O /tmp/cmocka-1.1.0.tar.xz tar -xf /tmp/cmocka-1.1.0.tar.xz -C /tmp cd cmocka && cmake -DUNIT_TESTING=On /tmp/cmocka-1.1.0 && make && make test # cmake builds an so instead of a dll in mingw/msys diff --git a/tests/regress/Makefile b/tests/regress/Makefile index 431cdf32..c7da4ec4 100644 --- a/tests/regress/Makefile +++ b/tests/regress/Makefile @@ -1,6 +1,11 @@ CFLAGS += -Wall -Werror -I../../include LDLIBS += -L../../ -lpthread -lm -lunicorn +UNAME_S := $(shell uname -s) +ifeq ($(UNAME_S), Linux) +LDLIBS += -lrt +endif + EXECUTE_VARS = LD_LIBRARY_PATH=../../cmocka/src:../../ DYLD_LIBRARY_PATH=../../ TESTS_SOURCE = $(wildcard *.c) diff --git a/tests/unit/Makefile b/tests/unit/Makefile index 0768210a..57b8c038 100644 --- a/tests/unit/Makefile +++ b/tests/unit/Makefile @@ -3,6 +3,12 @@ CFLAGS += -L ../../ -I ../../include CFLAGS += -L ../../cmocka/src -I ../../cmocka/include LDLIBS += -lcmocka -lunicorn +UNAME_S := $(shell uname -s) +ifeq ($(UNAME_S), Linux) +LDLIBS += -lrt +endif + + EXECUTE_VARS = LD_LIBRARY_PATH=../../cmocka/src:../../ DYLD_LIBRARY_PATH=../../ ifeq ($(UNICORN_ASAN),yes)