Makefile.in 7.1 KB

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