diff options
Diffstat (limited to 'extra/locale')
-rw-r--r-- | extra/locale/Makefile.in | 165 |
1 files changed, 165 insertions, 0 deletions
diff --git a/extra/locale/Makefile.in b/extra/locale/Makefile.in new file mode 100644 index 000000000..e7ca2154f --- /dev/null +++ b/extra/locale/Makefile.in @@ -0,0 +1,165 @@ +# Makefile for uClibc +# +# Copyright (C) 2000-2005 Erik Andersen <andersen@uclibc.org> +# +# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. +# + +HOSTCFLAGS-locale-common := -D__UCLIBC_GEN_LOCALE + +HOSTCFLAGS-gen_wc8bit := $(HOSTCFLAGS-locale-common) -DCTYPE_PACKED=1 + +HOSTCFLAGS-gen_wctype := $(HOSTCFLAGS-locale-common) + +HOSTCFLAGS-gen_ldc := +ifeq ($(UCLIBC_HAS_WCHAR),y) +HOSTCFLAGS-gen_wc8bit += -DDO_WIDE_CHAR=1 +HOSTCFLAGS-gen_ldc += -D__WCHAR_ENABLED=1 +endif + +DEPH-locale := $(top_builddir)include/bits/sysnum.h +DEPH-gen_locale := c8tables.h +DEPH-gen_ldc := c8tables.h wctables.h locale_tables.h locale_collate.h + +locale_DIR := $(top_srcdir)extra/locale +locale_OUT := $(top_builddir)extra/locale + +#locale_OBJ := gen_collate gen_ldc gen_locale gen_wc8bit gen_wctype +locale_OBJ := gen_collate gen_wc8bit gen_wctype +locale_OBJ := $(patsubst %,$(locale_OUT)/%,$(locale_OBJ)) + +ifeq ($(UCLIBC_HAS_LOCALE),y) +locale_objs: locale_build +else +locale_objs: +endif + +objs: locale_objs + +# make sure that the host system has locales (this check is ok for uClibc/glibc) +# we do not know though which locales were really enabled for libc at build time +ifeq ($(wildcard /usr/include/iconv.h),) + +$(locale_OUT)/codesets.txt: + @if [ ! -f $@ ] ; then \ + set -e; \ + echo " "; \ + echo "You do not have a codesets.txt file. Please create this "; \ + echo "file in the $(locale_OUT) directory by running something like: "; \ + echo -e " find $(locale_DIR)/charmaps -name \"*.pairs\" > \\"; \ + echo -e " $@"; \ + echo "and then edit that file to disable/enable the codesets you wish to support. "; \ + echo " "; \ + false; \ + fi; + +$(locale_OUT)/locales.txt: + @if [ ! -f $@ ] ; then \ + set -e; \ + echo " "; \ + echo "You do not have a locales.txt file in the $(locale_OUT) "; \ + echo "directory, Please copy the LOCALES file to locales.txt by "; \ + echo "running something like: "; \ + echo " cp $(locale_DIR)/LOCALES \\ "; \ + echo " $@ "; \ + echo "then edit locales.txt to disable/enable the locales you wish "; \ + echo "to support. "; \ + echo " "; \ + false; \ + fi; + +else + +$(locale_OUT)/codesets.txt: +ifeq ($(UCLIBC_BUILD_MINIMAL_LOCALE),y) + echo "$(locale_DIR)/charmaps/ASCII.pairs" > $@ ; \ + echo "$(locale_DIR)/charmaps/ISO-8859-1.pairs" >> $@ +else + find $(locale_DIR)/charmaps -name '*.pairs' | sort > $@ +endif + +# the lines beginning w/ '#-' are mandatory +# at least one conversion is needed (euro/cyrillic) +$(locale_OUT)/locales.txt: $(locale_DIR)/LOCALES +ifeq ($(UCLIBC_BUILD_MINIMAL_LOCALE),y) + echo "@euro e" > $@ ; \ + echo "#-" >> $@ ; \ + echo "UTF-8 yes" >> $@ ; \ + echo "8-BIT yes" >> $@ ; \ + echo "#-" >> $@ ; \ + echo "en_US.UTF-8 UTF-8" >> $@ ; \ + echo "en_US ISO-8859-1" >> $@ +else + cp $< $@ +endif + +endif + +$(locale_OBJ): $(locale_OUT)/% : $(locale_DIR)/%.c | $(DEPH-locale) + $(hcompile.u) + +$(locale_OUT)/gen_locale : $(locale_DIR)/gen_locale.c | $(DEPH-locale) $(patsubst %,$(locale_OUT)/%,$(DEPH-gen_locale)) + $(hcompile.u) + +$(locale_OUT)/gen_ldc : $(locale_DIR)/gen_ldc.c | $(DEPH-locale) $(patsubst %,$(locale_OUT)/%,$(DEPH-gen_ldc)) + $(hcompile.u) + +# code needs to be modified to support top_builddir in almost all apps that right directly to a file +# grep fopen *.c +$(locale_OUT)/c8tables.h: $(locale_OUT)/gen_wc8bit $(locale_OUT)/codesets.txt + $< `cat $(word 2,$^)` + +# Warning! Beware tr_TR toupper/tolower exceptions! +$(locale_OUT)/wctables.h: $(locale_OUT)/gen_wctype + $< en_US + +$(locale_OUT)/locale_tables.h: $(locale_OUT)/gen_locale $(locale_OUT)/locales.txt + $< $(word 2,$^) + +$(locale_OUT)/lt_defines.h: $(locale_OUT)/locale_tables.h $(locale_OUT)/locale_collate.h + grep "^#define" $< > $@ + grep "^#define __lc" $(word 2,$^) >> $@ + +$(locale_OUT)/locale_collate.h: $(locale_OUT)/gen_collate $(locale_OUT)/locale_tables.h + grep COL_IDX_ $(word 2,$^) | sed -e "s/^.*COL_IDX_\([^, ]*\).*$$/\1/" | \ + sort | uniq | xargs $< + +$(locale_OUT)/locale_data.c: $(locale_OUT)/gen_ldc + $< + +ifeq ($(UCLIBC_PREGENERATED_LOCALE_DATA),y) + +#$(locale_OUT)/uClibc_locale_data.h: +# cp $(locale_DIR)/full/common/*.h $(locale_OUT)/ +#ifeq ($(wildcard $(locale_DIR)/full/$(TARGET_ARCH)/*.c),) +# cp $(locale_DIR)/full/orig/*.{c,h} $(locale_OUT)/ +#else +# # we need here support for endian versions +# cp $(locale_DIR)/full/$(TARGET_ARCH)/*.{h,c} $(locale_OUT)/ +#endif + +locale_build: $(top_builddir)include/bits/uClibc_locale_data.h + +else + +$(locale_OUT)/uClibc_locale_data.h: $(locale_OUT)/lt_defines.h $(locale_OUT)/c8tables.h $(locale_OUT)/wctables.h $(locale_OUT)/locale_mmap.h + grep -v "define __LC" $< > $@ + cat $(wordlist 2,3,4,$^) >> $@ + +locale_build: $(top_builddir)include/bits/uClibc_locale_data.h $(locale_OUT)/locale_data.c + +endif + +$(top_builddir)include/bits/uClibc_locale_data.h: $(locale_OUT)/uClibc_locale_data.h $(top_builddir)include/bits/sysnum.h + cat $< | awk 'BEGIN{i=1}{ if ( /WANT_/ ) i = /endif/ ; else if (i) print $0 }' > $@ + +# to be removed after included by top Makefile.in +clean: locale_clean + +objclean-y += locale_clean + +# lmmtolso.c/gen_mmap.c/tst-*.c not used +locale_clean: + $(RM) $(locale_OBJ) $(locale_OUT)/{*.txt,locale_data.c,gen_locale,gen_ldc} + $(RM) $(locale_OUT)/{uClibc_locale_data,lt_defines,c8tables,wctables,locale_tables,locale_collate}.h + $(RM) $(locale_OUT)/{lmmtolso,gen_mmap,locale.mmap} |