From: Stefano Lattarini Date: Fri, 10 Aug 2012 09:15:15 +0000 (+0200) Subject: [ng] refactor: drop 'HOST', 'BUILD' and 'TARGET' transforms X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2a67361368049577d352949e9636c3595d8b18d4;p=thirdparty%2Fautomake.git [ng] refactor: drop 'HOST', 'BUILD' and 'TARGET' transforms Instead, use the new make variables $(am.conf.host-triplet), $(am.conf.build-triplet) and $(am.conf.host-triplet) are defined. * automake.in (preprocess_file): Drop 'HOST', 'BUILD' and 'TARGET' transforms. Their role taken over ... (generate_makefile): ... by the new variables 'am.conf.host-triplet', 'am.conf.build-triplet' and 'am.conf.target-triplet' defined here. * lib/am/dejagnu.am: Adjust. * t/triplet.sh: New test. Signed-off-by: Stefano Lattarini --- diff --git a/automake.in b/automake.in index c50e0ada4..4e28402bd 100644 --- a/automake.in +++ b/automake.in @@ -5707,10 +5707,6 @@ sub preprocess_file ($%) 'SUBDIRS' => !! var ('SUBDIRS'), 'TOPDIR_P' => $relative_dir eq '.', - 'BUILD' => ($seen_canonical >= AC_CANONICAL_BUILD), - 'HOST' => ($seen_canonical >= AC_CANONICAL_HOST), - 'TARGET' => ($seen_canonical >= AC_CANONICAL_TARGET), - 'LIBTOOL' => !! var ('LIBTOOL'), 'NONLIBTOOL' => 1, 'SILENT' => silent_flag (), @@ -6707,7 +6703,8 @@ sub generate_makefile ($$) } } - # Must do this after reading .am file. + # Some of these must do this after reading .am file. + define_variable ('subdir', INTERNAL, $relative_dir); define_variable ('am.conf.is-topdir', INTERNAL, $relative_dir eq '.' ? "yes" : ""); @@ -6718,6 +6715,13 @@ sub generate_makefile ($$) define_variable ('am.relpath.makefile.in', INTERNAL, prepend_srcdir ($makefile_in)); + define_variable 'am.conf.build-triplet', INTERNAL, + $seen_canonical >= AC_CANONICAL_BUILD ? '$(build)' : ''; + define_variable 'am.conf.host-triplet', INTERNAL, + $seen_canonical >= AC_CANONICAL_HOST ? '$(host)' : ''; + define_variable 'am.conf.target-triplet', INTERNAL, + $seen_canonical >= AC_CANONICAL_TARGET ? '$(target)' : ''; + # If DIST_SUBDIRS is defined, make sure SUBDIRS is, so that # recursive rules are enabled. define_variable ('SUBDIRS', INTERNAL, '') diff --git a/lib/am/dejagnu.am b/lib/am/dejagnu.am index 42ba485c0..c3a96591b 100644 --- a/lib/am/dejagnu.am +++ b/lib/am/dejagnu.am @@ -55,12 +55,12 @@ site.exp: Makefile $(EXTRA_DEJAGNU_SITE_CONFIG) @echo 'set srcdir "$(srcdir)"' >>site.tmp @echo "set objdir `pwd`" >>site.tmp ## Quote the *_alias variables because they might be empty. -?BUILD? @echo 'set build_alias "$(build_alias)"' >>site.tmp -?BUILD? @echo 'set build_triplet $(build)' >>site.tmp -?HOST? @echo 'set host_alias "$(host_alias)"' >>site.tmp -?HOST? @echo 'set host_triplet $(host)' >>site.tmp -?TARGET? @echo 'set target_alias "$(target_alias)"' >>site.tmp -?TARGET? @echo 'set target_triplet $(target)' >>site.tmp + $(if $(am.conf.build-triplet),@echo 'set build_triplet $(build)' >>site.tmp) + $(if $(am.conf.build-triplet),@echo 'set build_alias "$(build_alias)"' >>site.tmp) + $(if $(am.conf.host-triplet),@echo 'set host_triplet $(host)' >>site.tmp) + $(if $(am.conf.host-triplet),@echo 'set host_alias "$(host_alias)"' >>site.tmp) + $(if $(am.conf.target-triplet),@echo 'set target_alias "$(target_alias)"' >>site.tmp) + $(if $(am.conf.target-triplet),@echo 'set target_triplet $(target)' >>site.tmp) ## Allow the package author to extend site.exp. @list='$(EXTRA_DEJAGNU_SITE_CONFIG)'; for f in $$list; do \ echo "## Begin content included from file $$f. Do not modify. ##" \ diff --git a/t/triplet.sh b/t/triplet.sh new file mode 100755 index 000000000..f2796c331 --- /dev/null +++ b/t/triplet.sh @@ -0,0 +1,73 @@ +#! /bin/sh +# Copyright (C) 2012 Free Software Foundation, Inc. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +# The $(host), $(build), $(target) variables, and their '*_alias' +# and 'am.conf.*-triplet' counterparts. + +. ./defs || exit 1 + +: > config.guess +: > config.sub +: > Makefile.am + +$ACLOCAL +$AUTOMAKE +grep "^am\.conf\.host-triplet = *$" Makefile.in +grep "^am\.conf\.build-triplet = *$" Makefile.in +grep "^am\.conf\.target-triplet = *$" Makefile.in + +mv -f configure.ac configure.tmpl + +for M in HOST BUILD TARGET; do + m=$(echo $M | LC_ALL=C tr '[A-Z]' '[a-z]') + (cat configure.tmpl && echo AC_CANONICAL_$M) > configure.ac + rm -rf autom4te.cache + $AUTOMAKE + grep "^$m = @$m@$" Makefile.in + grep "^${m}_alias = @${m}_alias@$" Makefile.in + grep "^am\\.conf\\.${m}-triplet = \\\$(${m})$" Makefile.in + case $m in + build) + grep '^am\.conf\.host-triplet = *$' Makefile.in + grep '^am\.conf\.target-triplet = *$' Makefile.in + ;; + host) + grep '^am\.conf\.build-triplet = $(build)$' Makefile.in + grep '^am\.conf\.target-triplet = *$' Makefile.in + ;; + target) + grep '^am\.conf\.build-triplet = $(build)$' Makefile.in + grep '^am\.conf\.target-triplet = $(target)$' Makefile.in + ;; + esac +done + +rm -rf autom4te.cache + +cat configure.tmpl - >configure.ac <<'END' +AC_CANONICAL_HOST +AC_CANONICAL_BUILD +AC_CANONICAL_TARGET +END + +$AUTOMAKE +for m in host build target; do + grep "^$m = @$m@$" Makefile.in + grep "^${m}_alias = @${m}_alias@$" Makefile.in + grep "^am\.conf\.${m}-triplet = \$(${m})$" Makefile.in +done + +: