From dce4a1e5ac51628cb8aaa7c4a79c2beda43ac5e2 Mon Sep 17 00:00:00 2001 From: Tom Tromey Date: Fri, 5 Jan 1996 06:33:44 +0000 Subject: [PATCH] Merged dist targets into automake proper --- ChangeLog | 15 ++++++++ Makefile.am | 4 +- Makefile.in | 21 +++++++---- TODO | 13 +++---- automake.in | 105 ++++++++++++++++++++++++++++++++++++++++++++++------- configure | 2 +- configure.in | 2 +- dist-subd-top.am | 37 ------------------- dist-subd.am | 8 ---- dist.am | 21 ----------- lib/am/Makefile.am | 4 +- 11 files changed, 131 insertions(+), 101 deletions(-) delete mode 100644 dist-subd-top.am delete mode 100644 dist-subd.am delete mode 100644 dist.am diff --git a/ChangeLog b/ChangeLog index ddf789b..56f7d6b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,18 @@ +Thu Jan 4 21:21:29 1996 Tom Tromey + + * Makefile.am (pkgdata_DATA): Removed old dist files. + + * dist-subd-top.am, dist-subd.am, dist.am: Removed. + + * automake.in (set_strictness): Set $strictness_name. + (strictness_name): New variable. + (handle_dist): Substantially rewrote. + + * configure.in: Point AC_INIT at automake.in. + + * automake.in (generate_makefile): Report errors against + Makefile.in, not Makefile.am. + Wed Jan 3 00:05:40 1996 Tom Tromey * mdate-sh: Bug fix from Jim Meyering. diff --git a/Makefile.am b/Makefile.am index c78298a..fe05d1c 100644 --- a/Makefile.am +++ b/Makefile.am @@ -4,8 +4,8 @@ TEXINFOS = automake.texi # CONFIG_HEADER = config.h pkgdata_DATA = clean-kr.am clean.am compile-kr.am compile-vars.am \ -compile.am data.am depend.am dist-subd-top.am \ -dist-subd.am dist-vars.am dist.am footer.am header-vars.am \ +compile.am data.am depend.am \ +dist-vars.am footer.am header-vars.am \ kr-vars.am libraries-vars.am \ libraries.am library.am mans-vars.am \ program.am programs.am remake-hdr.am \ diff --git a/Makefile.in b/Makefile.in index 15a27cf..004c05f 100644 --- a/Makefile.in +++ b/Makefile.in @@ -42,8 +42,8 @@ TEXINFOS = automake.texi # CONFIG_HEADER = config.h pkgdata_DATA = clean-kr.am clean.am compile-kr.am compile-vars.am \ -compile.am data.am depend.am dist-subd-top.am \ -dist-subd.am dist-vars.am dist.am footer.am header-vars.am \ +compile.am data.am depend.am \ +dist-vars.am footer.am header-vars.am \ kr-vars.am libraries-vars.am \ libraries.am library.am mans-vars.am \ program.am programs.am remake-hdr.am \ @@ -206,21 +206,28 @@ distclean-tags: rm -f TAGS ID maintainer-clean-tags: - distdir = $(PACKAGE)-$(VERSION) dist: $(DISTFILES) rm -rf $(distdir) mkdir $(distdir) - (cd $(srcdir) && automake --include-deps --output-dir=$(distdir)) + distdir=`cd $(distdir) && pwd` \ + && cd $(srcdir) \ + && automake --include-deps --output-dir=$$distdir --strictness=normal @for file in $(DISTFILES); do \ test -f $(distdir)/$$file \ || ln $(srcdir)/$$file $(distdir)/$$file \ || cp -p $(srcdir)/$$file $(distdir)/$$file; \ done - @sublist="$(DIST_SUBDIRS)"; \ - for dir in $$sublist; do \ + for subdir in $(SUBDIRS); do \ + test -d $(distdir)/$$subdir \ + || mkdir $(distdir)/$$subdir \ + || exit 1; \ + chmod 777 $(distdir)/$$subdir; \ + (cd $$subdir && $(MAKE) $@) || exit 1; \ + done + @for dir in $(DIST_SUBDIRS); do \ echo copying directory $$dir; \ - tar -chof - $$dir | (cd $(distdir) && tar -xBpf -); \ + tar -chf - $$dir | (cd $(distdir) && tar -xBpf -); \ done chmod -R a+r $(distdir) tar -chozf $(distdir).tar.gz $(distdir) diff --git a/TODO b/TODO index 95429ff..2fd4eb0 100644 --- a/TODO +++ b/TODO @@ -13,12 +13,11 @@ Top priorities: uninstall and pkg-dirs should rm -rf the dir. -Merge dist*.am files into automake itself; replication is bad. In -general most .am files should be merged into automake. For instance -all the "clean" targets could be merged by keeping lists of things to -be removed. This would be a lot nicer looking. Note that the install -targets probably should not be merged; it is sometimes useful to only -install a small part. +In general most .am files should be merged into automake. For +instance all the "clean" targets could be merged by keeping lists of +things to be removed. This would be a lot nicer looking. Note that +the install targets probably should not be merged; it is sometimes +useful to only install a small part. Clean up the output: * Order rules sensibly @@ -74,8 +73,6 @@ Some things for --strictness=gnits: * "cd $(foo); something" is an error in a rule. Should be: "cd $(foo) && something" * check for version number in NEWS file. -If --gnits or --gnu specified, then it should be specified in the -"dist" target as well. Maybe it should be possible to disable all GNU-specific things with --no-gnu? --ignore-standards? But what? And why? diff --git a/automake.in b/automake.in index 72bafe5..c33e691 100755 --- a/automake.in +++ b/automake.in @@ -52,6 +52,9 @@ $GNITS = 2; # Strictness level. $strictness = $NORMAL; +# Name of strictness level. +$strictness_name = 'normal'; + # This is TRUE if GNU make specific automatic dependency generation # code should be included in generated Makefile.in. $use_dependencies = 1; @@ -258,7 +261,8 @@ sub generate_makefile } if (! open (GM_FILE, "> " . $output_directory . '/' . $makefile . ".in")) { - &am_error ("cannot open:", $!); + warn "automake: ${am_file}.in: cannot open: $!\n"; + $exit_status = 1; return; } @@ -668,18 +672,92 @@ sub handle_dist # Some boilerplate. $output_vars .= &file_contents ('dist-vars'); - if ($relative_dir ne '.') + + # Initialization; only at top level. + if ($relative_dir eq '.') { - # In a subdirectory. - $output_vars .= "subdir = " . $relative_dir . "\n\n"; - $output_rules .= &file_contents ('dist-subd'); + $output_rules .= + ( + # Some boilerplate. + ' +distdir = $(PACKAGE)-$(VERSION) +dist: $(DISTFILES) +' + # Create dist directory. + . ' rm -rf $(distdir) + mkdir $(distdir) +' + # We need an absolute path for --output-dir. Thus the + # weirdness. + . ' distdir=`cd $(distdir) && pwd` \\ + && cd $(srcdir) \\ + && automake --include-deps --output-dir=$$distdir --strictness=' + # Set strictness of output. + . $strictness_name . "\n" + ); } else { - $output_rules .= &file_contents (defined $contents{'SUBDIRS'} - ? 'dist-subd-top' - : 'dist'); + $output_rules .= + ( + # Some boilerplate. + "\nsubdir = " . $relative_dir . "\n" + . 'distdir = $(PACKAGE)-$(VERSION)/$(subdir) +dist: $(DISTFILES) +' + ); + } + + # In loop, test for file existence because sometimes a file gets + # included in DISTFILES twice. For example this happens when a + # single source file is used in building more than one program. + # Also, there are situations in which "ln" can fail. For instance + # a file to distribute could actually be a cross-filesystem + # symlink -- this can easily happen if "gettextize" was run on the + # distribution. + $output_rules .= ' @for file in $(DISTFILES); do \\ + test -f $(distdir)/$$file \\ + || ln $(srcdir)/$$file $(distdir)/$$file \\ + || cp -p $(srcdir)/$$file $(distdir)/$$file; \\ + done +'; + + # If top level, create all dist subdirectories and do recursive + # build. + if ($relative_dir eq '.') + { + # Test for directory existence here because previous automake + # invocation might have created some directories. + $output_rules .= ' for subdir in $(SUBDIRS); do \\ + test -d $(distdir)/$$subdir \\ + || mkdir $(distdir)/$$subdir \\ + || exit 1; \\ + chmod 777 $(distdir)/$$subdir; \\ + (cd $$subdir && $(MAKE) $@) || exit 1; \\ + done +'; } + + # Make verbatim copies of some subdirectories if required. This + # is a hack which might go away. + if (defined $contents{'DIST_SUBDIRS'}) + { + $output_rules .= ' @for dir in $(DIST_SUBDIRS); do \\ + echo copying directory $$dir; \\ + tar -chf - $$dir | (cd $(distdir) && tar -xBpf -); \\ + done +'; + } + + # Finalize. + if ($relative_dir eq '.') + { + $output_rules .= ' chmod -R a+r $(distdir) + tar -chozf $(distdir).tar.gz $(distdir) + rm -rf $(distdir) +'; + } + push (@phony, 'dist'); } @@ -1674,23 +1752,22 @@ sub push_phony_cleaners # Set strictness. sub set_strictness { - local ($name) = @_; - - if ($name eq 'gnu') + $strictness_name = @_; + if ($strictness_name eq 'gnu') { $strictness = $GNU; } - elsif ($name eq 'gnits') + elsif ($strictness_name eq 'gnits') { $strictness = $GNITS; } - elsif ($name eq 'normal') + elsif ($strictness_name eq 'normal') { $strictness = $NORMAL; } else { - die "automake: level \`$name' not recognized\n"; + die "automake: level \`$strictness_name' not recognized\n"; } } diff --git a/configure b/configure index 89d394b..c4b7420 100755 --- a/configure +++ b/configure @@ -445,7 +445,7 @@ echo > confdefs.h # A filename unique to this package, relative to the directory that # configure is in, which we can look for to find out if srcdir is correct. -ac_unique_file=dist.am +ac_unique_file=automake.in # Find the source files, if location was not specified. if test -z "$srcdir"; then diff --git a/configure.in b/configure.in index 7721500..f5a0dd2 100644 --- a/configure.in +++ b/configure.in @@ -1,5 +1,5 @@ dnl Process this file with autoconf to produce a configure script. -AC_INIT(dist.am) +AC_INIT(automake.in) dnl we use this for gettext dnl AC_CONFIG_HEADER(config.h) diff --git a/dist-subd-top.am b/dist-subd-top.am deleted file mode 100644 index 85b135b..0000000 --- a/dist-subd-top.am +++ /dev/null @@ -1,37 +0,0 @@ -distdir = $(PACKAGE)-$(VERSION) -dist: $(DISTFILES) - rm -rf $(distdir) - mkdir $(distdir) -## We need an absolute path for --output-dir. Get that here. - distdir=`cd $(distdir) && pwd` \ - && cd $(srcdir) \ - && automake --include-deps --output-dir=$$distdir - @for file in $(DISTFILES); do \ -## Test for file existence because sometimes a file gets included in -## DISTFILES twice. For example this happens when a single source -## file is used in building more than one program. Also, there are -## situations in which "ln" can fail. For instance a file to -## distribute could actually be a cross-filesystem symlink -- this can -## easily happen if "gettextize" was run on the distribution. - test -f $(distdir)/$$file \ - || ln $(srcdir)/$$file $(distdir)/$$file \ - || cp -p $(srcdir)/$$file $(distdir)/$$file; \ - done - for subdir in $(SUBDIRS); do \ -## Test for directory existence here because previous automake -## invocation might have created some directories. - test -d $(distdir)/$$subdir \ - || mkdir $(distdir)/$$subdir \ - || exit 1; \ - chmod 777 $(distdir)/$$subdir; \ - (cd $$subdir && $(MAKE) $@) || exit 1; \ - done -## Set "sublist" here because shells fail on "for dir in ; do". - @sublist="$(DIST_SUBDIRS)"; \ - for dir in $$sublist; do \ - echo copying directory $$dir; \ - tar -chf - $$dir | (cd $(distdir) && tar -xBpf -); \ - done - chmod -R a+r $(distdir) - tar -chozf $(distdir).tar.gz $(distdir) - rm -rf $(distdir) diff --git a/dist-subd.am b/dist-subd.am deleted file mode 100644 index 1ea36ae..0000000 --- a/dist-subd.am +++ /dev/null @@ -1,8 +0,0 @@ -distdir = ../$(PACKAGE)-$(VERSION)/$(subdir) -dist: $(DISTFILES) - @for file in $(DISTFILES); do \ -## See dist-subd-top.am to understand this. - test -f $(distdir)/$$file \ - || ln $(srcdir)/$$file $(distdir)/$$file \ - || cp -p $(srcdir)/$$file $(distdir)/$$file; \ - done diff --git a/dist.am b/dist.am deleted file mode 100644 index 574c2bc..0000000 --- a/dist.am +++ /dev/null @@ -1,21 +0,0 @@ -## See dist-subd-top.am to understand this file. -distdir = $(PACKAGE)-$(VERSION) -dist: $(DISTFILES) - rm -rf $(distdir) - mkdir $(distdir) - distdir=`cd $(distdir) && pwd` \ - && cd $(srcdir) \ - && automake --include-deps --output-dir=$$distdir - @for file in $(DISTFILES); do \ - test -f $(distdir)/$$file \ - || ln $(srcdir)/$$file $(distdir)/$$file \ - || cp -p $(srcdir)/$$file $(distdir)/$$file; \ - done - @sublist="$(DIST_SUBDIRS)"; \ - for dir in $$sublist; do \ - echo copying directory $$dir; \ - tar -chof - $$dir | (cd $(distdir) && tar -xBpf -); \ - done - chmod -R a+r $(distdir) - tar -chozf $(distdir).tar.gz $(distdir) - rm -rf $(distdir) diff --git a/lib/am/Makefile.am b/lib/am/Makefile.am index c78298a..fe05d1c 100644 --- a/lib/am/Makefile.am +++ b/lib/am/Makefile.am @@ -4,8 +4,8 @@ TEXINFOS = automake.texi # CONFIG_HEADER = config.h pkgdata_DATA = clean-kr.am clean.am compile-kr.am compile-vars.am \ -compile.am data.am depend.am dist-subd-top.am \ -dist-subd.am dist-vars.am dist.am footer.am header-vars.am \ +compile.am data.am depend.am \ +dist-vars.am footer.am header-vars.am \ kr-vars.am libraries-vars.am \ libraries.am library.am mans-vars.am \ program.am programs.am remake-hdr.am \ -- 2.7.4