fix: correctly compile with pthreads
This commit is contained in:
parent
76336c307b
commit
1417cb8973
5
Makefile
5
Makefile
@ -34,8 +34,9 @@ includes=$(patsubst %,-I%,${src_dirs})
|
|||||||
|
|
||||||
CFLAGS+=-g -O0 ${includes} -fPIC
|
CFLAGS+=-g -O0 ${includes} -fPIC
|
||||||
LDFLAGS+=
|
LDFLAGS+=
|
||||||
ifdef _USE_PTHREAD
|
ifdef USE_PTHREAD
|
||||||
LDFLAGS+=-lpthread
|
LDFLAGS+=-lpthread
|
||||||
|
CFLAGS+=-DUSE_PTHREAD
|
||||||
endif
|
endif
|
||||||
|
|
||||||
# Tests if the last compilation was with pthread
|
# 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
|
.PHONY: pthreads
|
||||||
pthreads:
|
pthreads:
|
||||||
$(MAKE) _USE_PTHREAD=. ${pthread_targets}
|
$(MAKE) USE_PTHREAD=. ${pthread_targets}
|
||||||
touch .lastpthread
|
touch .lastpthread
|
||||||
|
|
||||||
.PHONY: check
|
.PHONY: check
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
#ifndef USE_PTHREAD
|
||||||
|
|
||||||
#include "thread.h"
|
#include "thread.h"
|
||||||
#include "debug.h"
|
#include "debug.h"
|
||||||
#include "pthread.h"
|
#include "pthread.h"
|
||||||
@ -42,4 +44,4 @@ int thread_mutex_unlock(thread_mutex_t *mutex) {
|
|||||||
return pthread_mutex_unlock((pthread_mutex_t *)mutex);
|
return pthread_mutex_unlock((pthread_mutex_t *)mutex);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
Loading…
x
Reference in New Issue
Block a user