Makefile.in 5.3 KB

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