[BZ #5043]
[platform/upstream/glibc.git] / iconv / Makefile
1 # Copyright (C) 1997,1998,2000,2001,2002,2003,2004,2007
2 #       Free Software Foundation, Inc.
3 # This file is part of the GNU C Library.
4
5 # The GNU C Library is free software; you can redistribute it and/or
6 # modify it under the terms of the GNU Lesser General Public
7 # License as published by the Free Software Foundation; either
8 # version 2.1 of the License, or (at your option) any later version.
9
10 # The GNU C Library is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13 # Lesser General Public License for more details.
14
15 # You should have received a copy of the GNU Lesser General Public
16 # License along with the GNU C Library; if not, write to the Free
17 # Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
18 # 02111-1307 USA.
19
20 #
21 #       Makefile for iconv.
22 #
23 subdir  := iconv
24
25 include ../Makeconfig
26
27 headers         = iconv.h gconv.h
28 routines        = iconv_open iconv iconv_close \
29                   gconv_open gconv gconv_close gconv_db gconv_conf \
30                   gconv_builtin gconv_simple gconv_trans gconv_cache
31 ifeq ($(elf),yes)
32 routines        += gconv_dl
33 else
34 CFLAGS-gconv_db.c = -DSTATIC_GCONV
35 CFLAGS-gconv_cache.c = -DSTATIC_GCONV
36 CFLAGS-gconv_simple.c = -DSTATIC_GCONV
37 endif
38
39 vpath %.c ../locale/programs ../intl
40
41 iconv_prog-modules = iconv_charmap charmap charmap-dir linereader \
42                      dummy-repertoire simple-hash xstrdup xmalloc
43 iconvconfig-modules = strtab xmalloc hash-string
44 extra-objs         = $(iconv_prog-modules:=.o) $(iconvconfig-modules:=.o)
45 CFLAGS-iconv_prog.c = -I../locale/programs
46 CFLAGS-iconv_charmap.c = -I../locale/programs
47 CFLAGS-dummy-repertoire.c = -I../locale/programs
48 CFLAGS-charmap.c = -DCHARMAP_PATH='"$(i18ndir)/charmaps"' \
49                    -DDEFAULT_CHARMAP=null_pointer -DNEED_NULL_POINTER
50 CFLAGS-linereader.c = -DNO_TRANSLITERATION
51 CFLAGS-simple-hash.c = -I../locale
52
53 tests   = tst-iconv1 tst-iconv2 tst-iconv3 tst-iconv5
54
55 distribute      = gconv_builtin.h gconv_int.h loop.c skeleton.c iconv_prog.h \
56                   iconv_charmap.c dummy-repertoire.c gconv_charset.h strtab.c \
57                   iconvconfig.h
58
59 others          = iconv_prog iconvconfig
60 install-others-programs = $(inst_bindir)/iconv
61 install-sbin    = iconvconfig
62
63 CFLAGS-gconv_cache.c += -DGCONV_DIR='"$(gconvdir)"'
64 CFLAGS-gconv_conf.c = -DGCONV_PATH='"$(gconvdir)"'
65 CFLAGS-iconvconfig.c = -DGCONV_PATH='"$(gconvdir)"' -DGCONV_DIR='"$(gconvdir)"'
66
67 CPPFLAGS-iconv_prog = -DNOT_IN_libc
68 CPPFLAGS-iconv_charmap = -DNOT_IN_libc
69 CPPFLAGS-iconvconfig = -DNOT_IN_libc
70 CPPFLAGS-linereader = -DNOT_IN_libc
71 CPPFLAGS-strtab = -DNOT_IN_libc
72 CPPFLAGS-charmap = -DNOT_IN_libc
73 CPPFLAGS-charmap-dir = -DNOT_IN_libc
74
75 include ../Rules
76
77 $(inst_bindir)/iconv: $(objpfx)iconv_prog $(+force)
78         $(do-install-program)
79
80 $(objpfx)iconv_prog: $(iconv_prog-modules:%=$(objpfx)%.o)
81 $(objpfx)iconvconfig: $(iconvconfig-modules:%=$(objpfx)%.o)
82
83 ifneq ($(cross-compiling),yes)
84 xtests: test-iconvconfig
85 endif
86
87 .PHONY: test-iconvconfig
88 test-iconvconfig: /dev/null $(objpfx)iconvconfig
89         tmp=$(objpfx)gconv-modules.cache.$$$$; \
90         rm -f $$tmp; \
91         $(make-test-out) --output=$$tmp --nostdlib $(inst_gconvdir) && \
92         cmp $$tmp $(inst_gconvdir)/gconv-modules.cache && \
93         rm -f $$tmp