Makefile.in 5.7 KB

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