OSDN Git Service

nptl: remove superfluous =1 from defines
[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-$(findstring y,$(UCLIBC_HAS_IPV4)$(UCLIBC_HAS_IPV6)) += 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 ifneq ($(UCLIBC_CTOR_DTOR),y)
67 START_FILE-libpthread.so := $(top_builddir)/libpthread/nptl/sysdeps/pthread/crti.o $(SHARED_START_FILES)
68 END_FILE-libpthread.so := $(SHARED_END_FILES) $(top_builddir)/libpthread/nptl/sysdeps/pthread/crtn.o
69 endif
70
71 libpthread_FULL_NAME := libpthread-$(VERSION).so
72 lib-a-$(UCLIBC_HAS_THREADS) += $(top_builddir)lib/libpthread.a
73 lib-so-$(UCLIBC_HAS_THREADS) += $(top_builddir)lib/libpthread.so
74
75 $(top_builddir)lib/libpthread.so: $(libpthread_OUT)/libpthread_so.a $(libc.depend) $(libdl.depend) $(top_builddir)lib/libpthread_nonshared.a
76         $(call link.so,$(libpthread_FULL_NAME),$(ABI_VERSION))
77         $(Q)cat $(top_srcdir)extra/scripts/format.lds > $@.tmp
78         $(Q)echo "GROUP ( $(notdir $@).$(ABI_VERSION) libpthread_nonshared.a )" >> $@.tmp
79         $(Q)mv $@.tmp $@
80
81 ifeq ($(PTHREADS_DEBUG_SUPPORT),y)
82 $(libpthread_OUT)/libpthread_so.a: STRIP_FLAGS:=$(STRIP_FLAGS:-x=-X --strip-debug)
83 endif
84 $(libpthread_OUT)/libpthread_so.a: $(libpthread-so-y)
85         $(Q)$(RM) $@
86         $(do_ar)
87
88 $(top_builddir)lib/libpthread.a: $(libpthread-a-y)
89         $(Q)$(INSTALL) -d $(dir $@)
90         $(Q)$(RM) $@
91         $(do_ar)
92
93 #
94 # Create 'pthread-errnos.h' header file.
95 #
96 CFLAGS-gen_pthread-errnos.c = -S
97
98 $(libpthread_OUT)/gen_pthread-errnos.c: $(libpthread_DIR)/pthread-errnos.sym | $(libpthread_OUT)
99         $(do_awk) $(top_srcdir)extra/scripts/gen-as-const.awk $< > $@
100
101 $(libpthread_OUT)/gen_pthread-errnos.s: $(libpthread_OUT)/gen_pthread-errnos.c | headers
102         $(compile.c)
103 libpthread-generated-y += $(libpthread_OUT)/gen_pthread-errnos.s
104 $(libpthread_OUT)/pthread-errnos.h: $(libpthread_OUT)/gen_pthread-errnos.s
105         $(do_sed) $(PTHREAD_GENERATE_MANGLE) $< > $@
106         @if test ! -s $@ ; then rm -f $@ ; false ; fi
107
108 pregen-headers-$(UCLIBC_HAS_THREADS_NATIVE) += $(libpthread_OUT)/pthread-errnos.h
109
110 headers-$(UCLIBC_HAS_THREADS_NATIVE) += $(nptl_headers_bootstrap)
111
112 libpthread_H := $(addprefix $(top_builddir)include/,semaphore.h)
113 libpthread_include_H := $(addprefix $(top_builddir)include/,pthread.h)
114 libpthread_include_BITS_H := $(addprefix $(top_builddir)include/bits/,libc-lock.h stdio-lock.h)
115 libpthread_include_STD_IMPL_OS_ARCH_BITS_H := $(addprefix $(top_builddir)include/bits/,pthreadtypes.h semaphore.h)
116
117 $(libpthread_include_STD_IMPL_OS_ARCH_BITS_H): $(top_builddir)include/bits/%:
118         $(do_ln) $(call rel_srcdir)$(PTDIR)/sysdeps/unix/sysv/linux/$(TARGET_ARCH)/bits/$(@F) $@
119 $(libpthread_include_BITS_H): $(top_builddir)include/bits/%:
120         $(do_ln) $(call rel_srcdir)$(PTDIR)/sysdeps/pthread/bits/$(@F) $@
121 $(libpthread_include_H): $(top_builddir)include/%:
122         $(do_ln) $(call rel_srcdir)$(PTDIR)/sysdeps/pthread/$(@F) $@
123 $(libpthread_H): $(top_builddir)include/%:
124         $(do_ln) $(call rel_srcdir)$(PTDIR)/$(@F) $@
125
126 nptl_headers_bootstrap = $(libpthread_H) $(libpthread_include_H) $(libpthread_include_BITS_H) $(libpthread_include_STD_IMPL_OS_ARCH_BITS_H)
127
128 objclean-y += CLEAN_libpthread/nptl
129 headers_clean-y += HEADERCLEAN_libpthread/nptl
130
131 HEADERCLEAN_libpthread/nptl:
132         $(do_rm) $(nptl_headers_bootstrap) \
133               $(addprefix $(libpthread_OUT)/gen_pthread-errnos., c s) \
134               $(libpthread_OUT)/pthread-errnos.h
135
136 CLEAN_libpthread/nptl:
137         $(do_rm) $(addprefix $(libpthread_OUT)/*., o os oS a)
138
139 ifeq ($(PTHREADS_DEBUG_SUPPORT),y)
140 LDFLAGS-libpthread.so := $(LDFLAGS_NOSTRIP) -Wl,-z,defs
141 else
142 LDFLAGS-libpthread.so := $(LDFLAGS)
143 endif
144
145 LDFLAGS-libpthread.so += $(top_builddir)lib/$(UCLIBC_LDSO_NAME)-$(VERSION).so $(top_builddir)lib/libdl-$(VERSION).so \
146         -Wl,-z,nodelete,-z,initfirst,-init=__pthread_initialize_minimal_internal
147
148 LIBS-libpthread.so := $(LIBS)
149
150 CFLAGS-nptl = -DNOT_IN_libc -DIS_IN_libpthread $(SSP_ALL_CFLAGS)
151
152 # Since cancellation handling is in large parts handled using exceptions
153 # we have to compile some files with exception handling enabled, some
154 # even with asynchronous unwind tables.
155
156 # init.c contains sigcancel_handler().
157 CFLAGS-init.c = -fexceptions -fasynchronous-unwind-tables
158 # The unwind code itself,
159 CFLAGS-unwind.c = -fexceptions
160 CFLAGS-unwind-forcedunwind.c = -fexceptions -fasynchronous-unwind-tables
161
162 # The following three functions must be async-cancel safe.
163 CFLAGS-pthread_cancel.c = -fexceptions -fasynchronous-unwind-tables
164 CFLAGS-pthread_setcancelstate.c = -fexceptions -fasynchronous-unwind-tables
165 CFLAGS-pthread_setcanceltype.c = -fexceptions -fasynchronous-unwind-tables
166
167 # These are internal functions which similar functionality as setcancelstate
168 # and setcanceltype.
169 CFLAGS-cancellation.c = -fasynchronous-unwind-tables
170 CFLAGS-libc-cancellation.c = -fasynchronous-unwind-tables
171
172 # Calling pthread_exit() must cause the registered cancel handlers to
173 # be executed.  Therefore exceptions have to be thrown through this
174 # function.
175 CFLAGS-pthread_exit.c = -fexceptions
176
177 # Among others, __pthread_unwind is forwarded.  This function must handle
178 # exceptions.
179 CFLAGS-forward.c = -fexceptions
180
181 # The following are cancellation points.  Some of the functions can
182 # block and therefore temporarily enable asynchronous cancellation.
183 # Those must be compiled asynchronous unwind tables.
184 CFLAGS-pthread_testcancel.c = -fexceptions
185 CFLAGS-pthread_join.c = -fexceptions -fasynchronous-unwind-tables
186 CFLAGS-pthread_timedjoin.c = -fexceptions -fasynchronous-unwind-tables
187 CFLAGS-pthread_once.c = $(uses-callbacks) -fexceptions \
188                         -fasynchronous-unwind-tables
189 CFLAGS-pthread_cond_wait.c = -fexceptions -fasynchronous-unwind-tables
190 CFLAGS-pthread_cond_timedwait.c = -fexceptions -fasynchronous-unwind-tables
191 CFLAGS-sem_wait.c = -fexceptions -fasynchronous-unwind-tables
192 CFLAGS-sem_timedwait.c = -fexceptions -fasynchronous-unwind-tables
193
194 # These are the function wrappers we have to duplicate here.
195 CFLAGS-fcntl.c = -fexceptions -fasynchronous-unwind-tables
196 CFLAGS-lockf.c = -fexceptions
197 CFLAGS-pread.c = -fexceptions -fasynchronous-unwind-tables
198 CFLAGS-pread64.c = -fexceptions -fasynchronous-unwind-tables
199 CFLAGS-pwrite.c = -fexceptions -fasynchronous-unwind-tables
200 CFLAGS-pwrite64.c = -fexceptions -fasynchronous-unwind-tables
201 CFLAGS-wait.c = -fexceptions -fasynchronous-unwind-tables
202 CFLAGS-waitpid.c = -fexceptions -fasynchronous-unwind-tables
203 CFLAGS-sigwait.c = -fexceptions -fasynchronous-unwind-tables
204 CFLAGS-msgrcv.c = -fexceptions -fasynchronous-unwind-tables
205 CFLAGS-msgsnd.c = -fexceptions -fasynchronous-unwind-tables
206 CFLAGS-tcdrain.c = -fexceptions -fasynchronous-unwind-tables
207
208 CFLAGS-pt-system.c = -fexceptions -I$(top_srcdir)libc/stdlib
209
210 #
211 # The rest of this file is uClibc specific.
212 #
213 CFLAGS-pthread_barrier_init.c = -D_GNU_SOURCE
214 CFLAGS-pthread_barrier_destroy.c = -D_GNU_SOURCE
215 CFLAGS-pthread_barrierattr_init.c = -D_GNU_SOURCE
216 CFLAGS-pthread_barrierattr_destroy.c = -D_GNU_SOURCE
217 CFLAGS-pthread_barrierattr_getpshared.c = -D_GNU_SOURCE
218 CFLAGS-pthread_barrierattr_setpshared.c = -D_GNU_SOURCE
219 CFLAGS-sem_open.c = -D_GNU_SOURCE
220
221 CFLAGS-OMIT-alloca_cutoff.c = $(CFLAGS-nptl)
222 CFLAGS-OMIT-forward.c = $(CFLAGS-nptl)
223 CFLAGS-OMIT-libc-lowlevelock.c = $(CFLAGS-nptl)
224 CFLAGS-OMIT-libc-cancellation.c = $(CFLAGS-nptl)