Makefile.in 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144
  1. # Makefile for uClibc
  2. #
  3. # Copyright (C) 2000-2008 Erik Andersen <andersen@uclibc.org>
  4. #
  5. # Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
  6. #
  7. subdirs += libc/string/$(TARGET_ARCH) libc/string/generic
  8. #
  9. # Arch specific fun
  10. #
  11. # Collect the subarch specific implementation (asm files)
  12. ifneq ($(strip $(TARGET_SUBARCH)),)
  13. STRING_SUBARCH_DIR := $(top_srcdir)libc/string/$(TARGET_ARCH)/$(TARGET_SUBARCH)
  14. STRING_SUBARCH_OUT := $(top_builddir)libc/string/$(TARGET_ARCH)/$(TARGET_SUBARCH)
  15. STRING_SUBARCH_SSRC := $(wildcard $(STRING_SUBARCH_OUT)/*.S)
  16. STRING_SUBARCH_SOBJ := $(patsubst $(STRING_SUBARCH_DIR)/%.S,$(STRING_SUBARCH_OUT)/%.o,$(STRING_SUBARCH_SSRC))
  17. STRING_SUBARCH_CSRC := $(wildcard $(STRING_SUBARCH_OUT)/*.c)
  18. STRING_SUBARCH_COBJ := $(patsubst $(STRING_SUBARCH_DIR)/%.c,$(STRING_SUBARCH_OUT)/%.o,$(STRING_SUBARCH_CSRC))
  19. STRING_SUBARCH_OBJS := $(STRING_SUBARCH_SOBJ) $(STRING_SUBARCH_COBJ)
  20. endif
  21. # Collect the arch specific implementation (asm, c files)
  22. STRING_ARCH_DIR := $(top_srcdir)libc/string/$(TARGET_ARCH)
  23. STRING_ARCH_OUT := $(top_builddir)libc/string/$(TARGET_ARCH)
  24. STRING_ARCH_SRC := $(wildcard $(STRING_ARCH_DIR)/*.c)
  25. STRING_ARCH_OBJ := $(patsubst $(STRING_ARCH_DIR)/%.c,$(STRING_ARCH_OUT)/%.o,$(STRING_ARCH_SRC))
  26. STRING_ARCH_SSRC := $(wildcard $(STRING_ARCH_DIR)/*.S)
  27. # Exclude the subarch implementation from the arch ones
  28. ifneq ($(strip $(STRING_SUBARCH_OBJS)),)
  29. STRING_ARCH_SSRC := $(filter-out $(patsubst %.o,$(STRING_ARCH_DIR)/%.S,$(notdir $(STRING_SUBARCH_OBJS))),$(STRING_ARCH_SSRC))
  30. endif
  31. STRING_ARCH_SOBJ := $(patsubst $(STRING_ARCH_DIR)/%.S,$(STRING_ARCH_OUT)/%.o,$(STRING_ARCH_SSRC))
  32. STRING_ARCH_OBJS := $(STRING_ARCH_OBJ) $(STRING_ARCH_SOBJ)
  33. libc-$(UCLIBC_HAS_STRING_ARCH_OPT) += $(STRING_ARCH_OBJS) $(STRING_SUBARCH_OBJS)
  34. libc-nomulti-$(UCLIBC_HAS_STRING_ARCH_OPT) += $(STRING_ARCH_SOBJ) $(STRING_SUBARCH_OBJS)
  35. #
  36. # Generic stuff
  37. #
  38. STRING_GENERIC_DIR := $(top_srcdir)libc/string/generic
  39. STRING_GENERIC_OUT := $(top_builddir)libc/string/generic
  40. STRING_GENERIC_SRC := $(wildcard $(STRING_GENERIC_DIR)/*.c)
  41. STRING_GENERIC_SRC := $(filter-out $(STRING_GENERIC_DIR)/_memcpy_fwd.c, $(STRING_GENERIC_SRC))
  42. ifeq ($(UCLIBC_HAS_STRING_ARCH_OPT),y)
  43. ifneq ($(strip $(STRING_ARCH_OBJS)),)
  44. STRING_GENERIC_SRC := $(filter-out $(patsubst %.o,$(STRING_GENERIC_DIR)/%.c,$(notdir $(STRING_ARCH_OBJS))),$(STRING_GENERIC_SRC))
  45. endif
  46. ifneq ($(strip $(STRING_SUBARCH_OBJS)),)
  47. STRING_GENERIC_SRC := $(filter-out $(patsubst %.o,$(STRING_GENERIC_DIR)/%.c,$(notdir $(STRING_SUBARCH_OBJS))),$(STRING_GENERIC_SRC))
  48. endif
  49. endif
  50. STRING_GENERIC_OBJS := $(patsubst $(STRING_GENERIC_DIR)/%.c,$(STRING_GENERIC_OUT)/%.o,$(STRING_GENERIC_SRC))
  51. libc-$(UCLIBC_HAS_STRING_GENERIC_OPT) += $(STRING_GENERIC_OBJS)
  52. #
  53. # Top level string
  54. #
  55. STRING_DIR := $(top_srcdir)libc/string
  56. STRING_OUT := $(top_builddir)libc/string
  57. STRING_ALL_WXSRC := $(wildcard $(STRING_DIR)/w*_l.c)
  58. ifeq ($(UCLIBC_HAS_LOCALE),y)
  59. STRING_WXSRC := $(STRING_ALL_WXSRC)
  60. else
  61. # wcscoll_l
  62. STRING_WXSRC := $(filter-out $(STRING_DIR)/wcsxfrm_l.c,$(STRING_ALL_WXSRC))
  63. endif
  64. STRING_ALL_XLSRC := $(filter-out $(STRING_ALL_WXSRC),$(wildcard $(STRING_DIR)/*_l.c))
  65. ifeq ($(UCLIBC_HAS_LOCALE),y)
  66. STRING_XLSRC := $(STRING_ALL_XLSRC)
  67. else
  68. # strcoll_l
  69. STRING_XLSRC := $(filter-out $(STRING_DIR)/strxfrm_l.c,$(STRING_ALL_XLSRC))
  70. endif
  71. STRING_ALL_WSRC := $(filter-out $(STRING_ALL_WXSRC),$(wildcard $(STRING_DIR)/w*.c))
  72. ifeq ($(UCLIBC_HAS_LOCALE),y)
  73. STRING_WSRC := $(STRING_ALL_WSRC)
  74. else
  75. # wcscoll
  76. STRING_WSRC := $(filter-out $(STRING_DIR)/wcsxfrm.c,$(STRING_ALL_WSRC))
  77. endif
  78. STRING_ALL_CSRC := $(filter-out $(STRING_ALL_WXSRC) $(STRING_ALL_XLSRC) $(STRING_ALL_WSRC) $(STRING_DIR)/_collate.c,$(wildcard $(STRING_DIR)/*.c))
  79. ifeq ($(UCLIBC_HAS_LOCALE),y)
  80. STRING_CSRC := $(STRING_ALL_CSRC)
  81. else
  82. # strcoll
  83. STRING_CSRC := $(filter-out $(STRING_DIR)/strxfrm.c,$(STRING_ALL_CSRC))
  84. endif
  85. ifeq ($(UCLIBC_HAS_WCHAR),y)
  86. STRING_CSRC += $(STRING_WSRC)
  87. endif
  88. ifeq ($(UCLIBC_HAS_XLOCALE),y)
  89. STRING_CSRC += $(STRING_XLSRC)
  90. ifeq ($(UCLIBC_HAS_WCHAR),y)
  91. STRING_CSRC += $(STRING_WXSRC)
  92. endif
  93. endif
  94. ifeq ($(UCLIBC_HAS_STRING_ARCH_OPT),y)
  95. ifneq ($(strip $(STRING_ARCH_OBJS)),)
  96. STRING_CSRC := $(filter-out $(patsubst %.o,$(STRING_DIR)/%.c,$(notdir $(STRING_ARCH_OBJS))),$(STRING_CSRC))
  97. endif
  98. ifneq ($(strip $(STRING_SUBARCH_OBJS)),)
  99. STRING_CSRC := $(filter-out $(patsubst %.o,$(STRING_DIR)/%.c,$(notdir $(STRING_SUBARCH_OBJS))),$(STRING_CSRC))
  100. endif
  101. endif
  102. ifeq ($(UCLIBC_HAS_STRING_GENERIC_OPT),y)
  103. ifneq ($(strip $(STRING_GENERIC_OBJS)),)
  104. STRING_CSRC := $(filter-out $(patsubst %.o,$(STRING_DIR)/%.c,$(notdir $(STRING_GENERIC_OBJS))),$(STRING_CSRC))
  105. endif
  106. endif
  107. STRING_COBJ := $(patsubst $(STRING_DIR)/%.c,$(STRING_OUT)/%.o,$(STRING_CSRC))
  108. libc-y += $(STRING_COBJ)
  109. libc-nomulti-$(UCLIBC_HAS_XLOCALE) += $(STRING_OUT)/wcsxfrm_l.o
  110. libc-nomulti-y += $(STRING_OUT)/__xpg_strerror_r.o
  111. objclean-y += CLEAN_libc/string
  112. CLEAN_libc/string:
  113. $(do_rm) $(addprefix $(STRING_OUT)/,$(addprefix *., o os oS) $(addprefix */*., o os oS) $(addprefix */*/*., o os oS))