diff --git a/Makefile b/Makefile index ba70aab..6bb380e 100644 --- a/Makefile +++ b/Makefile @@ -34,8 +34,9 @@ includes=$(patsubst %,-I%,${src_dirs}) CFLAGS+=-g -O0 ${includes} -fPIC LDFLAGS+= -ifdef _USE_PTHREAD +ifdef USE_PTHREAD LDFLAGS+=-lpthread +CFLAGS+=-DUSE_PTHREAD endif # Tests if the last compilation was with pthread @@ -85,7 +86,7 @@ build: ${bins_target} ${build_dir}/libthread.so ${build_dir}/libthread.a .PHONY: pthreads pthreads: - $(MAKE) _USE_PTHREAD=. ${pthread_targets} + $(MAKE) USE_PTHREAD=. ${pthread_targets} touch .lastpthread .PHONY: check diff --git a/src/thread/thread.c b/src/thread/thread.c index 496c93e..2b24486 100644 --- a/src/thread/thread.c +++ b/src/thread/thread.c @@ -1,3 +1,5 @@ +#ifndef USE_PTHREAD + #include "thread.h" #include "debug.h" #include "pthread.h" @@ -42,4 +44,4 @@ int thread_mutex_unlock(thread_mutex_t *mutex) { return pthread_mutex_unlock((pthread_mutex_t *)mutex); } - +#endif