Makefile.in 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141
  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/sysdeps/$(TARGET_ARCH)
  9. subdirs += libpthread/linuxthreads/sysdeps/unix/sysv/linux
  10. subdirs += libpthread/linuxthreads/sysdeps/pthread
  11. CFLAGS-dir_linuxthreads := -DNOT_IN_libc -DIS_IN_libpthread
  12. CFLAGS-linuxthreads := $(CFLAGS-dir_linuxthreads) $(SSP_ALL_CFLAGS)
  13. CFLAGS-libpthread/linuxthreads/sysdeps/$(TARGET_ARCH)/ := $(CFLAGS-linuxthreads)
  14. CFLAGS-libpthread/linuxthreads/sysdeps/unix/sysv/linux/ := $(CFLAGS-linuxthreads)
  15. CFLAGS-libpthread/linuxthreads/sysdeps/pthread/ := $(CFLAGS-linuxthreads)
  16. # This stuff will not compile without at least -O1
  17. # psm: can't handle this here, could maybe search for -O0 in CFLAGS
  18. # and append -O1 if found
  19. #CFLAGS:=$(CFLAGS:-O0=-O1)
  20. ifeq ($(PTHREADS_DEBUG_SUPPORT),y)
  21. LDFLAGS-libpthread.so := $(LDFLAGS_NOSTRIP) -Wl,-z,defs
  22. else
  23. LDFLAGS-libpthread.so := $(LDFLAGS)
  24. endif
  25. LIBS-libpthread.so := $(LIBS) $(ldso)
  26. START_FILE-libpthread.so := $(SHARED_START_FILES)
  27. END_FILE-libpthread.so := $(SHARED_END_FILES)
  28. libpthread_FULL_NAME := libpthread-$(VERSION).so
  29. libpthread_DIR := $(top_srcdir)libpthread/linuxthreads
  30. libpthread_OUT := $(top_builddir)libpthread/linuxthreads
  31. -include $(libpthread_DIR)/sysdeps/$(TARGET_ARCH)/Makefile.arch
  32. pthread_arch_SRC := pspinlock
  33. pthread_arch_SRC := $(patsubst %,$(libpthread_DIR)/sysdeps/$(TARGET_ARCH)/%.c,$(pthread_arch_SRC))
  34. pthread_linux_SRC := fork pt-sigsuspend register-atfork unregister-atfork
  35. pthread_linux_SRC := $(patsubst %,$(libpthread_DIR)/sysdeps/unix/sysv/linux/%.c,$(pthread_linux_SRC))
  36. pthread_sysdep_SRC := errno-loc herrno-loc ptlongjmp
  37. pthread_sysdep_SRC := $(patsubst %,$(libpthread_DIR)/sysdeps/pthread/%.c,$(pthread_sysdep_SRC))
  38. pthread_SRC := \
  39. attr barrier cancel condvar errno events join pthread \
  40. lockfile manager mutex pt-machine ptcleanup \
  41. ptclock_gettime ptclock_settime ptfork pthandles \
  42. pthread_setegid pthread_seteuid pthread_setgid pthread_setregid \
  43. pthread_setresgid pthread_setresuid pthread_setreuid pthread_setuid \
  44. rwlock semaphore sighandler signals specific spinlock
  45. pthread_SRC := $(patsubst %,$(libpthread_DIR)/%.c,$(pthread_SRC))
  46. libpthread_static_SRC := pthread_atfork
  47. libpthread_SRC := $(pthread_arch_SRC) $(pthread_linux_SRC) $(pthread_sysdep_SRC) $(pthread_SRC)
  48. libpthread_OBJ := $(patsubst $(libpthread_DIR)/%.c,$(libpthread_OUT)/%.o,$(libpthread_SRC))
  49. #
  50. # Stuff that goes into libc.so, not libpthread.so
  51. #
  52. #CFLAGS-OMIT-alloca_cutoff.c := $(CFLAGS-dir_linuxthreads)
  53. CFLAGS-OMIT-forward.c := $(CFLAGS-dir_linuxthreads)
  54. CFLAGS-OMIT-libc-cancellation.c := $(CFLAGS-dir_linuxthreads)
  55. CFLAGS-OMIT-libc_pthread_init.c := $(CFLAGS-dir_linuxthreads)
  56. libpthread_libc_CSRC := \
  57. forward.c libc-cancellation.c libc_pthread_init.c # alloca_cutoff.c
  58. libpthread_libc_OBJ := $(patsubst %.c, $(libpthread_OUT)/%.o,$(libpthread_libc_CSRC))
  59. libc-static-y += $(libpthread_OUT)/libc_pthread_init.o
  60. libc-shared-y += $(libpthread_libc_OBJ:.o=.oS)
  61. libpthread-static-y += $(patsubst %,$(libpthread_OUT)/%.o,$(libpthread_static_SRC))
  62. libpthread-nonshared-y += $(patsubst %,$(libpthread_OUT)/%.oS,$(libpthread_static_SRC))
  63. ifeq ($(DOPIC),y)
  64. libpthread-a-y += $(libpthread_OBJ:.o=.os) $(libpthread-static-y:.o=.os)
  65. else
  66. libpthread-a-y += $(libpthread_OBJ) $(libpthread-static-y)
  67. endif
  68. libpthread-so-y += $(libpthread_OBJ:.o=.oS)
  69. lib-a-$(UCLIBC_HAS_THREADS) += $(top_builddir)lib/libpthread.a
  70. lib-so-$(UCLIBC_HAS_THREADS) += $(top_builddir)lib/libpthread.so
  71. #ifeq ($(DOMULTI),n)
  72. $(top_builddir)lib/libpthread.so: $(libpthread_OUT)/libpthread_so.a $(libc.depend) $(top_builddir)lib/libpthread_nonshared.a
  73. $(call link.so,$(libpthread_FULL_NAME),$(MAJOR_VERSION))
  74. #else
  75. #$(top_builddir)lib/libpthread.so: $(libpthread_OUT)/libpthread.oS | $(libc.depend) $(top_builddir)lib/libpthread_nonshared.a
  76. # $(call linkm.so,$(libpthread_FULL_NAME),$(MAJOR_VERSION))
  77. #endif
  78. $(Q)$(RM) $@
  79. $(Q)cp $(top_srcdir)extra/scripts/format.lds $@
  80. $(Q)echo "GROUP ( $(notdir $@).$(MAJOR_VERSION) libpthread_nonshared.a )" >> $@
  81. ifeq ($(PTHREADS_DEBUG_SUPPORT),y)
  82. $(libpthread_OUT)/libpthread_so.a: STRIP_FLAGS:=$(STRIP_FLAGS:-x=-X --strip-debug)
  83. endif
  84. $(libpthread_OUT)/libpthread_so.a: $(libpthread-so-y)
  85. $(Q)$(RM) $@
  86. $(do_ar)
  87. ifeq ($(PTHREADS_DEBUG_SUPPORT),y)
  88. $(libpthread_OUT)/libpthread.oS: STRIP_FLAGS:=$(STRIP_FLAGS:-x=-X --strip-debug)
  89. endif
  90. $(libpthread_OUT)/libpthread.oS: $(libpthread_SRC)
  91. $(Q)$(RM) $@
  92. $(compile-m)
  93. ifeq ($(PTHREADS_DEBUG_SUPPORT),y)
  94. $(top_builddir)lib/libpthread.a: STRIP_FLAGS:=$(STRIP_FLAGS:-x=-X --strip-debug)
  95. endif
  96. $(top_builddir)lib/libpthread.a: $(libpthread-a-y)
  97. $(Q)$(INSTALL) -d $(dir $@)
  98. $(Q)$(RM) $@
  99. $(do_ar)
  100. $(top_builddir)include/pthread.h:
  101. $(do_ln) $(call rel_srcdir)$(PTDIR)/sysdeps/pthread/$(@F) $@
  102. $(top_builddir)include/semaphore.h:
  103. $(do_ln) $(call rel_srcdir)$(PTDIR)/$(@F) $@
  104. $(top_builddir)include/bits/pthreadtypes.h: | $(top_builddir)include/bits
  105. $(do_ln) $(call rel_srcdir)$(PTDIR)/sysdeps/pthread/bits/$(@F) $@
  106. linuxthreads_headers := $(top_builddir)include/pthread.h \
  107. $(top_builddir)include/semaphore.h \
  108. $(top_builddir)include/bits/pthreadtypes.h
  109. $(linuxthreads_headers): $(wildcard $(addprefix $(top_builddir)include/config/linuxthreads/,old.h new.h))
  110. headers-$(UCLIBC_HAS_THREADS) += $(linuxthreads_headers)
  111. objclean-y += libpthread_clean
  112. headers_clean-y += linuxthreads_headers_clean
  113. linuxthreads_headers_clean:
  114. $(do_rm) $(linuxthreads_headers)
  115. libpthread_clean:
  116. $(do_rm) $(addprefix $(libpthread_OUT)/,$(foreach e, o os oS a,$(foreach d, *. */*. */*/*. */*/*/*.,$(d)$(e))))