Makefile 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. # Makefile for uClibc
  2. #
  3. # Copyright (C) 2000-2005 Erik Andersen <andersen@uclibc.org>
  4. #
  5. # Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
  6. #
  7. top_builddir=../../
  8. include $(top_builddir)Rules.mak
  9. EXTRA_LOCALE_DIR:=${shell cd $(top_builddir)extra/locale && pwd}
  10. CFLAGS_wc8bit=-DCTYPE_PACKED=1
  11. CFLAGS_mmap=
  12. ifeq ($(UCLIBC_HAS_WCHAR),y)
  13. CFLAGS_wc8bit += -DDO_WIDE_CHAR=1
  14. CFLAGS_mmap += -D__WCHAR_ENABLED=1
  15. endif
  16. all: links-target
  17. codesets.txt:
  18. @if [ ! -f codesets.txt ] ; then \
  19. set -e; \
  20. echo " "; \
  21. echo "You do not have a codesets.txt file. Please create this "; \
  22. echo "file in the extra/locale directory by running something like: "; \
  23. echo -e " find $(EXTRA_LOCALE_DIR)/charmaps -name \"*.pairs\" > \\"; \
  24. echo -e " $(EXTRA_LOCALE_DIR)/codesets.txt"; \
  25. echo "and then edit that file to disable/enable the codesets you wish to support. "; \
  26. echo " "; \
  27. false; \
  28. fi;
  29. gen_wc8bit: gen_wc8bit.c
  30. $(HOSTCC) $(HOSTCFLAGS) $(NATIVE_LDFLAGS) $(CFLAGS_wc8bit) -D__UCLIBC_GEN_LOCALE $^ -o $@
  31. c8tables.h: gen_wc8bit codesets.txt
  32. ./gen_wc8bit `cat codesets.txt`
  33. gen_wctype: gen_wctype.c
  34. $(HOSTCC) $(HOSTCFLAGS) $(NATIVE_LDFLAGS) -D__UCLIBC_GEN_LOCALE $^ -o $@
  35. # Warning! Beware tr_TR toupper/tolower exceptions!
  36. wctables.h: gen_wctype
  37. ./gen_wctype en_US
  38. gen_locale: gen_locale.c c8tables.h
  39. $(HOSTCC) $(HOSTCFLAGS) $(NATIVE_LDFLAGS) gen_locale.c -o $@
  40. locale_tables.h: gen_locale locales.txt
  41. ./gen_locale locales.txt
  42. lt_defines.h: locale_tables.h locale_collate.h
  43. grep "^#define" locale_tables.h > lt_defines.h
  44. grep "^#define __lc" locale_collate.h >> lt_defines.h
  45. gen_collate: gen_collate.c
  46. $(HOSTCC) $(HOSTCFLAGS) $(NATIVE_LDFLAGS) gen_collate.c -o $@
  47. locale_collate.h: gen_collate locale_tables.h
  48. grep COL_IDX_ locale_tables.h | sed -e "s/^.*COL_IDX_\([^, ]*\).*$$/\1/" | sort | uniq | xargs ./gen_collate
  49. locales.txt:
  50. @if [ ! -f locales.txt ] ; then \
  51. set -e; \
  52. echo " "; \
  53. echo "You do not have a locales.txt file in the extra/locale "; \
  54. echo "directory, Please copy the LOCALES file to locales.txt by "; \
  55. echo "running something like: "; \
  56. echo " cp $(EXTRA_LOCALE_DIR)/LOCALES \\ "; \
  57. echo " $(EXTRA_LOCALE_DIR)/locales.txt "; \
  58. echo "then edit locales.txt to disable/enable the locales you wish "; \
  59. echo "to support. "; \
  60. echo " "; \
  61. false; \
  62. fi;
  63. gen_ldc: gen_ldc.c c8tables.h wctables.h locale_tables.h locale_collate.h
  64. $(HOSTCC) $(HOSTCFLAGS) $(NATIVE_LDFLAGS) $(CFLAGS_mmap) gen_ldc.c -o $@
  65. locale_data.c: gen_ldc
  66. ./gen_ldc
  67. uClibc_locale_data.h: c8tables.h wctables.h lt_defines.h locale_mmap.h
  68. grep -v "define __LC" lt_defines.h > uClibc_locale_data.h
  69. cat c8tables.h wctables.h locale_mmap.h >> uClibc_locale_data.h
  70. links-target: locale_data.c uClibc_locale_data.h
  71. cat uClibc_locale_data.h | awk 'BEGIN{i=1}{ if ( /WANT_/ ) i = /endif/ ; else if (i) print $0 }' > ../../include/bits/uClibc_locale_data.h
  72. pregen:
  73. cat uClibc_locale_data.h | awk 'BEGIN{i=1}{ if ( /WANT_/ ) i = /endif/ ; else if (i) print $0 }' > ../../include/bits/uClibc_locale_data.h
  74. clean:
  75. $(RM) *.o *~ core
  76. $(RM) gen_wc8bit gen_wctype gen_locale gen_ldc gen_collate
  77. $(RM) c8tables.h wctables.h locale_tables.h lt_defines.h locale_collate.h
  78. $(RM) gen_mmap locale.mmap lmmtolso
  79. $(RM) locale_data.c uClibc_locale_data.h
  80. .PHONY: pregen links-target