Volker Boerchers
2004-06-21 14:38:23 UTC
Hi,
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.
The output of the attached example is (using automake 1.5 or 1.7.6):
$ ./autogen.sh
automake: configure.in: installing `./install-sh'
automake: configure.in: installing `./mkinstalldirs'
automake: configure.in: installing `./missing'
automake: Makefile.am: installing `./COPYING'
automake: configure.in: installing `./depcomp'
$ ./configure
[omitted]
$ make
make all-am
make[1]: Entering directory `/home/vboerchers/hello'
source='hello.c' object='hello.o' libtool=no \
depfile='.deps/hello.Po' tmpdepfile='.deps/hello.TPo' \
depmode=gcc /bin/sh ./depcomp \
gcc -DHAVE_CONFIG_H -I. -I. -I. -g -O2 -c `test -f hello.c || echo './'`hello.c
gcc -g -O2 -o hello hello.o
hello.o: In function `main':
/home/vboerchers/hello/hello.c:2: undefined reference to `f'
collect2: ld returned 1 exit status
make[1]: *** [hello] Error 1
make[1]: Leaving directory `/home/vboerchers/hello'
make: *** [all] Error 2
$ make clean
test -z "hello" || rm -f hello
rm -f ChangeLog AUTHORS INSTALL Makefile.in Makefile NEWS README
rm -f aclocal.m4 config.h* depcomp install-sh missing mkinstalldirs
rm -f stamp* COPYING configure config.*
bar.c
make: execvp: bar.c: Permission denied
make: *** [clean-local] Error 127
Please note that the 'bar.c' is attached to the 'clean-local'-target
that is placed *before* the erroneous variable definition.
Would it be possible for automake to detect such errors, and to give a
warning like in case of trailing backslashes at the end of a variable
definition?
Volker
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.
The output of the attached example is (using automake 1.5 or 1.7.6):
$ ./autogen.sh
automake: configure.in: installing `./install-sh'
automake: configure.in: installing `./mkinstalldirs'
automake: configure.in: installing `./missing'
automake: Makefile.am: installing `./COPYING'
automake: configure.in: installing `./depcomp'
$ ./configure
[omitted]
$ make
make all-am
make[1]: Entering directory `/home/vboerchers/hello'
source='hello.c' object='hello.o' libtool=no \
depfile='.deps/hello.Po' tmpdepfile='.deps/hello.TPo' \
depmode=gcc /bin/sh ./depcomp \
gcc -DHAVE_CONFIG_H -I. -I. -I. -g -O2 -c `test -f hello.c || echo './'`hello.c
gcc -g -O2 -o hello hello.o
hello.o: In function `main':
/home/vboerchers/hello/hello.c:2: undefined reference to `f'
collect2: ld returned 1 exit status
make[1]: *** [hello] Error 1
make[1]: Leaving directory `/home/vboerchers/hello'
make: *** [all] Error 2
$ make clean
test -z "hello" || rm -f hello
rm -f ChangeLog AUTHORS INSTALL Makefile.in Makefile NEWS README
rm -f aclocal.m4 config.h* depcomp install-sh missing mkinstalldirs
rm -f stamp* COPYING configure config.*
bar.c
make: execvp: bar.c: Permission denied
make: *** [clean-local] Error 127
Please note that the 'bar.c' is attached to the 'clean-local'-target
that is placed *before* the erroneous variable definition.
Would it be possible for automake to detect such errors, and to give a
warning like in case of trailing backslashes at the end of a variable
definition?
Volker
--
Volker Börchers
TECON Systems AG
Volker Börchers
TECON Systems AG