silence gcc, add missing include
[uclibc-ng.git] / extra / locale / Makefile.in
blobc23461a11b21d55c932ef1af57690a96d95b63ba
1 # Makefile for uClibc
3 # Copyright (C) 2000-2008 Erik Andersen <andersen@uclibc.org>
5 # Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
8 .NOTPARALLEL:
10 locale_DIR := $(top_srcdir)extra/locale
11 locale_OUT := $(top_builddir)extra/locale
13 BUILD_CFLAGS-locale-common := \
14 -D__UCLIBC_GEN_LOCALE \
15 -I$(top_builddir)
17 BUILD_CFLAGS-gen_wc8bit := $(BUILD_CFLAGS-locale-common) -DCTYPE_PACKED=1
18 BUILD_CFLAGS-gen_wctype := $(BUILD_CFLAGS-locale-common)
19 BUILD_CFLAGS-gen_ldc := -I$(locale_OUT)
20 ifeq ($(UCLIBC_HAS_WCHAR),y)
21 BUILD_CFLAGS-gen_wc8bit += -DDO_WIDE_CHAR=1
22 BUILD_CFLAGS-gen_ldc += -D__WCHAR_ENABLED=1
23 endif
24 BUILD_CFLAGS-gen_locale := -D_GNU_SOURCE -I$(locale_OUT)
25 BUILD_CFLAGS-gen_collate := -D_GNU_SOURCE
27 locale_headers-$(UCLIBC_HAS_LOCALE) := $(top_builddir)include/bits/uClibc_locale_data.h
29 headers_dep += $(locale_headers-y)
31 DEPH-locale := $(top_builddir)include/bits/uClibc_config.h
32 DEPH-gen_collate := $(DEPH-locale)
33 DEPH-gen_ldc := $(addprefix $(locale_OUT)/,c8tables.h wctables.h locale_tables.h locale_collate.h) $(DEPH-locale)
34 DEPH-gen_locale := $(addprefix $(locale_OUT)/,c8tables.h) $(DEPH-locale)
35 DEPH-gen_wc8bit := $(top_builddir)include/bits/uClibc_ctype.h $(DEPH-locale)
36 DEPH-gen_wctype := $(top_builddir)include/bits/uClibc_ctype.h $(DEPH-locale)
38 locale_HOBJ := gen_collate gen_ldc gen_locale gen_wc8bit gen_wctype
39 locale_HOBJ := $(addprefix $(locale_OUT)/,$(locale_HOBJ))
40 $(locale_HOBJ): | $(locale_OUT)
42 locale_SRC := $(locale_OUT)/locale_data.c
43 locale_OBJ := $(locale_OUT)/locale_data.o
45 CFLAGS-locale_data.c := -D__WCHAR_ENABLED -I$(locale_OUT) -I$(locale_DIR)
47 libc-$(UCLIBC_HAS_LOCALE) += $(locale_OBJ)
48 libc-nomulti-$(UCLIBC_HAS_LOCALE) += $(locale_OBJ)
50 $(locale_OUT)%.o: $(locale_OUT)%.c FORCE ; $(compile.c)
51 $(locale_OUT)%.os: $(locale_OUT)%.c FORCE ; $(compile.c)
52 $(locale_OUT)%.oS: $(locale_OUT)%.c FORCE ; $(compile.c)
53 $(locale_OUT)%.o: $(locale_OUT)%.S FORCE ; $(compile.S)
54 $(locale_OUT)%.os: $(locale_OUT)%.S FORCE ; $(compile.S)
55 $(locale_OUT)%.oS: $(locale_OUT)%.S FORCE ; $(compile.S)
56 $(locale_OUT)%.o: $(locale_OUT)%.s FORCE ; $(compile.S)
57 $(locale_OUT)%.os: $(locale_OUT)%.s FORCE ; $(compile.S)
58 $(locale_OUT)%.oS: $(locale_OUT)%.s FORCE ; $(compile.S)
59 $(locale_OUT)%.i: $(locale_OUT)%.c FORCE ; $(compile.i)
60 $(locale_OUT)%.i: $(locale_OUT)%.S FORCE ; $(compile.i)
61 $(locale_OUT)%.s: $(locale_OUT)%.c FORCE ; $(compile.s)
62 $(locale_OUT)%.s: $(locale_OUT)%.S FORCE ; $(compile.s)
63 $(locale_OUT)%.dep:
66 locale_headers: $(locale_headers-y)
68 # make sure that the host system has locales (this check is ok for uClibc/glibc)
69 # we do not know though which locales were really enabled for libc at build time
70 ifeq ($(wildcard /usr/include/iconv.h),)
72 $(locale_OUT)/codesets.txt: $(locale_OUT)/gen_wc8bit
73 @if [ ! -f $@ ] ; then \
74 set -e; \
75 echo " "; \
76 echo "You do not have a codesets.txt file. Please create this "; \
77 echo "file in the $(locale_OUT) directory by running something like: "; \
78 echo " find $(CURDIR)/$(locale_DIR)/charmaps -name \"*.pairs\" > \\"; \
79 echo " $@"; \
80 echo "and then edit that file to disable/enable the codesets you wish to support. "; \
81 echo " "; \
82 false; \
85 $(locale_OUT)/locales.txt:
86 @if [ ! -f $@ ] ; then \
87 set -e; \
88 echo " "; \
89 echo "You do not have a locales.txt file in the $(locale_OUT) "; \
90 echo "directory, Please copy the LOCALES file to locales.txt by "; \
91 echo "running something like: "; \
92 echo " cp $(locale_DIR)/LOCALES \\ "; \
93 echo " $@ "; \
94 echo "then edit locales.txt to disable/enable the locales you wish "; \
95 echo "to support. "; \
96 echo " "; \
97 false; \
100 else
102 $(locale_OUT)/codesets.txt:
103 @$(disp_gen)
104 ifeq ($(UCLIBC_BUILD_MINIMAL_LOCALE),y)
105 $(Q)echo "$(CURDIR)/$(locale_DIR)/charmaps/ASCII.pairs" > $@
106 $(Q)echo "$(CURDIR)/$(locale_DIR)/charmaps/ISO-8859-1.pairs" >> $@
107 else
108 $(Q)set -e; \
109 find $(CURDIR)/$(locale_DIR)/charmaps/ -name '*.pairs' | \
110 sort > $@.new; \
111 [ -s $@.new ]; \
112 cmp -s $@ $@.new && $(RM) $@.new || mv -f $@.new $@
113 endif
115 # the lines beginning w/ '#-' are mandatory
116 # at least one conversion is needed (euro/cyrillic)
117 $(locale_OUT)/locales.txt: $(locale_DIR)/LOCALES $(locale_OUT)/gen_locale
118 @$(disp_gen)
119 ifeq ($(UCLIBC_BUILD_MINIMAL_LOCALE),y)
120 $(Q)echo "@euro e" > $@
121 $(Q)echo "#-" >> $@
122 $(Q)echo "UTF-8 yes" >> $@
123 $(Q)echo "8-BIT yes" >> $@
124 $(Q)echo "#-" >> $@
125 $(Q)for locale in $(call qstrip,$(UCLIBC_BUILD_MINIMAL_LOCALES)); do \
126 echo "$$locale.UTF-8 UTF-8"; \
127 echo "$$locale ISO-8859-1"; \
128 done >> $@
129 else
130 $(Q)cat $< > $@
131 endif
133 endif
135 $(locale_DIR)/gen_collate.c: $(DEPH-gen_collate)
136 $(locale_OUT)/gen_collate : $(locale_DIR)/gen_collate.c
137 $(hcompile.u)
138 $(locale_DIR)/gen_ldc.c: $(DEPH-gen_ldc)
139 $(locale_OUT)/gen_ldc : $(locale_DIR)/gen_ldc.c
140 $(hcompile.u)
141 $(locale_DIR)/gen_locale.c: $(DEPH-gen_locale)
142 $(locale_OUT)/gen_locale : $(locale_DIR)/gen_locale.c
143 $(hcompile.u)
144 $(locale_DIR)/gen_wc8bit.c: $(DEPH-gen_wc8bit)
145 $(locale_OUT)/gen_wc8bit : $(locale_DIR)/gen_wc8bit.c
146 $(hcompile.u)
147 $(locale_DIR)/gen_wctype.c: $(DEPH-gen_wctype)
148 $(locale_OUT)/gen_wctype : $(locale_DIR)/gen_wctype.c
149 $(hcompile.u)
151 ifneq ($(V),)
152 ifeq ($(V),1)
153 FLAG-locale-verbose := -v -v
154 endif
155 ifeq ($(V),2)
156 FLAG-locale-verbose := -v
157 endif
158 endif
160 # code needs to be modified to support top_builddir in almost all apps that write directly to a file
161 # grep fopen *.c
162 $(locale_OUT)/c8tables.h: $(locale_OUT)/gen_wc8bit $(locale_OUT)/codesets.txt
163 @$(disp_gen)
164 $(Q)$< `cat $(word 2,$^)` > $@
166 # Warning! Beware tr_TR toupper/tolower exceptions!
167 $(locale_OUT)/wctables.h: $(locale_OUT)/gen_wctype
168 @$(disp_gen)
169 $(Q)for locale in $(call qstrip,$(UCLIBC_BUILD_MINIMAL_LOCALES)) en_US en_GB; do \
170 $< $(FLAG-locale-verbose) $$locale > $@ || \
171 $< $(FLAG-locale-verbose) $$locale.UTF-8 > $@ || \
172 $< $(FLAG-locale-verbose) $$locale.iso8859-1 > $@ && break; \
173 done
175 $(locale_OUT)/locale_tables.h: $(locale_OUT)/gen_locale $(locale_OUT)/locales.txt
176 @$(disp_gen)
177 $(Q)$< $(FLAG-locale-verbose) -o $@ $(word 2,$^)
179 $(locale_OUT)/lt_defines.h: $(locale_OUT)/locale_tables.h $(locale_OUT)/locale_collate.h
180 @$(disp_gen)
181 $(Q)grep "^#define" $< > $@
182 $(Q)grep "^#define __lc" $(word 2,$^) >> $@
184 $(locale_OUT)/locale_collate.h: $(locale_OUT)/gen_collate $(locale_OUT)/locale_tables.h
185 @$(disp_gen)
186 $(Q)grep COL_IDX_ $(word 2,$^) | \
187 $(SED) -e "s/^.*COL_IDX_\([^, ]*\).*$$/\1/" | sort | uniq | \
188 xargs $< $(locale_DIR)/collation $(FLAG-locale-verbose) -o $@
190 $(locale_SRC): $(locale_OUT)/gen_ldc $(locale_OUT)/lt_defines.h
191 @$(disp_gen)
192 $(Q)$< $@
194 $(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)
195 @$(disp_gen)
196 $(Q)grep -v "define __LC" $< > $@
197 $(Q)cat $(wordlist 2,4,$^) >> $@
199 $(top_builddir)include/bits/uClibc_locale_data.h: $(locale_OUT)/uClibc_locale_data.h | $(top_builddir)include/bits/uClibc_config.h
200 @$(disp_gen)
201 $(Q)$(AWK) 'BEGIN{i=1}{if (/WANT_/) i=/endif/;else if (i) print $0}' \
202 $< > $@
204 objclean-y += CLEAN_extra/locale
206 # lmmtolso.c/gen_mmap.c/tst-*.c not used
207 CLEAN_extra/locale:
208 $(do_rm) $(locale_HOBJ) $(locale_SRC) $(addprefix $(locale_OUT)/*., o os txt) \
209 $(addprefix $(locale_OUT)/,$(addsuffix .h,uClibc_locale_data lt_defines c8tables wctables locale_tables locale_collate) lmmtolso gen_mmap locale.mmap)