Makefile.in 7.0 KB

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