From e09f5a739c740423a3a34346bf1ad27b52843d2f Mon Sep 17 00:00:00 2001 From: Tom Tromey Date: Sat, 24 Apr 1999 16:30:51 +0000 Subject: [PATCH] * automake.in (generate_makefile): Define `subdir' after reading .am file. (read_main_am_file): Give programming error if variable defined before invocation. --- ChangeLog | 7 +++++++ Makefile.in | 42 ++++++++++++++++++++++-------------------- automake.in | 12 +++++++++++- m4/Makefile.in | 3 +-- tests/Makefile.in | 3 +-- 5 files changed, 42 insertions(+), 25 deletions(-) diff --git a/ChangeLog b/ChangeLog index ab20bee..991e8ec 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +1999-04-24 Tom Tromey + + * automake.in (generate_makefile): Define `subdir' after reading + .am file. + (read_main_am_file): Give programming error if variable defined + before invocation. + 1999-04-22 Tom Tromey * automake.in (generate_makefile): Define `subdir' variable. diff --git a/Makefile.in b/Makefile.in index fb3077c..edd91ef 100644 --- a/Makefile.in +++ b/Makefile.in @@ -95,6 +95,7 @@ ETAGS_ARGS = $(amfiles) TAGS_DEPENDENCIES = $(ETAGS_ARGS) EXTRA_DIST = ChangeLog.1996 ChangeLog.1998 +subdir = . ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs CONFIG_CLEAN_FILES = automake aclocal @@ -110,9 +111,9 @@ DATA = $(dist_pkgdata_DATA) $(dist_script_DATA) 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 \ -config.guess config.sub configure configure.in elisp-comp install-sh \ -mdate-sh missing mkinstalldirs stamp-vti texinfo.tex version.texi \ -ylwrap +compile config.guess config.sub configure configure.in elisp-comp \ +install-sh mdate-sh missing mkinstalldirs stamp-vti texinfo.tex \ +version.texi ylwrap DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) @@ -144,21 +145,22 @@ install-binSCRIPTS: $(bin_SCRIPTS) @$(NORMAL_INSTALL) $(mkinstalldirs) $(DESTDIR)$(bindir) @list='$(bin_SCRIPTS)'; for p in $$list; do \ + f="`echo $$p|sed '$(transform)'`"; \ if test -f $$p; then \ - echo " $(INSTALL_SCRIPT) $$p $(DESTDIR)$(bindir)/`echo $$p|sed '$(transform)'`"; \ - $(INSTALL_SCRIPT) $$p $(DESTDIR)$(bindir)/`echo $$p|sed '$(transform)'`; \ - else if test -f $(srcdir)/$$p; then \ - echo " $(INSTALL_SCRIPT) $(srcdir)/$$p $(DESTDIR)$(bindir)/`echo $$p|sed '$(transform)'`"; \ - $(INSTALL_SCRIPT) $(srcdir)/$$p $(DESTDIR)$(bindir)/`echo $$p|sed '$(transform)'`; \ - else :; fi; fi; \ + echo " $(INSTALL_SCRIPT) $$p $(DESTDIR)$(bindir)/$$f"; \ + $(INSTALL_SCRIPT) $$p $(DESTDIR)$(bindir)/$$f; \ + elif test -f $(srcdir)/$$p; then \ + echo " $(INSTALL_SCRIPT) $(srcdir)/$$p $(DESTDIR)$(bindir)/$$f"; \ + $(INSTALL_SCRIPT) $(srcdir)/$$p $(DESTDIR)$(bindir)/$$f; \ + else :; fi; \ done uninstall-binSCRIPTS: @$(NORMAL_UNINSTALL) @list='$(bin_SCRIPTS)'; for p in $$list; do \ - file="`echo $$p|sed '$(transform)'`"; \ - echo " rm -f $(DESTDIR)$(bindir)/$$file"; \ - rm -f $(DESTDIR)$(bindir)/$$file; \ + f="`echo $$p|sed '$(transform)'`"; \ + echo " rm -f $(DESTDIR)$(bindir)/$$f"; \ + rm -f $(DESTDIR)$(bindir)/$$f; \ done $(srcdir)/version.texi: stamp-vti @@ -437,7 +439,7 @@ top_distdir = $(distdir) # tarfile. distcheck: dist -rm -rf $(distdir) - GZIP=$(GZIP_ENV) gunzip -c $(distdir).tar.gz | $(TAR) xf - + GZIP=$(GZIP_ENV) gunzip -c $(distdir).tar.gz | $(AMTAR) xf - mkdir $(distdir)/=build mkdir $(distdir)/=inst dc_install_base=`cd $(distdir)/=inst && pwd`; \ @@ -457,11 +459,11 @@ distcheck: dist echo "$$dashes" dist: distdir -chmod -R a+r $(distdir) - $(TAR) ch$(AMTARFLAGS)f - $(distdir) | GZIP=$(GZIP_ENV) gzip -c > $(distdir).tar.gz + $(AMTAR) ch$(AMTARFLAGS)f - $(distdir) | GZIP=$(GZIP_ENV) gzip -c > $(distdir).tar.gz -rm -rf $(distdir) dist-all: distdir -chmod -R a+r $(distdir) - $(TAR) ch$(AMTARFLAGS)f - $(distdir) | GZIP=$(GZIP_ENV) gzip -c > $(distdir).tar.gz + $(AMTAR) ch$(AMTARFLAGS)f - $(distdir) | GZIP=$(GZIP_ENV) gzip -c > $(distdir).tar.gz -rm -rf $(distdir) distdir: $(DISTFILES) @if sed 15q $(srcdir)/NEWS | fgrep -e "$(VERSION)" > /dev/null; then :; else \ @@ -570,11 +572,11 @@ distclean-vti clean-vti maintainer-clean-vti install-info-am \ uninstall-info mostlyclean-aminfo distclean-aminfo clean-aminfo \ maintainer-clean-aminfo uninstall-dist_pkgdataDATA \ install-dist_pkgdataDATA uninstall-dist_scriptDATA \ -install-dist_scriptDATA install-data-recursive uninstall-data-recursive \ -install-exec-recursive uninstall-exec-recursive installdirs-recursive \ -uninstalldirs-recursive all-recursive check-recursive \ -installcheck-recursive info-recursive dvi-recursive \ -mostlyclean-recursive distclean-recursive clean-recursive \ +install-dist_scriptDATA install-recursive uninstall-recursive \ +install-data-recursive uninstall-data-recursive install-exec-recursive \ +uninstall-exec-recursive installdirs-recursive uninstalldirs-recursive \ +all-recursive check-recursive installcheck-recursive info-recursive \ +dvi-recursive mostlyclean-recursive distclean-recursive clean-recursive \ maintainer-clean-recursive tags tags-recursive mostlyclean-tags \ distclean-tags clean-tags maintainer-clean-tags distdir info-am info \ dvi-am dvi check check-am installcheck-local installcheck-am \ diff --git a/automake.in b/automake.in index cf9439c..3411dbe 100755 --- a/automake.in +++ b/automake.in @@ -602,7 +602,6 @@ sub generate_makefile # the generated makefile. &push_dist_common ($in_file_name, $am_file_name); } - &define_variable ('subdir', $relative_dir); push (@sources, '$(SOURCES)') if &variable_defined ('SOURCES'); @@ -616,6 +615,10 @@ sub generate_makefile return; } + # Must do this after reading .am file. See read_main_am_file to + # understand weird tricks we play there with variables. + &define_variable ('subdir', $relative_dir); + # Check first, because we might modify some state. &check_cygnus; &check_gnu_standards; @@ -6471,6 +6474,13 @@ sub read_main_am_file local (@var_list) = (); local (%def_type) = (); + # This supports the strange variable tricks we are about to play. + if (scalar keys %contents > 0) + { + print STDERR "automake: programming error: variable defined before read_main_am_file\n"; + exit 1; + } + # We want to predefine as many variables as possible. This lets # the user set them with `+=' in Makefile.am. However, we don't # want these initial definitions to end up in the output quite diff --git a/m4/Makefile.in b/m4/Makefile.in index fb08215..ebe0974 100644 --- a/m4/Makefile.in +++ b/m4/Makefile.in @@ -76,6 +76,7 @@ termios.m4 winsz.m4 EXTRA_DIST = $(m4data_DATA) +subdir = m4 mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs CONFIG_CLEAN_FILES = DIST_SOURCES = @@ -120,8 +121,6 @@ TAGS: distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir) -subdir = m4 - distdir: $(DISTFILES) here=`cd $(top_builddir) && pwd`; \ top_distdir=`cd $(top_distdir) && pwd`; \ diff --git a/tests/Makefile.in b/tests/Makefile.in index 1aae92d..8d71064 100644 --- a/tests/Makefile.in +++ b/tests/Makefile.in @@ -114,6 +114,7 @@ xsource.test yacc.test yacc2.test yacc3.test yaccpp.test EXTRA_DIST = defs $(TESTS) +subdir = tests mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs CONFIG_CLEAN_FILES = DIST_SOURCES = @@ -138,8 +139,6 @@ TAGS: distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir) -subdir = tests - distdir: $(DISTFILES) here=`cd $(top_builddir) && pwd`; \ top_distdir=`cd $(top_distdir) && pwd`; \ -- 2.7.4