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) $^ -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) $^ -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 # TODO: if no wide char support, we should auto-disable all UTF-8 locales
45 locale_tables.h: gen_locale locales.txt
46 ./gen_locale locales.txt
48 lt_defines.h: locale_tables.h locale_collate.h
49 grep "^#define" locale_tables.h > lt_defines.h
50 grep "^#define __lc" locale_collate.h >> lt_defines.h
52 gen_collate: gen_collate.c
53 $(HOSTCC) $(HOSTCFLAGS) $(NATIVE_LDFLAGS) gen_collate.c -o $@
55 locale_collate.h: gen_collate locale_tables.h
56 grep COL_IDX_ locale_tables.h | sed -e "s/^.*COL_IDX_\([^, ]*\).*$$/\1/" | sort | uniq | xargs ./gen_collate
59 @if [ ! -f locales.txt ] ; then \
62 echo "You do not have a locales.txt file in the extra/locale "; \
63 echo "directory, Please copy the LOCALES file to locales.txt by "; \
64 echo "running something like: "; \
65 echo " cp $(EXTRA_LOCALE_DIR)/LOCALES \\ "; \
66 echo " $(EXTRA_LOCALE_DIR)/locales.txt "; \
67 echo "then edit locales.txt to disable/enable the locales you wish "; \
68 echo "to support. "; \
73 # ifneq ($(TARGET_ARCH),$(HOST_ARCH))
75 # locale.mmap: gen_mmap
76 # echo Your locale.mmap file is either missing or out of date.
77 # echo The developmental code can only generate one for the
78 # echo target arch == native arch case. Sorry.
81 # gen_mmap: gen_mmap.c c8tables.h wctables.h locale_tables.h
82 # gcc $(CFLAGS_mmap) -Os -Wall -static gen_mmap.c -o gen_mmap
84 # locale.mmap: gen_mmap
89 # lmmtolso: lmmtolso.c
90 # gcc -Os -Wall lmmtolso.c -o lmmtolso
92 # locale_data.c: lmmtolso locale.mmap
95 gen_ldc: gen_ldc.c c8tables.h wctables.h locale_tables.h locale_collate.h
96 $(HOSTCC) $(HOSTCFLAGS) $(NATIVE_LDFLAGS) $(CFLAGS_mmap) gen_ldc.c -o $@
99 locale_data.c: gen_ldc
102 locale_data.o: locale_data.c lt_defines.h
103 $(CC) $(CFLAGS_mmap) -c locale_data.c
104 $(STRIPTOOL) -x -R .note -R .comment locale_data.o
106 uClibc_locale_data.h: c8tables.h wctables.h lt_defines.h locale_mmap.h
107 grep -v "define __LC" lt_defines.h > uClibc_locale_data.h
108 cat c8tables.h wctables.h locale_mmap.h >> uClibc_locale_data.h
110 links-target: locale_data.o uClibc_locale_data.h
111 ln -sf ../../../extra/locale/locale_data.o ../../libc/misc/locale
112 cp uClibc_locale_data.h ../../libc/sysdeps/linux/common/bits/
115 $(CC) $(CFLAGS_mmap) -c locale_data.c
116 $(STRIPTOOL) -x -R .note -R .comment locale_data.o
117 ln -sf ../../../extra/locale/locale_data.o ../../libc/misc/locale
118 cp uClibc_locale_data.h ../../libc/sysdeps/linux/common/bits/
122 rm -f gen_wc8bit gen_wctype gen_locale gen_ldc gen_collate
123 rm -f c8tables.h wctables.h locale_tables.h lt_defines.h locale_collate.h
124 rm -f gen_mmap locale.mmap lmmtolso
125 rm -f locale_data.c locale_data.o uClibc_locale_data.h