bug-automake
[Top][All Lists]
Advanced

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

Double '/' in source path breaks compilation if done from a directory no


From: Aleksander Morgado
Subject: Double '/' in source path breaks compilation if done from a directory not where the Makefile.am resides
Date: Tue, 25 Nov 2008 11:16:09 +0100
User-agent: Thunderbird 2.0.0.17 (X11/20080925)

Hi all,

Not sure if this is a bug in automake, in make itself, or in my code,
but anyway I'll explain what happens.

I prepare a simple Makefile.am in my project, a single Makefile.am for
the whole project (not multiple Makefile.am in different directories),
where I compile one binary with one source file which is not in the same
directory as the Makefile.am:

bin_PROGRAMS = test

test_SOURCES = config.h \
               src/module/test.c

Then I usually compile the project from within a `build' directory,
which is in the same directory as the Makefile.am. The layout is like this:

project/configure.ac
project/Makefile.am
project/build/
project/src/module/test.c

The usual compilation, then, is like this:

address@hidden:~/dev/project$ autoreconf -i
address@hidden:~/dev/project$ cd build
address@hidden:~/dev/project$ ../configure
address@hidden:~/dev/project$ make

Now, this goes ok. But, if my Makefile.am contains a path with two
directory separators '/' together, like this:

test_SOURCES = config.h \
               src/module//test.c

Then when running `make' from within the `build' directory, it will fail
telling me:

make[1]: Entering directory `/home/aleksander/dev/project/build'
make[1]: *** No rule to make target `src/module//test.c', needed by
`test.o'.  Stop.
make[1]: Leaving directory `/home/aleksander/dev/project/build'
make: *** [all] Error 2


The thing is that if I compile that same code directly in the directory
where the Makefile.am resides, it doesn't crash:

address@hidden:~/dev/project$ autoreconf -i
address@hidden:~/dev/project$ ./configure
address@hidden:~/dev/project$ make

make  all-am
make[1]: Entering directory `/home/aleksander/dev/project'
gcc -DHAVE_CONFIG_H -I.     -g -O2 -MT test.o -MD -MP -MF .deps/test.Tpo
-c -o test.o `test -f 'src/module//test.c' || echo './'`src/module//test.c
mv -f .deps/test.Tpo .deps/test.Po
/bin/bash ./libtool --tag=CC   --mode=link gcc  -g -O2   -o test test.o
libtool: link: gcc -g -O2 -o test test.o
make[1]: Leaving directory `/home/aleksander/dev/project'


Also, if I use $(srcdir) to mark the top level path of the sources, it
won't crash. But not sure if this is the best way to have it:

test_SOURCES = config.h \
               $(srcdir)/src/module//test.c


This is really a minor problem for me, as I know that if I don't make
the mistake of putting the double '/' it works without any problem, but
anyway wanted to report it just in case I am not the only one with this
kind of problem.


automake (GNU automake) 1.10.1
autoconf (GNU Autoconf) 2.61
GNU Make 3.81
ltmain.sh (GNU libtool) 2.2.4

Cheers,
-Aleksander




reply via email to

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