OSDN Git Service

Several pthreads updates. Enable linuxthreads_db. Several fixes
[uclinux-h8/uClibc.git] / libpthread / Makefile
1 # Makefile for uClibc's pthread library
2 #
3 # Copyright (C) 2002 Erik Andersen <andersen@uclibc.org>
4 #
5 # This program is free software; you can redistribute it and/or modify it under
6 # the terms of the GNU Library General Public License as published by the Free
7 # Software Foundation; either version 2 of the License, or (at your option) any
8 # later version.
9 #
10 # This program is distributed in the hope that it will be useful, but WITHOUT
11 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
12 # FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more
13 # details.
14 #
15 # You should have received a copy of the GNU Library General Public License
16 # along with this program; if not, write to the Free Software Foundation, Inc.,
17 # 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18
19 TOPDIR=../
20 include $(TOPDIR)Rules.mak
21
22 #Adjust the soname version to avoid namespace collisions with glibc's libpthread
23 LIBPTHREAD=libpthread.a
24 LIBPTHREAD_SHARED=libpthread.so
25 LIBPTHREAD_SHARED_FULLNAME=libpthread-$(MAJOR_VERSION).$(MINOR_VERSION).$(SUBLEVEL).so
26
27 LIBTHREAD_DB=libthread_db.a
28 LIBTHREAD_DB_SHARED=libthread_db.so
29 LIBTHREAD_DB_SHARED_FULLNAME=libthread_db-$(MAJOR_VERSION).$(MINOR_VERSION).$(SUBLEVEL).so
30
31 DIRS=
32 ifeq ($(strip $(INCLUDE_THREADS)),true)
33         DIRS+=linuxthreads linuxthreads_db
34 endif
35
36 ALL_SUBDIRS = linuxthreads linuxthreads_db
37
38 all: $(LIBPTHREAD) $(LIBTHREAD_DB)
39
40 $(LIBPTHREAD): subdirs
41         @if [ -f $(LIBPTHREAD) ] ; then \
42                 set -e; \
43                 install -d $(TOPDIR)lib; \
44                 rm -f $(TOPDIR)lib/$(LIBPTHREAD); \
45                 install -m 644 $(LIBPTHREAD) $(TOPDIR)lib; \
46         fi;
47
48 $(LIBTHREAD_DB): subdirs
49         @if [ -f $(LIBTHREAD_DB) ] ; then \
50                 set -e; \
51                 install -d $(TOPDIR)lib; \
52                 rm -f $(TOPDIR)lib/$(LIBTHREAD_DB); \
53                 install -m 644 $(LIBTHREAD_DB) $(TOPDIR)lib; \
54         fi;
55
56
57 $(OBJS): %.o : %.c
58         $(CC) $(CFLAGS) -c $< -o $@
59         $(STRIPTOOL) -x -R .note -R .comment $*.o
60
61 $(OBJ): Makefile
62
63 shared: all
64         if [ -f $(LIBPTHREAD) ] ; then \
65                 set -e; \
66                 $(LD) $(LDFLAGS) -soname=$(LIBPTHREAD_SHARED).$(MAJOR_VERSION) \
67                         -o $(LIBPTHREAD_SHARED_FULLNAME) --whole-archive $(LIBPTHREAD) \
68                         --no-whole-archive $(TOPDIR)/libc/misc/internals/interp.o \
69                         -L$(TOPDIR)/lib -lc; \
70                 install -d $(TOPDIR)lib; \
71                 rm -f $(TOPDIR)lib/$(LIBPTHREAD_SHARED_FULLNAME) \
72                         $(TOPDIR)lib/$(LIBPTHREAD_SHARED).$(MAJOR_VERSION); \
73                 install -m 644 $(LIBPTHREAD_SHARED_FULLNAME) $(TOPDIR)lib; \
74                 (cd $(TOPDIR)lib && ln -sf $(LIBPTHREAD_SHARED_FULLNAME) \
75                         $(LIBPTHREAD_SHARED)); \
76                 (cd $(TOPDIR)lib && ln -sf $(LIBPTHREAD_SHARED_FULLNAME) \
77                         $(LIBPTHREAD_SHARED).$(MAJOR_VERSION)); \
78         fi;
79         if [ -f $(LIBTHREAD_DB) ] ; then \
80                 set -e; \
81                 $(LD) $(LDFLAGS) -soname=$(LIBTHREAD_DB_SHARED).$(MAJOR_VERSION) \
82                         -o $(LIBTHREAD_DB_SHARED_FULLNAME) --whole-archive $(LIBTHREAD_DB) \
83                         --no-whole-archive $(TOPDIR)/libc/misc/internals/interp.o \
84                         -L$(TOPDIR)/lib -lc; \
85                 install -d $(TOPDIR)lib; \
86                 rm -f $(TOPDIR)lib/$(LIBTHREAD_DB_SHARED_FULLNAME) \
87                         $(TOPDIR)lib/$(LIBTHREAD_DB_SHARED).$(MAJOR_VERSION); \
88                 install -m 644 $(LIBTHREAD_DB_SHARED_FULLNAME) $(TOPDIR)lib; \
89                 (cd $(TOPDIR)lib && ln -sf $(LIBTHREAD_DB_SHARED_FULLNAME) \
90                         $(LIBTHREAD_DB_SHARED)); \
91                 (cd $(TOPDIR)lib && ln -sf $(LIBTHREAD_DB_SHARED_FULLNAME) \
92                         $(LIBTHREAD_DB_SHARED).$(MAJOR_VERSION)); \
93         fi;
94
95 tags:
96         ctags -R
97         
98 subdirs: $(patsubst %, _dir_%, $(DIRS))
99 subdirs_clean: $(patsubst %, _dirclean_%, $(ALL_SUBDIRS))
100
101 $(patsubst %, _dir_%, $(DIRS)) : dummy
102         $(MAKE) -C $(patsubst _dir_%, %, $@)
103
104 $(patsubst %, _dirclean_%, $(ALL_SUBDIRS)) : dummy
105         $(MAKE) -C $(patsubst _dirclean_%, %, $@) clean
106
107 clean: subdirs_clean
108         rm -f *.[oa] *~ core $(LIBPTHREAD) $(LIBPTHREAD_SHARED_FULLNAME) \
109                 $(LIBTHREAD_DB) $(LIBTHREAD_DB_SHARED_FULLNAME)
110
111 .PHONY: dummy
112
113