-# Makefile for uClibc
+# Makefile for uClibc's pthread library
#
-# Copyright (C) 2000 by by Lineo, inc. and Erik Andersen
-# Copyright (C) 2000, 2001 by Erik Andersen <andersee@debian.org>
+# Copyright (C) 2002 Erik Andersen <andersen@uclibc.org>
#
# This program is free software; you can redistribute it and/or modify it under
# the terms of the GNU Library General Public License as published by the Free
# You should have received a copy of the GNU Library General Public License
# along with this program; if not, write to the Free Software Foundation, Inc.,
# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-#
-# Derived in part from the Linux-8086 C library, the GNU C Library, and several
-# other sundry sources. Files within this library are copyright by their
-# respective copyright holders.
TOPDIR=../
include $(TOPDIR)Rules.mak
-LIBPTHREAD=libpthread.a
-LIBPTHREAD_SHARED=libpthread.so
-LIBPTHREAD_SHARED_FULLNAME=libpthread-$(MAJOR_VERSION).$(MINOR_VERSION).so
+ALL_SUBDIRS = linuxthreads linuxthreads_db
-CSRC = pthread.c
-OBJS=$(patsubst %.c,%.o, $(CSRC))
+DIRS=linuxthreads
+ifeq ($(strip $(PTHREADS_DEBUG_SUPPORT)),y)
+ DIRS+=linuxthreads_db
+endif
-all: $(OBJS) $(LIBPTHREAD)
+all: subdirs
-$(LIBPTHREAD): ar-target
+headers:
+ifeq ($(strip $(UCLIBC_HAS_THREADS_NATIVE)),y)
+ $(LN) -sf $(TOPDIR)libpthread/nptl/sysdeps/pthread/pthread.h $(TOPDIR)include/
+ $(LN) -sf $(TOPDIR)libpthread/nptl/semaphore.h $(TOPDIR)include/
+ $(LN) -sf ../$(TOPDIR)libpthread/nptl/sysdeps/unix/sysv/linux/$(TARGET_ARCH)/bits/semaphore.h $(TOPDIR)include/bits/
+ $(LN) -sf ../$(TOPDIR)libpthread/nptl/sysdeps/unix/sysv/linux/$(TARGET_ARCH)/bits/pthreadtypes.h $(TOPDIR)include/bits/
+ $(LN) -sf ../$(TOPDIR)libpthread/nptl/sysdeps/pthread/bits/libc-lock.h $(TOPDIR)include/bits/
+ $(LN) -sf ../$(TOPDIR)libpthread/nptl/sysdeps/pthread/bits/stdio-lock.h $(TOPDIR)include/bits/
+ifeq ($(strip $(PTHREADS_DEBUG_SUPPORT)),y)
+ $(LN) -sf $(TOPDIR)libpthread/nptl_db/thread_db.h $(TOPDIR)include/
+endif
+else
+ $(LN) -sf $(TOPDIR)libpthread/linuxthreads/sysdeps/pthread/pthread.h $(TOPDIR)include/
+ $(LN) -sf $(TOPDIR)libpthread/linuxthreads/semaphore.h $(TOPDIR)include/
+ $(LN) -sf ../$(TOPDIR)libpthread/linuxthreads/sysdeps/pthread/bits/pthreadtypes.h $(TOPDIR)include/bits/
+ifeq ($(strip $(PTHREADS_DEBUG_SUPPORT)),y)
+ $(LN) -sf $(TOPDIR)libpthread/linuxthreads_db/thread_db.h $(TOPDIR)include/
+endif
+endif
-ar-target: $(OBJS)
- $(AR) $(ARFLAGS) $(LIBPTHREAD) $(OBJS)
- install -d $(TOPDIR)lib
- rm -f $(TOPDIR)lib/$(LIBPTHREAD)
- install -m 644 $(LIBPTHREAD) $(TOPDIR)lib
+tags:
+ ctags -R
-$(OBJS): %.o : %.c
- $(TARGET_CC) $(TARGET_CFLAGS) -c $< -o $@
- $(STRIPTOOL) -x -R .note -R .comment $*.o
+subdirs: $(patsubst %, _dir_%, $(DIRS))
+subdirs_clean: $(patsubst %, _dirclean_%, $(ALL_SUBDIRS))
-$(OBJ): Makefile
+$(patsubst %, _dir_%, $(DIRS)) : dummy
+ $(MAKE) -C $(patsubst _dir_%, %, $@)
-shared: all
- $(TARGET_CC) $(TARGET_LDFLAGS) -nostdlib -shared -o $(LIBPTHREAD_SHARED_FULLNAME) \
- -Wl,-soname,$(LIBPTHREAD_SHARED).$(MAJOR_VERSION) -Wl,--whole-archive $(LIBPTHREAD) -lc
- install -d $(TOPDIR)lib
- rm -f $(TOPDIR)lib/$(LIBPTHREAD_SHARED_FULLNAME) $(TOPDIR)lib/$(LIBPTHREAD_SHARED).$(MAJOR_VERSION)
- install -m 644 $(LIBPTHREAD_SHARED_FULLNAME) $(TOPDIR)lib;
- (cd $(TOPDIR)lib && ln -sf $(LIBPTHREAD_SHARED_FULLNAME) $(LIBPTHREAD_SHARED));
- (cd $(TOPDIR)lib && ln -sf $(LIBPTHREAD_SHARED_FULLNAME) $(LIBPTHREAD_SHARED).$(MAJOR_VERSION));
+$(patsubst %, _dirclean_%, $(ALL_SUBDIRS)) : dummy
+ $(MAKE) -C $(patsubst _dirclean_%, %, $@) clean
-clean:
- rm -f *.[oa] *~ core $(LIBPTHREAD_SHARED)* $(LIBPTHREAD_SHARED_FULLNAME)*
+clean: subdirs_clean
+ $(RM) $(TOPDIR)include/pthread.h $(TOPDIR)include/semaphore.h \
+ $(TOPDIR)include/thread_db.h \
+ $(TOPDIR)include/bits/pthreadtypes.h $(TOPDIR)include/bits/semaphore.h \
+ $(TOPDIR)include/bits/libc-lock.h $(TOPDIR)include/bits/stdio-lock
+.PHONY: dummy