OSDN Git Service

no need for hidden sigtimedwait
[uclinux-h8/uClibc.git] / libpthread / nptl / Makefile.in
1 # Makefile for uClibc NPTL
2 #
3 # Copyright (C) 2005-2006 Steven J. Hill <sjhill@realitydiluted.com>
4 #
5 # Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
6 #
7
8 subdirs += libpthread/nptl
9
10 libpthread_DIR = $(top_srcdir)libpthread/nptl
11 libpthread_OUT = $(top_builddir)libpthread/nptl
12
13 include $(libpthread_DIR)/sysdeps/Makefile.in
14
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
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)))
32
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
44
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
55
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)
65
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
72
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
76
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 $@
82
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)
89
90 $(top_builddir)lib/libpthread.a: $(libpthread-a-y)
91         $(Q)$(INSTALL) -d $(dir $@)
92         $(Q)$(RM) $@
93         $(do_ar)
94
95 #
96 # Create 'pthread-errnos.h' header file.
97 #
98 CFLAGS-gen_pthread-errnos.c = -S
99
100 $(libpthread_OUT)/gen_pthread-errnos.c: $(libpthread_DIR)/pthread-errnos.sym | $(libpthread_OUT)
101         $(do_awk) $(top_srcdir)extra/scripts/gen-as-const.awk $< > $@
102
103 $(libpthread_OUT)/gen_pthread-errnos.s: $(libpthread_OUT)/gen_pthread-errnos.c | headers
104         $(compile.c)
105 libpthread-generated-y += $(libpthread_OUT)/gen_pthread-errnos.s
106 $(libpthread_OUT)/pthread-errnos.h: $(libpthread_OUT)/gen_pthread-errnos.s
107         $(do_sed) $(PTHREAD_GENERATE_MANGLE) $< > $@
108         @if test ! -s $@ ; then rm -f $@ ; false ; fi
109
110 pregen-headers-$(UCLIBC_HAS_THREADS_NATIVE) += $(libpthread_OUT)/pthread-errnos.h
111
112 headers-$(UCLIBC_HAS_THREADS_NATIVE) += $(nptl_headers_bootstrap)
113
114 libpthread_H := $(addprefix $(top_builddir)include/,semaphore.h)
115 libpthread_include_H := $(addprefix $(top_builddir)include/,pthread.h)
116 libpthread_include_BITS_H := $(addprefix $(top_builddir)include/bits/,libc-lock.h stdio-lock.h)
117 libpthread_include_STD_IMPL_OS_ARCH_BITS_H := $(addprefix $(top_builddir)include/bits/,pthreadtypes.h semaphore.h)
118
119 $(libpthread_include_STD_IMPL_OS_ARCH_BITS_H): $(top_builddir)include/bits/%:
120         $(do_ln) $(call rel_srcdir)$(PTDIR)/sysdeps/unix/sysv/linux/$(TARGET_ARCH)/bits/$(@F) $@
121 $(libpthread_include_BITS_H): $(top_builddir)include/bits/%:
122         $(do_ln) $(call rel_srcdir)$(PTDIR)/sysdeps/pthread/bits/$(@F) $@
123 $(libpthread_include_H): $(top_builddir)include/%:
124         $(do_ln) $(call rel_srcdir)$(PTDIR)/sysdeps/pthread/$(@F) $@
125 $(libpthread_H): $(top_builddir)include/%:
126         $(do_ln) $(call rel_srcdir)$(PTDIR)/$(@F) $@
127
128 nptl_headers_bootstrap = $(libpthread_H) $(libpthread_include_H) $(libpthread_include_BITS_H) $(libpthread_include_STD_IMPL_OS_ARCH_BITS_H)
129
130 objclean-y += CLEAN_libpthread/nptl
131 headers_clean-y += HEADERCLEAN_libpthread/nptl
132
133 HEADERCLEAN_libpthread/nptl:
134         $(do_rm) $(nptl_headers_bootstrap) \
135               $(addprefix $(libpthread_OUT)/gen_pthread-errnos., c s) \
136               $(libpthread_OUT)/pthread-errnos.h
137
138 CLEAN_libpthread/nptl:
139         $(do_rm) $(addprefix $(libpthread_OUT)/*., o os oS a)
140
141 ifeq ($(PTHREADS_DEBUG_SUPPORT),y)
142 LDFLAGS-libpthread.so += $(LDFLAGS_NOSTRIP) -Wl,-z,defs
143 else
144 LDFLAGS-libpthread.so += $(LDFLAGS)
145 endif
146
147 LDFLAGS-libpthread.so += $(top_builddir)lib/$(UCLIBC_LDSO_NAME)-$(VERSION).so $(top_builddir)lib/libdl-$(VERSION).so \
148         -Wl,-z,nodelete,-z,initfirst,-init=__pthread_initialize_minimal_internal
149
150 LIBS-libpthread.so := $(LIBS)
151
152 CFLAGS-nptl = -DNOT_IN_libc -DIS_IN_libpthread $(SSP_ALL_CFLAGS)
153
154 # Since cancellation handling is in large parts handled using exceptions
155 # we have to compile some files with exception handling enabled, some
156 # even with asynchronous unwind tables.
157
158 # init.c contains sigcancel_handler().
159 CFLAGS-init.c = -fexceptions -fasynchronous-unwind-tables
160 # The unwind code itself,
161 CFLAGS-unwind.c = -fexceptions
162 CFLAGS-unwind-forcedunwind.c = -fexceptions -fasynchronous-unwind-tables
163
164 # The following three functions must be async-cancel safe.
165 CFLAGS-pthread_cancel.c = -fexceptions -fasynchronous-unwind-tables
166 CFLAGS-pthread_setcancelstate.c = -fexceptions -fasynchronous-unwind-tables
167 CFLAGS-pthread_setcanceltype.c = -fexceptions -fasynchronous-unwind-tables
168
169 # These are internal functions which similar functionality as setcancelstate
170 # and setcanceltype.
171 CFLAGS-cancellation.c = -fasynchronous-unwind-tables
172 CFLAGS-libc-cancellation.c = -fasynchronous-unwind-tables
173
174 # Calling pthread_exit() must cause the registered cancel handlers to
175 # be executed.  Therefore exceptions have to be thrown through this
176 # function.
177 CFLAGS-pthread_exit.c = -fexceptions
178
179 # Among others, __pthread_unwind is forwarded.  This function must handle
180 # exceptions.
181 CFLAGS-forward.c = -fexceptions
182
183 # The following are cancellation points.  Some of the functions can
184 # block and therefore temporarily enable asynchronous cancellation.
185 # Those must be compiled asynchronous unwind tables.
186 CFLAGS-pthread_testcancel.c = -fexceptions
187 CFLAGS-pthread_join.c = -fexceptions -fasynchronous-unwind-tables
188 CFLAGS-pthread_timedjoin.c = -fexceptions -fasynchronous-unwind-tables
189 CFLAGS-pthread_once.c = $(uses-callbacks) -fexceptions \
190                         -fasynchronous-unwind-tables
191 CFLAGS-pthread_cond_wait.c = -fexceptions -fasynchronous-unwind-tables
192 CFLAGS-pthread_cond_timedwait.c = -fexceptions -fasynchronous-unwind-tables
193 CFLAGS-sem_wait.c = -fexceptions -fasynchronous-unwind-tables
194 CFLAGS-sem_timedwait.c = -fexceptions -fasynchronous-unwind-tables
195
196 # These are the function wrappers we have to duplicate here.
197 CFLAGS-fcntl.c = -fexceptions -fasynchronous-unwind-tables
198 CFLAGS-lockf.c = -fexceptions
199 CFLAGS-pread.c = -fexceptions -fasynchronous-unwind-tables
200 CFLAGS-pread64.c = -fexceptions -fasynchronous-unwind-tables
201 CFLAGS-pwrite.c = -fexceptions -fasynchronous-unwind-tables
202 CFLAGS-pwrite64.c = -fexceptions -fasynchronous-unwind-tables
203 CFLAGS-wait.c = -fexceptions -fasynchronous-unwind-tables
204 CFLAGS-waitpid.c = -fexceptions -fasynchronous-unwind-tables
205 CFLAGS-sigwait.c = -fexceptions -fasynchronous-unwind-tables
206 CFLAGS-msgrcv.c = -fexceptions -fasynchronous-unwind-tables
207 CFLAGS-msgsnd.c = -fexceptions -fasynchronous-unwind-tables
208 CFLAGS-tcdrain.c = -fexceptions -fasynchronous-unwind-tables
209
210 CFLAGS-pt-system.c = -fexceptions -I$(top_srcdir)libc/stdlib
211
212 #
213 # The rest of this file is uClibc specific.
214 #
215 CFLAGS-pthread_barrier_init.c = -D_GNU_SOURCE
216 CFLAGS-pthread_barrier_destroy.c = -D_GNU_SOURCE
217 CFLAGS-pthread_barrierattr_init.c = -D_GNU_SOURCE
218 CFLAGS-pthread_barrierattr_destroy.c = -D_GNU_SOURCE
219 CFLAGS-pthread_barrierattr_getpshared.c = -D_GNU_SOURCE
220 CFLAGS-pthread_barrierattr_setpshared.c = -D_GNU_SOURCE
221 CFLAGS-sem_open.c = -D_GNU_SOURCE
222
223 CFLAGS-OMIT-alloca_cutoff.c = $(CFLAGS-nptl)
224 CFLAGS-OMIT-forward.c = $(CFLAGS-nptl)
225 CFLAGS-OMIT-libc-lowlevelock.c = $(CFLAGS-nptl)
226 CFLAGS-OMIT-libc-cancellation.c = $(CFLAGS-nptl)