Makefile.in 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135
  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. subdirs += libpthread/nptl/sysdeps/pthread
  8. #
  9. # NOTE: glibc puts flockfile.c, ftrylockfile.c, funlockfile.c, and
  10. # pt-longjmp.c in libc and libpthread. For uClibc, they are
  11. # in libc only.
  12. #
  13. libpthread_pthread_DIR = $(top_srcdir)libpthread/nptl/sysdeps/pthread
  14. libpthread_pthread_OUT = $(top_builddir)libpthread/nptl/sysdeps/pthread
  15. libpthread_pthread_COBJ = $(patsubst %.c,$(libpthread_pthread_OUT)/%.o,$(libpthread_pthread_CSRC))
  16. libpthread_pthread_CSRC = \
  17. pthread_barrier_destroy.c \
  18. pthread_barrier_init.c \
  19. pthread_barrier_wait.c \
  20. pthread_cond_broadcast.c \
  21. pthread_cond_signal.c \
  22. pthread_cond_timedwait.c \
  23. pthread_cond_wait.c \
  24. pthread_rwlock_rdlock.c \
  25. pthread_rwlock_timedrdlock.c \
  26. pthread_rwlock_timedwrlock.c \
  27. pthread_rwlock_unlock.c \
  28. pthread_rwlock_wrlock.c \
  29. pthread_sigmask.c \
  30. pthread_spin_destroy.c \
  31. pthread_spin_init.c \
  32. pthread_spin_unlock.c \
  33. pt-longjmp.c \
  34. pt-sigaction.c \
  35. pt-sigfillset.c \
  36. pt-sigprocmask.c \
  37. tpp.c
  38. CFLAGS-pthread = $(SSP_ALL_CFLAGS) -DNOT_IN_libc -DIS_IN_libpthread
  39. CFLAGS-pthread_barrier_wait.c = -D_GNU_SOURCE
  40. CFLAGS-pthread_spin_destroy.c = -D_GNU_SOURCE
  41. CFLAGS-pthread_spin_init.c = -D_GNU_SOURCE
  42. CFLAGS-pthread_spin_unlock.c = -D_GNU_SOURCE
  43. CFLAGS-pt-sigaction.c = -I$(top_srcdir)libc/sysdeps/linux/$(TARGET_ARCH) \
  44. -I$(top_srcdir)libc/signal
  45. CFLAGS-pt-sigfillset.c = -I$(top_srcdir)libc/signal
  46. CFLAGS-pt-sigprocmask.c = -I$(top_srcdir)libc/sysdeps/linux/common
  47. CFLAGS-unwind-forcedunwind.c = -fexceptions -fasynchronous-unwind-tables
  48. CFLAGS-OMIT-librt-cancellation.c = -DIS_IN_libpthread
  49. CFLAGS-OMIT-rt-unwind-resume.c = -DIS_IN_libpthread
  50. CFLAGS-librt-cancellation.c = -DIS_IN_librt \
  51. -fexceptions -fasynchronous-unwind-tables
  52. CFLAGS-rt-unwind-resume.c = -DIS_IN_librt \
  53. -fexceptions -fasynchronous-unwind-tables
  54. libpthread-so-y += $(patsubst %,$(libpthread_pthread_OUT)/%.oS, \
  55. pt-sigaction pt-sigprocmask unwind-forcedunwind)
  56. CFLAGS-OMIT-sigaction.c = $(CFLAGS-pthread)
  57. CFLAGS-sigaction.c = -I$(top_srcdir)libc/signal
  58. libc-y += $(libpthread_pthread_OUT)/sigaction.o
  59. librt-pt-routines-y = librt-cancellation.c
  60. librt-pt-shared-only-routines-y = rt-unwind-resume.c
  61. ifeq ($(UCLIBC_CTOR_DTOR),y)
  62. CFLAGS-OMIT-pt-initfini.c = $(CFLAGS-pthread)
  63. CFLAGS-pt-initfini.c = -S -g0 $(PICFLAG) -fno-inline-functions \
  64. $(call check_gcc,-fno-unit-at-a-time,) \
  65. $(SSP_DISABLE_FLAGS) \
  66. -finhibit-size-directive \
  67. -fno-asynchronous-unwind-tables -fno-unwind-tables \
  68. $(patsubst -f%,-fno-%,$(call check_gcc,-fexceptions,))
  69. #ASFLAGS += $(PICFLAG) -I$(top_srcdir)include -I$(top_srcdir)libc/sysdeps/linux/$(TARGET_ARCH)
  70. ifneq ($(wildcard $(libpthread_pthread_DIR)/../unix/sysv/linux/$(TARGET_ARCH)/pt-initfini.c),)
  71. PTHREAD_INITFINI := $(libpthread_pthread_DIR)/../unix/sysv/linux/$(TARGET_ARCH)/pt-initfini.c
  72. else
  73. PTHREAD_INITFINI := $(libpthread_pthread_DIR)/pt-initfini.c
  74. endif
  75. ASFLAGS-pt-crti.S = $(PICFLAG)
  76. ASFLAGS-pt-crtn.S = $(PICFLAG)
  77. $(libpthread_pthread_OUT)/pt-crti.o: $(libpthread_pthread_OUT)/pt-crti.S
  78. $(compile.S)
  79. $(libpthread_pthread_OUT)/pt-crtn.o: $(libpthread_pthread_OUT)/pt-crtn.S
  80. $(compile.S)
  81. $(libpthread_pthread_OUT)/pt-initfini.s: $(PTHREAD_INITFINI) | $(top_builddir)include/bits/uClibc_config.h
  82. $(compile.c)
  83. $(libpthread_pthread_OUT)/defs.h: $(PTHREAD_INITFINI)
  84. $(do_sed) -n -e '/@TESTS_BEGIN/,/@TESTS_END/p' $< | \
  85. $(AWK) -f $(top_srcdir)extra/scripts/defs.awk > $@.tmp
  86. $(Q)mv $@.tmp $@
  87. $(libpthread_pthread_OUT)/pt-crti.S: $(libpthread_pthread_OUT)/pt-initfini.s $(libpthread_pthread_OUT)/defs.h
  88. $(do_sed) -n -e '/[ ]*\.file/d' \
  89. -e '1,/@HEADER_ENDS/p' \
  90. -e '/@_.*_PROLOG_BEGINS/,/@_.*_PROLOG_ENDS/p' \
  91. -e '/@TRAILER_BEGINS/,$$p' $< > $@.tmp
  92. $(Q)mv $@.tmp $@
  93. $(libpthread_pthread_OUT)/pt-crtn.S: $(libpthread_pthread_OUT)/pt-initfini.s $(libpthread_pthread_OUT)/defs.h
  94. $(do_sed) -n -e '/[ ]*\.file/d' \
  95. -e '1,/@HEADER_ENDS/p' \
  96. -e '/@_.*_EPILOG_BEGINS/,/@_.*_EPILOG_ENDS/p' \
  97. -e '/@TRAILER_BEGINS/,$$p' $< > $@.tmp
  98. $(Q)mv $@.tmp $@
  99. endif
  100. # It would have been easier to just add dummy files that include the real
  101. # impl, but ok.
  102. # Special rules needed since we do objdir->objdir compilation for these 3.
  103. # First symlink them, then build them. Rob would freak out on these. Sheesh! ;)
  104. pthread-lc-fwd = sigaction sigfillset sigprocmask
  105. $(patsubst %,$(libpthread_pthread_OUT)/pt-%.c,$(pthread-lc-fwd)): | $(libpthread_pthread_OUT)
  106. $(do_ln) $(call rel_srcdir)$(patsubst pt-%,$(libpthread_pthread_DIR)/%,$(@F)) $@
  107. $(patsubst %,$(libpthread_pthread_OUT)/pt-%.oS,$(pthread-lc-fwd)): $(libpthread_pthread_OUT)/pt-%.oS: $(libpthread_pthread_OUT)/pt-%.c
  108. $(compile.c)
  109. $(patsubst %,$(libpthread_pthread_OUT)/pt-%.o,$(pthread-lc-fwd)): $(libpthread_pthread_OUT)/pt-%.o: $(libpthread_pthread_OUT)/pt-%.c
  110. $(compile.c)
  111. ifeq ($(DOPIC),y)
  112. $(patsubst %,$(libpthread_pthread_OUT)/pt-%.os,$(pthread-lc-fwd)): $(libpthread_pthread_OUT)/pt-%.os: $(libpthread_pthread_OUT)/pt-%.c
  113. $(compile.c)
  114. endif
  115. objclean-y += CLEAN_libpthread/nptl/sysdeps/pthread
  116. CLEAN_libpthread/nptl/sysdeps/pthread:
  117. $(do_rm) $(addprefix $(libpthread_pthread_OUT)/*., o os oS s S) \
  118. $(libpthread_pthread_OUT)/defs.h \
  119. $(addprefix $(libpthread_pthread_DIR)/,pt-sigaction.c \
  120. pt-sigfillset.c pt-sigprocmask.c)