Makefile.commonarch 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211
  1. # Makefile for uClibc NPTL
  2. #
  3. # Copyright (C) 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/unix/sysv/linux \
  8. libpthread/nptl/sysdeps/unix/sysv/linux/$(TARGET_ARCH)
  9. ifneq ($(abspath libpthread/nptl/sysdeps/unix/sysv/linux/$(TARGET_ARCH)),$(abspath libpthread/nptl/sysdeps/unix/sysv/linux/$(TARGET_ARCH)/$(TARGET_SUBARCH)))
  10. subdirs += libpthread/nptl/sysdeps/unix/sysv/linux/$(TARGET_ARCH)/$(TARGET_SUBARCH)
  11. endif
  12. libpthread_linux_DIR := $(top_srcdir)libpthread/nptl/sysdeps/unix/sysv/linux
  13. libpthread_linux_OUT := $(top_builddir)libpthread/nptl/sysdeps/unix/sysv/linux
  14. libpthread_linux_arch_DIR := $(libpthread_linux_DIR)/$(TARGET_ARCH)
  15. libpthread_linux_arch_OUT := $(libpthread_linux_OUT)/$(TARGET_ARCH)
  16. libc_linux_CSRC :=
  17. libpthread_linux_CSRC :=
  18. librt_linux_CSRC :=
  19. -include $(libpthread_linux_arch_DIR)/Makefile.arch
  20. ifneq ($(TARGET_SUBARCH),)
  21. libpthread_linux_subarch_DIR := $(libpthread_linux_arch_DIR)/$(TARGET_SUBARCH)
  22. libpthread_linux_subarch_OUT := $(libpthread_linux_arch_OUT)/$(TARGET_SUBARCH)
  23. libpthread_linux_subarch_SSRC := $(notdir $(wildcard $(libpthread_linux_subarch_DIR)/*.S))
  24. libc_linux_subarch_SSRC := $(notdir $(wildcard $(libpthread_linux_subarch_DIR)/libc-*.S))
  25. librt_linux_subarch_SSRC := $(notdir $(wildcard $(libpthread_linux_subarch_DIR)/librt-*.S))
  26. ifneq ($(libc_linux_subarch_SSRC)$(librt_linux_subarch_SSRC),)
  27. libpthread_linux_subarch_SSRC := $(filter-out $(libc_linux_subarch_SSRC) $(librt_linux_subarch_SSRC),$(libpthread_linux_subarch_SSRC))
  28. libc_linux_arch_CSRC := $(filter-out $(libc_linux_subarch_SSRC:.S=.c),$(libc_linux_arch_CSRC))
  29. libc_linux_arch_SSRC := $(filter-out $(libc_linux_subarch_SSRC),$(libc_linux_arch_SSRC))
  30. endif
  31. ifneq ($(libpthread_linux_subarch_SSRC),)
  32. libpthread_linux_arch_SSRC := $(filter-out $(libpthread_linux_subarch_SSRC),$(libpthread_linux_arch_SSRC))
  33. libpthread_linux_arch_CSRC := $(filter-out $(libpthread_linux_subarch_SSRC:.S=.c),$(libpthread_linux_arch_CSRC))
  34. endif
  35. ifneq ($(librt_linux_subarch_SSRC),)
  36. librt_linux_arch_SSRC := $(filter-out $(librt_linux_subarch_SSRC),$(librt_linux_arch_SSRC))
  37. librt_linux_arch_CSRC := $(filter-out $(librt_linux_subarch_SSRC:.S=.c),$(librt_linux_arch_CSRC))
  38. endif
  39. libpthread_linux_subarch_SOBJ = $(patsubst %.S,$(libpthread_linux_subarch_OUT)/%.o,$(libpthread_linux_subarch_SSRC))
  40. libc_linux_subarch_SOBJ := $(patsubst %.S,$(libpthread_linux_subarch_OUT)/%.o,$(libc_linux_subarch_SSRC))
  41. librt_linux_subarch_SOBJ := $(patsubst %.S,$(libpthread_linux_subarch_OUT)/%.o,$(librt_linux_subarch_SSRC))
  42. endif
  43. libpthread_linux_arch_SOBJ = $(patsubst %.S,$(libpthread_linux_arch_OUT)/%.o,$(libpthread_linux_arch_SSRC))
  44. libpthread_linux_arch_COBJ = $(patsubst %.c,$(libpthread_linux_arch_OUT)/%.o,$(libpthread_linux_arch_CSRC))
  45. libpthread_linux_arch_OBJS := $(libpthread_linux_subarch_SOBJ) $(libpthread_linux_arch_SOBJ) $(libpthread_linux_arch_COBJ)
  46. libc_linux_arch_SOBJ = $(patsubst %.S,$(libpthread_linux_arch_OUT)/%.o,$(libc_linux_arch_SSRC))
  47. libc_linux_arch_COBJ = $(patsubst %.c,$(libpthread_linux_arch_OUT)/%.o,$(libc_linux_arch_CSRC))
  48. libc_linux_arch_OBJS := $(libc_linux_subarch_SOBJ) $(libc_linux_arch_SOBJ) $(libc_linux_arch_COBJ)
  49. librt_linux_arch_SOBJ = $(patsubst %.S,$(libpthread_linux_arch_OUT)/%.o,$(librt_linux_arch_SSRC))
  50. librt_linux_arch_COBJ = $(patsubst %.c,$(libpthread_linux_arch_OUT)/%.o,$(librt_linux_arch_CSRC))
  51. librt_linux_arch_OBJS := $(librt_linux_subarch_SOBJ) $(librt_linux_arch_SOBJ) $(librt_linux_arch_COBJ)
  52. libpthread_linux_CSRC += pthread_attr_getaffinity.c pthread_attr_setaffinity.c \
  53. pthread_getaffinity.c pthread_setaffinity.c \
  54. pthread_getcpuclockid.c pthread_kill.c \
  55. pthread_mutex_cond_lock.c pthread_yield.c \
  56. sem_post.c sem_timedwait.c sem_trywait.c sem_wait.c \
  57. pt-fork.c pt-sleep.c pthread_sigqueue.c \
  58. sigtimedwait.c sigwaitinfo.c sigwait.c \
  59. lowlevellock.c lowlevelrobustlock.c
  60. libpthread_linux_SSRC := #ptw-close.S ptw-open.S ptw-waitid.S ptw-waidpid.S ptw-write.S
  61. libc_linux_CSRC += libc_pthread_init.c libc_multiple_threads.c \
  62. register-atfork.c unregister-atfork.c getpid.c \
  63. raise.c sleep.c jmp-unwind.c libc-lowlevellock.c
  64. librt_linux_CSRC += mq_notify.c timer_create.c timer_delete.c \
  65. timer_getoverr.c timer_gettime.c timer_routines.c \
  66. timer_settime.c
  67. # These provide both a cancellable and a not cancellable implementation
  68. libc_linux_SSRC = close.S open.S write.S read.S waitpid.S
  69. libc_linux_SSRC := $(filter-out $(libc_linux_arch_SSRC-OMIT),$(libc_linux_SSRC))
  70. libpthread_linux_CSRC := $(filter-out $(notdir $(libpthread_linux_arch_OBJS:.o=.c)),$(libpthread_linux_CSRC))
  71. libpthread_linux_SSRC := $(filter-out $(notdir $(libpthread_linux_arch_OBJS:.o=.S)),$(libpthread_linux_SSRC))
  72. libc_linux_SSRC := $(filter-out $(notdir $(libc_linux_arch_OBJS:.o=.S)),$(libc_linux_SSRC))
  73. libc_linux_CSRC := $(filter-out $(notdir $(libc_linux_arch_OBJS:.o=.c)),$(libc_linux_CSRC))
  74. librt_linux_SSRC := $(filter-out $(notdir $(librt_linux_arch_OBJS:.o=.S)),$(librt_linux_SSRC))
  75. librt_linux_CSRC := $(filter-out $(notdir $(librt_linux_arch_OBJS:.o=.c)),$(librt_linux_CSRC))
  76. libpthread_linux_OBJS = $(libpthread_linux_arch_OBJS)
  77. libpthread_linux_OBJS += $(patsubst %.c,$(libpthread_linux_OUT)/%.o,$(libpthread_linux_CSRC))
  78. libpthread_linux_OBJS += $(patsubst %.S,$(libpthread_linux_OUT)/%.o,$(libpthread_linux_SSRC))
  79. ifneq ($(libpthread_linux_OMIT_OBJS),)
  80. libpthread_linux_OBJS := $(filter-out $(libpthread_linux_OMIT_OBJS),$(libpthread_linux_OBJS))
  81. endif
  82. libpthread-a-y += $(if $(DOPIC),$(libpthread_linux_OBJS:.o=.os),$(libpthread_linux_OBJS))
  83. libpthread-so-y += $(libpthread_linux_OBJS:.o=.oS)
  84. libpthread-so-y += $(libpthread_linux_OUT)/pt-raise.oS
  85. #libpthread-nomulti-y += $(libpthread_linux_OBJS)
  86. libc_linux_OBJS := $(libc_linux_arch_OBJS)
  87. libc_linux_OBJS += $(patsubst %.c,$(libpthread_linux_OUT)/%.o,$(libc_linux_CSRC))
  88. libc_linux_OBJS += $(patsubst %.S,$(libpthread_linux_OUT)/%.o,$(libc_linux_SSRC))
  89. ifneq ($(libc_linux_OMIT_OBJS),)
  90. libc_linux_OBJS := $(filter-out $(libc_linux_OMIT_OBJS),$(libc_linux_OBJS))
  91. endif
  92. libc-static-y += $(libc_linux_OBJS)
  93. libc-shared-y += $(libc_linux_OBJS:.o=.oS)
  94. #libc-nomulti-y += $(libc_linux_OBJS)
  95. librt_linux_OBJS := $(librt_linux_arch_OBJS)
  96. librt_linux_OBJS += $(patsubst %.c,$(libpthread_linux_OUT)/%.o,$(librt_linux_CSRC))
  97. librt_linux_OBJS += $(patsubst %.S,$(libpthread_linux_OUT)/%.o,$(librt_linux_SSRC))
  98. objclean-y += CLEAN_libpthread/nptl/sysdeps/unix/sysv/linux
  99. headers_clean-y += HEADERCLEAN_libpthread/nptl/sysdeps/unix/sysv/linux
  100. CFLAGS-pthread_getcpuclockid.c = -I$(top_srcdir)librt
  101. CFLAGS-pt-pread_pwrite.c = -I$(top_srcdir)libc/sysdeps/linux/$(TARGET_ARCH) \
  102. -I$(top_srcdir)libc/sysdeps/linux/common
  103. CFLAGS-mq_notify.c = -I$(top_srcdir)librt -DIS_IN_librt
  104. CFLAGS-timer_create.c = -I$(top_srcdir)librt -DIS_IN_librt
  105. CFLAGS-timer_delete.c = -I$(top_srcdir)librt -DIS_IN_librt
  106. CFLAGS-timer_getoverr.c = -I$(top_srcdir)librt -DIS_IN_librt
  107. CFLAGS-timer_gettime.c = -I$(top_srcdir)librt -DIS_IN_librt
  108. CFLAGS-timer_routines.c = -I$(top_srcdir)librt -DIS_IN_librt
  109. CFLAGS-timer_settime.c = -I$(top_srcdir)librt -DIS_IN_librt
  110. CFLAGS-linux = -DNOT_IN_libc -DIS_IN_libpthread $(SSP_ALL_CFLAGS)
  111. CFLAGS-OMIT-libc_pthread_init.c = -DNOT_IN_libc -DIS_IN_libpthread
  112. CFLAGS-OMIT-libc_multiple_threads.c = -DNOT_IN_libc -DIS_IN_libpthread
  113. CFLAGS-OMIT-register-atfork.c = -DNOT_IN_libc -DIS_IN_libpthread
  114. CFLAGS-OMIT-unregister-atfork.c = -DNOT_IN_libc -DIS_IN_libpthread
  115. CFLAGS-OMIT-getpid.c = -DNOT_IN_libc -DIS_IN_libpthread
  116. CFLAGS-OMIT-raise.c = -DNOT_IN_libc -DIS_IN_libpthread
  117. CFLAGS-OMIT-sleep.c = -DNOT_IN_libc -DIS_IN_libpthread
  118. CFLAGS-OMIT-libc-lowlevellock.c = -DNOT_IN_libc -DIS_IN_libpthread
  119. CFLAGS-OMIT-close.S = -DNOT_IN_libc -DIS_IN_libpthread
  120. CFLAGS-OMIT-open.S = -DNOT_IN_libc -DIS_IN_libpthread
  121. CFLAGS-OMIT-read.S = -DNOT_IN_libc -DIS_IN_libpthread
  122. CFLAGS-OMIT-write.S = -DNOT_IN_libc -DIS_IN_libpthread
  123. CFLAGS-OMIT-waitpid.S = -DNOT_IN_libc -DIS_IN_libpthread
  124. CFLAGS-OMIT-mq_notify.c = -DIS_IN_libpthread
  125. CFLAGS-OMIT-timer_create.c = -DIS_IN_libpthread
  126. CFLAGS-OMIT-timer_delete.c = -DIS_IN_libpthread
  127. CFLAGS-OMIT-timer_getoverr.c = -DIS_IN_libpthread
  128. CFLAGS-OMIT-timer_gettime.c = -DIS_IN_libpthread
  129. CFLAGS-OMIT-timer_routines.c = -DIS_IN_libpthread
  130. CFLAGS-OMIT-timer_settime.c = -DIS_IN_libpthread
  131. ASFLAGS-open.S = -D_LIBC_REENTRANT
  132. ASFLAGS-close.S = -D_LIBC_REENTRANT
  133. ASFLAGS-read.S = -D_LIBC_REENTRANT
  134. ASFLAGS-write.S = -D_LIBC_REENTRANT
  135. ASFLAGS-waitpid.S = -D_LIBC_REENTRANT
  136. #
  137. # Create header files.
  138. #
  139. CFLAGS-gen_lowlevelbarrier.c = -S
  140. CFLAGS-gen_lowlevelcond.c = -S
  141. CFLAGS-gen_lowlevelrobustlock.c = -S
  142. CFLAGS-gen_lowlevelrwlock.c = -S
  143. CFLAGS-gen_pthread-pi-defines.c = -S
  144. CFLAGS-gen_structsem.c = -S
  145. CFLAGS-gen_unwindbuf.c = -S
  146. PTHREAD_GENERATE_MANGLE ?= -n "s/^.*@@@name@@@\([^@]*\)@@@value@@@[^0-9Xxa-fA-F-]*\([0-9Xxa-fA-F-][0-9Xxa-fA-F-]*\).*@@@end@@@.*\$$/\#define \1 \2/p"
  147. PTHREAD_LINUX_SYM := $(notdir $(wildcard $(libpthread_linux_DIR)/*.sym))
  148. PTHREAD_LINUX_SYM_C := $(addprefix $(libpthread_linux_OUT)/gen_,$(PTHREAD_LINUX_SYM:.sym=.c))
  149. PTHREAD_LINUX_SYM_S := $(PTHREAD_LINUX_SYM_C:.c=.s)
  150. PTHREAD_LINUX_SYM_H := $(addprefix $(libpthread_linux_OUT)/,$(PTHREAD_LINUX_SYM:.sym=.h))
  151. $(PTHREAD_LINUX_SYM_C): $(libpthread_linux_OUT)/gen_%.c: $(libpthread_linux_DIR)/%.sym | $(libpthread_linux_OUT)
  152. $(do_awk) $(top_srcdir)extra/scripts/gen-as-const.awk $< > $@
  153. $(PTHREAD_LINUX_SYM_S): $(libpthread_linux_OUT)/gen_%.s: $(libpthread_linux_OUT)/gen_%.c | headers
  154. $(compile.c)
  155. libpthread-generated-y += $(PTHREAD_LINUX_SYM_S)
  156. $(PTHREAD_LINUX_SYM_H): $(libpthread_linux_OUT)/%.h: $(libpthread_linux_OUT)/gen_%.s
  157. $(do_sed) $(PTHREAD_GENERATE_MANGLE) $< > $@
  158. @if test ! -s $@ ; then rm -f $@ ; false ; fi
  159. pregen-headers-$(UCLIBC_HAS_THREADS_NATIVE) += $(PTHREAD_LINUX_SYM_H)
  160. HEADERS_BITS_PTHREAD := $(notdir $(wildcard $(libpthread_linux_DIR)/bits/*.h))
  161. ALL_HEADERS_BITS_PTHREAD := $(addprefix $(top_builddir)include/bits/,$(HEADERS_BITS_PTHREAD))
  162. $(ALL_HEADERS_BITS_PTHREAD): $(top_builddir)include/bits/%: | $(top_builddir)include/bits
  163. $(do_ln) $(call rel_srcdir)$(libpthread_linux_DIR)/bits/$(@F) $@
  164. HEADERCLEAN_libpthread/nptl/sysdeps/unix/sysv/linux:
  165. $(do_rm) $(PTHREAD_LINUX_SYM_C) $(PTHREAD_LINUX_SYM_S) \
  166. $(PTHREAD_LINUX_SYM_H)
  167. CLEAN_libpthread/nptl/sysdeps/unix/sysv/linux:
  168. $(do_rm) $(addprefix $(libpthread_linux_OUT)/*., o os oS)
  169. objclean-y+=CLEAN_libpthread/nptl/sysdeps/unix/sysv/linux/$(TARGET_ARCH)
  170. CLEAN_libpthread/nptl/sysdeps/unix/sysv/linux/$(TARGET_ARCH):
  171. $(do_rm) $(addprefix $(libpthread_linux_arch_OUT)/*., o os oS)
  172. ifneq ($(TARGET_SUBARCH),)
  173. objclean-y+=CLEAN_libpthread/nptl/sysdeps/unix/sysv/linux/$(TARGET_ARCH)/$(TARGET_SUBARCH)
  174. CLEAN_libpthread/nptl/sysdeps/unix/sysv/linux/$(TARGET_ARCH)/$(TARGET_SUBARCH):
  175. $(do_rm) $(addprefix $(libpthread_linux_subarch_OUT)/*., o os oS)
  176. endif