OSDN Git Service

mkostemp: fix implementation
[uclinux-h8/uClibc.git] / libpthread / linuxthreads / Makefile.in
index b0537bb..4a499f7 100644 (file)
 # Makefile for uClibc
 #
 # Copyright (C) 2003 Paul Mundt <lethal@linux-sh.org>
-# Copyright (C) 2000-2005 Erik Andersen <andersen@uclibc.org>
+# Copyright (C) 2000-2008 Erik Andersen <andersen@uclibc.org>
 #
 # Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
 #
 
-CFLAGS+=$(SSP_ALL_CFLAGS)
+subdirs += libpthread/linuxthreads/sysdeps/$(TARGET_ARCH)
+subdirs += libpthread/linuxthreads/sysdeps/unix/sysv/linux
+subdirs += libpthread/linuxthreads/sysdeps/pthread
 
-# This stuff will not compile without at least -O1
-CFLAGS:=$(CFLAGS:-O0=-O1)
-
-LDFLAGS:=$(LDFLAGS_NOSTRIP)
+CFLAGS-dir_linuxthreads := -DNOT_IN_libc -DIS_IN_libpthread
+CFLAGS-libpthread/linuxthreads := $(CFLAGS-dir_linuxthreads) $(SSP_ALL_CFLAGS)
 
-ifeq ($(UCLIBC_CTOR_DTOR),y)
-SHARED_START_FILES:=$(top_builddir)lib/crti.o $(LIBGCC_DIR)crtbeginS.o
-SHARED_END_FILES:=$(LIBGCC_DIR)crtendS.o $(top_builddir)lib/crtn.o
-endif
+# This stuff will not compile without at least -O1
+# psm: can't handle this here, could maybe search for -O0 in CFLAGS
+# and append -O1 if found
+#CFLAGS:=$(CFLAGS:-O0=-O1)
 
 ifeq ($(PTHREADS_DEBUG_SUPPORT),y)
-STRIP_FLAGS:=-X --strip-debug -R .note -R .comment
+LDFLAGS-libpthread.so := $(LDFLAGS_NOSTRIP) -Wl,-z,defs
+else
+LDFLAGS-libpthread.so := $(LDFLAGS)
 endif
 
-DOMULTI=n
+LIBS-libpthread.so := $(LIBS) $(ldso)
 
-LIB_NAME:=libpthread
+START_FILE-libpthread.so := $(SHARED_START_FILES)
+END_FILE-libpthread.so := $(SHARED_END_FILES)
 
-libpthread_DIR:=$(top_srcdir)libpthread/linuxthreads
-libpthread_OUT:=$(top_builddir)libpthread/linuxthreads
+libpthread_FULL_NAME := libpthread-$(VERSION).so
 
-ARCH_CFLAGS:=$(CFLAGS)
--include $(libpthread_DIR)/sysdeps/$(TARGET_ARCH)/Makefile.in
-CFLAGS:=$(ARCH_CFLAGS)
+libpthread_DIR := $(top_srcdir)libpthread/linuxthreads
+libpthread_OUT := $(top_builddir)libpthread/linuxthreads
 
