NPTL/arc: notify kernel of the TP value
[uClibc.git] / libpthread / nptl / Makefile.in
blob55eeba2a110b2704e50970ae6e48e42e44aa4a38
1 # Makefile for uClibc NPTL
3 # Copyright (C) 2005-2006 Steven J. Hill <sjhill@realitydiluted.com>
5 # Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
8 subdirs += libpthread/nptl
10 libpthread_DIR = $(top_srcdir)libpthread/nptl
11 libpthread_OUT = $(top_builddir)libpthread/nptl
13 include $(libpthread_DIR)/sysdeps/Makefile.in
15 libc-shared-routines-y = forward.c libc-cancellation.c
16 libc-static-routines-y = alloca_cutoff.c libc-cancellation.c
17 libpthread-shared-only-routines-y = version.c
18 libpthread-static-only-routines-y = pthread_atfork.c
19 libpthread-routines- += $(notdir $(wildcard $(libpthread_DIR)/gen_*.c)) # dummy generated files
20 libpthread-routines- += allocatestack.c # dummy included by pthread_create.c
21 libpthread-routines- += pthread_mutex_getprioceiling.c pthread_mutex_setprioceiling.c # XXX: delete those or use them!
22 libpthread-routines-$(UCLIBC_HAS_RESOLVER_SUPPORT) += res.c
23 libpthread-routines-$(UCLIBC_SUSV4_LEGACY) += pthread_getconcurrency.c \
24 pthread_setconcurrency.c
25 libpthread_CSRC = $(filter-out $(libpthread-routines-) \
26 $(libc-shared-routines-y) \
27 $(libc-static-routines-y) \
28 $(libpthread-shared-only-routines-y) \
29 $(libpthread-static-only-routines-y) \
30 $(notdir $(libpthread_OBJS:.o=.c)), \
31 $(notdir $(wildcard $(libpthread_DIR)/*.c)))
33 libpthread_OBJS += $(addprefix $(libpthread_OUT)/,$(libpthread_CSRC:.c=.o))
34 libpthread-so-y += $(addprefix $(libpthread_OUT)/,$(libpthread-shared-only-routines-y:.c=.oS))
35 libpthread-so-y += $(libpthread_OBJS:.o=.oS)
36 libpthread-nonshared-y := $(addprefix $(libpthread_OUT)/,$(libpthread-static-only-routines-y:.c=.oS))
37 libpthread-static-y := $(addprefix $(libpthread_OUT)/,$(libpthread-static-only-routines-y:.c=.o))
38 libpthread-static-y += $(libpthread_OBJS)
39 ifeq ($(DOPIC),y)
40 libpthread-a-y := $(libpthread-static-y:.o=.os)
41 else
42 libpthread-a-y := $(libpthread-static-y)
43 endif
45 libc-shared-routines-y := $(filter-out $(notdir $(libpthread_libc_OBJS:.o=.c)), $(libc-shared-routines-y))
46 libc-static-routines-y := $(filter-out $(notdir $(libpthread_libc_OBJS:.o=.c)), $(libc-static-routines-y))
47 libc-shared-routines-y := $(addprefix $(libpthread_OUT)/,$(libc-shared-routines-y:.c=.oS))
48 libc-static-routines-y := $(addprefix $(libpthread_OUT)/,$(libc-static-routines-y:.c=.o))
49 libc-shared-y += $(libc-shared-routines-y) $(libpthread_libc_OBJS:.o=.oS)
50 ifeq ($(DOPIC),y)
51 libc-static-y += $(libc-static-routines-y:.o=.os) $(libpthread_libc_a_OBJS:.o=.os) $(libpthread_ld_tls_COBJ:.o=.os)
52 else
53 libc-static-y += $(libc-static-routines-y) $(libpthread_libc_a_OBJS) $(libpthread_ld_tls_COBJ)
54 endif
56 librt-pt-routines-y := $(patsubst %.c,$(libpthread_pthread_OUT)/%.o,$(filter-out $(notdir $(libpthread_librt_OBJS:.o=.c)), $(librt-pt-routines-y)))
57 librt-pt-shared-only-routines-y := $(patsubst %.c,$(libpthread_pthread_OUT)/%.o,$(filter-out $(notdir $(libpthread_librt_OBJS:.o=.c)), $(librt-pt-shared-only-routines-y)))
58 librt_OBJS = $(libpthread_librt_OBJS) $(librt-pt-routines-y)
59 ifeq ($(DOPIC),y)
60 librt-a-y += $(librt_OBJS:.o=.os)
61 else
62 librt-a-y += $(librt_OBJS)
63 endif
64 librt-so-y += $(librt_OBJS:.o=.oS) $(librt-pt-shared-only-routines-y:.o=.oS)
66 ifeq ($(UCLIBC_CTOR_DTOR),y)
67 START_FILE-libpthread.so := $(top_builddir)libpthread/nptl/sysdeps/pthread/pt-crti.o
68 END_FILE-libpthread.so := $(top_builddir)libpthread/nptl/sysdeps/pthread/pt-crtn.o
69 LDFLAGS-libpthread.so += -nostartfiles
70 $(top_builddir)lib/libpthread.so: | $(START_FILE-libpthread.so) $(END_FILE-libpthread.so)
71 endif
73 libpthread_FULL_NAME := libpthread-$(VERSION).so
74 lib-a-$(UCLIBC_HAS_THREADS) += $(top_builddir)lib/libpthread.a
75 lib-so-$(UCLIBC_HAS_THREADS) += $(top_builddir)lib/libpthread.so
77 $(top_builddir)lib/libpthread.so: $(libpthread_OUT)/libpthread_so.a $(libc.depend) $(libdl.depend) $(top_builddir)lib/libpthread_nonshared.a
78 $(call link.so,$(libpthread_FULL_NAME),$(ABI_VERSION))
79 $(Q)cat $(top_srcdir)extra/scripts/format.lds > $@.tmp
80 $(Q)echo "GROUP ( $(notdir $@).$(ABI_VERSION) libpthread_nonshared.a )" >> $@.tmp
81 $(Q)mv $@.tmp $@
83 ifeq ($(PTHREADS_DEBUG_SUPPORT),y)
84 $(libpthread_OUT)/libpthread_so.a: STRIP_FLAGS:=$(STRIP_FLAGS:-x=-X --strip-debug)
85 endif
86 $(libpthread_OUT)/libpthread_so.a: $(libpthread-so-y)
87 $(Q)$(RM) $@
88 $(do_ar)
90 $(top_builddir)lib/libpthread.a: $(libpthread-a-y)
91 $(Q)$(INSTALL) -d $(dir $@)
92 $(Q)$(RM) $@
93 $(do_ar)
95 $(libpthread_OUT)/pthread-errnos.h: $(top_srcdir)extra/scripts/gen-as-const.awk
96 $(libpthread_OUT)/pthread-errnos.h: $(libpthread_DIR)/pthread-errnos.sym
97 @$(disp_gen)
98 $(do_awk) $(top_srcdir)extra/scripts/gen-as-const.awk $< \
99 | $(CC) $(CFLAGS) -x c - -S -o - \
100 | $(SED) $(PTHREAD_GENERATE_MANGLE) > $@
101 @if test ! -s $@ ; then rm -f $@ ; false ; fi
103 pregen-headers-$(UCLIBC_HAS_THREADS_NATIVE) += $(libpthread_OUT)/pthread-errnos.h
105 headers-$(UCLIBC_HAS_THREADS_NATIVE) += $(nptl_headers_bootstrap)
107 libpthread_H := $(addprefix $(top_builddir)include/,semaphore.h)
108 libpthread_include_H := $(addprefix $(top_builddir)include/,pthread.h)
109 libpthread_include_BITS_H := $(addprefix $(top_builddir)include/bits/,libc-lock.h stdio-lock.h)
110 libpthread_include_STD_IMPL_OS_ARCH_BITS_H := $(addprefix $(top_builddir)include/bits/,pthreadtypes.h semaphore.h)
112 $(libpthread_include_STD_IMPL_OS_ARCH_BITS_H): $(top_builddir)include/bits/%:
113 $(do_ln) $(call rel_srcdir)$(PTDIR)/sysdeps/unix/sysv/linux/$(TARGET_ARCH)/bits/$(@F) $@
114 $(libpthread_include_BITS_H): $(top_builddir)include/bits/%:
115 $(do_ln) $(call rel_srcdir)$(PTDIR)/sysdeps/pthread/bits/$(@F) $@
116 $(libpthread_include_H): $(top_builddir)include/%:
117 $(do_ln) $(call rel_srcdir)$(PTDIR)/sysdeps/pthread/$(@F) $@
118 $(libpthread_H): $(top_builddir)include/%:
119 $(do_ln) $(call rel_srcdir)$(PTDIR)/$(@F) $@
121 nptl_headers_bootstrap = $(libpthread_H) $(libpthread_include_H) $(libpthread_include_BITS_H) $(libpthread_include_STD_IMPL_OS_ARCH_BITS_H)
123 objclean-y += CLEAN_libpthread/nptl
124 headers_clean-y += HEADERCLEAN_libpthread/nptl
126 HEADERCLEAN_libpthread/nptl:
127 $(do_rm) $(nptl_headers_bootstrap) \
128 $(libpthread_OUT)/pthread-errnos.h
130 CLEAN_libpthread/nptl:
131 $(do_rm) $(addprefix $(libpthread_OUT)/*., o os oS a)
133 ifeq ($(PTHREADS_DEBUG_SUPPORT),y)
134 LDFLAGS-libpthread.so += $(LDFLAGS_NOSTRIP) -Wl,-z,defs
135 else
136 LDFLAGS-libpthread.so += $(LDFLAGS)
137 endif
139 LDFLAGS-libpthread.so += $(top_builddir)lib/$(UCLIBC_LDSO_NAME)-$(VERSION).so $(top_builddir)lib/libdl-$(VERSION).so \
140 -Wl,-z,nodelete,-z,initfirst,-init=$(SYMBOL_PREFIX)__pthread_initialize_minimal_internal
142 LIBS-libpthread.so := $(LIBS)
144 CFLAGS-dir_nptl := -DNOT_IN_libc -DIS_IN_libpthread
145 CFLAGS-libpthread/nptl := $(CFLAGS-dir_nptl) $(SSP_ALL_CFLAGS)
147 # Since cancellation handling is in large parts handled using exceptions
148 # we have to compile some files with exception handling enabled, some
149 # even with asynchronous unwind tables.
151 # init.c contains sigcancel_handler().
152 CFLAGS-init.c = -fexceptions -fasynchronous-unwind-tables
153 # The unwind code itself,
154 CFLAGS-unwind.c = -fexceptions
155 CFLAGS-unwind-forcedunwind.c = -fexceptions -fasynchronous-unwind-tables
157 # The following three functions must be async-cancel safe.
158 CFLAGS-pthread_cancel.c = -fexceptions -fasynchronous-unwind-tables
159 CFLAGS-pthread_setcancelstate.c = -fexceptions -fasynchronous-unwind-tables
160 CFLAGS-pthread_setcanceltype.c = -fexceptions -fasynchronous-unwind-tables
162 # These are internal functions which similar functionality as setcancelstate
163 # and setcanceltype.
164 CFLAGS-cancellation.c = -fasynchronous-unwind-tables
165 CFLAGS-libc-cancellation.c = -fasynchronous-unwind-tables
167 # Calling pthread_exit() must cause the registered cancel handlers to
168 # be executed. Therefore exceptions have to be thrown through this
169 # function.
170 CFLAGS-pthread_exit.c = -fexceptions
172 # Among others, __pthread_unwind is forwarded. This function must handle
173 # exceptions.
174 CFLAGS-forward.c = -fexceptions
176 # The following are cancellation points. Some of the functions can
177 # block and therefore temporarily enable asynchronous cancellation.
178 # Those must be compiled asynchronous unwind tables.
179 CFLAGS-pthread_testcancel.c = -fexceptions
180 CFLAGS-pthread_join.c = -fexceptions -fasynchronous-unwind-tables
181 CFLAGS-pthread_timedjoin.c = -fexceptions -fasynchronous-unwind-tables
182 CFLAGS-pthread_once.c = $(uses-callbacks) -fexceptions \
183 -fasynchronous-unwind-tables
184 CFLAGS-pthread_cond_wait.c = -fexceptions -fasynchronous-unwind-tables
185 CFLAGS-pthread_cond_timedwait.c = -fexceptions -fasynchronous-unwind-tables
186 CFLAGS-sem_wait.c = -fexceptions -fasynchronous-unwind-tables
187 CFLAGS-sem_timedwait.c = -fexceptions -fasynchronous-unwind-tables
189 # These are the function wrappers we have to duplicate here.
190 CFLAGS-fcntl.c = -fexceptions -fasynchronous-unwind-tables
191 CFLAGS-lockf.c = -fexceptions
192 CFLAGS-pread.c = -fexceptions -fasynchronous-unwind-tables
193 CFLAGS-pread64.c = -fexceptions -fasynchronous-unwind-tables
194 CFLAGS-pwrite.c = -fexceptions -fasynchronous-unwind-tables
195 CFLAGS-pwrite64.c = -fexceptions -fasynchronous-unwind-tables
196 CFLAGS-wait.c = -fexceptions -fasynchronous-unwind-tables
197 CFLAGS-waitpid.c = -fexceptions -fasynchronous-unwind-tables
198 CFLAGS-sigwait.c = -fexceptions -fasynchronous-unwind-tables
199 CFLAGS-msgrcv.c = -fexceptions -fasynchronous-unwind-tables
200 CFLAGS-msgsnd.c = -fexceptions -fasynchronous-unwind-tables
201 CFLAGS-tcdrain.c = -fexceptions -fasynchronous-unwind-tables
203 CFLAGS-pt-system.c = -fexceptions -I$(top_srcdir)libc/stdlib
206 # The rest of this file is uClibc specific.
208 CFLAGS-pthread_barrier_init.c = -D_GNU_SOURCE
209 CFLAGS-pthread_barrier_destroy.c = -D_GNU_SOURCE
210 CFLAGS-pthread_barrierattr_init.c = -D_GNU_SOURCE
211 CFLAGS-pthread_barrierattr_destroy.c = -D_GNU_SOURCE
212 CFLAGS-pthread_barrierattr_getpshared.c = -D_GNU_SOURCE
213 CFLAGS-pthread_barrierattr_setpshared.c = -D_GNU_SOURCE
214 CFLAGS-sem_open.c = -D_GNU_SOURCE
216 CFLAGS-OMIT-alloca_cutoff.c = $(CFLAGS-dir_nptl)
217 CFLAGS-OMIT-forward.c = $(CFLAGS-dir_nptl)
218 CFLAGS-OMIT-libc-lowlevelock.c = $(CFLAGS-dir_nptl)
219 CFLAGS-OMIT-libc-cancellation.c = $(CFLAGS-dir_nptl)