[OpenAFS-devel] Why I like libtool

Russ Allbery rra@stanford.edu
Fri, 13 May 2005 08:51:20 -0700


Russ Allbery <rra@stanford.edu> writes:

>  * I can't easily build a shared libsys or even a subset of what would go
>    into libsys in the same directory as all of the sources because there
>    is no easy way to compile the same *.c file into multiple *.o files
>    without clobbering existing files.  (Not all compilers support -o with
>    -c in the same invocation.)  libtool fixes this for me; without
>    libtool, I have to use weird hacks like creating a pic subdirectory
>    and then using compiler rules that cd into the subdirectory and then
>    invoke the compiler on source relative to $(abssrcdir)... which I can't
>    use because we're still using Autoconf 2.13, which doesn't define it.
>    $(srcdir) may be relative or may be absolute, so there's no way to
>    use it to refer to a different directory that doesn't break under some
>    circumstance.

Ignore this; I was confusing this problem with a different problem and was
making life too complicated for myself.  You can just do:

.c.o:
        ${CCOBJ} ${CFLAGS} ${SHLIB_CFLAGS} -c $<
        mkdir -p shobj && mv $@ shobj/
        ${CCOBJ} ${CFLAGS} -c $<

and that should work just fine.  (The problem libtool handles is when
you're building source that's in a subdirectory of your current directory
and the source file name may not be unique across all the subdirectories,
something OpenAFS doesn't do.)

I'll attach an updated patch for the libafssetpag Makefile.in changes that
replaces the logic I had with something more like the above.

-- 
Russ Allbery (rra@stanford.edu)             <http://www.eyrie.org/~eagle/>