Update.
[glibc.git] / iconvdata / Makefile
blob0b64ba4a6671078b286a639f25eee2296f62487e
1 # Copyright (C) 1997 Free Software Foundation, Inc.
2 # This file is part of the GNU C Library.
4 # The GNU C Library is free software; you can redistribute it and/or
5 # modify it under the terms of the GNU Library General Public License as
6 # published by the Free Software Foundation; either version 2 of the
7 # License, or (at your option) any later version.
9 # The GNU C Library is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 # Library General Public License for more details.
14 # You should have received a copy of the GNU Library General Public
15 # License along with the GNU C Library; see the file COPYING.LIB. If
16 # not, write to the Free Software Foundation, Inc.,
17 # 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
20 # Makefile for iconv data and code.
22 subdir := iconvdata
24 # Names of all the shared objects which implement the transformations.
25 modules := ISO8859-1 ISO8859-2 ISO8859-3 ISO8859-4 ISO8859-5 \
26 ISO8859-6 ISO8859-7 ISO8859-8 ISO8859-9 ISO8859-10 \
27 T.61 ISO_6937 SJIS KOI-8 KOI8-R LATIN-GREEK LATIN-GREEK-1 \
28 HP-ROMAN8 EBCDIC-AT-DE EBCDIC-AT-DE-A EBCDIC-CA-FR \
29 libJIS
30 modules.so := $(addsuffix .so, $(modules))
33 include ../Makeconfig
35 ISO8859-1-routines := iso8859-1
36 ISO8859-2-routines := iso8859-2
37 ISO8859-3-routines := iso8859-3
38 ISO8859-4-routines := iso8859-4
39 ISO8859-5-routines := iso8859-5
40 ISO8859-6-routines := iso8859-6
41 ISO8859-7-routines := iso8859-7
42 ISO8859-8-routines := iso8859-8
43 ISO8859-9-routines := iso8859-9
44 ISO8859-10-routines := iso8859-10
45 T.61-routines := t61
46 ISO_6937-routines := iso6937
47 SJIS-routines := sjis
48 KOI-8-routines := koi-8
49 KOI8-R-routines := koi8-r
50 LATIN-GREEK-routines := latin-greek
51 LATIN-GREEK-1-routines := latin-greek-1
52 HP-ROMAN8-routines := hp-roman8
53 EBCDIC-AT-DE-routines := ebcdic-at-de
54 EBCDIC-AT-DE-A-routines := ebcdic-at-de-a
55 EBCDIC-CA-FR-routines := ebcdic-ca-fr
56 libJIS-routines := jis0201 jis0208 jis0212
58 distribute := 8bit-generic.c 8bit-gap.c gap.pl gaptab.pl \
59 iso8859-1.c iso8859-2.c iso8859-3.c iso8859-4.c iso8859-5.c \
60 iso8859-6.c iso8859-7.c iso8859-8.c iso8859-9.c iso8859-10.c\
61 t61.c iso6937.c sjis.c jis0201.h jis0208.h jis0212.h \
62 koi-8.c koi8-r.c koi8-r.h hp-roman8.c latin-greek.c \
63 latin-greek.h latin-greek-1.c latin-greek-1.h ebcdic-at-de.c\
64 ebcdic-at-de-a.c ebcdic-ca-fr.c
66 # We build the transformation modules only when we build shared libs.
67 ifeq (yes,$(build-shared))
69 # This macro is similar to build-shlib but it does not define a soname
70 # and it does not depend on the destination name to start with `lib'.
71 define build-module
72 $(LINK.o) -shared -o $@ $(sysdep-LDFLAGS) $(config-LDFLAGS) \
73 -B$(csu-objpfx) $(load-map-file:%=-Wl,--version-script=%) \
74 $(LDFLAGS.so) $(LDFLAGS-$(@F:%.so=%).so) \
75 -L$(subst :, -L,$(rpath-link)) -Wl,-rpath-link=$(rpath-link) \
76 -Wl,--whole-archive \
77 $(filter-out $($(@F:.so=)-map) $(+preinit) $(+postinit),$^) \
78 $(no-whole-archive) $(LDLIBS-$(@F:%.so=%).so)
79 endef
81 # Rule to generate the shared objects.
82 extra-modules-left := $(modules)
83 include extra-module.mk
86 extra-objs += $(modules.so)
87 install-others = $(addprefix $(inst_gconvdir)/, $(modules.so)) \
88 $(inst_gconvdir)/gconv-modules
90 # If we have the localedata add-on available we can build the conversion
91 # tables for numerous charsets.
92 define generate-8bit-table
93 ( echo "static const wchar_t to_ucs4[256] = {"; \
94 sed -e '/^[^[:space:]]*[[:space:]]*.x00/d' -e 's/^[^[:space:]]*[[:space:]]*.x\(..\)[[:space:]]*<U\(....\)>.*/ [0x\1] = 0x\2,/p' -e d $^ | sort -u; \
95 echo "};"; \
96 echo "static const char from_ucs4[] = {"; \
97 sed -e '/^[^[:space:]]*[[:space:]]*.x00/d' -e 's/^[^[:space:]]*[[:space:]]*.x\(..\)[[:space:]]*<U\(....\)>.*/ [0x\2] = 0x\1,/p' -e d $^ | sort -u; \
98 echo "};" ) > $@.new && rm -f $@ && mv $@.new $@
99 endef
101 sed-generated-headers := iso8859-2.h iso8859-3.h iso8859-4.h iso8859-5.h \
102 iso8859-6.h iso8859-7.h iso8859-8.h iso8859-9.h \
103 iso8859-10.h koi-8.h hp-roman8.h ebcdic-at-de.h \
104 ebcdic-at-de-a.h ebcdic-ca-fr.h
106 define generate-8bit-gap-table
107 ( echo "static const wchar_t to_ucs4[256] = {"; \
108 sed -e '/^[^[:space:]]*[[:space:]]*.x00/d' -e 's/^[^[:space:]]*[[:space:]]*.x\(..\)[[:space:]]*<U\(....\)>.*/ [0x\1] = 0x\2,/p' -e d $^ | sort -u; \
109 echo "};"; \
110 echo "static struct gap from_idx[] = {"; \
111 sed -e '/^[^[:space:]]*[[:space:]]*.x00/d' -e 's/^[^[:space:]]*[[:space:]]*.x\(..\)[[:space:]]*<U\(....\)>.*/0x\2 0x\1/p' -e d $^ | sort -u | $(PERL) gap.pl; \
112 echo " { start: 0xffff, end: 0xffff, idx: 0 }"; \
113 echo "};"; \
114 echo "static const char from_ucs4[] = {"; \
115 sed -e '/^[^[:space:]]*[[:space:]]*.x00/d' -e 's/^[^[:space:]]*[[:space:]]*.x\(..\)[[:space:]]*<U\(....\)>.*/0x\2 0x\1/p' -e d $^ | sort -u | $(PERL) gaptab.pl; \
116 echo "};" ) > $@.new && rm -f $@ && mv $@.new $@
117 endef
119 perl-generated-headers := koi8-r.h latin-greek.h latin-greek-1.h
121 # The headers must be generated before the compilation.
122 before-compile = $(sed-generated-headers) $(perl-generated-headers)
125 # Rules to generate the headers.
126 iso8859-2.h: ../localedata/charmaps/ISO-8859-2 Makefile
127 $(generate-8bit-table)
128 iso8859-3.h: ../localedata/charmaps/ISO-8859-3 Makefile
129 $(generate-8bit-table)
130 iso8859-4.h: ../localedata/charmaps/ISO-8859-4 Makefile
131 $(generate-8bit-table)
132 iso8859-5.h: ../localedata/charmaps/ISO-8859-5 Makefile
133 $(generate-8bit-table)
134 iso8859-6.h: ../localedata/charmaps/ISO-8859-6 Makefile
135 $(generate-8bit-table)
136 iso8859-7.h: ../localedata/charmaps/ISO-8859-7 Makefile
137 $(generate-8bit-table)
138 iso8859-8.h: ../localedata/charmaps/ISO-8859-8 Makefile
139 $(generate-8bit-table)
140 iso8859-9.h: ../localedata/charmaps/ISO-8859-9 Makefile
141 $(generate-8bit-table)
142 iso8859-10.h: ../localedata/charmaps/ISO-8859-10 Makefile
143 $(generate-8bit-table)
145 koi-8.h: ../localedata/charmaps/KOI-8 Makefile
146 $(generate-8bit-table)
148 hp-roman8.h: ../localedata/charmaps/HP-ROMAN8 Makefile
149 $(generate-8bit-table)
151 ebcdic-at-de.h: ../localedata/charmaps/EBCDIC-AT-DE Makefile
152 $(generate-8bit-table)
153 ebcdic-at-de-a.h: ../localedata/charmaps/EBCDIC-AT-DE-A Makefile
154 $(generate-8bit-table)
155 ebcdic-ca-fr.h: ../localedata/charmaps/EBCDIC-CA-FR Makefile
156 $(generate-8bit-table)
158 ifneq ($(PERL),no)
159 koi8-r.h: ../localedata/charmaps/KOI8-R Makefile
160 $(generate-8bit-gap-table)
161 latin-greek.h: ../localedata/charmaps/LATIN-GREEK Makefile
162 $(generate-8bit-gap-table)
163 latin-greek-1.h: ../localedata/charmaps/LATIN-GREEK-1 Makefile
164 $(generate-8bit-gap-table)
165 endif
167 headers: $(sed-generated-headers) $(perl-generated-headers)
170 $(addprefix $(inst_gconvdir)/, $(modules.so)): $(inst_gconvdir)/%: $(objpfx)%
171 $(do-install-program)
172 $(inst_gconvdir)/gconv-modules: gconv-modules
173 $(do-install)
174 endif
176 include ../Rules