Makefile.in 7.2 KB

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