Makefile 3.1 KB

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