Makefile 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  1. TOPDIR = ../../
  2. EXTRA_LOCALE_DIR:=${shell cd $(TOPDIR)/extra/locale && pwd}
  3. include $(TOPDIR)Rules.mak
  4. CFLAGS_wc8bit=-DCTYPE_PACKED=1
  5. CFLAGS_mmap=
  6. ifeq ($(strip $(UCLIBC_HAS_WCHAR)),y)
  7. CFLAGS_wc8bit += -DDO_WIDE_CHAR=1
  8. CFLAGS_mmap += -D__WCHAR_ENABLED=1
  9. endif
  10. all: links-target
  11. codesets.txt:
  12. @if [ ! -f codesets.txt ] ; then \
  13. set -e; \
  14. echo " "; \
  15. echo "You do not have a codesets.txt file. Please create this "; \
  16. echo "file in the extra/locale directory by running something like: "; \
  17. echo -e " find $(EXTRA_LOCALE_DIR)/charmaps -name \"*.pairs\" > \\"; \
  18. echo -e " $(EXTRA_LOCALE_DIR)/codesets.txt"; \
  19. echo "and then edit that file to disable/enable the codesets you wish to support. "; \
  20. echo " "; \
  21. false; \
  22. fi;
  23. gen_wc8bit: gen_wc8bit.c
  24. $(HOSTCC) $(HOSTCFLAGS) $(NATIVE_LDFLAGS) $(CFLAGS_wc8bit) $^ -o $@
  25. c8tables.h: gen_wc8bit codesets.txt
  26. ./gen_wc8bit `cat codesets.txt`
  27. gen_wctype: gen_wctype.c
  28. $(HOSTCC) $(HOSTCFLAGS) $(NATIVE_LDFLAGS) $^ -o $@
  29. # Warning! Beware tr_TR toupper/tolower exceptions!
  30. wctables.h: gen_wctype
  31. ./gen_wctype en_US
  32. gen_locale: gen_locale.c c8tables.h
  33. $(HOSTCC) $(HOSTCFLAGS) $(NATIVE_LDFLAGS) gen_locale.c -o $@
  34. # TODO: if no wide char support, we should auto-disable all UTF-8 locales
  35. locale_tables.h: gen_locale locales.txt
  36. ./gen_locale locales.txt
  37. lt_defines.h: locale_tables.h locale_collate.h
  38. grep "^#define" locale_tables.h > lt_defines.h
  39. grep "^#define __lc" locale_collate.h >> lt_defines.h
  40. gen_collate: gen_collate.c
  41. $(HOSTCC) $(HOSTCFLAGS) $(NATIVE_LDFLAGS) gen_collate.c -o $@
  42. locale_collate.h: gen_collate locale_tables.h
  43. grep COL_IDX_ locale_tables.h | sed -e "s/^.*COL_IDX_\([^, ]*\).*$$/\1/" | sort | uniq | xargs ./gen_collate
  44. locales.txt:
  45. @if [ ! -f locales.txt ] ; then \
  46. set -e; \
  47. echo " "; \
  48. echo "You do not have a locales.txt file in the extra/locale "; \
  49. echo "directory, Please copy the LOCALES file to locales.txt by "; \
  50. echo "running something like: "; \
  51. echo " cp $(EXTRA_LOCALE_DIR)/LOCALES \\ "; \
  52. echo " $(EXTRA_LOCALE_DIR)/locales.txt "; \
  53. echo "then edit locales.txt to disable/enable the locales you wish "; \
  54. echo "to support. "; \
  55. echo " "; \
  56. false; \
  57. fi;
  58. # ifneq ($(TARGET_ARCH),$(HOST_ARCH))
  59. # locale.mmap: gen_mmap
  60. # echo Your locale.mmap file is either missing or out of date.
  61. # echo The developmental code can only generate one for the
  62. # echo target arch == native arch case. Sorry.
  63. # else
  64. # gen_mmap: gen_mmap.c c8tables.h wctables.h locale_tables.h
  65. # gcc $(CFLAGS_mmap) -Os -Wall -static gen_mmap.c -o gen_mmap
  66. # locale.mmap: gen_mmap
  67. # ./gen_mmap
  68. # endif
  69. # lmmtolso: lmmtolso.c
  70. # gcc -Os -Wall lmmtolso.c -o lmmtolso
  71. # locale_data.c: lmmtolso locale.mmap
  72. # ./lmmtolso
  73. gen_ldc: gen_ldc.c c8tables.h wctables.h locale_tables.h locale_collate.h
  74. $(HOSTCC) $(HOSTCFLAGS) $(NATIVE_LDFLAGS) $(CFLAGS_mmap) gen_ldc.c -o $@
  75. #gen_ldc.c -o gen_ldc
  76. locale_data.c: gen_ldc
  77. ./gen_ldc
  78. locale_data.o: locale_data.c lt_defines.h
  79. $(CC) $(CFLAGS_mmap) -c locale_data.c
  80. $(STRIPTOOL) -x -R .note -R .comment locale_data.o
  81. uClibc_locale_data.h: c8tables.h wctables.h lt_defines.h locale_mmap.h
  82. grep -v "define __LC" lt_defines.h > uClibc_locale_data.h
  83. cat c8tables.h wctables.h locale_mmap.h >> uClibc_locale_data.h
  84. links-target: locale_data.o uClibc_locale_data.h
  85. ln -sf ../../../extra/locale/locale_data.o ../../libc/misc/locale
  86. cp uClibc_locale_data.h ../../libc/sysdeps/linux/common/bits/
  87. pregen:
  88. $(CC) $(CFLAGS_mmap) -c locale_data.c
  89. $(STRIPTOOL) -x -R .note -R .comment locale_data.o
  90. ln -sf ../../../extra/locale/locale_data.o ../../libc/misc/locale
  91. cp uClibc_locale_data.h ../../libc/sysdeps/linux/common/bits/
  92. clean:
  93. rm -f *.[oa] *~ core
  94. rm -f gen_wc8bit gen_wctype gen_locale gen_ldc gen_collate
  95. rm -f c8tables.h wctables.h locale_tables.h lt_defines.h locale_collate.h
  96. rm -f gen_mmap locale.mmap lmmtolso
  97. rm -f locale_data.c locale_data.o uClibc_locale_data.h