Makefile.in 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163
  1. # Makefile for uClibc NPTL
  2. #
  3. # Copyright (C) 2005-2006 Steven J. Hill <sjhill@uclibc.org>
  4. #
  5. # Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
  6. #
  7. #
  8. # NOTE: glibc puts flockfile.c, ftrylockfile.c, funlockfile.c, and
  9. # pt-longjmp.c in libc and libpthread. For uClibc, they are
  10. # in libc only.
  11. #
  12. libpthread_CSRC = pthread_barrier_init.c pthread_barrier_destroy.c \
  13. pthread_barrier_wait.c pthread_cond_broadcast.c \
  14. pthread_cond_signal.c pthread_cond_timedwait.c \
  15. pthread_cond_wait.c pthread_rwlock_rdlock.c \
  16. pthread_rwlock_timedrdlock.c \
  17. pthread_rwlock_timedwrlock.c pthread_rwlock_unlock.c \
  18. pthread_rwlock_wrlock.c pthread_sigmask.c \
  19. pthread_spin_destroy.c pthread_spin_init.c \
  20. pthread_spin_unlock.c pt-sigfillset.c \
  21. pt-longjmp.c tpp.c
  22. ifeq ($(TARGET_ARCH),i386)
  23. X86_PTHREAD_EXCLUDE_LIST = pthread_spin_unlock.c pthread_spin_init.c \
  24. pthread_barrier_wait.c pthread_cond_broadcast.c \
  25. pthread_cond_signal.c pthread_rwlock_timedrdlock.c \
  26. pthread_rwlock_timedwrlock.c pthread_rwlock_unlock.c pthread_rwlock_wrlock.c \
  27. pthread_rwlock_rdlock.c
  28. libpthread_CSRC := $(filter-out $(X86_PTHREAD_EXCLUDE_LIST),$(libpthread_CSRC))
  29. endif
  30. ifeq ($(TARGET_ARCH),sh)
  31. SH_PTHREAD_EXCLUDE_LIST = pthread_spin_unlock.c pthread_spin_init.c \
  32. pthread_rwlock_wrlock.c pthread_rwlock_rdlock.c \
  33. pthread_rwlock_unlock.c pt-longjmp.c \
  34. pthread_barrier_wait.c pthread_cond_broadcast.c \
  35. pthread_cond_signal.c \
  36. pthread_rwlock_timedrdlock.c \
  37. pthread_rwlock_timedwrlock.c
  38. libpthread_CSRC := $(filter-out $(SH_PTHREAD_EXCLUDE_LIST),$(libpthread_CSRC))
  39. endif
  40. ifeq ($(TARGET_ARCH),sparc)
  41. SPARC_PTHREAD_EXCLUDE_LIST = pthread_barrier_init.c pthread_barrier_wait.c \
  42. pthread_barrier_destroy.c
  43. libpthread_CSRC := $(filter-out $(SPARC_PTHREAD_EXCLUDE_LIST),$(libpthread_CSRC))
  44. endif
  45. ifeq ($(TARGET_ARCH),x86_64)
  46. X64_PTHREAD_EXCLUDE_LIST = pthread_spin_unlock.c pthread_spin_init.c \
  47. pthread_barrier_wait.c pthread_cond_broadcast.c \
  48. pthread_cond_signal.c pthread_rwlock_timedrdlock.c \
  49. pthread_rwlock_timedwrlock.c pthread_rwlock_unlock.c pthread_rwlock_wrlock.c \
  50. pthread_rwlock_rdlock.c pthread_cond_timedwait.c pthread_cond_wait.c
  51. libpthread_CSRC := $(filter-out $(X64_PTHREAD_EXCLUDE_LIST),$(libpthread_CSRC))
  52. endif
  53. CFLAGS-pt-common = -DNOT_IN_libc=1 $(SSP_ALL_CFLAGS)
  54. CFLAGS-pthread_barrier_init.c = $(CFLAGS-pt-common) -DIS_IN_libpthread=1
  55. CFLAGS-pthread_barrier_destroy.c = $(CFLAGS-pt-common) -DIS_IN_libpthread=1
  56. CFLAGS-pthread_barrier_wait.c = -D_GNU_SOURCE $(CFLAGS-pt-common) \
  57. -DIS_IN_libpthread=1
  58. CFLAGS-pthread_cond_broadcast.c = $(CFLAGS-pt-common) -DIS_IN_libpthread=1
  59. CFLAGS-pthread_cond_signal.c = $(CFLAGS-pt-common) -DIS_IN_libpthread=1
  60. CFLAGS-pthread_cond_timedwait.c = $(CFLAGS-pt-common) -DIS_IN_libpthread=1
  61. CFLAGS-pthread_cond_wait.c = $(CFLAGS-pt-common) -DIS_IN_libpthread=1
  62. CFLAGS-pthread_rwlock_rdlock.c = $(CFLAGS-pt-common) -DIS_IN_libpthread=1
  63. CFLAGS-pthread_rwlock_timedrdlock.c = $(CFLAGS-pt-common) -DIS_IN_libpthread=1
  64. CFLAGS-pthread_rwlock_timedwrlock.c = $(CFLAGS-pt-common) -DIS_IN_libpthread=1
  65. CFLAGS-pthread_rwlock_unlock.c = $(CFLAGS-pt-common) -DIS_IN_libpthread=1
  66. CFLAGS-pthread_rwlock_wrlock.c = $(CFLAGS-pt-common) -DIS_IN_libpthread=1
  67. CFLAGS-pthread_sigmask.c = $(CFLAGS-pt-common) -DIS_IN_libpthread=1
  68. CFLAGS-pthread_spin_destroy.c = -D_GNU_SOURCE $(CFLAGS-pt-common) \
  69. -DIS_IN_libpthread=1
  70. CFLAGS-pthread_spin_init.c = -D_GNU_SOURCE $(CFLAGS-pt-common) \
  71. -DIS_IN_libpthread=1
  72. CFLAGS-pthread_spin_unlock.c = -D_GNU_SOURCE $(CFLAGS-pt-common) \
  73. -DIS_IN_libpthread=1
  74. CFLAGS-pt-sigaction.c = $(CFLAGS-pt-common) -DIS_IN_libpthread=1 \
  75. -I$(top_srcdir)libc/sysdeps/linux/$(TARGET_ARCH) \
  76. -I$(top_srcdir)libc/signal
  77. CFLAGS-pt-sigfillset.c = $(CFLAGS-pt-common) -DIS_IN_libpthread=1 \
  78. -I$(top_srcdir)libc/signal
  79. CFLAGS-pt-sigprocmask.c = $(CFLAGS-pt-common) -DIS_IN_libpthread=1 \
  80. -I$(top_srcdir)libc/sysdeps/linux/common
  81. CFLAGS-unwind-forcedunwind.c = $(CFLAGS-pt-common) -DIS_IN_libpthread=1 -fexceptions -fasynchronous-unwind-tables
  82. CFLAGS-librt-cancellation.c = -DIS_IN_librt=1 $(CFLAGS-pt-common) \
  83. -fexceptions -fasynchronous-unwind-tables
  84. CFLAGS-rt-unwind-resume.c = -DIS_IN_librt=1 $(CFLAGS-pt-common) \
  85. -fexceptions -fasynchronous-unwind-tables
  86. CFLAGS-tpp.c = $(CFLAGS-pt-common) -DIS_IN_libpthread=1
  87. #CFLAGS:=$(CFLAGS:-O1=-O2)
  88. pthread_DIR := $(top_srcdir)libpthread/nptl/sysdeps/pthread
  89. pthread_OUT := $(top_builddir)libpthread/nptl/sysdeps/pthread
  90. pthread_SRC = $(patsubst %.c, $(pthread_DIR)/%.c, $(libpthread_CSRC))
  91. pthread_OBJ = $(patsubst %.c, $(pthread_OUT)/%.o, $(libpthread_CSRC))
  92. ifeq ($(DOPIC),y)
  93. libpthread-a-y += $(pthread_OBJ:.o=.os)
  94. else
  95. libpthread-a-y += $(pthread_OBJ)
  96. endif
  97. libpthread-so-y += $(pthread_OBJ:.o=.oS)
  98. libpthread-so-y += $(pthread_OUT)/pt-sigaction.oS $(pthread_OUT)/pt-sigprocmask.oS \
  99. $(pthread_OUT)/unwind-forcedunwind.oS
  100. CFLAGS-sigaction.c = -I$(top_srcdir)libc/signal
  101. libc-y += $(pthread_OUT)/sigaction.o
  102. librt-a-y += $(pthread_OUT)/librt-cancellation.o
  103. librt-so-y += $(pthread_OUT)/librt-cancellation.oS \
  104. $(pthread_OUT)/rt-unwind-resume.oS
  105. ifeq ($(UCLIBC_CTOR_DTOR),y)
  106. CFLAGS-pt-initfini.c = -S -g0 -fPIC -fno-inline-functions \
  107. $(call check_gcc,-fno-unit-at-a-time,) \
  108. -finhibit-size-directive \
  109. $(patsubst -f%,-fno-%,$(call check_gcc,-fexceptions,))
  110. ASFLAGS-crti.S = -g0
  111. ASFLAGS-crtn.S = -g0
  112. $(pthread_OUT)/pt-initfini.s: $(pthread_DIR)/pt-initfini.c
  113. $(compile.c)
  114. sed -n -e '/@TESTS_BEGIN/,/@TESTS_END/p' $< | \
  115. awk -f $(pthread_DIR)/defs.awk > $(pthread_OUT)/defs.h
  116. $(pthread_OUT)/crti.S: $(pthread_OUT)/pt-initfini.s
  117. sed -n -e '1,/@HEADER_ENDS/p' \
  118. -e '/@_.*_PROLOG_BEGINS/,/@_.*_PROLOG_ENDS/p' \
  119. -e '/@TRAILER_BEGINS/,$$p' $< > $@
  120. $(pthread_OUT)/crtn.S: $(pthread_OUT)/pt-initfini.s
  121. sed -n -e '1,/@HEADER_ENDS/p' \
  122. -e '/@_.*_EPILOG_BEGINS/,/@_.*_EPILOG_ENDS/p' \
  123. -e '/@TRAILER_BEGINS/,$$p' $< > $@
  124. endif
  125. $(pthread_DIR)/pt-sigaction.c:
  126. $(LN) -s sigaction.c $@
  127. $(pthread_DIR)/pt-sigfillset.c:
  128. $(LN) -s sigfillset.c $@
  129. $(pthread_DIR)/pt-sigprocmask.c:
  130. $(LN) -s sigprocmask.c $@
  131. objclean-y += nptl_pthread_clean
  132. nptl_pthread_clean:
  133. $(do_rm) $(addprefix $(pthread_OUT)/*., o os oS s S) $(pthread_OUT)/defs.h \
  134. $(pthread_DIR)/pt-sigaction.c $(pthread_DIR)/pt-sigfillset.c \
  135. $(pthread_DIR)/pt-sigprocmask.c