OSDN Git Service

A slight improvement over my previous commit which ensured we always rebuild
[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-dir_linuxthreads := -DNOT_IN_libc -DIS_IN_libpthread
10 CFLAGS-linuxthreads := $(CFLAGS-dir_linuxthreads) $(SSP_ALL_CFLAGS)
11
12 CFLAGS-libpthread/linuxthreads/sysdeps/$(TARGET_ARCH)/ := $(CFLAGS-linuxthreads)
13 CFLAGS-libpthread/linuxthreads/sysdeps/unix/sysv/linux/ := $(CFLAGS-linuxthreads)
14 CFLAGS-libpthread/linuxthreads/sysdeps/pthread/         := $(CFLAGS-linuxthreads)
15
16 # This stuff will not compile without at least -O1
17 # psm: can't handle this here, could maybe search for -O0 in CFLAGS
18 # and append -O1 if found
19 #CFLAGS:=$(CFLAGS:-O0=-O1)
20
21 ifeq ($(PTHREADS_DEBUG_SUPPORT),y)
22 LDFLAGS-libpthread.so := $(LDFLAGS_NOSTRIP) -Wl,-z,defs
23 else
24 LDFLAGS-libpthread.so := $(LDFLAGS)
25 endif
26
27 LIBS-libpthread.so := $(LIBS) $(ldso)
28
29 START_FILE-libpthread.so := $(SHARED_START_FILES)
30 END_FILE-libpthread.so := $(SHARED_END_FILES)
31
32 libpthread_FULL_NAME := libpthread-$(VERSION).so
33
34 libpthread_DIR := $(top_srcdir)libpthread/linuxthreads
35 libpthread_OUT := $(top_builddir)libpthread/linuxthreads
36
37 -include $(libpthread_DIR)/sysdeps/$(TARGET_ARCH)/Makefile.arch
38
39 pthread_arch_SRC   := pspinlock
40 pthread_arch_SRC   := $(patsubst %,$(libpthread_DIR)/sysdeps/$(TARGET_ARCH)/%.c,$(pthread_arch_SRC))
41 pthread_linux_SRC  := fork pt-sigsuspend register-atfork unregister-atfork
42 pthread_linux_SRC  := $(patsubst %,$(libpthread_DIR)/sysdeps/unix/sysv/linux/%.c,$(pthread_linux_SRC))
43 pthread_sysdep_SRC := errno-loc herrno-loc ptlongjmp
44 pthread_sysdep_SRC := $(patsubst %,$(libpthread_DIR)/sysdeps/pthread/%.c,$(pthread_sysdep_SRC))
45 pthread_SRC := \
46         attr barrier cancel condvar errno events join pthread \
47         lockfile manager mutex pt-machine ptcleanup \
48         ptclock_gettime ptclock_settime ptfork pthandles \
49         pthread_setegid pthread_seteuid pthread_setgid pthread_setregid \
50         pthread_setresgid pthread_setresuid pthread_setreuid pthread_setuid \
51         rwlock semaphore sighandler signals specific spinlock
52 pthread_SRC := $(patsubst %,$(libpthread_DIR)/%.c,$(pthread_SRC))
53
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-OMIT-alloca_cutoff.c := $(CFLAGS-dir_linuxthreads)
62 CFLAGS-OMIT-forward.c := $(CFLAGS-dir_linuxthreads)
63 CFLAGS-OMIT-libc-cancellation.c := $(CFLAGS-dir_linuxthreads)
64 CFLAGS-OMIT-libc_pthread_init.c := $(CFLAGS-dir_linuxthreads)
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
73 libpthread-nonshared-y += $(patsubst %,$(libpthread_OUT)/%.oS,$(libpthread_static_SRC))
74
75 ifeq ($(DOPIC),y)
76 libpthread-a-y  += $(libpthread_OBJ:.o=.os) $(libpthread-static-y:.o=.os)
77 else
78 libpthread-a-y  += $(libpthread_OBJ) $(libpthread-static-y)
79 endif
80 libpthread-so-y += $(libpthread_OBJ:.o=.oS)
81
82 lib-a-$(UCLIBC_HAS_THREADS) += $(top_builddir)lib/libpthread.a
83 lib-so-$(UCLIBC_HAS_THREADS) += $(top_builddir)lib/libpthread.so
84 objclean-y += libpthread_clean
85 headers-$(UCLIBC_HAS_THREADS) += linuxthreads_headers
86 headers_clean-y += linuxthreads_headers_clean
87
88 #ifeq ($(DOMULTI),n)
89 $(top_builddir)lib/libpthread.so: $(libpthread_OUT)/libpthread_so.a $(libc.depend) $(top_builddir)lib/libpthread_nonshared.a
90         $(call link.so,$(libpthread_FULL_NAME),$(MAJOR_VERSION))
91 #else
92 #$(top_builddir)lib/libpthread.so: $(libpthread_OUT)/libpthread.oS | $(libc.depend) $(top_builddir)lib/libpthread_nonshared.a
93 #       $(call linkm.so,$(libpthread_FULL_NAME),$(MAJOR_VERSION))
94 #endif
95         $(Q)$(RM) $@
96         $(Q)cp $(top_srcdir)extra/scripts/format.lds $@
97         $(Q)echo "GROUP ( $(notdir $@).$(MAJOR_VERSION) libpthread_nonshared.a )" >> $@
98
99 $(libpthread_OUT)/libpthread_so.a: $(libpthread-so-y)
100         $(Q)$(RM) $@
101 ifeq ($(PTHREADS_DEBUG_SUPPORT),y)
102         $(do_strip:-x=-X --strip-debug)
103 else
104         $(do_strip)
105 endif
106         $(do_ar)
107
108 $(libpthread_OUT)/libpthread.oS: $(libpthread_SRC)
109         $(Q)$(RM) $@
110         $(compile-m)
111 ifeq ($(PTHREADS_DEBUG_SUPPORT),y)
112         $(do_t_strip:-x=-X --strip-debug)
113 else
114         $(do_t_strip)
115 endif
116
117 $(top_builddir)lib/libpthread.a: $(libpthread-a-y)
118         $(Q)$(INSTALL) -d $(dir $@)
119         $(Q)$(RM) $@
120 ifeq ($(PTHREADS_DEBUG_SUPPORT),y)
121         $(do_strip:-x=-X --strip-debug)
122 else
123         $(do_strip)
124 endif
125         $(do_ar)
126
127 linuxthreads_headers:
128         $(Q)$(LN) -sf ../$(PTDIR)/sysdeps/pthread/pthread.h $(top_builddir)include/
129         $(Q)$(LN) -sf ../$(PTDIR)/semaphore.h $(top_builddir)include/
130         $(Q)$(INSTALL) -d $(top_builddir)include/bits
131         $(Q)$(LN) -sf ../../$(PTDIR)/sysdeps/pthread/bits/pthreadtypes.h $(top_builddir)include/bits/
132
133 linuxthreads_headers_clean:
134         $(RM) $(top_builddir)include/pthread.h $(top_builddir)include/semaphore.h \
135                 $(top_builddir)include/bits/pthreadtypes.h
136
137 libpthread_clean:
138         $(RM) $(libpthread_OUT)/{,*/,*/*/,*/*/*/,*/*/*/*/}*.{o,os,oS,a}