From ebf5498364b5d2065a91ce1d672a202ed5e15dd4 Mon Sep 17 00:00:00 2001 From: Tom Tromey Date: Wed, 2 Feb 2000 04:29:01 +0000 Subject: [PATCH] 2000-02-02 Assar Westerlund * automake.in (handle_single_transform_list): do not use $< which is not handled by all non-GNU makes. Instead do explicit sh code testing for the file in this directory and srcdir. Based on a suggestion by Alexandre Oliva --- ChangeLog | 7 ++++++ Makefile.in | 10 ++++---- automake.in | 9 +++---- tests/ChangeLog | 4 ++++ tests/Makefile.am | 1 + tests/Makefile.in | 3 +++ tests/target-cflags.test | 51 ++++++++++++++++++++++++++++++++++++++++ 7 files changed, 77 insertions(+), 8 deletions(-) create mode 100755 tests/target-cflags.test diff --git a/ChangeLog b/ChangeLog index c7fee919..82a57734 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2000-02-02 Assar Westerlund + + * automake.in (handle_single_transform_list): do not use $< which + is not handled by all non-GNU makes. Instead do explicit sh code + testing for the file in this directory and srcdir. Based on a + suggestion by Alexandre Oliva + 2000-01-12 Tom Tromey * m4/lispdir.m4: Added --with-lispdir argument processing. diff --git a/Makefile.in b/Makefile.in index b897d512..3d18f6b5 100644 --- a/Makefile.in +++ b/Makefile.in @@ -57,6 +57,8 @@ POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : + +@SET_MAKE@ AMTAR = @AMTAR@ AMTARFLAGS = @AMTARFLAGS@ AWK = @AWK@ @@ -120,8 +122,8 @@ DIST_COMMON = README $(dist_pkgdata_DATA) $(dist_script_DATA) AUTHORS \ COPYING ChangeLog INSTALL Makefile.am Makefile.in NEWS README-alpha \ THANKS TODO aclocal.in aclocal.m4 ansi2knr.1 ansi2knr.c automake.in \ compile config.guess config.sub configure configure.in depcomp \ -elisp-comp install-sh mdate-sh missing mkinstalldirs stamp-vti \ -texinfo.tex version.texi ylwrap +elisp-comp install-sh mdate-sh missing mkinstalldirs py-compile \ +stamp-vti texinfo.tex version.texi ylwrap DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) @@ -357,8 +359,6 @@ uninstall-dist_scriptDATA: # (which will cause the Makefiles to be regenerated when you run `make'); # (2) otherwise, pass the desired values on the `make' command line. -@SET_MAKE@ - all-recursive install-data-recursive install-exec-recursive \ installdirs-recursive install-recursive uninstall-recursive \ check-recursive installcheck-recursive info-recursive dvi-recursive: @@ -480,6 +480,7 @@ distcheck: dist dist: distdir -find $(distdir) -type d ! -perm -777 -exec chmod a+rwx {} \; -o \ ! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \ + ! -type d ! -perm -400 -exec chmod a+r {} \; -o \ ! -type d ! -perm -444 -exec $(SHELL) $(install_sh) -c -m a+r {} {} \; \ || chmod -R a+r $(distdir) $(AMTAR) chof - $(distdir) | GZIP=$(GZIP_ENV) gzip -c > $(distdir).tar.gz @@ -487,6 +488,7 @@ dist: distdir dist-all: distdir -find $(distdir) -type d ! -perm -777 -exec chmod a+rwx {} \; -o \ ! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \ + ! -type d ! -perm -400 -exec chmod a+r {} \; -o \ ! -type d ! -perm -444 -exec $(SHELL) $(install_sh) -c -m a+r {} {} \; \ || chmod -R a+r $(distdir) $(AMTAR) chof - $(distdir) | GZIP=$(GZIP_ENV) gzip -c > $(distdir).tar.gz diff --git a/automake.in b/automake.in index 9a58889b..5f666c18 100755 --- a/automake.in +++ b/automake.in @@ -1361,10 +1361,11 @@ sub handle_single_transform_list local ($xform); ($xform = $object) =~ s,/,\\/,g; $rule =~ s/\$\@/$xform/; - # FIXME: we use $< in an explicit rule here. - # We can't use $(srcdir)/ because we don't - # actually know it is in srcdir. - $rule .= ' $<'; + + # We cannot use $< here since this is an explicit + # rule and not all makes handle that. + $rule .= " \`test -f $full || echo '\$(srcdir)/'\`$full"; + # FIXME: handle .lo and .obj as well. $output_rules .= "\t" . $rule . "\n"; } diff --git a/tests/ChangeLog b/tests/ChangeLog index f35fb488..cd89af48 100644 --- a/tests/ChangeLog +++ b/tests/ChangeLog @@ -1,3 +1,7 @@ +2000-02-02 Assar Westerlund + + * target-cflags.test: new test case to target-specific CFLAGS + 2000-01-08 Tom Tromey * ansi.test, texinfo.test, empty.test, insh2.test, texinfo8.test: diff --git a/tests/Makefile.am b/tests/Makefile.am index 3162b9fb..38ba3ef3 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -228,6 +228,7 @@ syntax.test \ tags.test \ tagsub.test \ target.test \ +target-cflags.test \ texinfo.test \ texinfo2.test \ texinfo3.test \ diff --git a/tests/Makefile.in b/tests/Makefile.in index 88b2ebd4..6f8896a6 100644 --- a/tests/Makefile.in +++ b/tests/Makefile.in @@ -57,6 +57,8 @@ POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : + +@SET_MAKE@ AMTAR = @AMTAR@ AMTARFLAGS = @AMTARFLAGS@ AWK = @AWK@ @@ -295,6 +297,7 @@ syntax.test \ tags.test \ tagsub.test \ target.test \ +target-cflags.test \ texinfo.test \ texinfo2.test \ texinfo3.test \ diff --git a/tests/target-cflags.test b/tests/target-cflags.test new file mode 100755 index 00000000..fd412fde --- /dev/null +++ b/tests/target-cflags.test @@ -0,0 +1,51 @@ +#! /bin/sh + +# Test to make sure target specific CFLAGS work +# Assar Westerlund + +. $srcdir/defs || exit 1 + +cat > configure.in << 'END' +AC_INIT(foo.c) +AM_INIT_AUTOMAKE(target-cflags,0.0) +AC_PROG_CC +AC_OUTPUT(Makefile) +END + +cat > Makefile.am << 'END' +AUTOMAKE_OPTIONS = foreign no-dependencies + +bin_PROGRAMS = foo bar +foo_CFLAGS = -DFOO +END + +cat > foo.c << 'END' +#include +#ifdef FOO +int main(void) { + return 0; +} +#endif +END + +cat > bar.c << 'END' +#ifndef FOO +int main(void) +{ + return 0; +} +#endif +END + +# Fail gracefully if no autoconf. +(autoconf --version) > /dev/null 2>&1 || exit 0 + +# Likewise for gcc. +(gcc -v) > /dev/null 2>&1 || exit 0 + +$ACLOCAL \ + && autoconf \ + && $AUTOMAKE -a \ + && mkdir obj \ + && (cd obj && ../configure && $MAKE && ./foo && ./bar) \ + && ./configure && $MAKE && ./foo && ./bar -- 2.43.5