Makefile.in 5.8 KB

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