Makefile.in 9.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204
  1. # Makefile for uClibc NPTL
  2. #
  3. # Copyright (C) 2005-2006 Steven J. Hill <sjhill@realitydiluted.com>
  4. #
  5. # Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
  6. #
  7. subdirs += libpthread/nptl
  8. libpthread_DIR = $(top_srcdir)libpthread/nptl
  9. libpthread_OUT = $(top_builddir)libpthread/nptl
  10. include $(libpthread_DIR)/sysdeps/Makefile.in
  11. libc-shared-routines-y = libc-cancellation.c
  12. libc-static-routines-y = alloca_cutoff.c libc-cancellation.c
  13. libpthread-shared-only-routines-y = version.c
  14. libpthread-static-only-routines-y = pthread_atfork.c
  15. libpthread-routines- += $(notdir $(wildcard $(libpthread_DIR)/gen_*.c)) # dummy generated files
  16. libpthread-routines- += allocatestack.c # dummy included by pthread_create.c
  17. libpthread-routines- += pthread_mutex_getprioceiling.c pthread_mutex_setprioceiling.c # XXX: delete those or use them!
  18. libpthread-routines-$(UCLIBC_SUSV4_LEGACY) += pthread_getconcurrency.c \
  19. pthread_setconcurrency.c
  20. libpthread_CSRC = $(filter-out $(libpthread-routines-) \
  21. $(libc-shared-routines-y) \
  22. $(libc-static-routines-y) \
  23. $(libpthread-shared-only-routines-y) \
  24. $(libpthread-static-only-routines-y) \
  25. $(notdir $(libpthread_OBJS:.o=.c)), \
  26. $(notdir $(wildcard $(libpthread_DIR)/*.c)))
  27. libpthread_OBJS += $(addprefix $(libpthread_OUT)/,$(libpthread_CSRC:.c=.o))
  28. libpthread-so-y += $(addprefix $(libpthread_OUT)/,$(libpthread-shared-only-routines-y:.c=.oS))
  29. libpthread-so-y += $(libpthread_OBJS:.o=.oS)
  30. libpthread-nonshared-y := $(addprefix $(libpthread_OUT)/,$(libpthread-static-only-routines-y:.c=.oS))
  31. libpthread-static-y := $(addprefix $(libpthread_OUT)/,$(libpthread-static-only-routines-y:.c=.o))
  32. libpthread-static-y += $(libpthread_OBJS)
  33. ifeq ($(DOPIC),y)
  34. libpthread-a-y := $(libpthread-static-y:.o=.os)
  35. else
  36. libpthread-a-y := $(libpthread-static-y)
  37. endif
  38. libc-shared-routines-y := $(filter-out $(notdir $(libpthread_libc_OBJS:.o=.c)), $(libc-shared-routines-y))
  39. libc-static-routines-y := $(filter-out $(notdir $(libpthread_libc_OBJS:.o=.c)), $(libc-static-routines-y))
  40. libc-shared-routines-y := $(addprefix $(libpthread_OUT)/,$(libc-shared-routines-y:.c=.oS))
  41. libc-static-routines-y := $(addprefix $(libpthread_OUT)/,$(libc-static-routines-y:.c=.o))
  42. libc-shared-y += $(libc-shared-routines-y) $(libpthread_libc_OBJS:.o=.oS)
  43. ifeq ($(DOPIC),y)
  44. libc-static-y += $(libc-static-routines-y:.o=.os) $(libpthread_libc_a_OBJS:.o=.os) $(libpthread_ld_tls_COBJ:.o=.os)
  45. else
  46. libc-static-y += $(libc-static-routines-y) $(libpthread_libc_a_OBJS) $(libpthread_ld_tls_COBJ)
  47. endif
  48. librt-pt-routines-y := $(patsubst %.c,$(libpthread_pthread_OUT)/%.o,$(filter-out $(notdir $(libpthread_librt_OBJS:.o=.c)), $(librt-pt-routines-y)))
  49. librt-pt-shared-only-routines-y := $(patsubst %.c,$(libpthread_pthread_OUT)/%.o,$(filter-out $(notdir $(libpthread_librt_OBJS:.o=.c)), $(librt-pt-shared-only-routines-y)))
  50. librt_OBJS = $(libpthread_librt_OBJS) $(librt-pt-routines-y)
  51. ifeq ($(DOPIC),y)
  52. librt-a-y += $(librt_OBJS:.o=.os)
  53. else
  54. librt-a-y += $(librt_OBJS)
  55. endif
  56. librt-so-y += $(librt_OBJS:.o=.oS) $(librt-pt-shared-only-routines-y:.o=.oS)
  57. $(libpthread_OUT)/pthread-errnos.h: $(top_srcdir)extra/scripts/gen-as-const.awk
  58. $(libpthread_OUT)/pthread-errnos.h: $(libpthread_DIR)/pthread-errnos.sym
  59. @$(disp_gen)
  60. $(do_awk) $(top_srcdir)extra/scripts/gen-as-const.awk $< \
  61. | $(CC) $(CFLAGS) -x c - -S -o - \
  62. | $(SED) $(PTHREAD_GENERATE_MANGLE) > $@
  63. @if test ! -s $@ ; then rm -f $@ ; false ; fi
  64. pregen-headers-$(UCLIBC_HAS_THREADS_NATIVE) += $(libpthread_OUT)/pthread-errnos.h
  65. headers-$(UCLIBC_HAS_THREADS_NATIVE) += $(nptl_headers_bootstrap)
  66. libpthread_H := $(addprefix $(top_builddir)include/,semaphore.h)
  67. libpthread_include_H := $(addprefix $(top_builddir)include/,pthread.h)
  68. libpthread_include_BITS_H := $(addprefix $(top_builddir)include/bits/,libc-lock.h stdio-lock.h)
  69. libpthread_include_STD_IMPL_OS_ARCH_BITS_H := $(addprefix $(top_builddir)include/bits/,pthreadtypes.h semaphore.h)
  70. $(libpthread_include_STD_IMPL_OS_ARCH_BITS_H): $(top_builddir)include/bits/%:
  71. $(do_ln) $(call rel_srcdir)$(PTDIR)/sysdeps/unix/sysv/linux/$(TARGET_ARCH)/bits/$(@F) $@
  72. $(libpthread_include_BITS_H): $(top_builddir)include/bits/%:
  73. $(do_ln) $(call rel_srcdir)$(PTDIR)/sysdeps/pthread/bits/$(@F) $@
  74. $(libpthread_include_H): $(top_builddir)include/%:
  75. $(do_ln) $(call rel_srcdir)$(PTDIR)/sysdeps/pthread/$(@F) $@
  76. $(libpthread_H): $(top_builddir)include/%:
  77. $(do_ln) $(call rel_srcdir)$(PTDIR)/$(@F) $@
  78. nptl_headers_bootstrap = $(libpthread_H) $(libpthread_include_H) $(libpthread_include_BITS_H) $(libpthread_include_STD_IMPL_OS_ARCH_BITS_H)
  79. objclean-y += CLEAN_libpthread/nptl
  80. headers_clean-y += HEADERCLEAN_libpthread/nptl
  81. HEADERCLEAN_libpthread/nptl:
  82. $(do_rm) $(nptl_headers_bootstrap) \
  83. $(libpthread_OUT)/pthread-errnos.h
  84. CLEAN_libpthread/nptl:
  85. $(do_rm) $(addprefix $(libpthread_OUT)/*., o os oS a)
  86. CFLAGS-dir_nptl := -DNOT_IN_libc -DIS_IN_libpthread
  87. CFLAGS-libpthread/nptl := $(CFLAGS-dir_nptl) $(SSP_ALL_CFLAGS)
  88. # Since cancellation handling is in large parts handled using exceptions
  89. # we have to compile some files with exception handling enabled, some
  90. # even with asynchronous unwind tables.
  91. # init.c contains sigcancel_handler().
  92. CFLAGS-init.c = -fexceptions -fasynchronous-unwind-tables
  93. # The unwind code itself,
  94. CFLAGS-unwind.c = -fexceptions
  95. CFLAGS-unwind-forcedunwind.c = -fexceptions -fasynchronous-unwind-tables
  96. # The following three functions must be async-cancel safe.
  97. CFLAGS-pthread_cancel.c = -fexceptions -fasynchronous-unwind-tables
  98. CFLAGS-pthread_setcancelstate.c = -fexceptions -fasynchronous-unwind-tables
  99. CFLAGS-pthread_setcanceltype.c = -fexceptions -fasynchronous-unwind-tables
  100. # These are internal functions which similar functionality as setcancelstate
  101. # and setcanceltype.
  102. CFLAGS-cancellation.c = -fasynchronous-unwind-tables
  103. CFLAGS-libc-cancellation.c = -fasynchronous-unwind-tables
  104. # Calling pthread_exit() must cause the registered cancel handlers to
  105. # be executed. Therefore exceptions have to be thrown through this
  106. # function.
  107. CFLAGS-pthread_exit.c = -fexceptions
  108. # The following are cancellation points. Some of the functions can
  109. # block and therefore temporarily enable asynchronous cancellation.
  110. # Those must be compiled asynchronous unwind tables.
  111. CFLAGS-pthread_testcancel.c = -fexceptions
  112. CFLAGS-pthread_join.c = -fexceptions -fasynchronous-unwind-tables
  113. CFLAGS-pthread_timedjoin.c = -fexceptions -fasynchronous-unwind-tables
  114. CFLAGS-pthread_once.c = $(uses-callbacks) -fexceptions \
  115. -fasynchronous-unwind-tables
  116. CFLAGS-pthread_cond_wait.c = -fexceptions -fasynchronous-unwind-tables
  117. CFLAGS-pthread_cond_timedwait.c = -fexceptions -fasynchronous-unwind-tables
  118. CFLAGS-sem_wait.c = -fexceptions -fasynchronous-unwind-tables
  119. CFLAGS-sem_timedwait.c = -fexceptions -fasynchronous-unwind-tables
  120. # These are the function wrappers we have to duplicate here.
  121. CFLAGS-accept.c = -fexceptions -fasynchronous-unwind-tables
  122. CFLAGS-clock_nanosleep.c = -fexceptions -fasynchronous-unwind-tables
  123. CFLAGS-close.c = -fexceptions -fasynchronous-unwind-tables
  124. CFLAGS-connect.c = -fexceptions -fasynchronous-unwind-tables
  125. CFLAGS-creat.c = -fexceptions -fasynchronous-unwind-tables
  126. CFLAGS-fdatasync.c = -fexceptions -fasynchronous-unwind-tables
  127. CFLAGS-fsync.c = -fexceptions -fasynchronous-unwind-tables
  128. CFLAGS-lockf.c = -fexceptions
  129. CFLAGS-msgrcv.c = -fexceptions -fasynchronous-unwind-tables
  130. CFLAGS-msgsnd.c = -fexceptions -fasynchronous-unwind-tables
  131. CFLAGS-msync.c = -fexceptions -fasynchronous-unwind-tables
  132. CFLAGS-nanosleep.c = -fexceptions -fasynchronous-unwind-tables
  133. CFLAGS-open64.c = -fexceptions -fasynchronous-unwind-tables
  134. CFLAGS-open.c = -fexceptions -fasynchronous-unwind-tables
  135. CFLAGS-pause.c = -fexceptions -fasynchronous-unwind-tables
  136. CFLAGS-poll.c = -fexceptions -fasynchronous-unwind-tables
  137. CFLAGS-ppoll.c = -fexceptions -fasynchronous-unwind-tables
  138. CFLAGS-pread_write.c = -fexceptions -fasynchronous-unwind-tables
  139. CFLAGS-pselect.c = -fexceptions -fasynchronous-unwind-tables
  140. CFLAGS-read.c = -fexceptions -fasynchronous-unwind-tables
  141. CFLAGS-readv.c = -fexceptions -fasynchronous-unwind-tables
  142. CFLAGS-recv.c = -fexceptions -fasynchronous-unwind-tables
  143. CFLAGS-recvfrom.c = -fexceptions -fasynchronous-unwind-tables
  144. CFLAGS-recvmsg.c = -fexceptions -fasynchronous-unwind-tables
  145. CFLAGS-__rt_sigtimedwait.c = -fexceptions -fasynchronous-unwind-tables
  146. CFLAGS-__rt_sigwaitinfo.c = -fexceptions -fasynchronous-unwind-tables
  147. CFLAGS-select.c = -fexceptions -fasynchronous-unwind-tables
  148. CFLAGS-send.c = -fexceptions -fasynchronous-unwind-tables
  149. CFLAGS-sendmsg.c = -fexceptions -fasynchronous-unwind-tables
  150. CFLAGS-sendto.c = -fexceptions -fasynchronous-unwind-tables
  151. CFLAGS-sigpause.c = -fexceptions
  152. CFLAGS-sigsuspend.c = -fexceptions -fasynchronous-unwind-tables
  153. CFLAGS-sigtimedwait.c = -fexceptions -fasynchronous-unwind-tables
  154. CFLAGS-sigwait.c = -fexceptions -fasynchronous-unwind-tables
  155. CFLAGS-sigwaitinfo.c = -fexceptions -fasynchronous-unwind-tables
  156. CFLAGS-__syscall_fcntl64.c = -fexceptions -fasynchronous-unwind-tables
  157. CFLAGS-__syscall_fcntl.c = -fexceptions -fasynchronous-unwind-tables
  158. CFLAGS-tcdrain.c = -fexceptions -fasynchronous-unwind-tables
  159. CFLAGS-usleep.c = -fexceptions -fasynchronous-unwind-tables
  160. CFLAGS-wait4.c = -fexceptions -fasynchronous-unwind-tables
  161. CFLAGS-wait.c = -fexceptions -fasynchronous-unwind-tables
  162. CFLAGS-waitid.c = -fexceptions -fasynchronous-unwind-tables
  163. CFLAGS-waitpid.c = -fexceptions -fasynchronous-unwind-tables
  164. CFLAGS-write.c = -fexceptions -fasynchronous-unwind-tables
  165. CFLAGS-writev.c = -fexceptions -fasynchronous-unwind-tables
  166. #
  167. # The rest of this file is uClibc specific.
  168. #
  169. CFLAGS-pthread_barrier_init.c = -D_GNU_SOURCE
  170. CFLAGS-pthread_barrier_destroy.c = -D_GNU_SOURCE
  171. CFLAGS-pthread_barrierattr_init.c = -D_GNU_SOURCE
  172. CFLAGS-pthread_barrierattr_destroy.c = -D_GNU_SOURCE
  173. CFLAGS-pthread_barrierattr_getpshared.c = -D_GNU_SOURCE
  174. CFLAGS-pthread_barrierattr_setpshared.c = -D_GNU_SOURCE
  175. CFLAGS-sem_open.c = -D_GNU_SOURCE
  176. CFLAGS-OMIT-alloca_cutoff.c = $(CFLAGS-dir_nptl)
  177. CFLAGS-OMIT-libc-lowlevelock.c = $(CFLAGS-dir_nptl)
  178. CFLAGS-OMIT-libc-cancellation.c = $(CFLAGS-dir_nptl)