-libpthread_SRC:=$(wildcard $(libpthread_DIR)/*.c)
-ifneq ($(UCLIBC_HAS_XLOCALE),y)
-libpthread_SRC:=$(filter-out $(libpthread_DIR)/locale.c,$(libpthread_SRC))
-endif
+-include $(libpthread_DIR)/sysdeps/$(TARGET_ARCH)/Makefile.arch
 
-# remove generic sources, if arch specific version is present
-ifneq ($(strip $(libpthread_ARCH_SRC)),)
-libpthread_SRC:=$(filter-out $(patsubst %.c,$(libpthread_DIR)/%.c,$(notdir $(libpthread_ARCH_SRC))),$(libpthread_SRC))
-endif
+pthread_arch_SRC   := pspinlock
+pthread_arch_SRC   := $(patsubst %,$(libpthread_DIR)/sysdeps/$(TARGET_ARCH)/%.c,$(pthread_arch_SRC))
+pthread_linux_SRC  := fork pt-sigsuspend register-atfork unregister-atfork
+pthread_linux_SRC  := $(patsubst %,$(libpthread_DIR)/sysdeps/unix/sysv/linux/%.c,$(pthread_linux_SRC))
+pthread_sysdep_SRC := errno-loc herrno-loc ptlongjmp
+pthread_sysdep_SRC := $(patsubst %,$(libpthread_DIR)/sysdeps/pthread/%.c,$(pthread_sysdep_SRC))
+pthread_SRC := \
+       attr barrier cancel condvar errno events join pthread \
+       lockfile manager mutex pt-machine ptcleanup \
+       ptclock_gettime ptclock_settime ptfork pthandles \
+       pthread_setegid pthread_seteuid pthread_setgid pthread_setregid \
+       pthread_setresgid pthread_setresuid pthread_setreuid pthread_setuid \
+       rwlock semaphore sighandler signals specific spinlock
+pthread_SRC := $(patsubst %,$(libpthread_DIR)/%.c,$(pthread_SRC))
 
-libpthread_OBJ:=$(patsubst $(libpthread_DIR)/%.c,$(libpthread_OUT)/%.o,$(libpthread_SRC))
+libpthread_static_SRC := pthread_atfork
+libpthread_SRC := $(pthread_arch_SRC) $(pthread_linux_SRC) $(pthread_sysdep_SRC) $(pthread_SRC)
+libpthread_OBJ := $(patsubst $(libpthread_DIR)/%.c,$(libpthread_OUT)/%.o,$(libpthread_SRC))
 
-libpthread-a-$(UCLIBC_HAS_THREADS)+=$(libpthread_OBJ)
-libpthread-a-pic-$(UCLIBC_HAS_THREADS)+=$(libpthread_OBJ:.o=.os)
-libpthread-so-$(UCLIBC_HAS_THREADS)+=$(libpthread_OBJ:.o=.os)
+#
+# Stuff that goes into libc.so, not libpthread.so
+#
+#CFLAGS-OMIT-alloca_cutoff.c := $(CFLAGS-dir_linuxthreads)
+CFLAGS-OMIT-forward.c := $(CFLAGS-dir_linuxthreads)
+CFLAGS-OMIT-libc-cancellation.c := $(CFLAGS-dir_linuxthreads)
+CFLAGS-OMIT-libc_pthread_init.c := $(CFLAGS-dir_linuxthreads)
+libpthread_libc_CSRC := \
+       forward.c libc-cancellation.c libc_pthread_init.c # alloca_cutoff.c
+libpthread_libc_OBJ  := $(patsubst %.c, $(libpthread_OUT)/%.o,$(libpthread_libc_CSRC))
+libc-static-y += $(libpthread_OUT)/libc_pthread_init.o
+libc-shared-y += $(libpthread_libc_OBJ:.o=.oS)
+
+libpthread-static-y += $(patsubst %,$(libpthread_OUT)/%.o,$(libpthread_static_SRC))
+
+libpthread-nonshared-y += $(patsubst %,$(libpthread_OUT)/%.oS,$(libpthread_static_SRC))
+
+ifeq ($(DOPIC),y)
+libpthread-a-y  += $(libpthread_OBJ:.o=.os) $(libpthread-static-y:.o=.os)
+else
+libpthread-a-y  += $(libpthread_OBJ) $(libpthread-static-y)
+endif
+libpthread-so-y += $(libpthread_OBJ:.o=.oS)
+
+lib-a-$(UCLIBC_HAS_THREADS) += $(top_builddir)lib/libpthread.a
+lib-so-$(UCLIBC_HAS_THREADS) += $(top_builddir)lib/libpthread.so
+
+#ifeq ($(DOMULTI),n)
+$(top_builddir)lib/libpthread.so: $(libpthread_OUT)/libpthread_so.a $(libc.depend) $(top_builddir)lib/libpthread_nonshared.a
+       $(call link.so,$(libpthread_FULL_NAME),$(ABI_VERSION))
+#else
+#$(top_builddir)lib/libpthread.so: $(libpthread_OUT)/libpthread.oS | $(libc.depend) $(top_builddir)lib/libpthread_nonshared.a
+#      $(call linkm.so,$(libpthread_FULL_NAME),$(ABI_VERSION))
+#endif
+       $(Q)$(RM) $@
+       $(Q)cat $(top_srcdir)extra/scripts/format.lds > $@.tmp
+       $(Q)echo "GROUP ( $(notdir $@).$(ABI_VERSION) libpthread_nonshared.a )" >> $@.tmp
+       $(Q)mv $@.tmp $@
 
-libpthread-multi-$(UCLIBC_HAS_THREADS)+=$(libpthread_SRC)
+ifeq ($(PTHREADS_DEBUG_SUPPORT),y)
+$(libpthread_OUT)/libpthread_so.a: STRIP_FLAGS:=$(STRIP_FLAGS:-x=-X --strip-debug)
+endif
+$(libpthread_OUT)/libpthread_so.a: $(libpthread-so-y)
+       $(Q)$(RM) $@
+       $(do_ar)
 
-objclean-y+=libpthread_clean
+ifeq ($(PTHREADS_DEBUG_SUPPORT),y)
+$(libpthread_OUT)/libpthread.oS: STRIP_FLAGS:=$(STRIP_FLAGS:-x=-X --strip-debug)
+endif
+$(libpthread_OUT)/libpthread.oS: $(libpthread_SRC)
+       $(Q)$(RM) $@
+       $(compile-m)
 
-lib-a-$(UCLIBC_HAS_THREADS)+=$(top_builddir)lib/libpthread.a
-lib-a-pic-$(UCLIBC_HAS_THREADS)+=$(top_builddir)lib/libpthread.a
-lib-so-$(UCLIBC_HAS_THREADS)+=$(top_builddir)lib/libpthread.so
+ifeq ($(PTHREADS_DEBUG_SUPPORT),y)
+$(top_builddir)lib/libpthread.a: STRIP_FLAGS:=$(STRIP_FLAGS:-x=-X --strip-debug)
+endif
+$(top_builddir)lib/libpthread.a: $(libpthread-a-y)
+       $(Q)$(INSTALL) -d $(dir $@)
+       $(Q)$(RM) $@
+       $(do_ar)
+
+$(top_builddir)include/pthread.h:
+       $(do_ln) $(call rel_srcdir)$(PTDIR)/sysdeps/pthread/$(@F) $@
+$(top_builddir)include/semaphore.h:
+       $(do_ln) $(call rel_srcdir)$(PTDIR)/$(@F) $@
+$(top_builddir)include/bits/pthreadtypes.h: | $(top_builddir)include/bits
+       $(do_ln) $(call rel_srcdir)$(PTDIR)/sysdeps/pthread/bits/$(@F) $@
+
+linuxthreads_headers := $(top_builddir)include/pthread.h \
+                       $(top_builddir)include/semaphore.h \
+                       $(top_builddir)include/bits/pthreadtypes.h
+$(linuxthreads_headers): $(wildcard $(addprefix $(top_builddir)include/config/linuxthreads/,old.h new.h))
+headers-$(UCLIBC_HAS_THREADS) += $(linuxthreads_headers)
+
+objclean-y += CLEAN_libpthread/linuxthreads
+headers_clean-y += HEADERCLEAN_libpthread/linuxthreads
+HEADERCLEAN_libpthread/linuxthreads:
+       $(do_rm) $(linuxthreads_headers)
+
+CLEAN_libpthread/linuxthreads:
+       $(do_rm) $(addprefix $(libpthread_OUT)/,$(foreach e, o os oS a,$(foreach d, *. */*. */*/*. */*/*/*.,$(d)$(e))))