Makefile.in 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  1. # Makefile for uClibc
  2. #
  3. # Copyright (C) 2003 Paul Mundt <lethal@linux-sh.org>
  4. # Copyright (C) 2000-2008 Erik Andersen <andersen@uclibc.org>
  5. #
  6. # Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
  7. #
  8. subdirs += libpthread/linuxthreads
  9. CFLAGS-dir_linuxthreads := -DNOT_IN_libc -DIS_IN_libpthread
  10. CFLAGS-libpthread/linuxthreads := $(CFLAGS-dir_linuxthreads) $(SSP_ALL_CFLAGS)
  11. ifeq ($(PTHREADS_DEBUG_SUPPORT),y)
  12. LDFLAGS-libpthread.so := $(LDFLAGS_NOSTRIP) -Wl,-z,defs
  13. else
  14. LDFLAGS-libpthread.so := $(LDFLAGS)
  15. endif
  16. LDFLAGS-$(UCLIBC_FORMAT_DSBT_ELF)-libpthread.so := -Wl,--dsbt-index=10
  17. LIBS-libpthread.so := $(LIBS) $(ldso)
  18. START_FILE-libpthread.so := $(SHARED_START_FILES)
  19. END_FILE-libpthread.so := $(SHARED_END_FILES)
  20. libpthread_FULL_NAME := libpthread-$(VERSION).so
  21. libpthread_DIR := $(top_srcdir)libpthread/linuxthreads
  22. libpthread_OUT := $(top_builddir)libpthread/linuxthreads
  23. -include $(libpthread_DIR)/sysdeps/$(TARGET_ARCH)/Makefile.arch
  24. libpthread_SRC := \
  25. attr.c cancel.c condvar.c errno.c events.c join.c lockfile.c manager.c \
  26. mutex.c pt-machine.c ptfork.c pthread.c ptlongjmp.c \
  27. rwlock.c semaphore.c signals.c specific.c spinlock.c wrapsyscall.c
  28. ifeq ($(UCLIBC_HAS_XLOCALE),y)
  29. libpthread_SRC += locale.c
  30. endif
  31. # remove generic sources, if arch specific version is present
  32. ifneq ($(strip $(libpthread_ARCH_SRC)),)
  33. libpthread_SRC := $(filter-out $(patsubst %.c,$(libpthread_DIR)/%.c,$(notdir $(libpthread_ARCH_SRC))),$(libpthread_SRC))
  34. endif
  35. libpthread_SRC := $(patsubst %,$(libpthread_DIR)/%,$(libpthread_SRC))
  36. libpthread_OBJ := $(patsubst $(libpthread_DIR)/%.c,$(libpthread_OUT)/%.o,$(libpthread_SRC))
  37. #
  38. # Stuff that goes into libc.so, not libpthread.so
  39. #
  40. CFLAGS-OMIT-forward.c := $(CFLAGS-dir_linuxthreads)
  41. CFLAGS-OMIT-libc_pthread_init.c := $(CFLAGS-dir_linuxthreads)
  42. libpthread_libc_CSRC := forward.c libc_pthread_init.c
  43. libpthread_libc_OBJ := $(patsubst %.c, $(libpthread_OUT)/%.o,$(libpthread_libc_CSRC))
  44. libc-static-y += $(libpthread_OUT)/libc_pthread_init.o
  45. libc-shared-y += $(libpthread_libc_OBJ:.o=.oS)
  46. ifeq ($(DOPIC),y)
  47. libpthread-a-y += $(libpthread_OBJ:.o=.os)
  48. else
  49. libpthread-a-y += $(libpthread_OBJ)
  50. endif
  51. libpthread-so-y += $(libpthread_OBJ:.o=.oS)
  52. lib-a-$(UCLIBC_HAS_THREADS) += $(top_builddir)lib/libpthread.a
  53. lib-so-$(UCLIBC_HAS_THREADS) += $(top_builddir)lib/libpthread.so
  54. $(top_builddir)lib/libpthread.so: $(libpthread_OUT)/libpthread_so.a $(libc.depend) $(top_builddir)lib/libpthread_nonshared.a
  55. $(call link.so,$(libpthread_FULL_NAME),$(ABI_VERSION))
  56. # link for backward compatibility
  57. $(call link.so,$(libpthread_FULL_NAME),0)
  58. $(Q)cat $(top_srcdir)extra/scripts/format.lds > $@.tmp
  59. $(Q)echo "GROUP ( $(notdir $@).$(ABI_VERSION) libpthread_nonshared.a )" >> $@.tmp
  60. $(Q)mv $@.tmp $@
  61. ifeq ($(PTHREADS_DEBUG_SUPPORT),y)
  62. $(libpthread_OUT)/libpthread_so.a: STRIP_FLAGS:=$(STRIP_FLAGS:-x=-X --strip-debug)
  63. endif
  64. $(libpthread_OUT)/libpthread_so.a: $(libpthread-so-y)
  65. $(Q)$(RM) $@
  66. $(do_ar)
  67. ifeq ($(PTHREADS_DEBUG_SUPPORT),y)
  68. $(libpthread_OUT)/libpthread.oS: STRIP_FLAGS:=$(STRIP_FLAGS:-x=-X --strip-debug)
  69. endif
  70. $(libpthread_OUT)/libpthread.oS: $(libpthread_SRC)
  71. $(Q)$(RM) $@
  72. $(compile-m)
  73. ifeq ($(PTHREADS_DEBUG_SUPPORT),y)
  74. $(top_builddir)lib/libpthread.a: STRIP_FLAGS:=$(STRIP_FLAGS:-x=-X --strip-debug)
  75. endif
  76. $(top_builddir)lib/libpthread.a: $(libpthread-a-y)
  77. $(Q)$(INSTALL) -d $(dir $@)
  78. $(Q)$(RM) $@
  79. $(do_ar)
  80. $(top_builddir)include/pthread.h:
  81. $(do_ln) $(call rel_srcdir)$(PTDIR)/sysdeps/pthread/$(@F) $@
  82. $(top_builddir)include/semaphore.h:
  83. $(do_ln) $(call rel_srcdir)$(PTDIR)/$(@F) $@
  84. $(top_builddir)include/bits/pthreadtypes.h: | $(top_builddir)include/bits
  85. $(do_ln) $(call rel_srcdir)$(PTDIR)/sysdeps/pthread/bits/$(@F) $@
  86. linuxthreads_headers := $(top_builddir)include/pthread.h \
  87. $(top_builddir)include/semaphore.h \
  88. $(top_builddir)include/bits/pthreadtypes.h
  89. $(linuxthreads_headers): $(wildcard $(addprefix $(top_builddir)include/config/linuxthreads/,old.h new.h))
  90. headers-$(UCLIBC_HAS_THREADS) += $(linuxthreads_headers)
  91. objclean-y += CLEAN_libpthread/linuxthreads
  92. headers_clean-y += HEADERCLEAN_libpthread/linuxthreads
  93. HEADERCLEAN_libpthread/linuxthreads:
  94. $(do_rm) $(linuxthreads_headers)
  95. CLEAN_libpthread/linuxthreads:
  96. $(do_rm) $(addprefix $(libpthread_OUT)/*., o os oS a)