1 # Makefile for uClibc NPTL
3 # Copyright (C) 2005-2006 Steven J. Hill <sjhill@uclibc.org>
5 # Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
8 subdirs += libpthread/nptl/sysdeps/pthread
10 # NOTE: glibc puts flockfile.c, ftrylockfile.c, funlockfile.c, and
11 # pt-longjmp.c in libc and libpthread. For uClibc, they are
14 libpthread_pthread_DIR = $(top_srcdir)libpthread/nptl/sysdeps/pthread
15 libpthread_pthread_OUT = $(top_builddir)libpthread/nptl/sysdeps/pthread
17 libpthread_pthread_COBJ = $(patsubst %.c,$(libpthread_pthread_OUT)/%.o,$(libpthread_pthread_CSRC))
18 libpthread_pthread_CSRC = \
19 pthread_barrier_destroy.c \
20 pthread_barrier_init.c \
21 pthread_barrier_wait.c \
22 pthread_cond_broadcast.c \
23 pthread_cond_signal.c \
24 pthread_cond_timedwait.c \
26 pthread_rwlock_rdlock.c \
27 pthread_rwlock_timedrdlock.c \
28 pthread_rwlock_timedwrlock.c \
29 pthread_rwlock_unlock.c \
30 pthread_rwlock_wrlock.c \
32 pthread_spin_destroy.c \
34 pthread_spin_unlock.c \
38 CFLAGS-pthread_barrier_wait.c = -D_GNU_SOURCE
39 CFLAGS-pthread_spin_destroy.c = -D_GNU_SOURCE
40 CFLAGS-pthread_spin_init.c = -D_GNU_SOURCE
41 CFLAGS-pthread_spin_unlock.c = -D_GNU_SOURCE
42 CFLAGS-unwind-forcedunwind.c = -fexceptions -fasynchronous-unwind-tables
44 CFLAGS-OMIT-librt-cancellation.c = -DIS_IN_libpthread
45 CFLAGS-OMIT-rt-unwind-resume.c = -DIS_IN_libpthread
46 CFLAGS-librt-cancellation.c = -DIS_IN_librt \
47 -fexceptions -fasynchronous-unwind-tables
48 CFLAGS-rt-unwind-resume.c = -DIS_IN_librt \
49 -fexceptions -fasynchronous-unwind-tables
51 libpthread-so-y += $(patsubst %,$(libpthread_pthread_OUT)/%.oS, unwind-forcedunwind)
53 librt-pt-routines-y = librt-cancellation.c
54 librt-pt-shared-only-routines-y = rt-unwind-resume.c
56 ifeq ($(UCLIBC_CTOR_DTOR),y)
57 CFLAGS-OMIT-pt-initfini.c = $(CFLAGS-y-libpthread/nptl/sysdeps/pthread)
58 CFLAGS-pt-initfini.c = -S -g0 $(PICFLAG) -fno-inline-functions \
59 $(call check_gcc,-fno-unit-at-a-time,) \
60 $(SSP_DISABLE_FLAGS) \
61 -finhibit-size-directive \
62 -fno-asynchronous-unwind-tables -fno-unwind-tables \
63 $(patsubst -f%,-fno-%,$(call check_gcc,-fexceptions,))
65 #ASFLAGS += $(PICFLAG) -I$(top_srcdir)include -I$(top_srcdir)libc/sysdeps/linux/$(TARGET_ARCH)
66 ifneq ($(wildcard $(libpthread_pthread_DIR)/../unix/sysv/linux/$(TARGET_ARCH)/pt-initfini.c),)
67 PTHREAD_INITFINI := $(libpthread_pthread_DIR)/../unix/sysv/linux/$(TARGET_ARCH)/pt-initfini.c
69 PTHREAD_INITFINI := $(libpthread_pthread_DIR)/pt-initfini.c
72 ASFLAGS-pt-crti.S = $(PICFLAG)
73 ASFLAGS-pt-crtn.S = $(PICFLAG)
75 $(libpthread_pthread_OUT)/pt-crti.o: $(libpthread_pthread_OUT)/pt-crti.S
78 $(libpthread_pthread_OUT)/pt-crtn.o: $(libpthread_pthread_OUT)/pt-crtn.S
81 $(libpthread_pthread_OUT)/pt-initfini.s: $(PTHREAD_INITFINI) | $(top_builddir)include/bits/uClibc_config.h
83 $(libpthread_pthread_OUT)/defs.h: $(PTHREAD_INITFINI)
84 $(do_sed) -n -e '/@TESTS_BEGIN/,/@TESTS_END/p' $< | \
85 $(AWK) -f $(top_srcdir)extra/scripts/defs.awk > $@.tmp
88 $(libpthread_pthread_OUT)/pt-crti.S: $(libpthread_pthread_OUT)/pt-initfini.s $(libpthread_pthread_OUT)/defs.h
89 $(do_sed) -n -e '/[ ]*\.file/d' \
90 -e '1,/@HEADER_ENDS/p' \
91 -e '/@_.*_PROLOG_BEGINS/,/@_.*_PROLOG_ENDS/p' \
92 -e '/@TRAILER_BEGINS/,$$p' $< > $@.tmp
94 $(libpthread_pthread_OUT)/pt-crtn.S: $(libpthread_pthread_OUT)/pt-initfini.s $(libpthread_pthread_OUT)/defs.h
95 $(do_sed) -n -e '/[ ]*\.file/d' \
96 -e '1,/@HEADER_ENDS/p' \
97 -e '/@_.*_EPILOG_BEGINS/,/@_.*_EPILOG_ENDS/p' \
98 -e '/@TRAILER_BEGINS/,$$p' $< > $@.tmp
102 objclean-y += CLEAN_libpthread/nptl/sysdeps/pthread
104 CLEAN_libpthread/nptl/sysdeps/pthread:
105 $(do_rm) $(addprefix $(libpthread_pthread_OUT)/*., o os oS s S) \
106 $(libpthread_pthread_OUT)/defs.h