+Tue Mar 5 16:12:04 1996 Tom Tromey <tromey@creche.cygnus.com>
+
+ * automake.in (OBJECT_PATTERN): Removed.
+ (am_install_var): No error if name is invalid.
+ (handle_programs): Canonicalize program names.
+ (BOGUS_MACRO_PATTERN): New variable.
+ (read_am_file): Error if bad macro name given.
+ (require_file_internal): Use am_line_error, not am_conf_error.
+
+ * program.am (@PROGRAM@): Recognize @PROGRAM@_DEPENDENCIES.
+
Mon Mar 4 19:30:24 1996 Tom Tromey <tromey@creche.cygnus.com>
* automake.in (handle_lib_objects): New function.
* DIST_SUBDIRS is deprecated
* @ALLOCA@ and @LIBOBJS@ now work in _LDADD variables
* Better error messages in many cases
+* Program names are canonicalized
\f
New in 0.30:
* Bug fixes
* Must rewrite am_install_var. Should break into multiple functions.
This will allow the callers to be a little smarter.
* Rewrite clean targets.
-* Expand test suite.
+* Must rewrite error handling code. Right now it is a real mess
Consider allowing mkinstalldirs, mdate-sh, and others to be put in
AC_CONFIG_AUX_DIR. Maybe even ansi2knr?
with all the different package utilities somehow. Lately I've been
hearing good things about the RedHat packaging utilities. Why are
there so many of these? Are they fun to write or something?
+The RedHat package utility is called RPM; see
+ ftp://ftp.redhat.com/pub/code/rpm
+It actually has problems, like no configure script and no documentation.
================================================================
$COMMENT_PATTERN = "^#";
$RULE_PATTERN = "^([a-zA-Z_.][-.a-zA-Z0-9_.]*) *:";
$MACRO_PATTERN = "^([A-Za-z][A-Za-z0-9_]*)[ \t]*=[ \t]*(.*)\$";
-
-# Valid syntax for a derived object, eg a program name. This must
-# satisfy both the filesystem and make.
-$OBJECT_PATTERN = "^[A-Za-z_][-+.A-Za-z_0-9]+\$";
+$BOGUS_MACRO_PATTERN = "^([^ \t]*)[ \t]*=[ \t]*(.*)\$";
# Constants to define the "strictness" level.
$FOREIGN = 0;
return if ! @proglist;
local ($obj) = &get_object_extension;
- local ($one_file, $munge);
+ local ($one_file, $xname, $munge);
foreach $one_file (@proglist)
{
- &handle_source_transform ($one_file, $obj);
+ # Canonicalize names.
+ ($xname = $one_file) =~ tr/A-Za-z0-9_/_/c;
+ if ($xname ne $one_file)
+ {
+ local ($xt);
+ foreach $xt ('_LDADD', '_SOURCES', '_OBJECTS', '_DEPENDENCIES')
+ {
+ &am_line_error ($one_file . $xt,
+ "invalid variable \`" . $one_file . $xt
+ . "'; should be \`" . $xname . $xt . "'")
+ if defined $contents{$one_file . $xt};
+ }
+ }
- if (defined $contents{$one_file . "_LDADD"})
+ &handle_source_transform ($xname, $obj);
+
+ if (defined $contents{$xname . "_LDADD"})
{
- &handle_lib_objects ($one_file . '_LDADD');
+ &handle_lib_objects ($xname . '_LDADD');
}
else
{
# User didn't define prog_LDADD override. So do it.
- $output_vars .= $one_file . '_LDADD = $(LDADD)' . "\n";
+ $output_vars .= $xname . '_LDADD = $(LDADD)' . "\n";
}
$output_rules .=
- &file_contents_with_transform ('s/\@PROGRAM\@/' . $one_file
- . '/go', 'program');
+ &file_contents_with_transform
+ ('s/\@PROGRAM\@/' . $one_file . '/go;'
+ . 's/\@XPROGRAM\@/' . $xname . '/go;',
+ 'program');
}
&handle_lib_objects ('LDADD')
$comment = '';
$spacing = "\n";
+ local ($is_ok_macro);
while ($_)
{
if (/$IGNORE_PATTERN/o)
$comment = $spacing = '';
$saw_bk = /\\$/;
}
- elsif (/$MACRO_PATTERN/o)
+ elsif (($is_ok_macro = /$MACRO_PATTERN/o)
+ || /$BOGUS_MACRO_PATTERN/o)
{
- # warn "** Saw macro .$1.\n";
# Found a macro definition.
$was_rule = 0;
$last_var_name = $1;
$output_vars .= $comment . $spacing . $_;
$comment = $spacing = '';
$saw_bk = /\\$/;
+
+ # Error if bogus.
+ &am_line_error ($., "bad macro name \`$1'")
+ if ! $is_ok_macro;
}
else
{
if (defined $contents{$one_name})
{
# Append actual contents of where_PRIMARY variable to
- # result. Skip elements that look like configure
- # substitutions. Also, possibly check contents of
- # variable for validity.
+ # result.
local ($rcurs);
foreach $rcurs (split (/\s+/, $contents{$one_name}))
{
+ # Skip configure substitutions. Possibly bogus.
next if $rcurs =~ /^\@.*\@$/;
push (@result, $rcurs);
- &am_line_error ($one_name, "invalid object name \`$rcurs'")
- if $primary_uses_subobjects{$primary}
- && $rcurs !~ /$OBJECT_PATTERN/;
}
if ($do_clean)
}
else
{
- &am_conf_error
+ &am_line_error
($line, "required file \"$fullfile\" not found");
}
}
rmt_SOURCES = @dots{}
@end example
+It is also occasionally useful to have a program depend on some other
+target which is not actually part of that program. This can be done
+using the @samp{prog_DEPENDENCIES} variable. Each program depends on
+the contents of such a variable, but no further interpretation is done.
+
+Since program names are rewritten into Makefile macro names, program
+names must follow Makefile macro syntax. Sometimes it is useful to have
+a program whose name does not follow such rules. In these cases,
+Automake canonicalizes the program name. All characters in the name
+except for letters, numbers, and the underscore are turned into
+underscores when making macro references. Eg, if your program is named
+@code{sniff-glue}, you would use @code{sniff_glue_SOURCES}, not
+@code{sniff-glue_SOURCES}.
+
@node A Library
@section Building a library
bin_PROGRAMS = etags ctags
ctags_SOURCES =
ctags_LDADD = ctags.o
+ctags_DEPENDENCIES = ctags.o
etags.o:
$(COMPILE) -DETAGS_REGEXPS etags.c
implicit value is substituted. The implicit value, however, is used to
generate @code{etags} from @file{etags.o}.
+@code{ctags_LDADD} is used to get @file{ctags.o} into the link line,
+while @code{ctags_DEPENDENCIES} exists to make sure that @file{ctags.o}
+gets built in the first place.
+
+This is a somewhat pathological example.
+
@node Automake
@section Automake uses itself
## along with this program; if not, write to the Free Software
## Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
## 02111-1307, USA.
-@PROGRAM@: $(@PROGRAM@_OBJECTS)
+@PROGRAM@: $(@PROGRAM@_OBJECTS) $(@PROGRAM@_DEPENDENCIES)
$(LINK) $(@PROGRAM@_OBJECTS) $(@PROGRAM@_LDADD) $(LIBS)
## along with this program; if not, write to the Free Software
## Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
## 02111-1307, USA.
-@PROGRAM@: $(@PROGRAM@_OBJECTS)
+@PROGRAM@: $(@PROGRAM@_OBJECTS) $(@PROGRAM@_DEPENDENCIES)
$(LINK) $(@PROGRAM@_OBJECTS) $(@PROGRAM@_LDADD) $(LIBS)
+Tue Mar 5 16:22:46 1996 Tom Tromey <tromey@creche.cygnus.com>
+
+ * badprog.test: Rewrote.
+
+ * canon.test: New file.
+
Mon Mar 4 21:08:37 1996 Tom Tromey <tromey@creche.cygnus.com>
* exdir.test: New file.
TESTS = mdate.test vtexi.test acoutput.test instexec.test checkall.test \
acoutnoq.test acouttbs.test libobj.test proginst.test acoutqnl.test \
-confincl.test spelling.test prefix.test badprog.test depend.test exdir.test
+confincl.test spelling.test prefix.test badprog.test depend.test exdir.test \
+canon.test
EXTRA_DIST = defs
TESTS = mdate.test vtexi.test acoutput.test instexec.test checkall.test \
acoutnoq.test acouttbs.test libobj.test proginst.test acoutqnl.test \
-confincl.test spelling.test prefix.test badprog.test depend.test exdir.test
+confincl.test spelling.test prefix.test badprog.test depend.test exdir.test \
+canon.test
EXTRA_DIST = defs
DIST_COMMON = ChangeLog Makefile.am Makefile.in
#! /bin/sh
-# Test to make sure that programs with bad names are diagnosed.
+# Test to make sure that programs with bad names are properly
+# transformed.
. $srcdir/defs || exit 1
cat > Makefile.am << 'END'
bin_PROGRAMS = a,b
+a_b_SOURCES = ab.c
END
-$AUTOMAKE && exit 1
-exit 0
+$AUTOMAKE
--- /dev/null
+#! /bin/sh
+
+# Test to make sure that name canonicalization error works.
+
+. $srcdir/defs || exit 1
+
+cat > Makefile.am << 'END'
+bin_PROGRAMS = sniff-glue
+sniff-glue_SOURCES = sg.c
+END
+
+$AUTOMAKE && exit 1
+exit 0
-@set UPDATED 4 March 1996
+@set UPDATED 5 March 1996
@set EDITION 0.31
@set VERSION 0.31