OSDN Git Service

f8ab00a2b7b337e2c2ce5ee318434f127a78a06a
[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).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).so
30
31 DIRS=
32 ifeq ($(strip $(INCLUDE_THREADS)),true)
33         DIRS+=linuxthreads
34 # For now, don't build the debug library since it doesn't work yet anyways...
35 #ifeq ($(strip $(DODEBUG)),true)
36 #       DIRS+=linuxthreads_db
37 #endif
38 endif
39
40 ALL_SUBDIRS = linuxthreads linuxthreads_db
41
42 all: $(LIBPTHREAD) $(LIBTHREAD_DB)
43
44 $(LIBPTHREAD): subdirs
45         @if [ -f $(LIBPTHREAD) ] ; then \
46                 set -e; \
47                 install -d $(TOPDIR)lib; \
48                 rm -f $(TOPDIR)lib/$(LIBPTHREAD); \
49                 install -m 644 $(LIBPTHREAD) $(TOPDIR)lib; \
50         fi;
51
52 $(LIBTHREAD_DB): subdirs
53         @if [ -f $(LIBTHREAD_DB) ] ; then \
54                 set -e; \
55                 install -d $(TOPDIR)lib; \
56                 rm -f $(TOPDIR)lib/$(LIBTHREAD_DB); \
57                 install -m 644 $(LIBTHREAD_DB) $(TOPDIR)lib; \
58         fi;
59
60
61 $(OBJS): %.o : %.c
62         $(CC) $(CFLAGS) -c $< -o $@
63         $(STRIPTOOL) -x -R .note -R .comment $*.o
64
65 $(OBJ): Makefile
66
67 shared: all
68         if [ -f $(LIBPTHREAD) ] ; then \
69                 set -e; \
70                 $(LD) $(LDFLAGS) -soname=$(LIBPTHREAD_SHARED).$(MAJOR_VERSION) \
71                         -o $(LIBPTHREAD_SHARED_FULLNAME) --whole-archive $(LIBPTHREAD) \
72                         --no-whole-archive $(TOPDIR)/libc/misc/internals/interp.o \
73                         -L$(TOPDIR)/lib -lc; \
74                 install -d $(TOPDIR)lib; \
75                 rm -f $(TOPDIR)lib/$(LIBPTHREAD_SHARED_FULLNAME) \
76                         $(TOPDIR)lib/$(LIBPTHREAD_SHARED).$(MAJOR_VERSION); \
77                 install -m 644 $(LIBPTHREAD_SHARED_FULLNAME) $(TOPDIR)lib; \
78                 (cd $(TOPDIR)lib && ln -sf $(LIBPTHREAD_SHARED_FULLNAME) \
79                         $(LIBPTHREAD_SHARED)); \
80                 (cd $(TOPDIR)lib && ln -sf $(LIBPTHREAD_SHARED_FULLNAME) \
81                         $(LIBPTHREAD_SHARED).$(MAJOR_VERSION)); \
82         fi;
83         if [ -f $(LIBTHREAD_DB) ] ; then \
84                 set -e; \
85                 $(LD) $(LDFLAGS) -soname=$(LIBTHREAD_DB_SHARED).$(MAJOR_VERSION) \
86                         -o $(LIBTHREAD_DB_SHARED_FULLNAME) --whole-archive $(LIBTHREAD_DB) \
87                         --no-whole-archive $(TOPDIR)/libc/misc/internals/interp.o \
88                         -L$(TOPDIR)/lib -lc; \
89                 install -d $(TOPDIR)lib; \
90                 rm -f $(TOPDIR)lib/$(LIBTHREAD_DB_SHARED_FULLNAME) \
91                         $(TOPDIR)lib/$(LIBTHREAD_DB_SHARED).$(MAJOR_VERSION); \
92                 install -m 644 $(LIBTHREAD_DB_SHARED_FULLNAME) $(TOPDIR)lib; \
93                 (cd $(TOPDIR)lib && ln -sf $(LIBTHREAD_DB_SHARED_FULLNAME) \
94                         $(LIBTHREAD_DB_SHARED)); \
95                 (cd $(TOPDIR)lib && ln -sf $(LIBTHREAD_DB_SHARED_FULLNAME) \
96                         $(LIBTHREAD_DB_SHARED).$(MAJOR_VERSION)); \
97         fi;
98
99 tags:
100         ctags -R
101         
102 subdirs: $(patsubst %, _dir_%, $(DIRS))
103 subdirs_clean: $(patsubst %, _dirclean_%, $(ALL_SUBDIRS))
104
105 $(patsubst %, _dir_%, $(DIRS)) : dummy
106         $(MAKE) -C $(patsubst _dir_%, %, $@)
107
108 $(patsubst %, _dirclean_%, $(ALL_SUBDIRS)) : dummy
109         $(MAKE) -C $(patsubst _dirclean_%, %, $@) clean
110
111 clean: subdirs_clean
112         rm -f *.[oa] *~ core $(LIBPTHREAD) $(LIBPTHREAD_SHARED_FULLNAME) \
113                 $(LIBTHREAD_DB) $(LIBTHREAD_DB_SHARED_FULLNAME)
114
115 .PHONY: dummy
116
117