3 # Copyright (C) 2003 Paul Mundt <lethal@linux-sh.org>
4 # Copyright (C) 2000-2006 Erik Andersen <andersen@uclibc.org>
6 # Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
9 CFLAGS-linuxthreads := -DNOT_IN_libc -DIS_IN_libpthread $(SSP_ALL_CFLAGS)
11 CFLAGS-libpthread/linuxthreads/sysdeps/$(TARGET_ARCH)/ := $(CFLAGS-linuxthreads)
12 CFLAGS-libpthread/linuxthreads/sysdeps/unix/sysv/linux/ := $(CFLAGS-linuxthreads)
13 CFLAGS-libpthread/linuxthreads/sysdeps/pthread/ := $(CFLAGS-linuxthreads)
15 # This stuff will not compile without at least -O1
16 # psm: can't handle this here, could maybe search for -O0 in CFLAGS
17 # and append -O1 if found
18 #CFLAGS:=$(CFLAGS:-O0=-O1)
20 ifeq ($(PTHREADS_DEBUG_SUPPORT),y)
21 LDFLAGS-libpthread.so := $(LDFLAGS_NOSTRIP) -z defs
23 LDFLAGS-libpthread.so := $(LDFLAGS)
26 LIBS-libpthread.so := $(LIBS) $(ldso)
28 START_FILE-libpthread.so := $(SHARED_START_FILES)
29 END_FILE-libpthread.so := $(SHARED_END_FILES)
31 libpthread_FULL_NAME := libpthread-$(MAJOR_VERSION).$(MINOR_VERSION).$(SUBLEVEL).so
33 libpthread_DIR := $(top_srcdir)libpthread/linuxthreads
34 libpthread_OUT := $(top_builddir)libpthread/linuxthreads
36 -include $(libpthread_DIR)/sysdeps/$(TARGET_ARCH)/Makefile.arch
38 pthread_arch_SRC := pspinlock
39 pthread_arch_SRC := $(patsubst %,$(libpthread_DIR)/sysdeps/$(TARGET_ARCH)/%.c,$(pthread_arch_SRC))
40 pthread_linux_SRC := fork pt-sigsuspend register-atfork unregister-atfork
41 pthread_linux_SRC := $(patsubst %,$(libpthread_DIR)/sysdeps/unix/sysv/linux/%.c,$(pthread_linux_SRC))
42 pthread_sysdep_SRC := errno-loc herrno-loc ptlongjmp
43 pthread_sysdep_SRC := $(patsubst %,$(libpthread_DIR)/sysdeps/pthread/%.c,$(pthread_sysdep_SRC))
45 attr barrier cancel condvar errno events join pthread \
46 lockfile manager mutex pt-machine ptcleanup \
47 ptclock_gettime ptclock_settime ptfork pthandles \
48 pthread_setegid pthread_seteuid pthread_setgid pthread_setregid \
49 pthread_setresgid pthread_setresuid pthread_setreuid pthread_setuid \
50 rwlock semaphore sighandler signals specific spinlock
51 pthread_SRC := $(patsubst %,$(libpthread_DIR)/%.c,$(pthread_SRC))
53 libpthread_static_SRC := pthread_atfork
54 libpthread_SRC := $(pthread_arch_SRC) $(pthread_linux_SRC) $(pthread_sysdep_SRC) $(pthread_SRC)
55 libpthread_OBJ := $(patsubst $(libpthread_DIR)/%.c,$(libpthread_OUT)/%.o,$(libpthread_SRC))
58 # Stuff that goes into libc.so, not libpthread.so
60 #CFLAGS-alloca_cutoff.c := -DIS_IN_libc
61 CFLAGS-forward.c := -DIS_IN_libc
62 CFLAGS-libc-cancellation.c := -DIS_IN_libc
63 CFLAGS-libc_pthread_init.c := -DIS_IN_libc
64 libpthread_libc_CSRC := \
65 forward.c libc-cancellation.c libc_pthread_init.c # alloca_cutoff.c
66 libpthread_libc_OBJ := $(patsubst %.c, $(libpthread_OUT)/%.o,$(libpthread_libc_CSRC))
67 libc-static-y += $(libpthread_OUT)/libc_pthread_init.o
68 libc-shared-y += $(libpthread_libc_OBJ:.o=.oS)
70 libpthread-static-y += $(patsubst %,$(libpthread_OUT)/%.o,$(libpthread_static_SRC))
73 libpthread-a-y += $(libpthread_OBJ:.o=.os) $(libpthread-static-y:.o=.os)
75 libpthread-a-y += $(libpthread_OBJ) $(libpthread-static-y)
77 libpthread-so-y += $(libpthread_OBJ:.o=.os)
79 lib-a-$(UCLIBC_HAS_THREADS) += $(top_builddir)lib/libpthread.a
80 lib-so-$(UCLIBC_HAS_THREADS) += $(top_builddir)lib/libpthread.so
81 objclean-y += libpthread_clean
82 headers-$(UCLIBC_HAS_THREADS) += linuxthreads_headers
83 headers_clean-y += linuxthreads_headers_clean
86 $(top_builddir)lib/libpthread.so: $(libpthread_OUT)/libpthread_so.a $(libc)
87 $(call link.so,$(libpthread_FULL_NAME),$(MAJOR_VERSION))
89 $(top_builddir)lib/libpthread.so: $(libpthread_OUT)/libpthread.oS $(libc)
90 $(call linkm.so,$(libpthread_FULL_NAME),$(MAJOR_VERSION))
93 $(libpthread_OUT)/libpthread_so.a: $(libpthread-so-y)
95 ifeq ($(PTHREADS_DEBUG_SUPPORT),y)
96 $(do_strip:-x=-X --strip-debug)
102 $(libpthread_OUT)/libpthread.oS: $(libpthread_SRC)
105 ifeq ($(PTHREADS_DEBUG_SUPPORT),y)
106 $(do_t_strip:-x=-X --strip-debug)
111 $(top_builddir)lib/libpthread.a: $(libpthread-a-y)
112 $(Q)$(INSTALL) -d $(dir $@)
114 ifeq ($(PTHREADS_DEBUG_SUPPORT),y)
115 $(do_strip:-x=-X --strip-debug)
121 linuxthreads_headers:
122 $(LN) -sf ../$(PTDIR)/sysdeps/pthread/pthread.h $(top_builddir)include/
123 $(LN) -sf ../$(PTDIR)/semaphore.h $(top_builddir)include/
124 $(INSTALL) -d $(top_builddir)include/bits
125 $(LN) -sf ../../$(PTDIR)/sysdeps/pthread/bits/pthreadtypes.h $(top_builddir)include/bits/
127 linuxthreads_headers_clean:
128 $(RM) $(top_builddir)include/pthread.h $(top_builddir)include/semaphore.h \
129 $(top_builddir)include/bits/pthreadtypes.h
132 $(RM) $(libpthread_OUT)/{,*/,*/*/,*/*/*/,*/*/*/*/}*.{o,os,oS,a}