OSDN Git Service

Back out nptl changes, which for now will be done in branches/uClibc-nptl
[uclinux-h8/uClibc.git] / libpthread / linuxthreads / Makefile
1 # Makefile for uClibc's pthread library
2 #
3 # Copyright (C) 2002 Erik Andersen <andersen@uclibc.org>
4 # Copyright (C) 2003 Paul Mundt <lethal@linux-sh.org>
5 #
6 # This program is free software; you can redistribute it and/or modify it under
7 # the terms of the GNU Library General Public License as published by the Free
8 # Software Foundation; either version 2 of the License, or (at your option) any
9 # later version.
10 #
11 # This program is distributed in the hope that it will be useful, but WITHOUT
12 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
13 # FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more
14 # details.
15 #
16 # You should have received a copy of the GNU Library General Public License
17 # along with this program; if not, write to the Free Software Foundation, Inc.,
18 # 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 # Makefile for uClibc
20
21 TOPDIR=../../
22 include $(TOPDIR)Rules.mak
23
24 # As long as there is only one subdir, we don't 
25 # have to worry about race conditions with multiple 
26 # $(AR)'s in subdirs running on linuxthreads.a.
27 DIRS = sysdeps
28
29 #Adjust the soname version to avoid namespace collisions with glibc's libpthread
30 LIBPTHREAD:=../libpthread.a
31 ifeq ($(strip $(TARGET_ARCH)),sparc)
32 SYSDEPS_DIR:=$(TARGET_ARCH)/sparc32
33 else
34 SYSDEPS_DIR:=$(TARGET_ARCH)
35 endif
36 #This stuff will not compile without at least -O1
37 CFLAGS :=$(CFLAGS:-O0=-O1)
38
39
40 # set up system dependencies include dirs (NOTE: order matters!)
41 PTDIR = $(TOPDIR)libpthread/linuxthreads/
42 SYSDEPINC = -I$(PTDIR)sysdeps/unix/sysv/linux \
43             -I$(PTDIR)sysdeps/pthread \
44             -I$(PTDIR)sysdeps/unix/sysv \
45             -I$(PTDIR)sysdeps/unix/unix \
46             -I$(PTDIR)sysdeps/$(TARGET_ARCH) \
47             -I$(PTDIR)sysdeps \
48             -I$(TOPDIR)libc/sysdeps/linux/$(TARGET_ARCH)
49 CFLAGS += $(SYSDEPINC)
50
51 CSRC=attr.c cancel.c condvar.c errno.c events.c join.c lockfile.c manager.c \
52         mutex.c oldsemaphore.c pt-machine.c ptfork.c pthread.c \
53         ptlongjmp.c rwlock.c semaphore.c signals.c specific.c spinlock.c \
54         wrapsyscall.c
55
56 ifeq ($(UCLIBC_HAS_XLOCALE),y)
57         CSRC += locale.c
58 endif
59
60 COBJS=$(patsubst %.c,%.o, $(CSRC))
61 OBJS=$(COBJS)
62
63 # We need to make sure that we put all the top-level $(OBJS) into
64 # our archive before executing subdirs.  That way, when $(AR) is 
65 # run in the subdirs, it'll bump the generic top-level objects 
66 # out of our archive in favor of the machine-specific ones.
67 all: $(LIBPTHREAD) subdirs
68
69 $(LIBPTHREAD) ar-target: $(OBJS)
70         $(AR) $(ARFLAGS) $(LIBPTHREAD) $(OBJS)
71
72 $(COBJS): %.o : %.c
73         $(CC) $(CFLAGS) -c $< -o $@
74 ifeq ($(strip $(PTHREADS_DEBUG_SUPPORT)),y)
75         $(STRIPTOOL) -X --strip-debug -R .note -R .comment $*.o
76 else
77         $(STRIPTOOL) -x -R .note -R .comment $*.o
78 endif
79
80 clean: subdirs_clean
81         $(RM) *.[oa] *~ core
82
83 subdirs: $(patsubst %, _dir_%, $(DIRS))
84 subdirs_clean: $(patsubst %, _dirclean_%, $(DIRS))
85
86 $(patsubst %, _dir_%, $(DIRS)): $(LIBPTHREAD)
87         $(MAKE) -C $(patsubst _dir_%, %, $@)
88
89 $(patsubst %, _dirclean_%, $(DIRS)):
90         $(MAKE) -C $(patsubst _dirclean_%, %, $@) clean
91
92 .PHONY: dummy