Makefile.in 5.7 KB

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