automake
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Redefined extension caused problems


From: Alexandre Duret-Lutz
Subject: Re: Redefined extension caused problems
Date: 27 Dec 2001 13:03:44 +0100
User-agent: Gnus/5.0808 (Gnus v5.8.8) Emacs/21.1

>>> "Dmitry" == Dmitry Mikhin <address@hidden> writes:

 Dmitry> I'm trying to use autotools for a project that includes
 Dmitry> Fortran-90 files (extensions f90 for preprocessed files
 Dmitry> and F90 for source files).
[...]
 Dmitry> make distclean

 Dmitry> tries to compile a file distclean-compile, fails, and aborts the make.

 Dmitry> The distclean-compile rule in 'Makefile.in' is:

 Dmitry> distclean-compile:
 Dmitry>        -rm -f *.tab.c
 Dmitry>        $(F77COMPILE) -c -o $@ `test -f $< || echo '$(srcdir)/'`$<

I've looked into this and I'm horrified.  I wonder how this
mailing list hasn't been flooded with bug reports like yours...

Your project uses file with `.f90' extension.  This extension is
listed in the extensions for Fortran77 (no idea why, IIRC someone
already complained about this a few weeks ago).  Therefore
Automake injects the rules for .f90->.{o,lo,obj} into Makefile.in.

These rules are generated by evaluating depend2.am as follow:

| .f90.o:
| if FALSE
|         source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
|         depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' 
@AMDEPBACKSLASH@
|         $(noDEPMODE) $(depcomp) @AMDEPBACKSLASH@
| endif FALSE
|         $(F77COMPILE) -c -o $@ `test -f $< || echo '$(srcdir)/'`$<
|
| .f90.obj:
| if FALSE
|         source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
|         depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' 
@AMDEPBACKSLASH@
|         $(noDEPMODE) $(depcomp) @AMDEPBACKSLASH@
| endif FALSE
|         $(F77COMPILE) -c -o $@ `cygpath -w $<`
|
| if FALSE
| .f90.lo:
| if  FALSE
|         source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
|         depfile='$(DEPDIR)/$*.Plo' tmpdepfile='$(DEPDIR)/$*.TPlo' 
@AMDEPBACKSLAS
| H@
|         $(noDEPMODE) $(depcomp) @AMDEPBACKSLASH@
| endif  FALSE
|         $(LTF77COMPILE) -c -o $@ `test -f $< || echo '$(srcdir)/'`$<
| endif FALSE

This text then split in paragraphs by make_paragraphs as follow:

| .f90.o:
-
| if FALSE
-
|         source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
|         depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' 
@AMDEPBACKSLASH@
|         $(noDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-
| endif FALSE
-
|         $(F77COMPILE) -c -o $@ `test -f $< || echo '$(srcdir)/'`$<
-
| .f90.obj:
-
| if FALSE
-
|         source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
|         depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' 
@AMDEPBACKSLASH@
|         $(noDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-
| endif FALSE
-
|         $(F77COMPILE) -c -o $@ `cygpath -w $<`
-
| if FALSE
-
| .f90.lo:
-
| if  FALSE
-
|         source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
|         depfile='$(DEPDIR)/$*.Plo' tmpdepfile='$(DEPDIR)/$*.TPlo' 
@AMDEPBACKSLAS
| H@
|         $(noDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-
| endif  FALSE
-
|         $(LTF77COMPILE) -c -o $@ `test -f $< || echo '$(srcdir)/'`$<
-
| endif FALSE

And finally file_contents_internal removes unecessary paragaphs.
The removed paragraphs are those enclosed in `if
FALSE'/`endif', and also `.f90.o:' because you have already
defined this rule.  The remaining text is

|         $(F77COMPILE) -c -o $@ `test -f $< || echo '$(srcdir)/'`$<
|
| .f90.obj:
|         $(F77COMPILE) -c -o $@ `cygpath -w $<`

Blah!

I think the idea behind make_paragraphs is that each rule should be
in a paragraph.  However this doesn't work if `if'/`else'/`endif' are
handled on a paragraph basis but yet allowed _in_ a rule.

IMHO, Automake should be changed to work on a line by line basis
(i.e.  not paragraph) and let file_contents_internal accumulate
the lines for a rule.  Other opinions?

[...]
-- 
Alexandre Duret-Lutz




reply via email to

[Prev in Thread] Current Thread [Next in Thread]