Re: patch: stamp-h? files in subdirs
Tom Tromey wrote: > > "Derek" == Derek R Price <[EMAIL PROTECTED]> writes: > > Derek> by an automake configure script. The problem was in > Derek> AM_CONFIG_HEADERS. I fixed it, but is dependent on the > Derek> autoconf beta. > > The next automake must be compatible with the old autoconf. So this > patch can't go in as-is. > > Tom Ok. This new patch (attached) does the same thing in shell. It's not quite as robust since a configure.in is limited to a single call to AM_CONFIG_HEADER and no COMMANDS or INIT-CMDS instead of the multiple calls and shell script hooks like AC_CONFIG_HEADER now allows. Derek -- Derek Price CVS Solutions Architect ( http://CVSHome.org ) mailto:[EMAIL PROTECTED] OpenAvenue ( http://OpenAvenue.com ) -- File not found. Should I fake it? (Y/N) ? automake-1.4c-stamph.diff ? automake-1.4c-stamph2.diff ? m4/acheader.m4.sav ? tests/stamph2.test ? tests/dirname.test Index: ChangeLog === RCS file: /cvs/automake/ChangeLog,v retrieving revision 1.963 diff -u -r1.963 ChangeLog --- ChangeLog 2001/01/31 04:05:43 1.963 +++ ChangeLog 2001/01/31 22:51:19 @@ -1,3 +1,8 @@ +2001-01-31 Derek Price <[EMAIL PROTECTED]> + + * m4/header.m4 (AM_CONFIG_HEADER): This macro was broken due to + unescaped shell metachars. also fix stamp-h placement + 2001-01-30 Tom Tromey <[EMAIL PROTECTED]> * automake.in (scan_one_autoconf_file): Don't mention Index: m4/header.m4 === RCS file: /cvs/automake/m4/header.m4,v retrieving revision 1.7 diff -u -r1.7 header.m4 --- m4/header.m42000/08/06 12:36:53 1.7 +++ m4/header.m42001/01/31 22:51:19 @@ -16,13 +16,23 @@ [], [test -z "$CONFIG_HEADERS" || echo timestamp >dnl patsubst([$1], [^\([^:]*/\)?.*], [\1])stamp-h]), - [am_indx=1 - for am_file in $1; do -case " $CONFIG_HEADERS " in -*" $am_file "*) - echo timestamp > `echo $am_file | sed 's%:.*%%;s%[^/]*$%%'`stamp-h$am_indx - ;; -esac -am_indx=\`expr \$am_indx + 1\` - done]) -]) +[am_indx=1 +for am_file in $1; do + case " \$CONFIG_HEADERS " in + *" \$am_file "*) +am_dir=\`echo \$am_file |sed 's%:.*%%;s%[^/]*\$%%'\` +if test -n "\$am_dir"; then + am_tmpdir=\`echo \$am_dir |sed 's%^\(/*\).*\$%\1%'\` + for am_subdir in \`echo \$am_dir |sed 's%/% %'\`; do +am_tmpdir=\$am_tmpdir\$am_subdir/ +if test ! -d \$am_tmpdir; then + mkdir \$am_tmpdir +fi + done +fi +echo timestamp > "\$am_dir"stamp-h\$am_indx +;; + esac + am_indx=\`expr \$am_indx + 1\` +done]) +]) # AM_CONFIG_HEADER Index: tests/ChangeLog === RCS file: /cvs/automake/tests/ChangeLog,v retrieving revision 1.326 diff -u -r1.326 ChangeLog --- tests/ChangeLog 2001/01/29 09:41:43 1.326 +++ tests/ChangeLog 2001/01/31 22:51:20 @@ -1,3 +1,8 @@ +2001-01-31 Derek Price <[EMAIL PROTECTED]> + + * stamph2.test: new file + * Makefile.am (TESTS): Added stamph2.test + 2001-01-29 Akim Demaille <[EMAIL PROTECTED]> * check.test: New. Index: tests/Makefile.am === RCS file: /cvs/automake/tests/Makefile.am,v retrieving revision 1.247 diff -u -r1.247 Makefile.am --- tests/Makefile.am 2001/01/29 09:41:43 1.247 +++ tests/Makefile.am 2001/01/31 22:51:20 @@ -226,6 +226,7 @@ spell3.test \ spelling.test \ stamph.test \ +stamph2.test \ stdlib.test \ subdir.test \ subdir2.test \ Index: tests/Makefile.in === RCS file: /cvs/automake/tests/Makefile.in,v retrieving revision 1.311 diff -u -r1.311 Makefile.in --- tests/Makefile.in 2001/01/29 09:41:43 1.311 +++ tests/Makefile.in 2001/01/31 22:51:20 @@ -295,6 +295,7 @@ spell3.test \ spelling.test \ stamph.test \ +stamph2.test \ stdlib.test \ subdir.test \ subdir2.test \ @@ -492,7 +493,7 @@ info-am install install-am install-data install-data-am install-exec \ install-exec-am install-strip installcheck installcheck-am installdirs \ maintainer-clean maintainer-clean-generic mostlyclean \ -mostlyclean-generic tags uninstall uninstall-am +mostlyclean-generic uninstall uninstall-am distclean-local: --- /dev/null Thu Aug 24 05:00:32 2000 +++ tests/stamph2.test Wed Jan 31 16:14:56 2001 @@ -0,0 +1,29 @@ +#! /bin/sh + +# Make sure stamp-h* files are created where we expect + +. $srcdir/defs || exit 1 + +cat > configure.in << 'END' +AC_INIT(Makefile.am) +AM_INIT_AUTOMAKE(nonesuch, nonesuch) +AM_CONFIG_HEADER(firstfile.h sdir/secondfile.h thirdfile.h) +AC_OUTPUT(Makefile) +END + +: > Makefile.am +mkdir sdir +: > firstfile.h.in +: > sdir/secondfile.h.in +: > thirdfile.h.in + +# Fail gracefully if no autoconf. +(autoconf --version) > /dev/null 2>&1 || exit 77 +
Re: patch: stamp-h? files in subdirs
Tim Van Holder wrote: > >(_AM_DIRNAME): helper function which basically implements an sh > >`dirname` in m4 > Only have 1 problem with it: no support for DOS-style paths (and this is > conveniently not tested in your dirname.test either :-P). Yeah, sorry. I noticed that, but I decided that if it was good enough for AS_DIRNAME it was good enough for _AM_DIRNAME. I stripped the regex verbatim from AS_DIRNAME and figured if anyone ever updated AS_DIRNAME someone would catch _AM_DIRNAME eventually. Derek -- Derek Price CVS Solutions Architect ( http://CVSHome.org ) mailto:[EMAIL PROTECTED] OpenAvenue ( http://OpenAvenue.com ) -- I will not drive the principal's car. I will not drive the principal's car. I will not drive the principal's car... - Bart Simpson on chalkboard, _The Simpsons_
Re: patch: stamp-h? files in subdirs
> "Derek" == Derek R Price <[EMAIL PROTECTED]> writes: Derek> by an automake configure script. The problem was in Derek> AM_CONFIG_HEADERS. I fixed it, but is dependent on the Derek> autoconf beta. The next automake must be compatible with the old autoconf. So this patch can't go in as-is. Tom
Re: 10-check-am.patch
> "Akim" == akim <[EMAIL PROTECTED]> writes: Akim> I kept comparing Makefile.in from previous automake with my patched Akim> versions, and didn't notice this problem. I just noticed this reading subdirs.am. I didn't look to see if automake.in still generates the .PHONY entries. Tom
Re: 15-file-contents-paragraph.patch
Akim> My goal was to follow strictly the syntax of Make so that people Akim> don't have several syntaxes to learn, and more than one way to Akim> shoot in their foot. Automake doesn't really support make syntax, it just pretends to. There are some differences. For instance a macro definition can't begin with whitespace in automake, but it can with make. Fixing this would be good, but I'd rather not do it for this release. The reason is that we don't know what this change would break. There are a lot of Makefile.am's out there, and although the test suite looks large it really only tests a very small part of automake's functionality. Tom
20-distdir-am.patch
Actually, it seems to me there is not enough paragraph rules at all in automake. Instead of the attrocious @SUBDIRS@ for subdir in $(@DIST_SUBDIR_NAME@); do \ @SUBDIRS@ if test "$$subdir" = .; then :; else \ @SUBDIRS@ test -d $(distdir)/$$subdir \ @SUBDIRS@ || mkdir $(distdir)/$$subdir \ @SUBDIRS@ || exit 1; \ @SUBDIRS@ (cd $$subdir && \ @SUBDIRS@ $(MAKE) $(AM_MAKEFLAGS) top_distdir=../$(@TOP_DISTDIR@) distdir=../$(distdir)/$$subdir distdir) \ @SUBDIRS@ || exit 1; \ @SUBDIRS@ fi; \ @SUBDIRS@ done one would want some for of conditional, such as @if HAS_SUBDIRS@ for subdir in $(@DIST_SUBDIR_NAME@); do \ if test "$$subdir" = .; then :; else \ test -d $(distdir)/$$subdir \ || mkdir $(distdir)/$$subdir \ || exit 1; \ (cd $$subdir && \ $(MAKE) $(AM_MAKEFLAGS) top_distdir=../$(@TOP_DISTDIR@) distdir=../$(distdir)/$$subdir distdir) \ || exit 1; \ fi; \ done @fi HAS_SUBDIRS@ or whatever the actual syntax. This means that we want to run the COMMAND of &file_contents on the *whole* file. Given that we have a paragraph reading afterwards, it is absolutely possible. Just my $0.002. Tell me what you think about it. So the point of this patch is (unofficially, that I continue learning and feeling about Automake to get an idea of what could be done to make it easier to understand/extend/migrate to another language) is to externalize the handling of the dist target. Because it was on my way to use even more %dependencies. I'm sorry for the size, one can't do less IMHO. Note that aside from the new file to distribute (distdir.am), the changes of the Makefile.ins are limited to a new empty line (of which we can get rid of but eliminating the leading empty lines in distdir.am, or, alternatively, decide that &file_contents should always get rid of leading lines). Akim Index: ChangeLog from Akim Demaille <[EMAIL PROTECTED]> * distdir.am (distdir): New file, extracted from... * automake.in (handle_dist_worker): here. Adjust. Index: automake.in --- automake.in Wed, 31 Jan 2001 21:12:00 +0100 akim (am/f/39_automake.i 1.26 755) +++ automake.in Wed, 31 Jan 2001 22:25:04 +0100 akim (am/f/39_automake.i 1.26 755) @@ -2613,28 +2613,26 @@ sub handle_multilib # Worker for handle_dist. sub handle_dist_worker { -local ($makefile) = @_; - -$output_rules .= 'distdir: $(DISTFILES)' . "\n"; +my $makefile = @_; +my $xform = ''; # Initialization; only at top level. if ($relative_dir eq '.') { - if (defined $options{'check-news'}) - { - # For Gnits users, this is pretty handy. Look at 15 lines - # in case some explanatory text is desirable. - $output_rules .= ' @if sed 15q $(srcdir)/NEWS | fgrep -e "$(VERSION)" > /dev/null; then :; else \\ - echo "NEWS not updated; not releasing" 1>&2; \\ - exit 1; \\ - fi -'; - } - +$xform .= 's/\@TOPDIR\@//g;'; +} +else +{ +$xform .= 's/\@TOPDIR\@.*//g;'; +} - # Create dist directory. - $output_rules .= ("\t-chmod -R a+w \$(distdir) > /dev/null 2>&1; rm -rf \$(distdir)\n" - . "\tmkdir \$(distdir)\n"); +if (defined $options{'check-news'}) +{ +$xform .= 's/\@CK-NEWS\@//g;'; +} +else +{ +$xform .= 's/\@CK-NEWS\@.*//g;'; } # Scan EXTRA_DIST to see if we need to distribute anything from a @@ -2674,39 +2672,23 @@ sub handle_dist_worker # hash lets us ensure that each directory is used only once. local (%dhash); grep ($dhash{'$(distdir)/' . $_} = 1, @dist_dirs); - $output_rules .= "\t"; - &pretty_print_rule ('$(mkinstalldirs)', "\t ", sort keys %dhash); + $xform .= &transform ('DISTDIRS', join (' ', sort keys %dhash)); +} +else +{ +$xform .= 's/.*\@DISTDIRS\@.*//g;'; } -# 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 .= "\t\@for file in \$(DISTFILES); do \\\n"; if ($cygnus_mode) { - $output_rules .= "\t if test -f \$\$file; then d=.; else d=\$(srcdir); fi; \\\n"; +$xform .= 's/\@CYGNUS\@\t*/\t/g;'; +$xform .= 's/.*\@NCYGNUS\@.*//g;'; } else { - $output_rules .= "\t d=\$(srcdir); \\\n"; +$xform .= 's/\@NCYGNUS\@\t*/\t/g;'; +$xform .= 's/.*\@CYGNUS\@.*//g;'; } -$output_rules .= ("\t if test -d \$\$
ACLOCAL_AMFLAGS
ACLOCAL_AMFLAGS are broken w/ cvs/automake Example: Given this excerpt of a sourcetree: aclocal/x.m4 a/b/configure.in a/b/Makefile.am cat a/b/Makefile.am .. ACLOCAL_AMFLAGS = -I ../../aclocal .. The generated Makefile.in will contain .. $(ACLOCAL_M4): configure.in \ ./../aclocal/x.m4 \ AFAIS, the "strip "./"" from this patch is to blame for this: revision 1.799 date: 2000/10/18 03:26:55; author: proski; state: Exp; lines: +7 -1 * automake.in (handle_aclocal_m4): exclude aclocal.m4 and acinclude.m4 from the dependencies of aclocal.m4 to avoid circular and duplicated dependencies. Strip "./" from the dependencies. --- automake.in 2000/10/16 09:01:35 1.798 +++ automake.in 2000/10/18 03:26:55 1.799 @@ -3189,7 +3189,13 @@ $examine_next = 0; if ($amdir !~ /^\// && -d $amdir) { - push (@ac_deps, &my_glob ($amdir . '/*.m4')); + foreach $ac_dep (&my_glob ($amdir . '/*.m4')) + { + $ac_dep =~ s/^\.\/*//; + push (@ac_deps, $ac_dep) + unless $ac_dep eq "aclocal.m4" + || $ac_dep eq "acinclude.m4"; + } } } elsif ($amdir eq '-I') Ralf -- Ralf Corsepius Forschungsinstitut fuer Anwendungsorientierte Wissensverarbeitung (FAW) Helmholtzstr. 16, 89081 Ulm, Germany Tel: +49/731/501-8690 mailto:[EMAIL PROTECTED] FAX: +49/731/501-999 http://www.faw.uni-ulm.de
18-depend.patch
This patch gets rid of @phony, using only %dependencies. &depend makes it somewhat more digest. It also fixes the problem Tom spotted, where my version of @phony was improperly initialized globally. There are other targets that can take advantage of this: clean etc., in fact, those which are initialized where @phony was. And of course, a significant part of the remaining work consists in spreading the adhoc code into the corresponding */am files. Akim PS/ This patch includes the diff of Automake's Makefile.ins, i.e., there are no diffs at all. Index: ChangeLog from Akim Demaille <[EMAIL PROTECTED]> * automake.in (%dependencies): Don't be initialize globally for all the files, but in... (&initialize_per_input): here. (&depend): New. (@phony): Replace all occurrences with the corresponding &depend invocation. Index: automake.in --- automake.in Wed, 31 Jan 2001 02:47:38 +0100 akim (am/f/39_automake.i 1.23 755) +++ automake.in Wed, 31 Jan 2001 20:39:11 +0100 akim (am/f/39_automake.i 1.23 755) @@ -324,16 +324,6 @@ # discovered while scanning configure.ac. We might distribute these # in the top-level Makefile.in. %configure_dist_common = (); - -# Holds the dependencies of target which dependencies are factored. -# Typically, `.PHONY' will appear in plenty of *.am files, but must -# be output once. Arguably all pure dependencies could be subject -# to this factorization, but it is not unpleasant to have paragraphs -# in Makefile: keeping related stuff altogether. -%dependencies = -( -".PHONY" => [] -); # Initialize global constants and our list of languages that are @@ -2522,12 +2512,12 @@ sub handle_man_pages $output_rules .= ("install-man: \$(MANS)\n" . "\t\@\$(NORMAL_INSTALL)\n"); &pretty_print_rule ("\t\$(MAKE) \$(AM_MAKEFLAGS)", "\t ", @namelist); -push (@phony, 'install-man'); +&depend ('.PHONY', 'install-man'); $output_rules .= "uninstall-man:\n\t\@\$(NORMAL_UNINSTALL)\n"; grep ($_ = 'un' . $_, @namelist); &pretty_print_rule ("\t\$(MAKE) \$(AM_MAKEFLAGS)", "\t ", @namelist); -push (@phony, 'uninstall-man'); +&depend ('.PHONY', 'uninstall-man'); $output_vars .= &file_contents ('mans-vars'); @@ -2561,7 +2551,7 @@ sub handle_tags . " && \$(MAKE) \$(AM_MAKEFLAGS) tags); \\\n" . "\tdone\n"); push (@tag_deps, 'tags-recursive'); - push (@phony, 'tags-recursive'); + &depend ('.PHONY', 'tags-recursive'); } if (&saw_sources_p (1) @@ -2792,7 +2782,7 @@ sub handle_dist_worker . " distdir=\"\$(distdir)\" $targ\n"); } -push (@phony, 'distdir'); +&depend ('.PHONY', 'distdir'); } # Handle 'dist' target. @@ -3709,13 +3699,13 @@ sub handle_installdirs # rule will work correctly. $output_rules .= ("installdirs: installdirs-recursive\n" . "installdirs-am:\n"); - push (@phony, 'installdirs-am'); + &depend ('.PHONY', 'installdirs-am'); } else { $output_rules .= "installdirs:\n"; } -push (@phony, 'installdirs'); +&depend ('.PHONY', 'installdirs'); if (@installdirs) { &pretty_print_rule ("\t" . '$(mkinstalldirs) ', "\t\t", @@ -3814,7 +3804,7 @@ sub handle_merge_targets . " all-recursive" . "\n\n"); $all_target = 'all-recursive-am'; - push (@phony, 'all-recursive-am'); + &depend ('.PHONY', 'all-recursive-am'); } } @@ -3840,7 +3830,7 @@ sub handle_merge_targets $output_rules .= ("install-strip:\n\t" . '$(MAKE) $(AM_MAKEFLAGS) INSTALL_STRIP_FLAG=-s install' . "\n"); -push (@phony, 'install-strip'); +&depend ('.PHONY', 'install-strip'); } # Helper for handle_merge_targets. Note that handle_merge_targets @@ -3853,7 +3843,7 @@ sub do_one_merge_target { # User defined local form of target. So include it. push (@values, $name . '-local'); - push (@phony, $name . '-local'); + &depend ('.PHONY', $name . '-local'); } &pretty_print_rule ($name . "-am:", "\t\t", @values); @@ -3884,11 +3874,11 @@ sub do_one_merge_target { $tname = 'all-redirect'; $lname = $all_target if $recursive_install; - push (@phony, 'all-redirect'); + &depend ('.PHONY', 'all-redirect'); $output_all = "all: all-redirect\n"; } &pretty_print_rule ($tname . ":", "\t\t", $lname); -push (@phony, $name . '-am', $name); +&depend ('.PHONY', $name . '-am', $name); } # Handle check merge target specially. @@ -3898,7 +3888,7 @@ sub do_check_merge_target { # User defined local form of target. So include it. push (@check_tests, 'check-local'); - push (@phony, 'check-local'); + &depend ('.PHONY',
19-dependencies-clean.patch
Again, no changes in Makefile.ins. Index: ChangeLog from Akim Demaille <[EMAIL PROTECTED]> * automake.in (@clean): Remove, replaced by... ($dependencies{'clean'}): this. Use `&depend' instead of push'ing into @clean. (handle_factored_dependencies): For the time being, skip 'clean'. (do_one_clean_target): Don't ask for argument 1 and 4 as they are always `clean', and `@clean'. Index: automake.in --- automake.in Wed, 31 Jan 2001 20:45:31 +0100 akim (am/f/39_automake.i 1.25 755) +++ automake.in Wed, 31 Jan 2001 21:09:59 +0100 akim (am/f/39_automake.i 1.25 755) @@ -870,7 +870,7 @@ sub get_object_extension push (@suffixes, '.c', '.o'); push (@suffixes, '.obj') if $seen_objext; - push (@clean, 'compile'); + &depend ('clean', 'compile'); $included_generic_compile = 1; } @@ -883,7 +883,7 @@ sub get_object_extension &push_phony_cleaners ('libtool'); push (@suffixes, '.lo'); - push (@clean, 'libtool'); + &depend ('clean', 'libtool'); $included_libtool_compile = 1; } @@ -910,7 +910,7 @@ sub get_object_extension &require_file_with_line ('AUTOMAKE_OPTIONS', $FOREIGN, 'ansi2knr.c', 'ansi2knr.1'); $output_rules .= &file_contents ('kr-extra'); - push (@clean, 'krextra'); + &depend ('clean', 'krextra'); &push_phony_cleaners ('krextra'); } @@ -957,7 +957,7 @@ sub get_object_extension $output_rules .= &file_contents ('clean-kr'); - push (@clean, 'kr'); + &depend ('clean', 'kr'); &push_phony_cleaners ('kr'); $included_knr_compile = 1; @@ -2273,7 +2273,7 @@ sub handle_texinfo ++$done; &push_dist_common ($vtexi, 'stamp-' . $vti); - push (@clean, $vti); + &depend ('clean', $vti); &require_conf_file_with_line ('info_TEXINFOS', $FOREIGN, 'mdate-sh'); @@ -2425,7 +2425,7 @@ sub handle_texinfo # get run twice during "make all". unshift (@all, '$(INFO_DEPS)'); } -push (@clean, 'aminfo'); +&depend ('clean', 'aminfo'); push (@info, '$(INFO_DEPS)'); push (@dvi, '$(DVIS)'); @@ -2583,7 +2583,7 @@ sub handle_tags $output_rules .= &file_contents ('tags', $xform); $output_rules .= &file_contents ('tags-clean'); - push (@clean, 'tags'); + &depend ('clean', 'tags'); &push_phony_cleaners ('tags'); &examine_variable ('TAGS_DEPENDENCIES'); } @@ -3080,7 +3080,7 @@ sub handle_dependencies } $output_rules .= &file_contents ('depend'); - push (@clean, 'depend'); + &depend ('clean', 'depend'); &push_phony_cleaners ('depend'); } } @@ -3460,7 +3460,7 @@ sub handle_configure $output_rules .= &file_contents ('clean-hdr', &transform ('FILES' => $distclean_config)); - push (@clean, 'hdr'); + &depend ('clean', 'hdr'); &push_phony_cleaners ('hdr'); } @@ -3963,42 +3963,47 @@ sub handle_clean $output_rules .= &file_contents ('clean', $xform); -push (@clean, 'generic'); +&depend ('clean', 'generic'); &push_phony_cleaners ('generic'); -&do_one_clean_target ('clean', 'mostly', '', @clean); -&do_one_clean_target ('clean', '', 'mostly', @clean); -&do_one_clean_target ('clean', 'dist', '', @clean); -&do_one_clean_target ('clean', 'maintainer-', 'dist', @clean); +&do_one_clean_target ('mostly', ''); +&do_one_clean_target ('', 'mostly'); +&do_one_clean_target ('dist', ''); +&do_one_clean_target ('maintainer-', 'dist'); -&depend ('.PHONY', 'clean', 'mostlyclean', 'distclean', 'maintainer-clean'); +&depend ('.PHONY', +'clean', 'mostlyclean', 'distclean', 'maintainer-clean'); } + +# &do_one_clean_target ($NAME, $LAST_NAME) +# # Helper for handle_clean. sub do_one_clean_target { -local ($target, $name, $last_name, @deps) = @_; +my ($name, $last_name) = @_; +my (@deps) = @{$dependencies{'clean'}}; # Change each dependency `BLARG' into `clean-BLARG'. grep (($_ = $name . 'clean-' . $_) && 0, @deps); # Push the previous clean target. There is no previous clean # target if we're doing mostlyclean. -push (@deps, $last_name . $target . '-am') +push (@deps, $last_name . 'clean-am') unless $name eq 'mostly'; # If a -local version of the rule is given, add it to the list. -if (&target_defined ($name . $target . '-local')) +if (&target_defined ($name . 'clean-local')) { - push (@deps, $name . $target . '-local'); + push (@deps, $name . 'clean-local'); } # Print the target and the dependencies. -&pretty_print_rule ($name .
amtraces functionality
The amtraces functionality for AC_CONFIG_FILES is totally broken. Anyone mind if I spend a few minutes on it? Derek -- Derek Price CVS Solutions Architect ( http://CVSHome.org ) mailto:[EMAIL PROTECTED] OpenAvenue ( http://OpenAvenue.com ) -- I don't suffer from stress. I'm a carrier. - Scott Adam's _Dilbert_
RE: patch: stamp-h? files in subdirs
>(_AM_DIRNAME): helper function which basically implements an sh >`dirname` in m4 Only have 1 problem with it: no support for DOS-style paths (and this is conveniently not tested in your dirname.test either :-P). It's bad enough working on patches for proper DOS/Win support when people AREN'T adding new incompatible macros :-) Having said that, I haven't sent in a patch for autoconf's AS_DIRNAME yet, so I suppose it's my fault. I'll just have to make a patch for both incarnations now.
Re: patch: stamp-h? files in subdirs
"Derek R. Price" wrote: > stamp-h? files in subdirs are still being created in the wrong locations > by an automake configure script. The problem was in AM_CONFIG_HEADERS. > I fixed it, but is dependent on the autoconf beta. Patch attached. > > I was thinking of attempting to eliminate the need for the recreation of > stamp-h? files in the Makefile.in targets, but it looked like a hassle > to get the quotes right in an m4 macro. If there's interest in this, > let me know and I'll spend some more time on it. > > * m4/header.m4 (AM_CONFIG_HEADERS): fix stamp-h creation to > occur in > the correct locations > (_AM_DIRNAME): helper function which basically implements an sh > `dirname` in m4 > * automake.in (scan_one_autoconf_file): change the warning > exception > for AC_CONFIG_HEADERS to match the new m4/header.m4 > * stamph2.test: new > * dirname.test: new Oh, I also tweaked AM_CONFIG_HEADERS to accept and pass through the same $2 & $3 arguments that AC_CONFIG_HEADERS uses (COMMANDS & INIT-CMDS). Seemed like the right thing to do. Derek -- Derek Price CVS Solutions Architect ( http://CVSHome.org ) mailto:[EMAIL PROTECTED] OpenAvenue ( http://OpenAvenue.com ) -- It does me no injury for my neighbor to say there are twenty gods or no god. It neither picks my pocket nor breaks my leg. - Thomas Jefferson
patch: stamp-h? files in subdirs
stamp-h? files in subdirs are still being created in the wrong locations by an automake configure script. The problem was in AM_CONFIG_HEADERS. I fixed it, but is dependent on the autoconf beta. Patch attached. I was thinking of attempting to eliminate the need for the recreation of stamp-h? files in the Makefile.in targets, but it looked like a hassle to get the quotes right in an m4 macro. If there's interest in this, let me know and I'll spend some more time on it. * m4/header.m4 (AM_CONFIG_HEADERS): fix stamp-h creation to occur in the correct locations (_AM_DIRNAME): helper function which basically implements an sh `dirname` in m4 * automake.in (scan_one_autoconf_file): change the warning exception for AC_CONFIG_HEADERS to match the new m4/header.m4 * stamph2.test: new * dirname.test: new Derek -- Derek Price CVS Solutions Architect ( http://CVSHome.org ) mailto:[EMAIL PROTECTED] OpenAvenue ( http://OpenAvenue.com ) -- The cafeteria deep fryer is not a toy. The cafeteria deep fryer is not a toy. The cafeteria deep fryer is not a toy... - Bart Simpson on chalkboard, _The Simpsons_ ? automake-1.4c-stamph.diff ? m4/acheader.m4.sav ? tests/stamph2.test ? tests/dirname.test Index: ChangeLog === RCS file: /cvs/automake/ChangeLog,v retrieving revision 1.963 diff -u -r1.963 ChangeLog --- ChangeLog 2001/01/31 04:05:43 1.963 +++ ChangeLog 2001/01/31 19:10:27 @@ -1,3 +1,12 @@ +2001-01-31 Derek Price <[EMAIL PROTECTED]> + + * m4/header.m4 (AM_CONFIG_HEADERS): fix stamp-h creation to occur in + the correct locations + (_AM_DIRNAME): helper function which basically implements an sh + `dirname` in m4 + * automake.in (scan_one_autoconf_file): change the warning exception + for AC_CONFIG_HEADERS to match the new m4/header.m4 + 2001-01-30 Tom Tromey <[EMAIL PROTECTED]> * automake.in (scan_one_autoconf_file): Don't mention Index: automake.in === RCS file: /cvs/automake/automake.in,v retrieving revision 1.839 diff -u -r1.839 automake.in --- automake.in 2001/01/31 04:00:45 1.839 +++ automake.in 2001/01/31 19:10:31 @@ -4576,7 +4576,7 @@ # means we are actually scanning AM_CONFIG_HEADER from # aclocal.m4. if (/A([CM])_CONFIG_HEADERS?\s*\((.*)\)/ - && $2 ne '[$1]') + && $2 !~ /^_AM_File,/) { &am_conf_line_error ($filename, $., "\`automake requires \`AM_CONFIG_HEADER', not \`AC_CONFIG_HEADER'") Index: m4/header.m4 === RCS file: /cvs/automake/m4/header.m4,v retrieving revision 1.7 diff -u -r1.7 header.m4 --- m4/header.m42000/08/06 12:36:53 1.7 +++ m4/header.m42001/01/31 19:10:31 @@ -1,3 +1,5 @@ +# AM_CONFIG_HEADER(HEADERS..., [COMMANDS], [INIT-CMDS]) +# - # Like AC_CONFIG_HEADER, but automatically create stamp file. # serial 3 @@ -7,22 +9,33 @@ # that is generated. We must strip everything past the first ":", # and everything past the last "/". -AC_PREREQ([2.12]) +AC_PREREQ([2.49c]) AC_DEFUN([AM_CONFIG_HEADER], -[AC_CONFIG_HEADER([$1]) - AC_OUTPUT_COMMANDS( - ifelse(patsubst([$1], [[^ ]], []), - [], - [test -z "$CONFIG_HEADERS" || echo timestamp >dnl - patsubst([$1], [^\([^:]*/\)?.*], [\1])stamp-h]), - [am_indx=1 - for am_file in $1; do -case " $CONFIG_HEADERS " in -*" $am_file "*) - echo timestamp > `echo $am_file | sed 's%:.*%%;s%[^/]*$%%'`stamp-h$am_indx - ;; -esac -am_indx=\`expr \$am_indx + 1\` - done]) -]) +[dnl init our file count if it isn't already +m4_ifndef([_AM_Config_Header_Index], m4_define([_AM_Config_Header_Index], +[0])) +dnl prepare to store our destination file list for use in config.status +AC_FOREACH([_AM_File], [$1], + [m4_pushdef([_AM_Dest], m4_patsubst(_AM_File, [:.*])) + m4_define([_AM_Config_Header_Index], +m4_incr(_AM_Config_Header_Index)) + dnl and add it to the list of files AC keeps track of, along + dnl with our hook + AC_CONFIG_HEADERS(_AM_File, +dnl COMMANDS, [, INIT-CMDS] +[# update the timestamp +echo timestamp >"AS_ESCAPE(_AM_DIRNAME(]_AM_Dest[))/stamp-h]_AM_Config_Header_Index[" +][$2]m4_ifval([$3], [, [$3]]))dnl AC_CONFIG_HEADERS + m4_popdef([_AM_Dest])]) +]) # AM_CONFIG_HEADER + +# _AM_DIRNAME(PATH) +# - +# Like AS_DIRNAME, only do it during macro expansion +AC_DEFUN([_AM_DIRNAME], +[m4_if(m4_regexp([$1], [^.*[^/]//*[^/][^/]*/*$]), -1, +m4_if(m4_regexp([$1], [^//\([^/]\|$\)]), -1, + m4_if(m4_regexp([$1], [^/.*]), -1, +
Re: 10-check-am.patch
On Wed, Jan 31, 2001 at 11:27:05AM -0700, Tom Tromey wrote: > > "Akim" == Akim Demaille <[EMAIL PROTECTED]> writes: > > Akim> My `plan' is what I implemented in the patch named > Akim> factored-dependencies. > > Thanks. I missed some patches in my inbox last night. > > BTW subdirs.am doesn't have .PHONY entries for the *clean-recursive > rules. Is this intentional? huh? Well, automake.in still has hard coded .PHONY targets, I've not finished spreading this. But if the code does not add them, then I must have done something wrong at some point. I'll check this into the details tomorrow. I kept comparing Makefile.in from previous automake with my patched versions, and didn't notice this problem.
Re: 15-file-contents-paragraph.patch
On Wed, Jan 31, 2001 at 11:19:37AM -0700, Tom Tromey wrote: > > "Akim" == Akim Demaille <[EMAIL PROTECTED]> writes: > > Akim> * automake.in (file_contents): Rewrite: instead of trying to parse > Akim> it line by line, first swallow it completely into $CONTENTS, > Akim> *then*, parse it *paragraph* by paragraph. > > I see this went in. > What is the rationale for this patch? To make it easier to handle special paragraphs such as .PHONY. My goal was to follow strictly the syntax of Make so that people don't have several syntaxes to learn, and more than one way to shoot in their foot. I apologize if I've been too fast on this patch. I was under pressure for cleaning up the mess I had left with maek check, and had all this in front of me. Fell free to ask me to revert these. Still, back to the point. My gaol was primarily to catch paragraphes such as the .PHONY ones. At the beginning I was looping on result_rules, but it quickly became exactly what I applied to the whole file_contents: reading by paragraphs (to make it short, but in practice I first tried some hairy elsif with the other, and them tried to parse line by line $result_rules, and fell on situations where Perl'RE engine was going nuts). It struck me that when you read in paragraph you no longer have the horrible $saw_bk, $was_rule and $ignoring hacks. > I'm very leery of changing file reading. For &file_contents it isn't > too worrisome, since we have complete control over the inputs. For > the other file reader it is scarier. Hm, you saw me coming up :) Frankly, the more I look at this loop, the more I think this is the right way to do it. But I can understand your fears. I'm sure Jim will agree to give a try to some experiments :) I'm sure we can drastically shorten and simplify the code using this technique. > Also, the patch that went in has some unconditional prints to STDERR. > This is wrong. Well, I left some in comment, which is not clean, agreed. I will remove those comments tomorrow then, sorry.
Re: 17-factored-dependencies.patch
On Wed, Jan 31, 2001 at 11:22:15AM -0700, Tom Tromey wrote: > > "Akim" == Akim Demaille <[EMAIL PROTECTED]> writes: > > Akim> * automake.in (%factored_dependencies): New. > Akim> (file_contents): Use it. > Akim> (handle_phony): Rename as... > Akim> (handle_factored_dependencies): this. > Akim> * subdirs.am: No need for convolved syntax to declare .PHONY. > > Akim> +# Holds the dependencies of target which dependencies are factored. > Akim> +# Typically, `.PHONY' will appear in plenty of *.am files, but must > Akim> +# be output once. Arguably all pure dependencies could be subject > Akim> +# to this factorization, but it is not unpleasant to have paragraphs > Akim> +# in Makefile: keeping related stuff altogether. > Akim> +%dependencies = > Akim> +( > Akim> +".PHONY" => [] > Akim> +); > > Shouldn't this processing be done on a per-Makefile basis? > I think so. That means this should be initialized in > &initialize_per_input, not globally. Definitely! Thanks, there are important things I have not caught yet.
Re: [revised patch 1/1] support AC_SUBST'able automake rules
On Wed, Jan 31, 2001 at 05:02:06PM +0100, Lars J. Aas wrote: : I've revised the patch to include the latest changes from CVS Autoconf, : which made the complate patch somewhat simpler than before. I even corrected complete My fingers are slippy today. Anyways, are the people that count looking into this patch? I'd prefer it if it was applied or rejected as soon as possible instead of waiting in the dark... Lars J -- Innovation is one percent inspiration and ninetynine percent perspiration, and in my case; twice that... -- Norville Barnes, `The Hudsucker Proxy'
Re: New bugs
> "Akim" == Akim Demaille <[EMAIL PROTECTED]> writes: Akim> First I want to write/enhance a test that fails on this. Try `make TESTS=subobj4.test VERBOSE=t check'. That will tell you all about the problem. Tom
Re: AC_LIBOBJ and libsources
> "Akim" == Akim Demaille <[EMAIL PROTECTED]> writes: Akim> Can there be any non source files which we want to ship? Yes, sometimes. For instance with ansi2knr support we ship the man page. I don't know whether this impacts autoconf though. Tom
Re: 10-check-am.patch
> "Akim" == Akim Demaille <[EMAIL PROTECTED]> writes: Akim> My `plan' is what I implemented in the patch named Akim> factored-dependencies. Thanks. I missed some patches in my inbox last night. BTW subdirs.am doesn't have .PHONY entries for the *clean-recursive rules. Is this intentional? Tom
Re: 17-factored-dependencies.patch
> "Akim" == Akim Demaille <[EMAIL PROTECTED]> writes: Akim> * automake.in (%factored_dependencies): New. Akim> (file_contents): Use it. Akim> (handle_phony): Rename as... Akim> (handle_factored_dependencies): this. Akim> * subdirs.am: No need for convolved syntax to declare .PHONY. Akim> +# Holds the dependencies of target which dependencies are factored. Akim> +# Typically, `.PHONY' will appear in plenty of *.am files, but must Akim> +# be output once. Arguably all pure dependencies could be subject Akim> +# to this factorization, but it is not unpleasant to have paragraphs Akim> +# in Makefile: keeping related stuff altogether. Akim> +%dependencies = Akim> +( Akim> +".PHONY" => [] Akim> +); Shouldn't this processing be done on a per-Makefile basis? I think so. That means this should be initialized in &initialize_per_input, not globally. Tom
Re: 15-file-contents-paragraph.patch
> "Akim" == Akim Demaille <[EMAIL PROTECTED]> writes: Akim> * automake.in (file_contents): Rewrite: instead of trying to parse Akim> it line by line, first swallow it completely into $CONTENTS, Akim> *then*, parse it *paragraph* by paragraph. I see this went in. What is the rationale for this patch? I'm very leery of changing file reading. For &file_contents it isn't too worrisome, since we have complete control over the inputs. For the other file reader it is scarier. Also, the patch that went in has some unconditional prints to STDERR. This is wrong. Tom
Re: New bugs
> "Akim" == Akim Demaille <[EMAIL PROTECTED]> writes: Akim> First I want to write/enhance a test that fails on this. Sorry for being that dumb. I finally understood the problem. Here is what I'm applying: Index: ChangeLog from Akim Demaille <[EMAIL PROTECTED]> * automake.in (add_depend2): Quote properly $obj and $source. Index: automake.in === RCS file: /cvs/automake/automake/automake.in,v retrieving revision 1.844 diff -u -u -r1.844 automake.in --- automake.in 2001/01/31 16:50:01 1.844 +++ automake.in 2001/01/31 17:31:52 @@ -3035,13 +3035,13 @@ 'BASE' => $obj, 'SOURCE'=> $source) # Generate rule for `.o'. -. 's/^\@EXT\@\.o:/' . $obj . '.o: ' . $source . '/g;' +. 's/^\@EXT\@\.o:/' . "\Q$obj.o: $source\E" . '/g;' # Maybe generate rule for `.lo'. Might be eliminated # by $XFORM. -. 's/^\@EXT\@\.lo:/' . $obj . '.lo: ' . $source . '/g;' +. 's/^\@EXT\@\.lo:/' . "\Q$obj.lo: $source\E" . '/g;' # Maybe generate rule for `.obj'. Might be # eliminated by $XFORM. -. 's/^\@EXT\@\.obj:/' . $obj . '.obj: ' . $source . '/g;'); +. 's/^\@EXT\@\.obj:/' . "\Q$obj.obj: $source\E" . '/g;'); } } Alternatively we could use a better scheme in depend2.am (to tell the truth, I'd like to have *only* @FOO@ substitutions).
Re: New bugs
> "Tom" == Tom Tromey <[EMAIL PROTECTED]> writes: Tom> Later we see: Tom> # Generate rule for `.o'. . 's/^\@EXT\@\.o:/' . $obj Tom> . '.o: ' . $source . '/g;' Tom> I think we need to quote $obj and $source here; this was handled Tom> in the old code. I did not change anything in the area, I'd like first to understand the failure you are describing. It's related to special characters in source file names which have special flags right? First I want to write/enhance a test that fails on this. If would be *wonderful* if someone had the courage to convert Automake's test suite to Autotest :(
Re: New bugs
> "Tom" == Tom Tromey <[EMAIL PROTECTED]> writes: Tom> The reason is only historical. Feel free to change it. I'm applying this. Sure, more clarification is needed in this area. I find it especially hard to track failures of substitution since Automake uses @FOO@ just like AC_SUBST :( Can't we move to something else, say %FOO%? 2001-01-31 Akim Demaille <[EMAIL PROTECTED]> * depend2.am: Instead of replacing @PFX@ in $(@PFX@COMPILE), and then replacing `$(@PFX@COMPILE)' for the files that need some special flags, use only @COMPILE@. Similarly for @LTCOMPILE@. Try to document this file. * automake.in (add_depend2): Adjust to these changes. Index: automake.in === RCS file: /cvs/automake/automake/automake.in,v retrieving revision 1.843 diff -u -u -r1.843 automake.in --- automake.in 2001/01/31 14:36:21 1.843 +++ automake.in 2001/01/31 16:44:49 @@ -2956,12 +2956,13 @@ { local ($lang) = @_; +# Get information on $LANG. +my $pfx = $language_map{"$lang-autodep"}; +my $fpfx = ($pfx eq '') ? 'CC' : $pfx; +my $flag = $language_map{"$lang-flags"}; + # First include code for ordinary objects. -local ($key) = $lang . '-autodep'; local ($xform, $ext); - -local ($pfx) = $language_map{$key}; -local ($fpfx) = ($pfx eq '') ? 'CC' : $pfx; $xform = &transform ('PFX' => $pfx, 'FPFX' => $fpfx); $xform .= $seen_objext ? 's/^OBJEXT//;' : 's/^OBJEXT.*$//;'; @@ -2972,12 +2973,16 @@ # target. In this case we don't want to include the generic code. if ($use_dependencies) { - local ($xform1) = ($xform - . &transform ('BASE' => '$*', -'SOURCE' => '$<', -'OBJ'=> '$@', -'LTOBJ' => '$@', -'OBJOBJ' => '$@')); +my $compile = '$(' . $pfx . 'COMPILE)'; + my $ltcompile = '$(LT' . $pfx . 'COMPILE)'; + my $xform1 = ($xform + . &transform ('BASE' => '$*', + 'SOURCE'=> '$<', + 'OBJ' => '$@', + 'LTOBJ' => '$@', + 'OBJOBJ'=> '$@', + 'COMPILE' => $compile, + 'LTCOMPILE' => $ltcompile)); foreach $ext (&lang_extensions ($lang)) { @@ -3007,11 +3012,12 @@ $source = $list[$i + 1]; $obj = $list[$i + 2]; $i += 3; + + my $val = "${derived}_${flag}"; - local ($flag) = $language_map{$lang . '-flags'}; - local ($val) = "(${derived}_${flag}"; - ($rule = $language_map{$lang . '-compile'}) =~ - s/\(AM_$flag/$val/; + my $obj_compile = $language_map{"$lang-compile"}; + $obj_compile =~ s/\(AM_$flag/\($val/; + my $obj_ltcompile = '$(LIBTOOL) --mode=compile ' . $obj_compile; # Generate a transform which will turn suffix targets in # depend2.am into real targets for the particular objects we @@ -3020,16 +3026,14 @@ &file_contents ('depend2', $xform -. &transform ('$(' . $pfx . 'COMPILE)' - => $rule, - '$(LT' . $pfx . 'COMPILE)' - => '$(LIBTOOL) --mode=compile ' . $rule, +. &transform ('COMPILE' => $obj_compile, + 'LTCOMPILE' => $obj_ltcompile, # Handle source and obj transforms. - 'OBJ'=> $obj . '.o', - 'OBJOBJ' => $obj . '.obj', - 'LTOBJ' => $obj . '.lo', - 'BASE' => $obj, - 'SOURCE' => $source) + 'OBJ' => $obj . '.o', + 'OBJOBJ'=> $obj . '.obj', + 'LTOBJ' => $obj . '.lo', + 'BASE' => $obj, + 'SOURCE'=> $source) # Generate rule for `.o'. . 's/^\@EXT\@\.o:/' . $obj . '.o: ' . $source . '/g;' # Maybe generate rule for `.lo'. Might be eliminated Index: depend2.am === RCS file: /cvs/automake/automake/depend2.am,v retrieving revision 1.26 diff -u -u -r1.26 depend2.am --- depend2.am 2000/10/16 09:01:36 1.26 +++ depend2.am 2001/01/31 16:44:49 @@ -1,5 +1,5 @@ ## automake - create Makefile.in from Makefile.am -## Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000 +## Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 ## Free Software Fou
Re: [revised patch 1/1] support AC_SUBST'able automake rules
I've revised the patch to include the latest changes from CVS Autoconf, which made the complate patch somewhat simpler than before. I even corrected the changelog date :) 2001-01-31 Lars J. Aas <[EMAIL PROTECTED]> * automake.in ($CANONICALS): New variable containing the character ranges allowed in canonical names, using it where appropriate. ($MACRO_PATTERN, $CANONICALS): Allow '@'s in automake macro names. Index: automake.in === RCS file: /cvs/automake/automake/automake.in,v retrieving revision 1.843 diff -u -r1.843 automake.in --- automake.in 2001/01/31 14:36:21 1.843 +++ automake.in 2001/01/31 15:55:57 @@ -46,7 +46,7 @@ # Only recognize leading spaces, not leading tabs. If we recognize # leading tabs here then we need to make the reader smarter, because # otherwise it will think rules like `foo=bar; \' are errors. -$MACRO_PATTERN = "^ *([A-Za-z0-9_]+)[ \t]*([:+]?)=[ \t]*(.*)\$"; +$MACRO_PATTERN = "^ *([A-Za-z0-9_\@]+)[ \t]*([:+]?)=[ \t]*(.*)\$"; $BOGUS_MACRO_PATTERN = "^ *([^ \t]*)[ \t]*([:+]?)=[ \t]*(.*)\$"; $GNITS_VERSION_PATTERN = "[0-9]+\\.[0-9]+([a-z]|\\.[0-9]+)?"; $IF_PATTERN = "^if[ \t]+\([A-Za-z][A-Za-z0-9_]*\)[ \t]*\(#.*\)?\$"; @@ -55,6 +55,7 @@ $PATH_PATTERN='(\\w|[/.-])+'; # This will pass through anything not of the prescribed form. $INCLUDE_PATTERN = "^include[ \t]+((\\\$\\\(top_srcdir\\\)/${PATH_PATTERN})|(\\\$\\\(srcdir\\\)/${PATH_PATTERN})|([^/\\\$]${PATH_PATTERN}))[ \t]*(#.*)?\$"; +$CANONICALS = "A-Za-z0-9_\@"; # Some regular expressions. One reason to put them here is that it # makes indentation work better in Emacs. @@ -1717,7 +1718,7 @@ local ($name, @suffixes) = @_; local ($xname, $xt); -($xname = $name) =~ tr/A-Za-z0-9_/_/c; +($xname = $name) =~ s/[^$CANONICALS]/_/og; if ($xname ne $name) { local ($xt); @@ -1849,7 +1850,7 @@ foreach $one_file (@proglist) { # Canonicalize names. - ($xname = $one_file) =~ tr/A-Za-z0-9_/_/c; + ($xname = $one_file) =~ s/[^$CANONICALS]/_/og; if (&variable_defined ($xname . '_LDADD')) { @@ -1953,7 +1954,7 @@ foreach $onelib (@liblist) { # Canonicalize names. - ($xlib = $onelib) =~ tr/A-Za-z0-9_/_/c; + ($xlib = $onelib) =~ s/[^$CANONICALS]/_/og; if (&variable_defined ($xlib . '_LIBADD')) { &check_libobjs_sources ($xlib, $xlib . '_LIBADD'); @@ -2114,7 +2115,7 @@ foreach $onelib (@liblist) { # Canonicalize names. - ($xlib = $onelib) =~ tr/A-Za-z0-9_/_/c; + ($xlib = $onelib) =~ s/[^$CANONICALS]/_/og; if (&variable_defined ($xlib . '_LIBADD')) { &check_libobjs_sources ($xlib, $xlib . '_LIBADD'); @@ -2318,7 +2319,7 @@ push (@texi_deps, '$(srcdir)/' . $vtexi) if $vtexi; # Canonicalize name first. - ($canonical = $infobase) =~ tr/A-Za-z0-9_/_/c; + ($canonical = $infobase) =~ s/[^$CANONICALS]/_/og; if (&variable_defined ($canonical . "_TEXINFOS")) { push (@texi_deps, '$(' . $canonical . '_TEXINFOS)');
Re: AC_LIBOBJ and libsources
> "Tom" == Tom Tromey <[EMAIL PROTECTED]> writes: > "Akim" == Akim Demaille <[EMAIL PROTECTED]> writes: Akim> 1. Does Automake need to know what are the files that can Akim> actually be in LIBOBJ, or headers can be included? Tom> Automake wants to know the associated headers as well. Can there be any non source files which we want to ship?
Re: 10-check-am.patch
> "Tom" == Tom Tromey <[EMAIL PROTECTED]> writes: Tom> Do you mean something like doing this for install, uninstall Tom> targets, and the like? Right. Tom> That would be fine with me. However for non-trivial targets Tom> sometimes weird special handling is required. Most probably. But in most cases, the variant part is handled by the COMMANDS which are run beforehand, so in most cases all the magic we need is already given. And in fact, but maybe this reasoning is naive, dependencies which must be factored are about targets which must be already specified in the *.am file, therefore, a priori, it should be also possible to use these targets in the factored dependencies.
Re: 10-check-am.patch
> "Tom" == Tom Tromey <[EMAIL PROTECTED]> writes: > "Akim" == Akim Demaille <[EMAIL PROTECTED]> writes: Akim> It means that for instance we could have Akim> a b c: d e f Akim> in a .am file, and have file_contents_with_transform (provided Akim> we taught it that a, b and c are special targets) push @a, @b, Akim> @c the list of d, e and f. Tom> Do you mean something like doing this for install, uninstall Tom> targets, and the like? Tom> That would be fine with me. However for non-trivial targets Tom> sometimes weird special handling is required. Akim> Now my patch is only an approximation of this, since it catches Akim> specifically just .PHONY. How to extend it? Tom> Or do it by matching against the names of the targets. There are Tom> probably a small number of targets like this, so we could handle Tom> it via a list of regexps. Tom> Or do I misunderstand? Your explanation is a bit abstract. Tom> Maybe some more concrete examples would help. My `plan' is what I implemented in the patch named factored-dependencies. Basically, here is how subdirs.am looks now: | .PHONY: all-recursive install-data-recursive install-exec-recursive \ | installdirs-recursive install-recursive uninstall-recursive \ | @INSTALLINFO@ check-recursive installcheck-recursive info-recursive \ | dvi-recursive | | all-recursive install-data-recursive install-exec-recursive \ | installdirs-recursive install-recursive uninstall-recursive @INSTALLINFO@ \ | check-recursive installcheck-recursive info-recursive dvi-recursive: | @set fnord $(MAKEFLAGS); amf=$$2; \ | dot_seen=no; \ | target=`echo $@ | sed s/-recursive//`; \ | list='$(SUBDIRS)'; for subdir in $$list; do \ | ... the first part being what's now possible. We could have added other targets than `.PHONY'. My goal was trying to have *.am files behaves like actual Makefiles, obeying the same rules, instead of having to code into automake.in.
[patch 2/2] support AC_SUBST'able automake rules
This patch makes it possible to have AC_SUBST keywords in for instance library names, allowing for much greater flexibility. It depends on patch 1/2, of course. 2001-02-01 Lars J. Aas <[EMAIL PROTECTED]> * automake.in ($quote_ats): New. ($MACRO_PATTERN, $CANONICALS): Allow '@'s in automake macro names. (&am_install_var): Use "e_ats to escape '@'s in transform rules given to &file_contents_with_transform. --- automake.in Mon Jan 29 21:17:31 2001 +++ automake.in Wed Jan 31 03:51:41 2001 @@ -45,7 +45,7 @@ # Only recognize leading spaces, not leading tabs. If we recognize # leading tabs here then we need to make the reader smarter, because # otherwise it will think rules like `foo=bar; \' are errors. -$MACRO_PATTERN = "^ *([A-Za-z0-9_]+)[ \t]*([:+]?)=[ \t]*(.*)\$"; +$MACRO_PATTERN = "^ *([A-Za-z0-9_\@]+)[ \t]*([:+]?)=[ \t]*(.*)\$"; $BOGUS_MACRO_PATTERN = "^ *([^ \t]*)[ \t]*([:+]?)=[ \t]*(.*)\$"; $GNITS_VERSION_PATTERN = "[0-9]+\\.[0-9]+([a-z]|\\.[0-9]+)?"; $IF_PATTERN = "^if[ \t]+\([A-Za-z][A-Za-z0-9_]*\)[ \t]*\(#.*\)?\$"; @@ -54,7 +54,7 @@ $PATH_PATTERN='(\\w|[/.-])+'; # This will pass through anything not of the prescribed form. $INCLUDE_PATTERN = "^include[ \t]+((\\\$\\\(top_srcdir\\\)/${PATH_PATTERN})|(\\\$\\\(srcdir\\\)/${PATH_PATTERN})|([^/\\\$]${PATH_PATTERN}))[ \t]*(#.*)?\$"; -$CANONICALS = "A-Za-z0-9_"; +$CANONICALS = "A-Za-z0-9_\@"; # Some regular expressions. One reason to put them here is that it # makes indentation work better in Emacs. @@ -5626,6 +5627,15 @@ return $val; } +# Quote 'at' (@) instances with backslash escapes so they don't evaluate as +# arrays. +sub quote_ats +{ +local ($val) = @_; +$val =~ s/\@/\\\@/og; +return $val; +} + # Return the set of conditions for which a variable is defined. # If the variable is not defined conditionally, and is not defined in @@ -7435,11 +7445,11 @@ } $output_rules .= - &file_contents_with_transform ('s/\@DIR\@/' . $X . '/g;' - . 's/\@NDIR\@/' . $nodir_name . '/go;' - . $ltxform . $cygxform - . $subdir_xform, - $file); + &file_contents_with_transform ( + "e_ats ('s/@DIR@/' . $X . '/g;' + . 's/@NDIR@/' . $nodir_name . '/go;' + . $ltxform . $cygxform . $subdir_xform), + $file); push (@uninstall, 'uninstall-' . $X . $primary); push (@phony, 'uninstall-' . $X . $primary);
[patch 1/2] support AC_SUBST'able automake rules
First a simple organize/cleanup patch. 2001-02-01 Lars J. Aas <[EMAIL PROTECTED]> * automake.in: Collect the canonical character ranges in variable $CANONICALS and utilize it. --- automake.in Mon Jan 29 21:17:31 2001 +++ automake.in Wed Jan 31 03:51:41 2001 @@ -54,6 +54,7 @@ $PATH_PATTERN='(\\w|[/.-])+'; # This will pass through anything not of the prescribed form. $INCLUDE_PATTERN = "^include[ \t]+((\\\$\\\(top_srcdir\\\)/${PATH_PATTERN})|(\\\$\\\(srcdir\\\)/${PATH_PATTERN})|([^/\\\$]${PATH_PATTERN}))[ \t]*(#.*)?\$"; +$CANONICALS = "A-Za-z0-9_"; # Some regular expressions. One reason to put them here is that it # makes indentation work better in Emacs. @@ -1708,7 +1709,7 @@ local ($name, @suffixes) = @_; local ($xname, $xt); -($xname = $name) =~ tr/A-Za-z0-9_/_/c; +($xname = $name) =~ s/[^$CANONICALS]/_/og; if ($xname ne $name) { local ($xt); @@ -1842,7 +1843,7 @@ foreach $one_file (@proglist) { # Canonicalize names. - ($xname = $one_file) =~ tr/A-Za-z0-9_/_/c; + ($xname = $one_file) =~ s/[^$CANONICALS]/_/og; if (&variable_defined ($xname . '_LDADD')) { @@ -1948,7 +1949,7 @@ foreach $onelib (@liblist) { # Canonicalize names. - ($xlib = $onelib) =~ tr/A-Za-z0-9_/_/c; + ($xlib = $onelib) =~ s/[^$CANONICALS]/_/og; if (&variable_defined ($xlib . '_LIBADD')) { &check_libobjs_sources ($xlib, $xlib . '_LIBADD'); @@ -2111,7 +2112,7 @@ foreach $onelib (@liblist) { # Canonicalize names. - ($xlib = $onelib) =~ tr/A-Za-z0-9_/_/c; + ($xlib = $onelib) =~ s/[^$CANONICALS]/_/og; if (&variable_defined ($xlib . '_LIBADD')) { &check_libobjs_sources ($xlib, $xlib . '_LIBADD'); @@ -2316,7 +2317,7 @@ push (@texi_deps, '$(srcdir)/' . $vtexi) if $vtexi; # Canonicalize name first. - ($canonical = $infobase) =~ tr/A-Za-z0-9_/_/c; + ($canonical = $infobase) =~ s/[^$CANONICALS]/_/og; if (&variable_defined ($canonical . "_TEXINFOS")) { push (@texi_deps, '$(' . $canonical . '_TEXINFOS)');
Re: Uppercasing files
Alexandre Oliva wrote: > > On Jan 31, 2001, Emiliano <[EMAIL PROTECTED]> wrote: > > > Tom Tromey wrote: > >> Write explicit rules. > > >> SOMETHING.EXT: something.ext > > > Yes, but I'd rather not if it can be avoided. > > I'm afraid it can't. Unix is case-sensitive, why shouldn't `make' be? But that's the whole issue. If unix weren't case sensitive we wouldn't be having this discussion. > Well... I suppose you could do something about it if you were willing > to get your Makefiles non-portable and use GNU make only, by using Totally acceptable. > $(shell ) magic. Or you could write a script to generate the rules > and get them included in the Makefile with AC_SUBST_FILE or automake's > include feature. I'd appreciate pointers on how to accomplish this. I've not been using automake very long and learning to abuse it would take some time :) Emile
Re: Uppercasing files
On Jan 31, 2001, Emiliano <[EMAIL PROTECTED]> wrote: > Tom Tromey wrote: >> Write explicit rules. >> SOMETHING.EXT: something.ext > Yes, but I'd rather not if it can be avoided. I'm afraid it can't. Unix is case-sensitive, why shouldn't `make' be? Well... I suppose you could do something about it if you were willing to get your Makefiles non-portable and use GNU make only, by using $(shell ) magic. Or you could write a script to generate the rules and get them included in the Makefile with AC_SUBST_FILE or automake's include feature. -- Alexandre Oliva Enjoy Guarana', see http://www.ic.unicamp.br/~oliva/ Red Hat GCC Developer aoliva@{cygnus.com, redhat.com} CS PhD student at IC-Unicampoliva@{lsd.ic.unicamp.br, gnu.org} Free Software Evangelist*Please* write to mailing lists, not to me
Re: Uppercasing files
Tom Tromey wrote: > > > "Emile" == Emiliano <[EMAIL PROTECTED]> writes: > > Emile> I'm trying to create an automake file that has rules to > Emile> uppercase files. For example I have something.ext and I want > Emile> it to create a copy SOMETHING.EXT. I tried with this: > > Emile> pkgdata_DATA = SOMETHING.EXT OTHER.EXT > Emile> CLEANFILES = $(pkgdata_DATA) > Emile> %.EXT : %.ext > Emile> cp -f $< `echo $< | tr a-z A-Z` > > Emile> but that doesn't work since no file SOMETHING.ext exists. How > Emile> so I go about this? > > Write explicit rules. > > SOMETHING.EXT: something.ext Yes, but I'd rather not if it can be avoided. There are quite a number of them and it impacts readability, plus there's more to keep consistent manually (after the uppercasing other ops are done on the files. At the moment I've used a default rule, which works, but doesn't handle dependancy: .DEFAULT: cp -f `echo $(basename $@) | tr [:upper:] [:lower:]`.m $(basename $@).m ../mumps/mumps $(basename $@).m 2>&1 Emile