Makefile.in 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  1. # Makefile for uClibc
  2. #
  3. # Copyright (C) 2003 Paul Mundt <lethal@linux-sh.org>
  4. # Copyright (C) 2000-2006 Erik Andersen <andersen@uclibc.org>
  5. #
  6. # Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
  7. #
  8. CFLAGS-linuxthreads := -DNOT_IN_libc -DIS_IN_libpthread $(SSP_ALL_CFLAGS)
  9. CFLAGS-libpthread/linuxthreads/sysdeps/$(TARGET_ARCH)/ := $(CFLAGS-linuxthreads)
  10. CFLAGS-libpthread/linuxthreads/sysdeps/unix/sysv/linux/ := $(CFLAGS-linuxthreads)
  11. CFLAGS-libpthread/linuxthreads/sysdeps/pthread/ := $(CFLAGS-linuxthreads)
  12. # This stuff will not compile without at least -O1
  13. # psm: can't handle this here, could maybe search for -O0 in CFLAGS
  14. # and append -O1 if found
  15. #CFLAGS:=$(CFLAGS:-O0=-O1)
  16. ifeq ($(PTHREADS_DEBUG_SUPPORT),y)
  17. LDFLAGS-libpthread.so := $(LDFLAGS_NOSTRIP) -z defs
  18. else
  19. LDFLAGS-libpthread.so := $(LDFLAGS)
  20. endif
  21. LIBS-libpthread.so := $(LIBS) $(ldso)
  22. START_FILE-libpthread.so := $(SHARED_START_FILES)
  23. END_FILE-libpthread.so := $(SHARED_END_FILES)
  24. libpthread_FULL_NAME := libpthread-$(MAJOR_VERSION).$(MINOR_VERSION).$(SUBLEVEL).so
  25. libpthread_DIR := $(top_srcdir)libpthread/linuxthreads
  26. libpthread_OUT := $(top_builddir)libpthread/linuxthreads
  27. -include $(libpthread_DIR)/sysdeps/$(TARGET_ARCH)/Makefile.arch
  28. pthread_arch_SRC := pspinlock
  29. pthread_arch_SRC := $(patsubst %,$(libpthread_DIR)/sysdeps/$(TARGET_ARCH)/%.c,$(pthread_arch_SRC))
  30. pthread_linux_SRC := fork pt-sigsuspend register-atfork unregister-atfork
  31. pthread_linux_SRC := $(patsubst %,$(libpthread_DIR)/sysdeps/unix/sysv/linux/%.c,$(pthread_linux_SRC))
  32. pthread_sysdep_SRC := errno-loc herrno-loc ptlongjmp
  33. pthread_sysdep_SRC := $(patsubst %,$(libpthread_DIR)/sysdeps/pthread/%.c,$(pthread_sysdep_SRC))
  34. pthread_SRC := \
  35. attr barrier cancel condvar errno events join pthread \
  36. lockfile manager mutex pt-machine ptcleanup \
  37. ptclock_gettime ptclock_settime ptfork pthandles \
  38. pthread_setegid pthread_seteuid pthread_setgid pthread_setregid \
  39. pthread_setresgid pthread_setresuid pthread_setreuid pthread_setuid \
  40. rwlock semaphore sighandler signals specific spinlock
  41. pthread_SRC := $(patsubst %,$(libpthread_DIR)/%.c,$(pthread_SRC))
  42. libpthread_static_SRC := pthread_atfork
  43. libpthread_SRC := $(pthread_arch_SRC) $(pthread_linux_SRC) $(pthread_sysdep_SRC) $(pthread_SRC)
  44. libpthread_OBJ := $(patsubst $(libpthread_DIR)/%.c,$(libpthread_OUT)/%.o,$(libpthread_SRC))
  45. #
  46. # Stuff that goes into libc.so, not libpthread.so
  47. #
  48. #CFLAGS-alloca_cutoff.c := -DIS_IN_libc
  49. CFLAGS-forward.c := -DIS_IN_libc
  50. CFLAGS-libc-cancellation.c := -DIS_IN_libc
  51. CFLAGS-libc_pthread_init.c := -DIS_IN_libc
  52. libpthread_libc_CSRC := \
  53. forward.c libc-cancellation.c libc_pthread_init.c # alloca_cutoff.c
  54. libpthread_libc_OBJ := $(patsubst %.c, $(libpthread_OUT)/%.o,$(libpthread_libc_CSRC))
  55. libc-static-y += $(libpthread_OUT)/libc_pthread_init.o
  56. libc-shared-y += $(libpthread_libc_OBJ:.o=.oS)
  57. libpthread-static-y += $(patsubst %,$(libpthread_OUT)/%.o,$(libpthread_static_SRC))
  58. ifeq ($(DOPIC),y)
  59. libpthread-a-y += $(libpthread_OBJ:.o=.os) $(libpthread-static-y:.o=.os)
  60. else
  61. libpthread-a-y += $(libpthread_OBJ) $(libpthread-static-y)
  62. endif
  63. libpthread-so-y += $(libpthread_OBJ:.o=.os)
  64. lib-a-$(UCLIBC_HAS_THREADS) += $(top_builddir)lib/libpthread.a
  65. lib-so-$(UCLIBC_HAS_THREADS) += $(top_builddir)lib/libpthread.so
  66. objclean-y += libpthread_clean
  67. headers-$(UCLIBC_HAS_THREADS) += linuxthreads_headers
  68. headers_clean-y += linuxthreads_headers_clean
  69. #ifeq ($(DOMULTI),n)
  70. $(top_builddir)lib/libpthread.so: $(libpthread_OUT)/libpthread_so.a $(libc)
  71. $(call link.so,$(libpthread_FULL_NAME),$(MAJOR_VERSION))
  72. #else
  73. #$(top_builddir)lib/libpthread.so: $(libpthread_OUT)/libpthread.oS | $(libc)
  74. # $(call linkm.so,$(libpthread_FULL_NAME),$(MAJOR_VERSION))
  75. #endif
  76. $(libpthread_OUT)/libpthread_so.a: $(libpthread-so-y)
  77. $(Q)$(RM) $@
  78. ifeq ($(PTHREADS_DEBUG_SUPPORT),y)
  79. $(do_strip:-x=-X --strip-debug)
  80. else
  81. $(do_strip)
  82. endif
  83. $(do_ar)
  84. $(libpthread_OUT)/libpthread.oS: $(libpthread_SRC)
  85. $(Q)$(RM) $@
  86. $(compile-m)
  87. ifeq ($(PTHREADS_DEBUG_SUPPORT),y)
  88. $(do_t_strip:-x=-X --strip-debug)
  89. else
  90. $(do_t_strip)
  91. endif
  92. $(top_builddir)lib/libpthread.a: $(libpthread-a-y)
  93. $(Q)$(INSTALL) -d $(dir $@)
  94. $(Q)$(RM) $@
  95. ifeq ($(PTHREADS_DEBUG_SUPPORT),y)
  96. $(do_strip:-x=-X --strip-debug)
  97. else
  98. $(do_strip)
  99. endif
  100. $(do_ar)
  101. linuxthreads_headers:
  102. $(LN) -sf ../$(PTDIR)/sysdeps/pthread/pthread.h $(top_builddir)include/
  103. $(LN) -sf ../$(PTDIR)/semaphore.h $(top_builddir)include/
  104. $(INSTALL) -d $(top_builddir)include/bits
  105. $(LN) -sf ../../$(PTDIR)/sysdeps/pthread/bits/pthreadtypes.h $(top_builddir)include/bits/
  106. linuxthreads_headers_clean:
  107. $(RM) $(top_builddir)include/pthread.h $(top_builddir)include/semaphore.h \
  108. $(top_builddir)include/bits/pthreadtypes.h
  109. libpthread_clean:
  110. $(RM) $(libpthread_OUT)/{,*/,*/*/,*/*/*/,*/*/*/*/}*.{o,os,oS,a}