summaryrefslogtreecommitdiffstats
path: root/libpthread/linuxthreads/Makefile
diff options
context:
space:
mode:
author"Steven J. Hill" <sjhill@realitydiluted.com>2005-10-04 00:13:51 +0000
committer"Steven J. Hill" <sjhill@realitydiluted.com>2005-10-04 00:13:51 +0000
commit61044293e40d58523315342c0521eec46d1994c6 (patch)
tree955140b2f7be38d255f2f3a17c16659d36f7f67f /libpthread/linuxthreads/Makefile
parent241a444da59023113b1d6f60a38c310dcf9de6de (diff)
downloaduClibc-alpine-61044293e40d58523315342c0521eec46d1994c6.tar.bz2
uClibc-alpine-61044293e40d58523315342c0521eec46d1994c6.tar.xz
Big, huge fricking merge. Peter, if you touch the build system again I'm going to smash your keyboard.
Diffstat (limited to 'libpthread/linuxthreads/Makefile')
-rw-r--r--libpthread/linuxthreads/Makefile92
1 files changed, 51 insertions, 41 deletions
diff --git a/libpthread/linuxthreads/Makefile b/libpthread/linuxthreads/Makefile
index 08ff8a2d8..4072d660f 100644
--- a/libpthread/linuxthreads/Makefile
+++ b/libpthread/linuxthreads/Makefile
@@ -16,56 +16,69 @@
# 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
-# Makefile for uClibc
TOPDIR=../../
include $(TOPDIR)Rules.mak
-# As long as there is only one subdir, we don't
-# have to worry about race conditions with multiple
-# $(AR)'s in subdirs running on linuxthreads.a.
-DIRS = sysdeps
+CFLAGS+=$(SSP_ALL_CFLAGS)
-#Adjust the soname version to avoid namespace collisions with glibc's libpthread
-LIBPTHREAD:=../libpthread.a
-ifeq ($(strip $(TARGET_ARCH)),sparc)
-SYSDEPS_DIR:=$(TARGET_ARCH)/sparc32
-else
-SYSDEPS_DIR:=$(TARGET_ARCH)
-endif
-CFLAGS += $(SSP_ALL_CFLAGS)
#This stuff will not compile without at least -O1
CFLAGS :=$(CFLAGS:-O0=-O1)
-
# set up system dependencies include dirs (NOTE: order matters!)
+# psm: don't think that the last include makes sense
+# they all should be already linked to $(TOPDIR)include
PTDIR = $(TOPDIR)libpthread/linuxthreads/
SYSDEPINC = -I$(PTDIR)sysdeps/pthread \
-I$(PTDIR)sysdeps/$(TARGET_ARCH) \
-I$(TOPDIR)libc/sysdeps/linux/$(TARGET_ARCH)
CFLAGS += $(SYSDEPINC)
-CSRC=attr.c cancel.c condvar.c errno.c events.c join.c lockfile.c manager.c \
- mutex.c oldsemaphore.c pt-machine.c ptfork.c pthread.c \
- ptlongjmp.c rwlock.c semaphore.c signals.c specific.c spinlock.c
+ARCH_CFLAGS = $(CFLAGS)
-ifeq ($(UCLIBC_HAS_XLOCALE),y)
- CSRC += locale.c
+ifeq ($(strip $(UCLIBC_CTOR_DTOR)),y)
+ SHARED_START_FILES = $(TOPDIR)lib/crti.o $(LIBGCC_DIR)crtbeginS.o
+ SHARED_END_FILES = $(LIBGCC_DIR)crtendS.o $(TOPDIR)lib/crtn.o
endif
-COBJS=$(patsubst %.c,%.o, $(CSRC))
-OBJS=$(COBJS)
+LIB_NAME=libpthread
+AR_LIB_NAME=$(TOPDIR)lib/$(LIB_NAME).a
+SO_LIB_NAME=$(TOPDIR)lib/$(LIB_NAME).so
+SO_FULL_NAME=$(LIB_NAME)-$(MAJOR_VERSION).$(MINOR_VERSION).$(SUBLEVEL).so
+
+ARCH_CSRC=$(wildcard sysdeps/$(TARGET_ARCH)/*.c)
+ARCH_OBJS=$(patsubst %.c,%.o, $(ARCH_CSRC))
+-include sysdeps/$(TARGET_ARCH)/Makefile.in
-# We need to make sure that we put all the top-level $(OBJS) into
-# our archive before executing subdirs. That way, when $(AR) is
-# run in the subdirs, it'll bump the generic top-level objects
-# out of our archive in favor of the machine-specific ones.
-all: $(LIBPTHREAD) subdirs
+CSRC = $(wildcard *.c)
+ifneq ($(strip $(UCLIBC_HAS_XLOCALE)),y)
+CSRC := $(filter-out locale.c,$(CSRC))
+endif
+
+OBJS=$(patsubst %.c,%.o, $(CSRC))
-$(LIBPTHREAD) ar-target: $(OBJS)
- $(AR) $(ARFLAGS) $(LIBPTHREAD) $(OBJS)
+ifeq ($(strip $(HAVE_SHARED)),y)
+all: $(SO_LIB_NAME)
+else
+all: $(AR_LIB_NAME)
+endif
-$(COBJS): %.o : %.c
+$(AR_LIB_NAME): $(OBJS) $(ARCH_OBJS)
+ $(INSTALL) -d $(TOPDIR)lib
+ $(RM) $(AR_LIB_NAME)
+ $(AR) $(ARFLAGS) $(AR_LIB_NAME) $(OBJS)
+ $(AR) $(ARFLAGS) $(AR_LIB_NAME) $(ARCH_OBJS)
+
+$(SO_LIB_NAME): $(AR_LIB_NAME)
+ $(RM) $(TOPDIR)lib/$(SO_FULL_NAME) $(SO_LIB_NAME).$(MAJOR_VERSION) $(SO_LIB_NAME)
+ $(LD) $(LDFLAGS_NOSTRIP) -soname=$(LIB_NAME).so.$(MAJOR_VERSION) \
+ -o $(TOPDIR)lib/$(SO_FULL_NAME) $(SHARED_START_FILES) --whole-archive $(AR_LIB_NAME) \
+ --no-whole-archive $(TOPDIR)libc/misc/internals/interp.o \
+ -L$(TOPDIR)lib -lc $(LDADD_LIBFLOAT) $(LIBGCC) $(SHARED_END_FILES)
+ $(LN) -sf $(SO_FULL_NAME) $(SO_LIB_NAME).$(MAJOR_VERSION)
+ $(LN) -sf $(SO_FULL_NAME) $(SO_LIB_NAME)
+
+$(OBJS): %.o : %.c
$(CC) $(CFLAGS) -c $< -o $@
ifeq ($(strip $(PTHREADS_DEBUG_SUPPORT)),y)
$(STRIPTOOL) -X --strip-debug -R .note -R .comment $*.o
@@ -73,16 +86,13 @@ else
$(STRIPTOOL) -x -R .note -R .comment $*.o
endif
-clean: subdirs_clean
- $(RM) *.[oa] *~ core
-
-subdirs: $(patsubst %, _dir_%, $(DIRS))
-subdirs_clean: $(patsubst %, _dirclean_%, $(DIRS))
-
-$(patsubst %, _dir_%, $(DIRS)): $(LIBPTHREAD)
- $(MAKE) -C $(patsubst _dir_%, %, $@)
-
-$(patsubst %, _dirclean_%, $(DIRS)):
- $(MAKE) -C $(patsubst _dirclean_%, %, $@) clean
+$(ARCH_OBJS): %.o : %.c
+ $(CC) $(ARCH_CFLAGS) -c $< -o $@
+ifeq ($(strip $(PTHREADS_DEBUG_SUPPORT)),y)
+ $(STRIPTOOL) -X --strip-debug -R .note -R .comment $*.o
+else
+ $(STRIPTOOL) -x -R .note -R .comment $*.o
+endif
-.PHONY: dummy
+clean:
+ $(RM) *.o sysdeps/*/*.o *~ core