This is the mail archive of the automake@gnu.org mailing list for the automake project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: backslashes in variable definition


Hi Andrew,

On Mon, 21 Jun 2004, Andrew Suffield wrote:
> On Mon, Jun 21, 2004 at 04:38:23PM +0200, Volker Boerchers wrote:
> > the _SOURCES values of our Makefile.am's are split into multiple lines
> > to improve readability like this
> > 
> >   libfoo_la_SOURCES = \
> > 	foo.c \
> > 	bar.c
> > 
> > However if one forgets a backslash the source files after that are
> > silently ignored by automake.
> > 
> >   libfoo_la_SOURCES = \
> >         foo.c                  # missing '\' 
> >         bar.c
> > 
> > These errors are hard to detect, at least for libraries since missing
> > dependencies are detected later.
> 
> You should see the error you get if you do this:
> 
> libfoo_la_SOURCES = \
> #        foo.c \
>         bar.c

hmm, perhaps my mail was capable of being misunderstood. The example
that was attached to my previous mail was

hello_SOURCES = \
	      hello.c
	      bar.c

The error appears not until link time, when the bar.o object is
missing (automake 1.5 and 1.7.6). Your example 

hello_SOURCES = \
#	      hello.c \
	      bar.c

is detected as erroneous by automake 1.5

  $ automake || echo error with automake
  Makefile.am:9: comment following trailing backslash
  error with automake
  $ automake --version | grep automake
  automake (GNU automake) 1.5

but not by automake 1.7.6:

  $ automake || echo error in automake
  $ automake --version | grep automake
  automake (GNU automake) 1.7.6

BTW there is another interesting case that I have mentioned in my
previous mail

hello_SOURCES = \
	      hello.c \
	      bar.c \

automake 1.5 detects that as long as there is a full line after the
last backslash:

  $ automake || echo error with automake
  Makefile.am:11: blank line following trailing backslash
  error with automake

automake 1.7.6 even detects it on the last line:

  $ automake || echo error in automake
  Makefile.am: trailing backslash on last line
  error in automake

It would be nice if automake would generate an error in all these
cases.

Volker
-- 
Volker Börchers
TECON Systems AG



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]