From: Tom Tromey Date: Tue, 5 Dec 1995 09:13:32 +0000 (+0000) Subject: Finished uniform naming scheme X-Git-Tag: Release-0-25~11 X-Git-Url: https://sourceware.org/git/?a=commitdiff_plain;h=8b508a4ed19cc0f34ba501d7ada164d7367de1e5;p=automake.git Finished uniform naming scheme --- diff --git a/ChangeLog b/ChangeLog index 6b10b2ba..80cbe239 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,33 @@ +Tue Dec 5 00:46:14 1995 Tom Tromey + + * programs.am: Changed for uniform naming scheme. + + * automake.in (read_am_file): Allow '-' and '.' in target names. + (generate_makefile): Don't pass arguments to handle_libraries. + (initialize_per_input): Define @sources, @objects. + (generate_makefile): Init @sources, @objects if needed. + (handle_source_transform): Push onto @sources, @objects here. + (am_install_var): Push primary onto @all, for configure-time + customization. + (handle_programs): Use new uniform naming scheme. + + * Makefile.am (check-local): New target. + + * automake.in (handle_libraries): Use uniform naming scheme. + + * libraries.am: Rewrote for uniform naming scheme. + + * scripts.am: Updated names of all clean targets. + + * automake.in (handle_programs): Split on all whitespace. + (handle_libraries): Ditto. + (handle_texinfo): Ditto. + (handle_man_pages): Ditto. + (am_install_var): Changed return result. + (am_install_var): Changed interface. + (am_install_var): Push onto @clean@ if requested. + (handle_scripts): Pass -clean to am_install_var. + Mon Dec 4 11:55:36 1995 Tom Tromey * automake.in (am_install_var): Push target onto @all. diff --git a/Makefile.am b/Makefile.am index da770f09..6d13cf63 100644 --- a/Makefile.am +++ b/Makefile.am @@ -15,8 +15,13 @@ texi-clean.am texi-version.am texinfos-vars.am texinfos.am DIST_OTHER = automake.in +# The following requires a fixed version of the Emacs 19.30 etags. +ETAGS_ARGS = automake.in + +# The simplest form of checking. +check-local: automake + @PERL@ -c -w automake + automake: automake.in CONFIG_FILES=$@ CONFIG_HEADERS= ./config.status -# The following requires a fixed version of the Emacs 19.30 etags. -ETAGS_ARGS = automake.in diff --git a/Makefile.in b/Makefile.in index 96664a29..c9a7c705 100644 --- a/Makefile.in +++ b/Makefile.in @@ -64,6 +64,7 @@ DIST_OTHER = automake.in ETAGS_ARGS = automake.in + SCRIPTS = $(bin_SCRIPTS) MAKEINFO = makeinfo @@ -100,14 +101,14 @@ uninstall-binSCRIPTS: rm -f $(bindir)/`echo $$p|sed '$(transform)'`; \ done -mostlyclean-scripts: +mostlyclean-binSCRIPTS: -clean-scripts: +clean-binSCRIPTS: rm -f $(bin_SCRIPTS) -distclean-scripts: +distclean-binSCRIPTS: -maintainer-clean-scripts: +maintainer-clean-binSCRIPTS: version.texi: stamp-vti @@ -238,13 +239,13 @@ dist: $(DISTFILES) tar -chozf $(distdir).tar.gz $(distdir) rm -rf $(distdir) -all: info $(bin_SCRIPTS) $(pkgdata_DATA) +all: info $(PROGRAMS) $(SCRIPTS) $(DATA) $(HEADERS) info: $(INFO_DEPS) dvi: $(DVIS) -check: +check: check-local installcheck: @@ -272,22 +273,26 @@ distclean-generic: maintainer-clean-generic: test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES) -mostlyclean: mostlyclean-vti mostlyclean-info mostlyclean-tags mostlyclean-generic +mostlyclean: mostlyclean-binSCRIPTS mostlyclean-vti mostlyclean-info mostlyclean-tags mostlyclean-generic -clean: mostlyclean clean-vti clean-info clean-tags clean-generic +clean: mostlyclean clean-binSCRIPTS clean-vti clean-info clean-tags clean-generic -distclean: clean distclean-vti distclean-info distclean-tags distclean-generic +distclean: clean distclean-binSCRIPTS distclean-vti distclean-info distclean-tags distclean-generic -maintainer-clean: distclean maintainer-clean-vti maintainer-clean-info maintainer-clean-tags maintainer-clean-generic +maintainer-clean: distclean maintainer-clean-binSCRIPTS maintainer-clean-vti maintainer-clean-info maintainer-clean-tags maintainer-clean-generic @echo "This command is intended for maintainers to use;" @echo "it deletes files that may require special tools to rebuild." # SUBDIRS = intl po # CONFIG_HEADER = config.h +# The following requires a fixed version of the Emacs 19.30 etags. +# The simplest form of checking. +check-local: automake + @PERL@ -c -w automake + automake: automake.in CONFIG_FILES=$@ CONFIG_HEADERS= ./config.status -# The following requires a fixed version of the Emacs 19.30 etags. .SUFFIXES: .SUFFIXES: .texi .info .dvi diff --git a/NEWS b/NEWS index 2decd9ac..88fca18f 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,8 @@ +New in 0.24: +* New uniform naming scheme. +* --strict option +* Works with Perl 5 + New in 0.23: * Allow objects to be conditionally included in libraries via lib_LIBADD. diff --git a/automake.in b/automake.in index 539d9835..1b0a975a 100755 --- a/automake.in +++ b/automake.in @@ -44,7 +44,7 @@ $GNITS = 2; # Variables global to entire run. # Strictness level. -$strictness = $LENIENT; +$strictness = $NORMAL; # This is TRUE if GNU make specific automatic dependency generation # code should be included in generated Makefile.in. @@ -193,7 +193,7 @@ sub require_argument sub generate_makefile { local ($makefile) = @_; - + print "creating ", $makefile, ".in\n"; &initialize_per_input; @@ -201,6 +201,8 @@ sub generate_makefile # FIXME with new 'dist' target, don't need Makefile.in. Probably # should remove it here. push_dist_common ('Makefile.in', 'Makefile.am'); + push (@sources, '$(SOURCES)') if (defined $contents{'SOURCES'}); + push (@objects, '$(OBJECTS)') if (defined $contents{'OBJECTS'}); # Generate header before reading .am file. The header must come # before anything else, and read_am_file copies code into the @@ -217,14 +219,14 @@ sub generate_makefile &check_gnu_standards; &check_gnits_standards; - # Program stuff. - local ($programs) = &am_variable ('PROGRAMS'); - local ($libprograms) = &am_variable ('LIBPROGRAMS'); - local ($libraries) = &am_variable ('LIBRARIES'); - - &handle_programs ($programs, $libprograms, $libraries); + &handle_libraries; + &handle_programs; &handle_scripts; - &handle_libraries ($libraries); + + # Re-init SOURCES and OBJECTS. FIXME other code shouldn't depend + # on this (but currently does). + $contents{'SOURCES'} = join (' ', @sources); + $contents{'OBJECTS'} = join (' ', @objects); &handle_texinfo; &handle_man_pages; @@ -310,7 +312,6 @@ sub handle_source_transform local ($one_file, $obj) = @_; # Look for file_SOURCES and file_OBJECTS. - local (@result) = (); if (defined $contents{$one_file . "_SOURCES"}) { if (! defined $contents{$one_file . "_OBJECTS"}) @@ -333,16 +334,16 @@ sub handle_source_transform &am_error ($one_file . '_OBJECTS', 'should not be defined'); } - @result = ('$(' . $one_file . "_SOURCES)", - '$(' . $one_file . "_OBJECTS)"); + push (@sources, '$(' . $one_file . "_SOURCES)"); + push (@objects, '$(' . $one_file . "_OBJECTS)"); } else { $output_vars .= ($one_file . "_SOURCES = " . $one_file . ".c\n" . $one_file . "_OBJECTS = ". $one_file . $obj . "\n"); - @result = ($one_file . '.c', - $one_file . $obj); + push (@sources, $one_file . '.c'); + push (@objects, $one_file . $obj); } if (defined $contents{'CONFIG_HEADER'}) @@ -357,89 +358,61 @@ sub handle_source_transform # Handle C programs. sub handle_programs { - local ($programs, $libprograms, $libraries) = @_; - - if (!$programs && !$libprograms && !$libraries) - { - # None exist. - return; - } + local (@proglist) = &am_install_var ('-clean', + 'programs', 'PROGRAMS', + 'bin', 'sbin', 'libexec', 'noinst'); + # FIXME error if PROGRAMS defined but no blah_PROGRAMS defined. + return if ($#proglist < 0); local ($obj) = &get_object_extension; - - local (@sources, @objects); - push (@sources, '$(SOURCES)') if (defined $contents{'SOURCES'}); - push (@objects, '$(OBJECTS)') if (defined $contents{'OBJECTS'}); - - local ($one_file); - local ($sadd, $oadd); - foreach $one_file (split (' ', ($programs . ' ' - . $libprograms . ' ' - . $libraries))) + local ($one_file, $munge); + local ($fcont) = &file_contents ('program'); + foreach $one_file (@proglist) { - ($sadd, $oadd) = &handle_source_transform ($one_file, $obj); - push (@sources, $sadd); - push (@objects, $oadd); - } - - $output_vars .= "\n"; - - # Re-init SOURCES and OBJECTS. FIXME other code shouldn't depend - # on this. - $contents{'SOURCES'} = join (' ', @sources); - $contents{'OBJECTS'} = join (' ', @objects); - - # Some boilerplate, and install rules. - if ($programs) - { - $output_rules .= &file_contents ('programs'); - push (@install_exec, "install-programs"); - push (@uninstall, 'uninstall-programs'); - push (@clean, 'programs'); - push (@installdirs, '$(bindir)'); - push (@all, '$(PROGRAMS)'); - } - if ($libprograms) - { - $output_rules .= &file_contents ('libprograms'); - push (@install_exec, 'install-libprograms'); - push (@uninstall, 'uninstall-libprograms'); - push (@clean, 'libprograms'); - push (@installdirs, '$(libexecdir)'); - push (@all, '$(LIBPROGRAMS)'); - } + &handle_source_transform ($one_file, $obj); - # Handle linking. - if ($programs || $libprograms) - { - local ($fcont) = &file_contents ('program'); - local ($munge); - foreach $one_file (split (' ', $programs . ' ' . $libprograms)) + if (! defined $contents{$one_file . "_LDADD"}) { - if (! defined $contents{$one_file . "_LDADD"}) - { - # User didn't define prog_LDADD override. So do it. - $output_vars .= $one_file . '_LDADD = $(LDADD)' . "\n"; - } - - ($munge = $fcont) =~ s/\@PROGRAM\@/$one_file/g; - $output_rules .= $munge; + # User didn't define prog_LDADD override. So do it. + $output_vars .= $one_file . '_LDADD = $(LDADD)' . "\n"; } + + ($munge = $fcont) =~ s/\@PROGRAM\@/$one_file/g; + $output_rules .= $munge; } } # Handle libraries. sub handle_libraries { - local ($libraries) = @_; - - return if (!$libraries); - - local (@liblist) = split (' ', $libraries); + local (@liblist) = &am_install_var ('-no-all', '-clean', + 'libraries', 'LIBRARIES', + 'lib', 'pkglib', 'noinst'); + # FIXME error if LIBRARIES defined but no blah_LIBRARIES defined. + return if ($#liblist < 0); + + # Generate _LIBFILES variables. Too bad we can't do this in + # am_install_var. + local ($onedir, $onelib); + local (@outlist); + foreach $onedir ('lib', 'pkglib', 'noinst') + { + if (defined $contents{$onedir . '_LIBRARIES'}) + { + @outlist = (); + foreach $onelib (split (/\s+/, $contents{$onedir . '_LIBRARIES'})) + { + push (@outlist, 'lib' . $onelib . '.a'); + } + $output_vars .= ($onedir . '_LIBFILES = ' + . join (' ', @outlist) . "\n"); + } + } + push (@all, '$(LIBFILES)'); - $output_rules .= &file_contents ('libraries'); - local ($onefile) = &file_contents ('library'); - local ($onelib, $munge); + local ($obj) = &get_object_extension; + local ($template) = &file_contents ('library'); + local ($munge); foreach $onelib (@liblist) { if (! defined $contents{$onelib . '_LIBADD'}) @@ -449,26 +422,28 @@ sub handle_libraries $output_vars .= $onelib . "_LIBADD =\n"; } - ($munge = $onefile) =~ s/\@LIBRARY\@/$onelib/g; + &handle_source_transform ($onelib, $obj); + + ($munge = $template) =~ s/\@LIBRARY\@/$onelib/g; $output_rules .= $munge; } # Turn "foo" into "libfoo.a" and include macro definition. grep (($_ = 'lib' . $_ . '.a') && 0, @liblist); - $output_vars .= ("LIBFILES = " . join (' ', @liblist) . "\n\n" - . &file_contents ('libraries-vars')); - push (@install_exec, 'install-libraries'); - push (@uninstall, 'uninstall-libraries'); - push (@clean, 'libraries'); - push (@all, '$(LIBFILES)'); + if (! defined $contents{'LIBFILES'}) + { + $output_vars .= 'LIBFILES = ' . join (' ', @liblist) . "\n"; + } + $output_vars .= &file_contents ('libraries-vars'); } # Handle scripts. sub handle_scripts { - &am_install_var ('scripts', 'SCRIPTS', 'bin', 'sbin', 'libexec', - 'noinst'); + &am_install_var ('-clean', + 'scripts', 'SCRIPTS', + 'bin', 'sbin', 'libexec', 'noinst'); } # Handle all Texinfo source. @@ -477,7 +452,7 @@ sub handle_texinfo local ($texis) = &am_variable ('TEXINFOS'); return if (!$texis); - local (@texis) = split (' ', $texis); + local (@texis) = split (/\s+/, $texis); if ($#texis > 0) { &am_error ('sorry, only one file allowed in `TEXINFOS\''); @@ -553,7 +528,7 @@ sub handle_man_pages # We generate the manpage install code by hand to avoid the use of # basename in the generated Makefile. - local (@mans) = split (' ', $contents{'MANS'}); + local (@mans) = split (/\s+/, $contents{'MANS'}); local (%sections, %inames, %secmap, %fullsecmap); foreach (@mans) { @@ -1073,7 +1048,7 @@ sub read_am_file # de-ANSI-fication. FIXME think of a better way. $contents{'@kr@'} = 1; } - elsif (m/^ *([a-zA-Z_.][a-zA-Z0-9_.]*) *:/) + elsif (m/^ *([a-zA-Z_.][-.a-zA-Z0-9_.]*) *:/) { # Found a rule. $was_rule = 1; @@ -1082,7 +1057,7 @@ sub read_am_file $contents{$1} = 1; $output_trailer .= $_ . "\n"; } - elsif (m/^ *([A-Za-z][A-Za-z0-9_]*)[ ]*=[ ]*(.*)$/) + elsif (m/^ *([A-Za-z][A-Za-z0-9_]*)[ \t]*=[ \t]*(.*)$/) { # Found a variable reference. $was_rule = 0; @@ -1235,6 +1210,11 @@ sub initialize_per_input @installcheck = (); @clean = (); + # These are pretty obvious, too. They are used to define the + # SOURCES and OBJECTS variables. + @sources = (); + @objects = (); + # TRUE if current directory holds any C source files. (Actually # holds object extension, but this information is encapsulated in # the function get_object_extension). @@ -1287,28 +1267,56 @@ sub am_variable # the second argument is the primary variable (eg HEADERS), and all # subsequent arguments are possible installation locations. FIXME # should scan all defined variables and do some error checking to -# avoid typos (eg 'bni_PROGRAMS' should give error). Returns TRUE if -# any items were found, FALSE otherwise. +# avoid typos (eg 'bni_PROGRAMS' should give error). Returns list of +# all values of all _HOW targets. +# +# Usage is: am_install_var (OPTION..., file, HOW, where...) sub am_install_var { - local ($file, $primary, @prefixes) = @_; + local (@args) = @_; + + local ($do_all, $do_clean) = (1, 0); + while ($#args >= 0) + { + if ($args[0] eq '-clean') + { + $do_clean = 1; + } + elsif ($args[0] eq '-no-all') + { + $do_all = 0; + } + elsif ($args[0] !~ /^-/) + { + last; + } + shift (@args); + } + local ($file, $primary, @prefixes) = @args; + local (@used) = (); + local (@result) = (); - local ($contents) = &file_contents ($file); + local ($template) = &file_contents ($file); local ($munge); + local ($one_name); foreach (@prefixes) { - if (defined $contents{$_ . '_' . $primary}) + $one_name = $_ . '_' . $primary; + if (defined $contents{$one_name}) { - push (@all, '$(' . $_ . '_' . $primary . ')'); - push (@used, '$(' . $_ . '_' . $primary . ')'); + # Append actual contents to result. + push (@result, split (/\s+/, $contents{$one_name})); + + push (@clean, $_ . $primary) if $do_clean; + push (@used, '$(' . $one_name . ')'); if ($_ eq 'noinst') { # Objects in noinst_FOO never get installed. next; } - ($munge = $contents) =~ s/\@DIR\@/$_/g; + ($munge = $template) =~ s/\@DIR\@/$_/g; $output_rules .= $munge; push (@uninstall, 'uninstall-' . $_ . $primary); @@ -1330,7 +1338,10 @@ sub am_install_var $output_vars .= $primary . " = " . join (' ', @used) . "\n\n"; } - return ($#used >= 0); + # Push here because PRIMARY might be configure time determined. + push (@all, '$(' . $primary . ')') if ($do_all && $#used >= 0); + + return (@result); } diff --git a/lib/am/Makefile.am b/lib/am/Makefile.am index da770f09..6d13cf63 100644 --- a/lib/am/Makefile.am +++ b/lib/am/Makefile.am @@ -15,8 +15,13 @@ texi-clean.am texi-version.am texinfos-vars.am texinfos.am DIST_OTHER = automake.in +# The following requires a fixed version of the Emacs 19.30 etags. +ETAGS_ARGS = automake.in + +# The simplest form of checking. +check-local: automake + @PERL@ -c -w automake + automake: automake.in CONFIG_FILES=$@ CONFIG_HEADERS= ./config.status -# The following requires a fixed version of the Emacs 19.30 etags. -ETAGS_ARGS = automake.in diff --git a/lib/am/scripts.am b/lib/am/scripts.am index 30ef3acf..35acf349 100644 --- a/lib/am/scripts.am +++ b/lib/am/scripts.am @@ -9,12 +9,12 @@ uninstall-@DIR@SCRIPTS: rm -f $(@DIR@dir)/`echo $$p|sed '$(transform)'`; \ done -mostlyclean-scripts: +mostlyclean-@DIR@SCRIPTS: -clean-scripts: +clean-@DIR@SCRIPTS: rm -f $(@DIR@_SCRIPTS) -distclean-scripts: +distclean-@DIR@SCRIPTS: -maintainer-clean-scripts: +maintainer-clean-@DIR@SCRIPTS: diff --git a/libraries.am b/libraries.am index 5229cf52..3c3e47a4 100644 --- a/libraries.am +++ b/libraries.am @@ -1,13 +1,21 @@ -install-libraries: $(LIBFILES) +install-@DIR@LIBRARIES: $(@DIR@_LIBFILES) + $(topsrcdir)/mkinstalldirs $(@DIR@dir) + for p in $(@DIR@_LIBFILES); do \ + $(INSTALL_DATA) $$p $(@DIR@dir)/$$p; \ + $(RANLIB) $(@DIR@dir)/$$p; \ + done -uninstall-libraries: +uninstall-@DIR@LIBRARIES: + for p in $(@DIR@_LIBFILES); do \ + rm -f $(@DIR@dir)/$$p; \ + done -mostlyclean-libraries: +mostlyclean-@DIR@LIBRARIES: -clean-libraries: - rm -f $(LIBFILES) +clean-@DIR@LIBRARIES: + rm -f $(@DIR@_LIBFILES) -distclean-libraries: +distclean-@DIR@LIBRARIES: -maintainer-clean-libraries: +maintainer-clean-@DIR@LIBRARIES: diff --git a/programs.am b/programs.am index bee98260..152b449f 100644 --- a/programs.am +++ b/programs.am @@ -1,20 +1,20 @@ -install-programs: $(PROGRAMS) +install-@DIR@PROGRAMS: $(@DIR@_PROGRAMS) $(top_srcdir)/mkinstalldirs $(bindir) - for p in $(PROGRAMS); do \ + for p in $(@DIR@_PROGRAMS); do \ $(INSTALL_PROGRAM) $$p $(bindir)/`echo $$p|sed '$(transform)'`; \ done -uninstall-programs: - for p in $(PROGRAMS); do \ +uninstall-@DIR@PROGRAMS: + for p in $(@DIR@_PROGRAMS); do \ rm -f $(bindir)/`echo $$p|sed '$(transform)'`; \ done -mostlyclean-programs: +mostlyclean-@DIR@PROGRAMS: -clean-programs: - rm -f $(PROGRAMS) +clean-@DIR@PROGRAMS: + rm -f $(@DIR@PROGRAMS) -distclean-programs: +distclean-@DIR@PROGRAMS: -maintainer-clean-programs: +maintainer-clean-@DIR@PROGRAMS: diff --git a/scripts.am b/scripts.am index 30ef3acf..35acf349 100644 --- a/scripts.am +++ b/scripts.am @@ -9,12 +9,12 @@ uninstall-@DIR@SCRIPTS: rm -f $(@DIR@dir)/`echo $$p|sed '$(transform)'`; \ done -mostlyclean-scripts: +mostlyclean-@DIR@SCRIPTS: -clean-scripts: +clean-@DIR@SCRIPTS: rm -f $(@DIR@_SCRIPTS) -distclean-scripts: +distclean-@DIR@SCRIPTS: -maintainer-clean-scripts: +maintainer-clean-@DIR@SCRIPTS: