Makefile.in 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181
  1. # Makefile for uClibc
  2. #
  3. # Copyright (C) 2000-2006 Erik Andersen <andersen@uclibc.org>
  4. #
  5. # Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
  6. #
  7. # command used to download source code
  8. WGET := wget --passive-ftp
  9. LOCALE_DATA_FILENAME := uClibc-locale-030818.tgz
  10. BUILD_CFLAGS-locale-common := -D__UCLIBC_GEN_LOCALE
  11. BUILD_CFLAGS-gen_wc8bit := $(BUILD_CFLAGS-locale-common) -DCTYPE_PACKED=1
  12. BUILD_CFLAGS-gen_wctype := $(BUILD_CFLAGS-locale-common)
  13. BUILD_CFLAGS-gen_ldc :=
  14. ifeq ($(UCLIBC_HAS_WCHAR),y)
  15. BUILD_CFLAGS-gen_wc8bit += -DDO_WIDE_CHAR=1
  16. BUILD_CFLAGS-gen_ldc += -D__WCHAR_ENABLED=1
  17. endif
  18. DEPH-locale := $(top_builddir)include/bits/sysnum.h
  19. DEPH-gen_locale := c8tables.h
  20. DEPH-gen_ldc := c8tables.h wctables.h locale_tables.h locale_collate.h
  21. locale_DIR := $(top_srcdir)extra/locale
  22. locale_OUT := $(top_builddir)extra/locale
  23. #locale_HOBJ := gen_collate gen_ldc gen_locale gen_wc8bit gen_wctype
  24. locale_HOBJ := gen_collate gen_wc8bit gen_wctype
  25. locale_HOBJ := $(patsubst %,$(locale_OUT)/%,$(locale_HOBJ))
  26. locale_SRC := $(locale_OUT)/locale_data.c
  27. locale_OBJ := $(locale_OUT)/locale_data.o
  28. CFLAGS-locale_data.c := -D__WCHAR_ENABLED -I$(locale_OUT) -I$(locale_DIR)
  29. # produces a loop
  30. #headers-$(UCLIBC_HAS_LOCALE) += locale_headers
  31. libc-$(UCLIBC_HAS_LOCALE) += $(locale_OBJ)
  32. libc-nomulti-$(UCLIBC_HAS_LOCALE) += $(locale_OBJ)
  33. locale_headers: $(top_builddir)include/bits/uClibc_locale_data.h
  34. # make sure that the host system has locales (this check is ok for uClibc/glibc)
  35. # we do not know though which locales were really enabled for libc at build time
  36. ifeq ($(wildcard /usr/include/iconv.h),)
  37. $(locale_OUT)/codesets.txt:
  38. @if [ ! -f $@ ] ; then \
  39. set -e; \
  40. echo " "; \
  41. echo "You do not have a codesets.txt file. Please create this "; \
  42. echo "file in the $(locale_OUT) directory by running something like: "; \
  43. echo -e " find $(locale_DIR)/charmaps -name \"*.pairs\" > \\"; \
  44. echo -e " $@"; \
  45. echo "and then edit that file to disable/enable the codesets you wish to support. "; \
  46. echo " "; \
  47. false; \
  48. fi;
  49. $(locale_OUT)/locales.txt:
  50. @if [ ! -f $@ ] ; then \
  51. set -e; \
  52. echo " "; \
  53. echo "You do not have a locales.txt file in the $(locale_OUT) "; \
  54. echo "directory, Please copy the LOCALES file to locales.txt by "; \
  55. echo "running something like: "; \
  56. echo " cp $(locale_DIR)/LOCALES \\ "; \
  57. echo " $@ "; \
  58. echo "then edit locales.txt to disable/enable the locales you wish "; \
  59. echo "to support. "; \
  60. echo " "; \
  61. false; \
  62. fi;
  63. else
  64. $(locale_OUT)/codesets.txt:
  65. ifeq ($(UCLIBC_BUILD_MINIMAL_LOCALE),y)
  66. echo "$(locale_DIR)/charmaps/ASCII.pairs" > $@ ; \
  67. echo "$(locale_DIR)/charmaps/ISO-8859-1.pairs" >> $@
  68. else
  69. find $(locale_DIR)/charmaps -name '*.pairs' | sort > $@
  70. endif
  71. # the lines beginning w/ '#-' are mandatory
  72. # at least one conversion is needed (euro/cyrillic)
  73. $(locale_OUT)/locales.txt: $(locale_DIR)/LOCALES
  74. ifeq ($(UCLIBC_BUILD_MINIMAL_LOCALE),y)
  75. echo "@euro e" > $@ ; \
  76. echo "#-" >> $@ ; \
  77. echo "UTF-8 yes" >> $@ ; \
  78. echo "8-BIT yes" >> $@ ; \
  79. echo "#-" >> $@ ; \
  80. echo "en_US.UTF-8 UTF-8" >> $@ ; \
  81. echo "en_US ISO-8859-1" >> $@
  82. else
  83. cp $< $@
  84. endif
  85. endif
  86. $(locale_HOBJ): $(locale_OUT)/% : $(locale_DIR)/%.c | $(DEPH-locale)
  87. $(hcompile.u)
  88. $(locale_OUT)/gen_locale : $(locale_DIR)/gen_locale.c | $(DEPH-locale) $(patsubst %,$(locale_OUT)/%,$(DEPH-gen_locale))
  89. $(hcompile.u)
  90. $(locale_OUT)/gen_ldc : $(locale_DIR)/gen_ldc.c | $(DEPH-locale) $(patsubst %,$(locale_OUT)/%,$(DEPH-gen_ldc))
  91. $(hcompile.u)
  92. # code needs to be modified to support top_builddir in almost all apps that write directly to a file
  93. # grep fopen *.c
  94. $(locale_OUT)/c8tables.h: $(locale_OUT)/gen_wc8bit $(locale_OUT)/codesets.txt
  95. $< `cat $(word 2,$^)`
  96. # Warning! Beware tr_TR toupper/tolower exceptions!
  97. $(locale_OUT)/wctables.h: $(locale_OUT)/gen_wctype
  98. $< en_US
  99. $(locale_OUT)/locale_tables.h: $(locale_OUT)/gen_locale $(locale_OUT)/locales.txt
  100. $< $(word 2,$^)
  101. $(locale_OUT)/lt_defines.h: $(locale_OUT)/locale_tables.h $(locale_OUT)/locale_collate.h
  102. grep "^#define" $< > $@
  103. grep "^#define __lc" $(word 2,$^) >> $@
  104. $(locale_OUT)/locale_collate.h: $(locale_OUT)/gen_collate $(locale_OUT)/locale_tables.h
  105. grep COL_IDX_ $(word 2,$^) | sed -e "s/^.*COL_IDX_\([^, ]*\).*$$/\1/" | \
  106. sort | uniq | xargs $<
  107. $(locale_OUT)/$(LOCALE_DATA_FILENAME):
  108. ifeq ($(UCLIBC_DOWNLOAD_PREGENERATED_LOCALE_DATA),y)
  109. ( cd $(dir $@); $(WGET) http://www.uclibc.org/downloads/$(notdir $@) )
  110. endif
  111. ifeq ($(UCLIBC_PREGENERATED_LOCALE_DATA),y)
  112. $(locale_SRC): $(locale_OUT)/$(LOCALE_DATA_FILENAME)
  113. zcat $< | tar -xv -C $(dir $@) -f -
  114. touch $@
  115. # we use the one in locale_DIR
  116. #$(RM) $(locale_OUT)/locale_mmap.h
  117. # for arch specific versions we have to at least overwrite lt_defines.h/locale_data.c/uClibc_locale_data.h
  118. $(locale_OUT)/uClibc_locale_data.h: $(locale_SRC)
  119. else
  120. $(locale_SRC): $(locale_OUT)/gen_ldc
  121. $<
  122. $(locale_OUT)/uClibc_locale_data.h: $(locale_OUT)/lt_defines.h $(locale_OUT)/c8tables.h $(locale_OUT)/wctables.h $(locale_DIR)/locale_mmap.h | $(locale_SRC)
  123. grep -v "define __LC" $< > $@
  124. cat $(wordlist 2,3,4,$^) >> $@
  125. endif
  126. $(locale_OBJ): $(locale_SRC) | $(headers_dep)
  127. $(compile.c)
  128. $(locale_OBJ:.o=.os): $(locale_SRC) | $(headers_dep)
  129. $(compile.c)
  130. $(top_builddir)include/bits/uClibc_locale_data.h: $(locale_OUT)/uClibc_locale_data.h | $(top_builddir)include/bits/uClibc_config.h
  131. cat $< | awk 'BEGIN{i=1}{ if ( /WANT_/ ) i = /endif/ ; else if (i) print $0 }' > $@
  132. objclean-y += locale_clean
  133. # lmmtolso.c/gen_mmap.c/tst-*.c not used
  134. locale_clean:
  135. $(RM) $(locale_HOBJ) $(locale_SRC) $(locale_OUT)/{*.{o,os,txt},gen_locale,gen_ldc}
  136. $(RM) $(locale_OUT)/{uClibc_locale_data,lt_defines,c8tables,wctables,locale_tables,locale_collate}.h
  137. $(RM) $(locale_OUT)/{lmmtolso,gen_mmap,locale.mmap}