OSDN Git Service

New linuxthreads builds on x86, vapier: pt-allocrtsig.c is missing from sources
[uclinux-h8/uClibc.git] / libpthread / linuxthreads / Makefile.in
1 # Makefile for uClibc
2 #
3 # Copyright (C) 2003 Paul Mundt <lethal@linux-sh.org>
4 # Copyright (C) 2000-2006 Erik Andersen <andersen@uclibc.org>
5 #
6 # Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
7 #
8
9 CFLAGS-linuxthreads := -DNOT_IN_libc -DIS_IN_libpthread $(SSP_ALL_CFLAGS)
10
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)
14
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)
19
20 ifeq ($(PTHREADS_DEBUG_SUPPORT),y)
21 LDFLAGS-libpthread.so := $(LDFLAGS_NOSTRIP) -z defs
22 else
23 LDFLAGS-libpthread.so := $(LDFLAGS)
24 endif
25
26 LIBS-libpthread.so := $(LIBS) $(ldso)
27
28 START_FILE-libpthread.so := $(SHARED_START_FILES)
29 END_FILE-libpthread.so := $(SHARED_END_FILES)
30
31 libpthread_FULL_NAME := libpthread-$(MAJOR_VERSION).$(MINOR_VERSION).$(SUBLEVEL).so
32
33 libpthread_DIR := $(top_srcdir)libpthread/linuxthreads
34 libpthread_OUT := $(top_builddir)libpthread/linuxthreads
35
36 -include $(libpthread_DIR)/sysdeps/$(TARGET_ARCH)/Makefile.arch
37
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))
44 pthread_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))
52
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))
57
58 #
59 # Stuff that goes into libc.so, not libpthread.so
60 #
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)
70
71 libpthread-static-y += $(patsubst %,$(libpthread_OUT)/%.o,$(libpthread_static_SRC))
72 libpthread-shared-y += $(patsubst %,$(libpthread_OUT)/%.oS,$(libpthread_shared_SRC))
73
74 ifeq ($(DOPIC),y)
75 libpthread-a-y  += $(libpthread_OBJ:.o=.os) $(libpthread-static-y:.o=.os)
76 else
77 libpthread-a-y  += $(libpthread_OBJ) $(libpthread-static-y)
78 endif
79 libpthread-so-y += $(libpthread_OBJ:.o=.os) $(libpthread-shared-y)
80
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
86
87 ifeq ($(DOMULTI),n)
88 $(top_builddir)lib/libpthread.so: $(libpthread_OUT)/libpthread_so.a $(libc)
89         $(call link.so,$(libpthread_FULL_NAME),$(MAJOR_VERSION))
90 else
91 $(top_builddir)lib/libpthread.so: $(libpthread_OUT)/libpthread.oS $(libc)
92         $(call linkm.so,$(libpthread_FULL_NAME),$(MAJOR_VERSION))
93 endif
94
95 $(libpthread_OUT)/libpthread_so.a: $(libpthread-so-y)
96         $(Q)$(RM) $@
97 ifeq ($(PTHREADS_DEBUG_SUPPORT),y)
98         $(do_strip:-x=-X --strip-debug)
99 else
100         $(do_strip)
101 endif
102         $(do_ar)
103
104 $(libpthread_OUT)/libpthread.oS: $(libpthread_SRC) $(patsubst %,$(libpthread_DIR)/%.c,$(libpthread_shared_SRC))
105         $(Q)$(RM) $@
106         $(compile-m)
107 ifeq ($(PTHREADS_DEBUG_SUPPORT),y)
108         $(do_t_strip:-x=-X --strip-debug)
109 else
110         $(do_t_strip)
111 endif
112
113 $(top_builddir)lib/libpthread.a: $(libpthread-a-y)
114         $(Q)$(INSTALL) -d $(dir $@)
115         $(Q)$(RM) $@
116 ifeq ($(PTHREADS_DEBUG_SUPPORT),y)
117         $(do_strip:-x=-X --strip-debug)
118 else
119         $(do_strip)
120 endif
121         $(do_ar)
122
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/
128
129 linuxthreads_headers_clean:
130         $(RM) $(top_builddir)include/pthread.h $(top_builddir)include/semaphore.h \
131                 $(top_builddir)include/bits/pthreadtypes.h
132
133 libpthread_clean:
134         $(RM) $(libpthread_OUT)/{,*/,*/*/,*/*/*/,*/*/*/*/}*.{o,os,oS,a}