1 # Makefile for uClibc's pthread library
3 # Copyright (C) 2002 Erik Andersen <andersen@uclibc.org>
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
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
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
20 include $(TOPDIR)Rules.mak
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
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
32 ifeq ($(strip $(INCLUDE_THREADS)),true)
35 ifeq ($(strip $(DODEBUG)),true)
39 ALL_SUBDIRS = linuxthreads linuxthreads_db
41 all: $(LIBPTHREAD) $(LIBTHREAD_DB)
43 $(LIBPTHREAD): subdirs
44 @if [ -f $(LIBPTHREAD) ] ; then \
46 install -d $(TOPDIR)lib; \
47 rm -f $(TOPDIR)lib/$(LIBPTHREAD); \
48 install -m 644 $(LIBPTHREAD) $(TOPDIR)lib; \
51 $(LIBTHREAD_DB): subdirs
52 @if [ -f $(LIBTHREAD_DB) ] ; then \
54 install -d $(TOPDIR)lib; \
55 rm -f $(TOPDIR)lib/$(LIBTHREAD_DB); \
56 install -m 644 $(LIBTHREAD_DB) $(TOPDIR)lib; \
61 $(CC) $(CFLAGS) -c $< -o $@
62 $(STRIPTOOL) -x -R .note -R .comment $*.o
67 if [ -f $(LIBPTHREAD) ] ; then \
69 $(LD) $(LDFLAGS) -soname=$(LIBPTHREAD_SHARED).$(MAJOR_VERSION) \
70 -o $(LIBPTHREAD_SHARED_FULLNAME) --whole-archive $(LIBPTHREAD) \
71 --no-whole-archive $(TOPDIR)/libc/misc/internals/interp.o \
72 -L$(TOPDIR)/lib -lc; \
73 install -d $(TOPDIR)lib; \
74 rm -f $(TOPDIR)lib/$(LIBPTHREAD_SHARED_FULLNAME) \
75 $(TOPDIR)lib/$(LIBPTHREAD_SHARED).$(MAJOR_VERSION); \
76 install -m 644 $(LIBPTHREAD_SHARED_FULLNAME) $(TOPDIR)lib; \
77 (cd $(TOPDIR)lib && ln -sf $(LIBPTHREAD_SHARED_FULLNAME) \
78 $(LIBPTHREAD_SHARED)); \
79 (cd $(TOPDIR)lib && ln -sf $(LIBPTHREAD_SHARED_FULLNAME) \
80 $(LIBPTHREAD_SHARED).$(MAJOR_VERSION)); \
82 if [ -f $(LIBTHREAD_DB) ] ; then \
84 $(LD) $(LDFLAGS) -soname=$(LIBTHREAD_DB_SHARED).$(MAJOR_VERSION) \
85 -o $(LIBTHREAD_DB_SHARED_FULLNAME) --whole-archive $(LIBTHREAD_DB) \
86 --no-whole-archive $(TOPDIR)/libc/misc/internals/interp.o \
87 -L$(TOPDIR)/lib -lc; \
88 install -d $(TOPDIR)lib; \
89 rm -f $(TOPDIR)lib/$(LIBTHREAD_DB_SHARED_FULLNAME) \
90 $(TOPDIR)lib/$(LIBTHREAD_DB_SHARED).$(MAJOR_VERSION); \
91 install -m 644 $(LIBTHREAD_DB_SHARED_FULLNAME) $(TOPDIR)lib; \
92 (cd $(TOPDIR)lib && ln -sf $(LIBTHREAD_DB_SHARED_FULLNAME) \
93 $(LIBTHREAD_DB_SHARED)); \
94 (cd $(TOPDIR)lib && ln -sf $(LIBTHREAD_DB_SHARED_FULLNAME) \
95 $(LIBTHREAD_DB_SHARED).$(MAJOR_VERSION)); \
101 subdirs: $(patsubst %, _dir_%, $(DIRS))
102 subdirs_clean: $(patsubst %, _dirclean_%, $(ALL_SUBDIRS))
104 $(patsubst %, _dir_%, $(DIRS)) : dummy
105 $(MAKE) -C $(patsubst _dir_%, %, $@)
107 $(patsubst %, _dirclean_%, $(ALL_SUBDIRS)) : dummy
108 $(MAKE) -C $(patsubst _dirclean_%, %, $@) clean
111 rm -f *.[oa] *~ core $(LIBPTHREAD) $(LIBPTHREAD_SHARED_FULLNAME) \
112 $(LIBTHREAD_DB) $(LIBTHREAD_DB_SHARED_FULLNAME)