Blame iconv/Makefile

Packit 6c4009
# Copyright (C) 1997-2018 Free Software Foundation, Inc.
Packit 6c4009
# This file is part of the GNU C Library.
Packit 6c4009
Packit 6c4009
# The GNU C Library is free software; you can redistribute it and/or
Packit 6c4009
# modify it under the terms of the GNU Lesser General Public
Packit 6c4009
# License as published by the Free Software Foundation; either
Packit 6c4009
# version 2.1 of the License, or (at your option) any later version.
Packit 6c4009
Packit 6c4009
# The GNU C Library is distributed in the hope that it will be useful,
Packit 6c4009
# but WITHOUT ANY WARRANTY; without even the implied warranty of
Packit 6c4009
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
Packit 6c4009
# Lesser General Public License for more details.
Packit 6c4009
Packit 6c4009
# You should have received a copy of the GNU Lesser General Public
Packit 6c4009
# License along with the GNU C Library; if not, see
Packit 6c4009
# <http://www.gnu.org/licenses/>.
Packit 6c4009
Packit 6c4009
#
Packit 6c4009
#	Makefile for iconv.
Packit 6c4009
#
Packit 6c4009
subdir	:= iconv
Packit 6c4009
Packit 6c4009
include ../Makeconfig
Packit 6c4009
Packit 6c4009
headers		= iconv.h gconv.h
Packit 6c4009
routines	= iconv_open iconv iconv_close \
Packit 6c4009
		  gconv_open gconv gconv_close gconv_db gconv_conf \
Packit 6c4009
		  gconv_builtin gconv_simple gconv_trans gconv_cache
Packit Service 4f8585
routines	+= gconv_dl gconv_charset
Packit 6c4009
Packit 6c4009
vpath %.c ../locale/programs ../intl
Packit 6c4009
Packit 6c4009
iconv_prog-modules = iconv_charmap charmap charmap-dir linereader \
Packit 6c4009
		     dummy-repertoire simple-hash xstrdup xmalloc \
Packit 6c4009
		     record-status
Packit 6c4009
iconvconfig-modules = strtab xmalloc hash-string
Packit 6c4009
extra-objs	   = $(iconv_prog-modules:=.o) $(iconvconfig-modules:=.o)
Packit 6c4009
CFLAGS-iconv_prog.c += -I../locale/programs
Packit 6c4009
CFLAGS-iconv_charmap.c += -I../locale/programs
Packit 6c4009
CFLAGS-dummy-repertoire.c += -I../locale/programs
Packit 6c4009
CFLAGS-charmap.c += -DCHARMAP_PATH='"$(i18ndir)/charmaps"' \
Packit 6c4009
		   -DDEFAULT_CHARMAP=null_pointer -DNEED_NULL_POINTER
Packit 6c4009
CFLAGS-linereader.c += -DNO_TRANSLITERATION
Packit 6c4009
CFLAGS-simple-hash.c += -I../locale
Packit 6c4009
Packit Service 4f8585
tests	= tst-iconv1 tst-iconv2 tst-iconv3 tst-iconv4 tst-iconv5 tst-iconv6 \
Packit Service 4f8585
	  tst-iconv-opt
Packit 6c4009
Packit 6c4009
others		= iconv_prog iconvconfig
Packit 6c4009
install-others-programs	= $(inst_bindir)/iconv
Packit 6c4009
install-sbin	= iconvconfig
Packit 6c4009
Packit 6c4009
CFLAGS-gconv_cache.c += -DGCONV_DIR='"$(gconvdir)"'
Packit 6c4009
CFLAGS-gconv_conf.c += -DGCONV_PATH='"$(gconvdir)"'
Packit 6c4009
CFLAGS-iconvconfig.c += -DGCONV_PATH='"$(gconvdir)"' -DGCONV_DIR='"$(gconvdir)"'
Packit 6c4009
Packit 6c4009
# Set libof-* for each routine.
Packit 6c4009
cpp-srcs-left := $(iconv_prog-modules) $(iconvconfig-modules)
Packit 6c4009
lib := iconvprogs
Packit 6c4009
include $(patsubst %,$(..)libof-iterator.mk,$(cpp-srcs-left))
Packit 6c4009
Packit 6c4009
ifeq ($(run-built-tests),yes)
Packit 6c4009
xtests-special += $(objpfx)test-iconvconfig.out
Packit Service 4f8585
tests-special += $(objpfx)tst-iconv_prog.out
Packit 6c4009
endif
Packit 6c4009
Packit 6c4009
# Make a copy of the file because gconv module names are constructed
Packit 6c4009
# relative to the path of the configuration file.
Packit 6c4009
$(objpfx)gconv-modules: test-gconv-modules
Packit 6c4009
	cp $< $@
Packit 6c4009
Packit 6c4009
ifeq (yes,$(build-shared))
Packit 6c4009
tests += tst-gconv-init-failure
Packit 6c4009
modules-names += tst-gconv-init-failure-mod
Packit 6c4009
modules-names-tests += tst-gconv-init-failure-mod
Packit 6c4009
$(objpfx)tst-gconv-init-failure-mod.so: $(libsupport)
Packit 6c4009
$(objpfx)tst-gconv-init-failure.out: \
Packit 6c4009
 $(objpfx)gconv-modules $(objpfx)tst-gconv-init-failure-mod.so
Packit 6c4009
endif
Packit 6c4009
Packit 6c4009
include ../Rules
Packit 6c4009
Packit Service 4f8585
ifeq ($(run-built-tests),yes)
Packit Service 4f8585
LOCALES := en_US.UTF-8
Packit Service 4f8585
include ../gen-locales.mk
Packit Service 4f8585
Packit Service 4f8585
$(objpfx)tst-iconv-opt.out: $(gen-locales)
Packit Service 4f8585
endif
Packit Service 4f8585
Packit 6c4009
$(inst_bindir)/iconv: $(objpfx)iconv_prog $(+force)
Packit 6c4009
	$(do-install-program)
Packit 6c4009
Packit 6c4009
$(objpfx)iconv_prog: $(iconv_prog-modules:%=$(objpfx)%.o)
Packit 6c4009
$(objpfx)iconvconfig: $(iconvconfig-modules:%=$(objpfx)%.o)
Packit 6c4009
Packit 6c4009
$(objpfx)test-iconvconfig.out: /dev/null $(objpfx)iconvconfig
Packit 6c4009
	(set -e; \
Packit 6c4009
	 tmp=$(objpfx)gconv-modules.cache.$$$$; \
Packit 6c4009
	 rm -f $$tmp; \
Packit 6c4009
	 $(make-test-out) --output=$$tmp --nostdlib $(inst_gconvdir); \
Packit 6c4009
	 cmp $$tmp $(inst_gconvdir)/gconv-modules.cache; \
Packit 6c4009
	 rm -f $$tmp) > $@; \
Packit 6c4009
	$(evaluate-test)
Packit Service 4f8585
Packit Service 4f8585
$(objpfx)tst-iconv_prog.out: tst-iconv_prog.sh $(objpfx)iconv_prog
Packit Service 4f8585
	$(BASH) $< $(common-objdir) '$(test-wrapper-env)' \
Packit Service 4f8585
		 '$(run-program-env)' > $@; \
Packit Service 4f8585
	$(evaluate-test)