hoi :) On Sat, Aug 13, 2005 at 06:46:41PM +0300, Mihai Rusu wrote: > I have started recently to switch some of the OSS projects I work on to > automake. In one of this projects we used autoconf with our own hand > made Makefile.in. This Makefile.in hided the issued compiler commands > and instead printed something like "Compiling src/common/list.c.." or > "Linking src/prog/prog1..." (kinda like samba is doing I think).
when I once had too much time, I tried to implement something like that for automake. I haven't sent the patch up to now as I really don't like it myself. But perhaps it's a starting point for volunteers. Add to autoconf: Index: lib/autom4te.in =================================================================== RCS file: /cvsroot/autoconf/autoconf/lib/autom4te.in,v retrieving revision 1.28 diff -u -p -r1.28 autom4te.in --- lib/autom4te.in 30 Jun 2005 11:09:37 -0000 1.28 +++ lib/autom4te.in 14 Aug 2005 21:24:55 -0000 @@ -57,6 +57,7 @@ args: --preselect AM_CONDITIONAL args: --preselect AM_GNU_GETTEXT args: --preselect AM_INIT_AUTOMAKE args: --preselect AM_MAINTAINER_MODE +args: --preselect AM_OUTPUT_FILTER args: --preselect AM_PROG_CC_C_O args: --preselect LT_SUPPORTED_TAG args: --preselect _LT_AC_TAGCONFIG and to automake: Index: automake.in =================================================================== RCS file: /cvsroot/automake/automake/automake.in,v retrieving revision 1.1611 diff -u -p -r1.1611 automake.in --- automake.in 7 Aug 2005 09:48:30 -0000 1.1611 +++ automake.in 14 Aug 2005 21:24:46 -0000 @@ -225,7 +225,7 @@ my @common_files = COPYING.LESSER ChangeLog INSTALL NEWS README THANKS TODO ansi2knr.1 ansi2knr.c compile config.guess config.rpath config.sub depcomp elisp-comp install-sh libversion.in mdate-sh missing - mkinstalldirs py-compile texinfo.tex ylwrap), + mkinstalldirs output-filter py-compile texinfo.tex ylwrap), @libtool_files, @libtool_sometimes); # Commonly used files we auto-include, but only sometimes. This list @@ -364,6 +364,9 @@ my $canonical_location; # Where AM_MAINTAINER_MODE appears. my $seen_maint_mode; +# Where AM_OUTPUT_FILTER appears. +my $seen_output_filter; + # Actual version we've seen. my $package_version = ''; @@ -1197,6 +1200,8 @@ sub handle_languages '-c' => $lang->compile_flag || '', 'MORE-THAN-ONE' => (count_files_for_language ($lang->name) > 1), + 'ACTION' => $lang->compiler, + # These are not used, but they need to be defined # so &transform do not complain. SUBDIROBJ => 0, @@ -3888,6 +3893,11 @@ sub handle_configure ($$$@) define_pretty_variable ('am__configure_deps', TRUE, INTERNAL, @configuredeps); + # include code for output filtering + &define_variable ('outfilter', + "\$(SHELL) $am_config_aux_dir/output-filter", + INTERNAL); + $output_rules .= file_contents ('configure', new Automake::Location, @@ -4769,6 +4779,7 @@ sub scan_autoconf_traces ($) AM_GNU_GETTEXT => 0, AM_INIT_AUTOMAKE => 0, AM_MAINTAINER_MODE => 0, + AM_OUTPUT_FILTER => 0, AM_PROG_CC_C_O => 0, LT_SUPPORTED_TAG => 1, _LT_AC_TAGCONFIG => 0, @@ -4934,6 +4945,10 @@ sub scan_autoconf_traces ($) { $seen_maint_mode = $where; } + elsif ($macro eq 'AM_OUTPUT_FILTER') + { + $seen_output_filter = $where; + } elsif ($macro eq 'AM_PROG_CC_C_O') { $seen_cc_c_o = $where; @@ -5101,6 +5116,8 @@ sub scan_autoconf_files () # Preserve dist_common for later. $configure_dist_common = variable_value ('DIST_COMMON') || ''; + require_conf_file ($seen_output_filter, FOREIGN, 'output-filter') + if ($seen_output_filter) } ################################################################ @@ -5839,7 +5856,8 @@ sub define_configure_variable ($) # pretty hacky. We also don't output AMDEPBACKSLASH: it might # be subst'd by `\', which certainly would not be appreciated by # Make. - if ($var eq 'ANSI2KNR' || $var eq 'AMDEPBACKSLASH') + if ($var eq 'ANSI2KNR' || $var eq 'AMDEPBACKSLASH' || + $var eq 'AMOUTFILTERBACKSLASH') { $pretty = VAR_SILENT; $owner = VAR_AUTOMAKE; @@ -6358,6 +6376,7 @@ sub make_paragraphs ($%) %transform = ('CYGNUS' => !! option 'cygnus', 'MAINTAINER-MODE' => $seen_maint_mode ? subst ('MAINTAINER_MODE_TRUE') : '', + 'OUTFILTER' => $seen_output_filter ? 'OUTFILTER' : 'FALSE', 'BZIP2' => !! option 'dist-bzip2', 'COMPRESS' => !! option 'dist-tarZ', Index: lib/Makefile.am =================================================================== RCS file: /cvsroot/automake/automake/lib/Makefile.am,v retrieving revision 1.9 diff -u -p -r1.9 Makefile.am --- lib/Makefile.am 14 May 2005 20:28:50 -0000 1.9 +++ lib/Makefile.am 14 Aug 2005 21:24:47 -0000 @@ -29,8 +29,8 @@ dist_pkgvdata_DATA = COPYING INSTALL tex ## what we want. So we make them executable by hand. scriptdir = $(pkgvdatadir) dist_script_DATA = config.guess config.sub install-sh mdate-sh missing \ - mkinstalldirs elisp-comp ylwrap acinstall depcomp compile py-compile \ - symlink-tree + mkinstalldirs elisp-comp ylwrap acinstall depcomp compile output-filter \ + py-compile symlink-tree EXTRA_DIST = gnupload Index: lib/Makefile.in =================================================================== RCS file: /cvsroot/automake/automake/lib/Makefile.in,v retrieving revision 1.122 diff -u -p -r1.122 Makefile.in --- lib/Makefile.in 30 Jun 2005 11:07:38 -0000 1.122 +++ lib/Makefile.in 14 Aug 2005 21:24:47 -0000 @@ -36,7 +36,7 @@ DIST_COMMON = $(dist_pkgvdata_DATA) $(di $(srcdir)/Makefile.am $(srcdir)/Makefile.in COPYING INSTALL \ ansi2knr.1 ansi2knr.c compile config.guess config.sub depcomp \ elisp-comp install-sh mdate-sh missing mkinstalldirs \ - py-compile texinfo.tex ylwrap + output-filter py-compile texinfo.tex ylwrap ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/amversion.m4 \ $(top_srcdir)/m4/auxdir.m4 $(top_srcdir)/m4/init.m4 \ @@ -47,6 +47,7 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/a $(top_srcdir)/m4/tar.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) +outfilter = $(SHELL) $(top_srcdir)/lib/output-filter mkinstalldirs = $(SHELL) $(top_srcdir)/lib/mkinstalldirs CONFIG_CLEAN_FILES = SOURCES = @@ -164,8 +165,8 @@ dist_pkgvdata_DATA = COPYING INSTALL tex scriptdir = $(pkgvdatadir) dist_script_DATA = config.guess config.sub install-sh mdate-sh missing \ - mkinstalldirs elisp-comp ylwrap acinstall depcomp compile py-compile \ - symlink-tree + mkinstalldirs elisp-comp ylwrap acinstall depcomp compile output-filter \ + py-compile symlink-tree EXTRA_DIST = gnupload all: all-recursive Index: lib/output-filter =================================================================== RCS file: lib/output-filter diff -N lib/output-filter --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ lib/output-filter 14 Aug 2005 21:24:47 -0000 @@ -0,0 +1,139 @@ +#!/bin/sh +# output-filter -- pretty print command lines + +scriptversion=2005-06-18 + +helptext="\ +Usage: $0 [OPTION] PROGRAM [ARGUMENTS] + +PRAGRAM and ARGUMENTS are printed to stdout and executed. +Can be used to pretty-print command-lines in Makefiles. + +Options: + --help print this help text + --version print the version number + --format=FORMAT set the desired output format + -s be silent + +Available output formats: + silent, quiet don't print anything + short only print the command and the -o argument (default) + long, verbose print the entire command-line +" + + +if test $# -eq 0; then + echo 1>&2 "Usage: $0 cmd [options]" + exit 1 +fi + + +# set defaults +format=default + +# parse options that are for us +haveoptions=yes +while test "$haveoptions" = yes; do + case "$1" in + -h|--h|--he|--hel|--help) + echo "$helptext" + exit 0 + ;; + -v|--v|--ve|--ver|--vers|--versi|--versio|--version) + echo "output-filter $scriptversion (GNU Automake)" + exit 0 + ;; + -s) + format=silent + shift + ;; + --format) + format="$2" + shift + shift + ;; + --format=*) + format=`echo "$1" | sed -e 's/^--format=//'` + shift + ;; + --action) + action="$2" + shift + shift + ;; + --action=*) + action=`echo "$1" | sed -e 's/^--action=//'` + shift + ;; + --output) + output="$2" + shift + shift + ;; + --output=*) + output=`echo "$1" | sed -e 's/^--output=//'` + shift + ;; + -*) + # we ignore everything else so that it is possible to call us + # via 'output-filter -$(MAKEFLAGS) $(CC) ...' + shift + ;; + *) + haveoptions=no + ;; + esac +done + +# pretty-print the command +case "$format" in + silent|quiet) + ;; + short|default) + state=1 + for arg; do + case "$state$arg" in + 1*=*|1-*) + # ignore everything until the first command name + ;; + 1libtool|1*/libtool|1depcomp|1*/depcomp|1ylwrap|1*/ylwrap) + # ignore some well known wrapper scripts + ;; + 1*) + cmd=`echo "$arg" | tr 'a-z' 'A-Z'` + state=2 + ;; + 2-o) + state=3 + ;; + 2*) + # ignore everything until we get the output filename + ;; + 3*) + out="$arg" + state=4 + ;; + *) + # we have everything we want, ignore the rest + ;; + esac + done + if test x"$action" != x; then + cmd="$action" + fi + if test x"$output" != x; then + out="$output" + fi + echo " $cmd $out" + ;; + long|verbose) + echo "$@" + ;; + *) + echo "$0: invalid output format '$format'" + echo "$@" + ;; +esac + +# execute the command +exec "$@" Index: lib/am/depend2.am =================================================================== RCS file: /cvsroot/automake/automake/lib/am/depend2.am,v retrieving revision 1.59 diff -u -p -r1.59 depend2.am --- lib/am/depend2.am 14 May 2005 20:28:52 -0000 1.59 +++ lib/am/depend2.am 14 Aug 2005 21:24:47 -0000 @@ -63,13 +63,19 @@ if %?NONLIBTOOL% ?GENERIC?%EXT%.o: ?!GENERIC?%OBJ%: %SOURCE% if %FASTDEP% +if %OUTFILTER% + @$(outfilter) --action=%ACTION% $(AM_OUTFILTER_FLAGS) @AMOUTFILTERBACKSLASH@ +endif %OUTFILTER% ## In fast-dep mode, we can always use -o. ## For non-suffix rules, we must emulate a VPATH search on %SOURCE%. -?!GENERIC? if %COMPILE% -MT %OBJ% -MD -MP -MF "%DEPBASE%.Tpo" %-c% -o %OBJ% `test -f '%SOURCE%' || echo '$(srcdir)/'`%SOURCE%; \ +?!GENERIC? %COMPILE% -MT %OBJ% -MD -MP -MF "%DEPBASE%.Tpo" %-c% -o %OBJ% `test -f '%SOURCE%' || echo '$(srcdir)/'`%SOURCE%; \ ?SUBDIROBJ??GENERIC? depbase=`echo %OBJ% | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`; \ -?GENERIC? if %COMPILE% -MT %OBJ% -MD -MP -MF "%DEPBASE%.Tpo" %-c% -o %OBJ% %SOURCE%; \ - then mv -f "%DEPBASE%.Tpo" "%DEPBASE%.Po"; else rm -f "%DEPBASE%.Tpo"; exit 1; fi +?GENERIC? %COMPILE% -MT %OBJ% -MD -MP -MF "%DEPBASE%.Tpo" %-c% -o %OBJ% %SOURCE%; \ + if test $$? -eq 0; then mv -f "%DEPBASE%.Tpo" "%DEPBASE%.Po"; else rm -f "%DEPBASE%.Tpo"; exit 1; fi else !%FASTDEP% +if %OUTFILTER% + @$(outfilter) --action=%ACTION% $(AM_OUTFILTER_FLAGS) @AMOUTFILTERBACKSLASH@ +endif %OUTFILTER% if %AMDEP% source='%SOURCE%' object='%OBJ%' libtool=no @AMDEPBACKSLASH@ DEPDIR=$(DEPDIR) $(%FPFX%DEPMODE) $(depcomp) @AMDEPBACKSLASH@ @@ -86,14 +92,20 @@ endif !%FASTDEP% ?GENERIC?%EXT%.obj: ?!GENERIC?%OBJOBJ%: %SOURCE% +if %OUTFILTER% + @$(outfilter) --action=%ACTION% $(AM_OUTFILTER_FLAGS) @AMOUTFILTERBACKSLASH@ +endif %OUTFILTER% if %FASTDEP% ## In fast-dep mode, we can always use -o. ## For non-suffix rules, we must emulate a VPATH search on %SOURCE%. -?!GENERIC? if %COMPILE% -MT %OBJOBJ% -MD -MP -MF "%DEPBASE%.Tpo" %-c% -o %OBJOBJ% `if test -f '%SOURCE%'; then $(CYGPATH_W) '%SOURCE%'; else $(CYGPATH_W) '$(srcdir)/%SOURCE%'; fi`; \ +?!GENERIC? %COMPILE% -MT %OBJOBJ% -MD -MP -MF "%DEPBASE%.Tpo" %-c% -o %OBJOBJ% `if test -f '%SOURCE%'; then $(CYGPATH_W) '%SOURCE%'; else $(CYGPATH_W) '$(srcdir)/%SOURCE%'; fi`; \ ?SUBDIROBJ??GENERIC? depbase=`echo %OBJ% | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`; \ -?GENERIC? if %COMPILE% -MT %OBJOBJ% -MD -MP -MF "%DEPBASE%.Tpo" %-c% -o %OBJOBJ% `$(CYGPATH_W) '%SOURCE%'`; \ - then mv -f "%DEPBASE%.Tpo" "%DEPBASE%.Po"; else rm -f "%DEPBASE%.Tpo"; exit 1; fi +?GENERIC? %COMPILE% -MT %OBJOBJ% -MD -MP -MF "%DEPBASE%.Tpo" %-c% -o %OBJOBJ% `$(CYGPATH_W) '%SOURCE%'`; \ + if test $$? -eq 0; then mv -f "%DEPBASE%.Tpo" "%DEPBASE%.Po"; else rm -f "%DEPBASE%.Tpo"; exit 1; fi else !%FASTDEP% +if %OUTFILTER% + @$(outfilter) --action=%ACTION% $(AM_OUTFILTER_FLAGS) @AMOUTFILTERBACKSLASH@ +endif %OUTFILTER% if %AMDEP% source='%SOURCE%' object='%OBJOBJ%' libtool=no @AMDEPBACKSLASH@ DEPDIR=$(DEPDIR) $(%FPFX%DEPMODE) $(depcomp) @AMDEPBACKSLASH@ @@ -113,13 +125,19 @@ if %?LIBTOOL% ?GENERIC?%EXT%.lo: ?!GENERIC?%LTOBJ%: %SOURCE% if %FASTDEP% +if %OUTFILTER% + @$(outfilter) --action=%ACTION% $(AM_OUTFILTER_FLAGS) @AMOUTFILTERBACKSLASH@ +endif %OUTFILTER% ## In fast-dep mode, we can always use -o. ## For non-suffix rules, we must emulate a VPATH search on %SOURCE%. -?!GENERIC? if %LTCOMPILE% -MT %LTOBJ% -MD -MP -MF "%DEPBASE%.Tpo" %-c% -o %LTOBJ% `test -f '%SOURCE%' || echo '$(srcdir)/'`%SOURCE%; \ +?!GENERIC? %LTCOMPILE% -MT %LTOBJ% -MD -MP -MF "%DEPBASE%.Tpo" %-c% -o %LTOBJ% `test -f '%SOURCE%' || echo '$(srcdir)/'`%SOURCE%; \ ?SUBDIROBJ??GENERIC? depbase=`echo %OBJ% | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.lo$$||'`; \ -?GENERIC? if %LTCOMPILE% -MT %LTOBJ% -MD -MP -MF "%DEPBASE%.Tpo" %-c% -o %LTOBJ% %SOURCE%; \ - then mv -f "%DEPBASE%.Tpo" "%DEPBASE%.Plo"; else rm -f "%DEPBASE%.Tpo"; exit 1; fi +?GENERIC? %LTCOMPILE% -MT %LTOBJ% -MD -MP -MF "%DEPBASE%.Tpo" %-c% -o %LTOBJ% %SOURCE%; \ + if test $$? -eq 0; then mv -f "%DEPBASE%.Tpo" "%DEPBASE%.Plo"; else rm -f "%DEPBASE%.Tpo"; exit 1; fi else !%FASTDEP% +if %OUTFILTER% + @$(outfilter) --action=%ACTION% $(AM_OUTFILTER_FLAGS) @AMOUTFILTERBACKSLASH@ +endif %OUTFILTER% if %AMDEP% source='%SOURCE%' object='%LTOBJ%' libtool=yes @AMDEPBACKSLASH@ DEPDIR=$(DEPDIR) $(%FPFX%DEPMODE) $(depcomp) @AMDEPBACKSLASH@ Index: lib/am/library.am =================================================================== RCS file: /cvsroot/automake/automake/lib/am/library.am,v retrieving revision 1.16 diff -u -p -r1.16 library.am --- lib/am/library.am 14 May 2005 20:28:53 -0000 1.16 +++ lib/am/library.am 14 Aug 2005 21:24:47 -0000 @@ -17,5 +17,11 @@ ## 02110-1301, USA. %LIBRARY%: $(%XLIBRARY%_OBJECTS) $(%XLIBRARY%_DEPENDENCIES) %DIRSTAMP% -rm -f %LIBRARY% +if %OUTFILTER% + @$(outfilter) --output=%LIBRARY% $(AM_OUTFILTER_FLAGS) @AMOUTFILTERBACKSLASH@ +endif %OUTFILTER% $(%XLIBRARY%_AR) %LIBRARY% $(%XLIBRARY%_OBJECTS) $(%XLIBRARY%_LIBADD) +if %OUTFILTER% + @$(outfilter) --output=%LIBRARY% $(AM_OUTFILTER_FLAGS) @AMOUTFILTERBACKSLASH@ +endif %OUTFILTER% $(RANLIB) %LIBRARY% Index: lib/am/program.am =================================================================== RCS file: /cvsroot/automake/automake/lib/am/program.am,v retrieving revision 1.26 diff -u -p -r1.26 program.am --- lib/am/program.am 14 May 2005 20:28:53 -0000 1.26 +++ lib/am/program.am 14 Aug 2005 21:24:47 -0000 @@ -23,4 +23,7 @@ ## Or maybe not... sadly, incremental linkers are rarer than losing ## systems. @rm -f %PROGRAM%%EXEEXT% +if %OUTFILTER% + @$(outfilter) --action=%XLINK% $(AM_OUTFILTER_FLAGS) @AMOUTFILTERBACKSLASH@ +endif %OUTFILTER% $(%XLINK%) $(%XPROGRAM%_OBJECTS) $(%XPROGRAM%_LDADD) $(LIBS) Index: lib/am/yacc.am =================================================================== RCS file: /cvsroot/automake/automake/lib/am/yacc.am,v retrieving revision 1.21 diff -u -p -r1.21 yacc.am --- lib/am/yacc.am 14 May 2005 20:28:53 -0000 1.21 +++ lib/am/yacc.am 14 Aug 2005 21:24:47 -0000 @@ -43,12 +43,18 @@ endif %?MAINTAINER-MODE% ?GENERIC?%EXT%%DERIVED-EXT%: ?!GENERIC?%OBJ%: %SOURCE% +if %OUTFILTER% + @$(outfilter) $(AM_OUTFILTER_FLAGS) @AMOUTFILTERBACKSLASH@ +endif %OUTFILTER% if %?MORE-THAN-ONE% ?GENERIC? $(am__skipyacc) $(SHELL) $(YLWRAP) %SOURCE% y.tab.c %OBJ% y.tab.h %BASE%.h y.output %BASE%.output -- %COMPILE% ?!GENERIC??DIST_SOURCE? $(am__skipyacc) \ ## For non-suffix rules, we must emulate a VPATH search on %SOURCE%. ?!GENERIC? $(SHELL) $(YLWRAP) `test -f '%SOURCE%' || echo '$(srcdir)/'`%SOURCE% y.tab.c %OBJ% y.tab.h %BASE%.h y.output %BASE%.output -- %COMPILE% else !%?MORE-THAN-ONE% +if %OUTFILTER% + @$(outfilter) $(AM_OUTFILTER_FLAGS) @AMOUTFILTERBACKSLASH@ +endif %OUTFILTER% ?GENERIC? $(am__skipyacc) %COMPILE% %SOURCE% ?!GENERIC??DIST_SOURCE? $(am__skipyacc) \ ## For non-suffix rules, we must emulate a VPATH search on %SOURCE%. Index: m4/Makefile.am =================================================================== RCS file: /cvsroot/automake/automake/m4/Makefile.am,v retrieving revision 1.54 diff -u -p -r1.54 Makefile.am --- m4/Makefile.am 14 May 2005 20:28:53 -0000 1.54 +++ m4/Makefile.am 14 Aug 2005 21:24:47 -0000 @@ -48,6 +48,7 @@ obsol-gt.m4 \ obsol-lt.m4 \ obsolete.m4 \ options.m4 \ +output-filter.m4 \ protos.m4 \ python.m4 \ regex.m4 \ Index: m4/Makefile.in =================================================================== RCS file: /cvsroot/automake/automake/m4/Makefile.in,v retrieving revision 1.267 diff -u -p -r1.267 Makefile.in --- m4/Makefile.in 30 Jun 2005 11:07:40 -0000 1.267 +++ m4/Makefile.in 14 Aug 2005 21:24:47 -0000 @@ -169,6 +169,7 @@ obsol-gt.m4 \ obsol-lt.m4 \ obsolete.m4 \ options.m4 \ +output-filter.m4 \ protos.m4 \ python.m4 \ regex.m4 \ Index: m4/output-filter.m4 =================================================================== RCS file: m4/output-filter.m4 diff -N m4/output-filter.m4 --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ m4/output-filter.m4 14 Aug 2005 21:24:47 -0000 @@ -0,0 +1,16 @@ + +AC_DEFUN([AM_OUTPUT_FILTER], [ + AC_ARG_WITH([output-filter], + AC_HELP_STRING([--with-output-filter=FORMAT], + [use the specified output format])) + if test x"$ac_with_output_filter" = x; then + ac_with_output_filter=default + fi + if test x"$ac_with_output_filter" != xno; then + AMOUTFILTERBACKSLASH='\' + AM_OUTFILTER_FLAGS="--format=$ac_with_output_filter -\$(MAKEFLAGS)" + fi + AC_SUBST([AMOUTFILTERBACKSLASH]) + AC_SUBST([AM_OUTFILTER_FLAGS]) + AM_CONDITIONAL([OUTFILTER], [test x"$ac_with_output_filter" != xno]) +]) -- Martin Waitz
signature.asc
Description: Digital signature