From f6e3b5c09b1121be31e469c198b3eb4485bc3ac8 Mon Sep 17 00:00:00 2001 From: Tom Tromey Date: Tue, 5 Dec 1995 06:54:15 +0000 Subject: [PATCH] Changes to check GNU/GNITS standards. Fixlets --- ChangeLog | 14 +++++++++++++ TODO | 8 ++++---- automake.in | 68 +++++++++++++++++++++++++++++++++++++++++++++++-------------- 3 files changed, 71 insertions(+), 19 deletions(-) diff --git a/ChangeLog b/ChangeLog index faa6b8f..8c42bda 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,19 @@ Mon Dec 4 11:55:36 1995 Tom Tromey + * automake.in (require_argument): New function. + (parse_arguments): Use it. + (push_dist_common): New function. + (generate_makefile): Use it. + (handle_texinfo): Ditto. + (handle_dist): Ditto. + (handle_configure): Ditto. + (require_file): Ditto. + (generate_makefile): Don't pass arguments to handle_scripts. + (handle_configure): Require configure.in. + (check_gnu_standards): New function. + (check_gnits_standards): Ditto. + (generate_makefile): Check standards. + * Makefile.am (bin_SCRIPTS): Changed name from SCRIPTS. * automake.in (LENIENT, GNU, GNITS): New constants. diff --git a/TODO b/TODO index f836353..1c9901a 100644 --- a/TODO +++ b/TODO @@ -12,6 +12,9 @@ Clean up the output: Need OTHER_SOURCES to hold sources whose objects end up in eg LIBOBJS. Dependency tracking should work here. +"@kr@" is a hack that should be fixed. And it should be possible to +have ansi2knr in just one place in a package. + Consider automatic support for ".y" files. At the very least arrange to have the corresponding ".c" file be distributed. @@ -53,10 +56,7 @@ Merge common parts of "dist" targets into dist-local. It would be good to check some parts of GNU standards. Already check for install-sh and mkinstalldirs. What else is required to be in package by GNU standards or by automake? -here are some ideas: -* --gnits, --gnu-, --no-gnu (default) are checking options -* --gnits is most strict -Some things for --gnits: +Some things for --strictness=gnits: * "cd $(foo); something" is an error in a rule. Should be: "cd $(foo) && something" diff --git a/automake.in b/automake.in index 3471d18..8aa3a08 100755 --- a/automake.in +++ b/automake.in @@ -200,7 +200,7 @@ sub generate_makefile $relative_dir = &dirname ($makefile); # FIXME with new 'dist' target, don't need Makefile.in. Probably # should remove it here. - @dist_common = ('Makefile.in', 'Makefile.am'); + push_dist_common ('Makefile.in', 'Makefile.am'); # Generate header before reading .am file. The header must come # before anything else, and read_am_file copies code into the @@ -213,15 +213,17 @@ sub generate_makefile &read_am_file ($makefile . '.am'); + # Check first, because we might modify some state. + &check_gnu_standards; + &check_gnits_standards; + # Program stuff. local ($programs) = &am_variable ('PROGRAMS'); local ($libprograms) = &am_variable ('LIBPROGRAMS'); local ($libraries) = &am_variable ('LIBRARIES'); - local ($scripts) = &am_variable ('SCRIPTS'); - local ($libscripts) = &am_variable ('LIBSCRIPTS'); &handle_programs ($programs, $libprograms, $libraries); - &handle_scripts ($scripts, $libscripts); + &handle_scripts; &handle_libraries ($libraries); &handle_texinfo; @@ -493,7 +495,7 @@ sub handle_texinfo { # Got a hit. push (@texis, 'version.texi'); - push (@dist_common, 'version.texi', 'stamp-vti'); + push_dist_common ('version.texi', 'stamp-vti'); push (@clean, 'vti'); local ($tfile); @@ -508,7 +510,7 @@ sub handle_texinfo if (defined $contents{$infobase . "_TEXINFOS"}) { push (@texis, "\$" . $infobase . '_TEXINFOS'); - push (@dist_common, "\$" . $infobase . '_TEXINFOS'); + push_dist_common ("\$" . $infobase . '_TEXINFOS'); } if ($#texis >= 0) @@ -650,11 +652,12 @@ sub handle_dist { if (-f ($relative_dir . "/" . $cfile)) { - push (@dist_common, $cfile); + push_dist_common ($cfile); } } - $output_vars .= "DIST_COMMON = " . join (' ', @dist_common) . "\n\n"; + $output_vars .= ("DIST_COMMON = " . join (' ', keys (%dist_common)) + . "\n\n"); # Some boilerplate. $output_vars .= &file_contents ('dist-vars'); @@ -736,10 +739,14 @@ sub handle_configure } else { + &require_file ($NORMAL, 'configure.in'); + # FIXME require 'configure'? What if autoconf hasn't been run + # yet? + if (-f 'aclocal.m4') { $output_vars .= "ACLOCAL = aclocal.m4\n"; - push (@dist_common, 'aclocal.m4'); + push_dist_common ('aclocal.m4'); } $output_rules .= &file_contents ('remake'); @@ -755,20 +762,20 @@ sub handle_configure if (-f 'acconfig.h') { $output_vars .= "ACCONFIG = acconfig.h\n"; - push (@dist_common, 'acconfig.h'); + push_dist_common ('acconfig.h'); } if (-f 'config.h.top') { $output_vars .= "CONFIG_TOP = config.h.top\n"; - push (@dist_common, 'config.h.top'); + push_dist_common ('config.h.top'); } if (-f 'config.h.bot') { $output_vars .= "CONFIG_BOT = config.h.bot\n"; - push (@dist_common, 'config.h.bot'); + push_dist_common ('config.h.bot'); } - push (@dist_common, 'stamp-h.in', $contents{'CONFIG_HEADER'} . '.in'); + push_dist_common ('stamp-h.in', $contents{'CONFIG_HEADER'} . '.in'); $output_rules .= &file_contents ('remake-hdr'); } @@ -999,6 +1006,25 @@ sub do_one_clean_target ################################################################ +# Do any extra checking for GNU standards. +sub check_gnu_standards +{ + require_file ($GNU, 'ChangeLog'); + + if ($relative_dir eq '.') + { + # In top level (or only) directory. + require_file ($GNU, 'INSTALL', 'NEWS', 'README'); + } +} + +# Do any extra checking for GNITS standards. +sub check_gnits_standards +{ +} + +################################################################ + # Read Makefile.am and set up %contents. Simultaneously copy lines # from Makefile.am into $output_trailer or $output_vars as # appropriate. NOTE we put rules in the trailer section. We want @@ -1194,7 +1220,7 @@ sub initialize_per_input # This holds a list of files that are included in the # distribution. - @dist_common = (); + %dist_common = (); # List of dependencies for the obvious targets. @install_data = (); @@ -1320,7 +1346,7 @@ sub require_file if (-f $fullfile) { - push (@dist_common, $file); + push_dist_common ($file); } elsif ($strictness >= $mystrict) { @@ -1329,6 +1355,18 @@ sub require_file } } +# Push a list of files onto dist_common. +sub push_dist_common +{ + local (@files) = @_; + local ($file); + + foreach $file (@files) + { + $dist_common{$file} = 1; + } +} + # Set strictness. sub set_strictness { -- 2.7.4