Makefile.in 7.2 KB

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