Makefile 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  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. $(NATIVE_CC) $(NATIVE_CFLAGS) $(NATIVE_LDFLAGS) $(CFLAGS_wc8bit) $^ -o $@
  25. #gen_wc8bit.c -o gen_wc8bit
  26. c8tables.h: gen_wc8bit codesets.txt
  27. ./gen_wc8bit `cat codesets.txt`
  28. gen_wctype: gen_wctype.c
  29. $(NATIVE_CC) $(NATIVE_CFLAGS) $(NATIVE_LDFLAGS) $^ -o $@
  30. #gen_wctype.c -o gen_wctype
  31. # Warning! Beware tr_TR toupper/tolower exceptions!
  32. # Warning! Ignore the width table. It will go away.
  33. wctables.h: gen_wctype
  34. ./gen_wctype en_US
  35. gen_locale: gen_locale.c c8tables.h
  36. $(NATIVE_CC) $(NATIVE_CFLAGS) $(NATIVE_LDFLAGS) gen_locale.c -o $@
  37. #gen_locale.c -o gen_locale
  38. # TODO: if no wide char support, we should auto-disable all UTF-8 locales
  39. locale_tables.h: gen_locale locales.txt
  40. ./gen_locale locales.txt
  41. lt_defines.h: locale_tables.h
  42. grep "^#define" locale_tables.h > lt_defines.h
  43. locales.txt:
  44. @if [ ! -f locales.txt ] ; then \
  45. set -e; \
  46. echo " "; \
  47. echo "You do not have a locales.txt file in the extra/locale "; \
  48. echo "directory, Please copy the LOCALES file to locales.txt by "; \
  49. echo "running something like: "; \
  50. echo " cp $(EXTRA_LOCALE_DIR)/LOCALES \\ "; \
  51. echo " $(EXTRA_LOCALE_DIR)/locales.txt "; \
  52. echo "then edit locales.txt to disable/enable the locales you wish "; \
  53. echo "to support. "; \
  54. echo " "; \
  55. false; \
  56. fi;
  57. # ifneq ($(TARGET_ARCH),$(NATIVE_ARCH))
  58. # locale.mmap: gen_mmap
  59. # echo Your locale.mmap file is either missing or out of date.
  60. # echo The developmental code can only generate one for the
  61. # echo target arch == native arch case. Sorry.
  62. # else
  63. # gen_mmap: gen_mmap.c c8tables.h wctables.h locale_tables.h
  64. # gcc $(CFLAGS_mmap) -Os -Wall -static gen_mmap.c -o gen_mmap
  65. # locale.mmap: gen_mmap
  66. # ./gen_mmap
  67. # endif
  68. # lmmtolso: lmmtolso.c
  69. # gcc -Os -Wall lmmtolso.c -o lmmtolso
  70. # locale_data.c: lmmtolso locale.mmap
  71. # ./lmmtolso
  72. gen_ldc: gen_ldc.c c8tables.h wctables.h locale_tables.h
  73. $(NATIVE_CC) $(NATIVE_CFLAGS) $(NATIVE_LDFLAGS) $(CFLAGS_mmap) gen_ldc.c -o $@
  74. #gen_ldc.c -o gen_ldc
  75. locale_data.c: gen_ldc
  76. ./gen_ldc
  77. locale_data.o: locale_data.c lt_defines.h
  78. $(CC) $(CFLAGS_mmap) -c locale_data.c
  79. $(STRIPTOOL) -x -R .note -R .comment locale_data.o
  80. uClibc_locale_data.h: c8tables.h wctables.h lt_defines.h locale_mmap.h
  81. grep -v "define __LC" lt_defines.h > uClibc_locale_data.h
  82. cat c8tables.h wctables.h locale_mmap.h >> uClibc_locale_data.h
  83. links-target: locale_data.o uClibc_locale_data.h
  84. ln -sf ../../../extra/locale/locale_data.o ../../libc/misc/locale
  85. cp uClibc_locale_data.h ../../libc/sysdeps/linux/common/bits/
  86. clean:
  87. rm -f *.[oa] *~ core
  88. rm -f gen_wc8bit gen_wctype gen_locale gen_ldc
  89. rm -f c8tables.h wctables.h locale_tables.h lt_defines.h
  90. rm -f gen_mmap locale.mmap lmmtolso
  91. rm -f locale_data.c locale_data.o uClibc_locale_data.h