Makefile.in 5.7 KB

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