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_shared_SRC := pt-allocrtsig
54 libpthread_static_SRC := pthread_atfork
55 libpthread_SRC := $(pthread_arch_SRC) $(pthread_linux_SRC) $(pthread_sysdep_SRC) $(pthread_SRC)
56 libpthread_OBJ := $(patsubst $(libpthread_DIR)/%.c,$(libpthread_OUT)/%.o,$(libpthread_SRC))
59 # Stuff that goes into libc.so, not libpthread.so
61 #CFLAGS-alloca_cutoff.c := -DIS_IN_libc
62 CFLAGS-forward.c := -DIS_IN_libc
63 CFLAGS-libc-cancellation.c := -DIS_IN_libc
64 CFLAGS-libc_pthread_init.c := -DIS_IN_libc
65 libpthread_libc_CSRC := \
66 forward.c libc-cancellation.c libc_pthread_init.c # alloca_cutoff.c
67 libpthread_libc_OBJ := $(patsubst %.c, $(libpthread_OUT)/%.o,$(libpthread_libc_CSRC))
68 libc-static-y += $(libpthread_OUT)/libc_pthread_init.o
69 libc-shared-y += $(libpthread_libc_OBJ:.o=.oS)
71 libpthread-static-y += $(patsubst %,$(libpthread_OUT)/%.o,$(libpthread_static_SRC))
72 libpthread-shared-y += $(patsubst %,$(libpthread_OUT)/%.oS,$(libpthread_shared_SRC))
75 libpthread-a-y += $(libpthread_OBJ:.o=.os) $(libpthread-static-y:.o=.os)
77 libpthread-a-y += $(libpthread_OBJ) $(libpthread-static-y)
79 libpthread-so-y += $(libpthread_OBJ:.o=.os) $(libpthread-shared-y)
81 lib-a-$(UCLIBC_HAS_THREADS) += $(top_builddir)lib/libpthread.a
82 lib-so-$(UCLIBC_HAS_THREADS) += $(top_builddir)lib/libpthread.so
83 objclean-y += libpthread_clean
84 headers-$(UCLIBC_HAS_THREADS) += linuxthreads_headers
85 headers_clean-y += linuxthreads_headers_clean
88 $(top_builddir)lib/libpthread.so: $(libpthread_OUT)/libpthread_so.a $(libc)
89 $(call link.so,$(libpthread_FULL_NAME),$(MAJOR_VERSION))
91 $(top_builddir)lib/libpthread.so: $(libpthread_OUT)/libpthread.oS $(libc)
92 $(call linkm.so,$(libpthread_FULL_NAME),$(MAJOR_VERSION))
95 $(libpthread_OUT)/libpthread_so.a: $(libpthread-so-y)
97 ifeq ($(PTHREADS_DEBUG_SUPPORT),y)
98 $(do_strip:-x=-X --strip-debug)
104 $(libpthread_OUT)/libpthread.oS: $(libpthread_SRC) $(patsubst %,$(libpthread_DIR)/%.c,$(libpthread_shared_SRC))
107 ifeq ($(PTHREADS_DEBUG_SUPPORT),y)
108 $(do_t_strip:-x=-X --strip-debug)
113 $(top_builddir)lib/libpthread.a: $(libpthread-a-y)
114 $(Q)$(INSTALL) -d $(dir $@)
116 ifeq ($(PTHREADS_DEBUG_SUPPORT),y)
117 $(do_strip:-x=-X --strip-debug)
123 linuxthreads_headers:
124 $(LN) -sf ../$(PTDIR)/sysdeps/pthread/pthread.h $(top_builddir)include/
125 $(LN) -sf ../$(PTDIR)/semaphore.h $(top_builddir)include/
126 $(INSTALL) -d $(top_builddir)include/bits
127 $(LN) -sf ../../$(PTDIR)/sysdeps/pthread/bits/pthreadtypes.h $(top_builddir)include/bits/
129 linuxthreads_headers_clean:
130 $(RM) $(top_builddir)include/pthread.h $(top_builddir)include/semaphore.h \
131 $(top_builddir)include/bits/pthreadtypes.h
134 $(RM) $(libpthread_OUT)/{,*/,*/*/,*/*/*/,*/*/*/*/}*.{o,os,oS,a}