OSDN Git Service

When it is going to fail silently anyways, whine loudly and
[uclinux-h8/uClibc.git] / extra / locale / Makefile
1
2 TOPDIR = ../../
3 include $(TOPDIR)Rules.mak
4
5 CFLAGS_wc8bit=-DCTYPE_PACKED=1
6 CFLAGS_mmap=
7 ifeq ($(strip $(HAS_WCHAR)),true)
8     CFLAGS_wc8bit += -DDO_WIDE_CHAR=1
9     CFLAGS_mmap += -D__WCHAR_ENABLED=1
10 endif
11
12 all: links-target
13
14 codesets.txt:
15         @if [ ! -f codesets.txt ] ; then \
16             set -e; \
17             echo " "; \
18             echo "You do not have a codesets.txt file.  Please create this "; \
19             echo "file in the extra/locale directory by running something like: "; \
20             echo -e "  find ./charmaps -name \"*.pairs\" > ./codesets.txt"; \
21             echo "and then edit that file to disable/enable the codesets you wish to support. "; \
22             echo " "; \
23             /bin/false; \
24         fi;
25
26 gen_wc8bit: gen_wc8bit.c
27         gcc -Os -Wall $(CFLAGS_wc8bit) gen_wc8bit.c -o gen_wc8bit
28
29 c8tables.h: gen_wc8bit codesets.txt
30         ./gen_wc8bit `cat codesets.txt`
31
32 gen_wctype: gen_wctype.c
33         gcc -Os -Wall gen_wctype.c -o gen_wctype
34
35 # Warning! Beware tr_TR toupper/tolower exceptions!
36 # Warning! Ignore the width table.  It will go away.
37 wctables.h: gen_wctype
38         ./gen_wctype en_US
39
40 gen_locale: gen_locale.c c8tables.h
41         gcc -Os -Wall gen_locale.c -o gen_locale
42
43 # TODO: if no wide char support, we should auto-disable all UTF-8 locales
44 locale_tables.h: gen_locale locales.txt
45         ./gen_locale locales.txt
46
47 lt_defines.h: locale_tables.h
48         grep "^#define" locale_tables.h > lt_defines.h
49
50 locales.txt:
51         @if [ ! -f locales.txt ] ; then \
52             set -e; \
53             echo " "; \
54             echo "You do not have a locales.txt file.  In the extra/locale "; \
55             echo "directory, Please copy the LOCALES file to locales.txt and "; \
56             echo "then edit that file to disable/enable the locales you wish "; \
57             echo "to support. "; \
58             echo " "; \
59             /bin/false; \
60         fi;
61
62 ifneq ($(TARGET_ARCH),$(NATIVE_ARCH))
63
64 locale.mmap: gen_mmap
65         echo Your locale.mmap file is either missing or out of date.
66         echo The developmental code can only generate one for the
67         echo target arch == native arch case.  Sorry.
68 else
69
70 gen_mmap: gen_mmap.c c8tables.h wctables.h locale_tables.h
71         gcc $(CFLAGS_mmap) -Os -Wall -static gen_mmap.c -o gen_mmap
72
73 locale.mmap: gen_mmap
74         ./gen_mmap
75
76 endif
77
78 lmmtolso: lmmtolso.c
79         gcc -Os -Wall lmmtolso.c -o lmmtolso
80
81 locale_data.c: lmmtolso locale.mmap
82         ./lmmtolso
83
84 locale_data.o: locale_data.c lt_defines.h
85         $(CC) -c locale_data.c
86         $(STRIPTOOL) -x -R .note -R .comment locale_data.o
87
88 uClibc_locale_data.h: c8tables.h wctables.h lt_defines.h locale_mmap.h
89         grep -v "define __LC" lt_defines.h > uClibc_locale_data.h
90         cat c8tables.h wctables.h locale_mmap.h >> uClibc_locale_data.h
91
92 links-target: locale_data.o uClibc_locale_data.h
93         ln -sf ../../../extra/locale/locale_data.o ../../libc/misc/locale
94         cp uClibc_locale_data.h ../../libc/sysdeps/linux/common/bits/
95
96 clean:
97         rm -f *.[oa] *~ core
98         rm -f gen_wc8bit gen_wctype gen_locale
99         rm -f c8tables.h wctables.h locale_tables.h lt_defines.h
100         rm -f gen_mmap locale.mmap lmmtolso
101         rm -f locale_data.c locale_data.o  uClibc_locale_data.h
102