Makefile 3.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  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) -D__UCLIBC_GEN_LOCALE $^ -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) -D__UCLIBC_GEN_LOCALE $^ -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. locale_tables.h: gen_locale locales.txt
  35. ./gen_locale locales.txt
  36. lt_defines.h: locale_tables.h locale_collate.h
  37. grep "^#define" locale_tables.h > lt_defines.h
  38. grep "^#define __lc" locale_collate.h >> lt_defines.h
  39. gen_collate: gen_collate.c
  40. $(HOSTCC) $(HOSTCFLAGS) $(NATIVE_LDFLAGS) gen_collate.c -o $@
  41. locale_collate.h: gen_collate locale_tables.h
  42. grep COL_IDX_ locale_tables.h | sed -e "s/^.*COL_IDX_\([^, ]*\).*$$/\1/" | sort | uniq | xargs ./gen_collate
  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. gen_ldc: gen_ldc.c c8tables.h wctables.h locale_tables.h locale_collate.h
  58. $(HOSTCC) $(HOSTCFLAGS) $(NATIVE_LDFLAGS) $(CFLAGS_mmap) gen_ldc.c -o $@
  59. locale_data.c: gen_ldc
  60. ./gen_ldc
  61. uClibc_locale_data.h: c8tables.h wctables.h lt_defines.h locale_mmap.h
  62. grep -v "define __LC" lt_defines.h > uClibc_locale_data.h
  63. cat c8tables.h wctables.h locale_mmap.h >> uClibc_locale_data.h
  64. links-target: locale_data.c uClibc_locale_data.h
  65. cat uClibc_locale_data.h | awk 'BEGIN{i=1}{ if ( /WANT_/ ) i = /endif/ ; else if (i) print $0 }' > ../../include/bits/uClibc_locale_data.h
  66. pregen:
  67. cat uClibc_locale_data.h | awk 'BEGIN{i=1}{ if ( /WANT_/ ) i = /endif/ ; else if (i) print $0 }' > ../../include/bits/uClibc_locale_data.h
  68. clean:
  69. $(RM) *.[oa] *~ core
  70. $(RM) gen_wc8bit gen_wctype gen_locale gen_ldc gen_collate
  71. $(RM) c8tables.h wctables.h locale_tables.h lt_defines.h locale_collate.h
  72. $(RM) gen_mmap locale.mmap lmmtolso
  73. $(RM) locale_data.c uClibc_locale_data.h
  74. .PHONY: pregen links-target