3 EXTRA_LOCALE_DIR:=${shell cd $(TOPDIR)/extra/locale && pwd}
4 include $(TOPDIR)Rules.mak
6 CFLAGS_wc8bit=-DCTYPE_PACKED=1
8 ifeq ($(strip $(UCLIBC_HAS_WCHAR)),y)
9 CFLAGS_wc8bit += -DDO_WIDE_CHAR=1
10 CFLAGS_mmap += -D__WCHAR_ENABLED=1
16 @if [ ! -f codesets.txt ] ; then \
19 echo "You do not have a codesets.txt file. Please create this "; \
20 echo "file in the extra/locale directory by running something like: "; \
21 echo -e " find $(EXTRA_LOCALE_DIR)/charmaps -name \"*.pairs\" > \\"; \
22 echo -e " $(EXTRA_LOCALE_DIR)/codesets.txt"; \
23 echo "and then edit that file to disable/enable the codesets you wish to support. "; \
28 gen_wc8bit: gen_wc8bit.c
29 $(HOSTCC) $(HOSTCFLAGS) $(NATIVE_LDFLAGS) $(CFLAGS_wc8bit) -D__UCLIBC_GEN_LOCALE $^ -o $@
31 c8tables.h: gen_wc8bit codesets.txt
32 ./gen_wc8bit `cat codesets.txt`
34 gen_wctype: gen_wctype.c
35 $(HOSTCC) $(HOSTCFLAGS) $(NATIVE_LDFLAGS) -D__UCLIBC_GEN_LOCALE $^ -o $@
37 # Warning! Beware tr_TR toupper/tolower exceptions!
38 wctables.h: gen_wctype
41 gen_locale: gen_locale.c c8tables.h
42 $(HOSTCC) $(HOSTCFLAGS) $(NATIVE_LDFLAGS) gen_locale.c -o $@
44 locale_tables.h: gen_locale locales.txt
45 ./gen_locale locales.txt
47 lt_defines.h: locale_tables.h locale_collate.h
48 grep "^#define" locale_tables.h > lt_defines.h
49 grep "^#define __lc" locale_collate.h >> lt_defines.h
51 gen_collate: gen_collate.c
52 $(HOSTCC) $(HOSTCFLAGS) $(NATIVE_LDFLAGS) gen_collate.c -o $@
54 locale_collate.h: gen_collate locale_tables.h
55 grep COL_IDX_ locale_tables.h | sed -e "s/^.*COL_IDX_\([^, ]*\).*$$/\1/" | sort | uniq | xargs ./gen_collate
58 @if [ ! -f locales.txt ] ; then \
61 echo "You do not have a locales.txt file in the extra/locale "; \
62 echo "directory, Please copy the LOCALES file to locales.txt by "; \
63 echo "running something like: "; \
64 echo " cp $(EXTRA_LOCALE_DIR)/LOCALES \\ "; \
65 echo " $(EXTRA_LOCALE_DIR)/locales.txt "; \
66 echo "then edit locales.txt to disable/enable the locales you wish "; \
67 echo "to support. "; \
72 gen_ldc: gen_ldc.c c8tables.h wctables.h locale_tables.h locale_collate.h
73 $(HOSTCC) $(HOSTCFLAGS) $(NATIVE_LDFLAGS) $(CFLAGS_mmap) gen_ldc.c -o $@
75 locale_data.c: gen_ldc
78 uClibc_locale_data.h: c8tables.h wctables.h lt_defines.h locale_mmap.h
79 grep -v "define __LC" lt_defines.h > uClibc_locale_data.h
80 cat c8tables.h wctables.h locale_mmap.h >> uClibc_locale_data.h
82 links-target: locale_data.c uClibc_locale_data.h
83 cat uClibc_locale_data.h | awk 'BEGIN{i=1}{ if ( /WANT_/ ) i = /endif/ ; else if (i) print $0 }' > ../../include/bits/uClibc_locale_data.h
86 cat uClibc_locale_data.h | awk 'BEGIN{i=1}{ if ( /WANT_/ ) i = /endif/ ; else if (i) print $0 }' > ../../include/bits/uClibc_locale_data.h
90 $(RM) gen_wc8bit gen_wctype gen_locale gen_ldc gen_collate
91 $(RM) c8tables.h wctables.h locale_tables.h lt_defines.h locale_collate.h
92 $(RM) gen_mmap locale.mmap lmmtolso
93 $(RM) locale_data.c uClibc_locale_data.h
95 .PHONY: pregen links-target