Re: trying to find a good solution to filename clash

2007-02-17 Thread Russell Kliese

/ If my makefile contains roughly the following:/

/ lib_LIBRARIES = libfoo.a/
/  libfoo_a_SOURCES = foo1/exception.cpp foo2/exception.cpp/

/  I end up with the following error:/
 
/  Makefile.am: object `exception.$(OBJEXT)' created by/

/  `foo2/exception.cpp' and `foo1/exception.cpp'/

I think that you want to put subdir-objects in your
AUTOMAKE_OPTIONS. 


Thanks Ben, that option does what I need and it works like a charm!

Following is the line I added to my Makefile.am:

AUTOMAKE_OPTIONS = subdir-objects





trying to find a good solution to filename clash

2007-02-16 Thread Russell Kliese
I've been having a hard time trying to find a solution to something I 
though should be quite strait-forward. Perhaps I've missed something 
obvious.


I'm trying to create a Makefile.am to build some files in the following 
files/directory structure


/lib/Makefile.am
/lib/foo1/exception.cpp
/lib/foo1/exception.cpp

If my makefile contains roughly the following:

lib_LIBRARIES = libfoo.a
libfoo_a_SOURCES = foo1/exception.cpp foo2/exception.cpp

I end up with the following error:

Makefile.am: object `exception.$(OBJEXT)' created by 
`foo2/exception.cpp' and `foo1/exception.cpp'


I'm wondering if there is a way to avoid this filename clash (perhaps by 
mangling the name with the directory it belongs to somehow).


The reason I've got these duplicate files is because they are exception 
classes in different namespaces. I've found it convenient to have the 
source files in directories that are the same as the namespace as the 
object contained in the source file. I know that I could just make sure 
that the filenames are unique, but I really want to try to avoid it.


Up to this point in time, I've been using hand crafted makefiles, but am 
keen to make use of the automatic dependency tracking that automake 
offers to remove the need to make clean.


Cheers,

Russell Kliese





Re: trying to find a good solution to filename clash

2007-02-16 Thread Ben Pfaff
Russell Kliese [EMAIL PROTECTED] writes:

 If my makefile contains roughly the following:

 lib_LIBRARIES = libfoo.a
 libfoo_a_SOURCES = foo1/exception.cpp foo2/exception.cpp

 I end up with the following error:

 Makefile.am: object `exception.$(OBJEXT)' created by
 `foo2/exception.cpp' and `foo1/exception.cpp'

I think that you want to put subdir-objects in your
AUTOMAKE_OPTIONS.  From the Automake manual:

`subdir-objects'
 If this option is specified, then objects are placed into the
 subdirectory of the build directory corresponding to the
 subdirectory of the source file.  For instance, if the source file
 is `subdir/file.cxx', then the output file would be
 `subdir/file.o'.

 In order to use this option with C sources, you should add
 `AM_PROG_CC_C_O' to `configure.ac'.

-- 
Ben Pfaff 
[EMAIL PROTECTED]
http://benpfaff.org