This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


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

Re: [patch] releases.html


On Wed, Feb 14, 2001 at 01:14:20PM -0700, Tom Tromey wrote:
> >>>>> "Zack" == Zack Weinberg <zackw@stanford.edu> writes:
> 
> Zack> Hm, I could have explained myself better.  I'm aware of the
> Zack> total complexity of metaconfig.  However, it seems to me that
> Zack> the complexity of its dynamic library/module support is far
> Zack> smaller than the complexity of libtool, for roughly equivalent
> Zack> functionality.  There is no heavyweight compiler wrapper script,
> Zack> only a straightforward set of additional Makefile variables
> Zack> (LDDLFLAGS etc.)
> 
> One problem is historical.  My recollection is that Gord specifically
> designed libtool to be independent of autoconf.  So instead of doing
> the "obvious" thing (write some autoconf macros and then rely on the
> Makefile to get things right), instead he built all the configury
> stuff into libtool itself.

I did not know that.  That explains a lot, in particular why the
libtool script is so heavyweight.

> I imagine the decision to support building both shared and static
> libraries at once probably also increased the size of libtool quite a
> bit.

Yabbut, thing is, I can do that in twenty lines of Makefile on any
platform that doesn't care what the extension of object files is.  Or
I can do it shorter and without weird extensions on any platform where
it's okay to put -fPIC code in a static library.

LIBFOO_OBJS = a.o b.o c.o d.o
LIBFOO_SO_OBJS = a.os b.os c.os d.os

PICFLAG = @picflag@
SHARED = @shared@

libfoo.a: $(LIBFOO_OBJS)
	-rm -f libfoo.a
	$(AR) cr libfoo.a $(LIBFOO_OBJS)
	$(RANLIB) libfoo.a

libfoo.so: $(LIBFOO_SO_OBJS)
	-rm -f libfoo.so
	$(CC) $(SHARED) $(LDFLAGS) -o libfoo.so $(LIBFOO_SO_OBJS)

.SUFFIXES: .o .os
.c.o:
	$(CC) -c $(CFLAGS) -o $@ $<
.c.os:
	$(CC) -c $(CFLAGS) $(PICFLAG) -o $@ $<

A small amount of additional complexity is required to handle sonames,
ELF version scripts, and getting the proper suffix on the shared
library's filename.

Random thought: what if we made

	gcc -staticlib -o libfoo.a a.o b.o c.o ...

run ar and possibly ranlib as appropriate to the target?

zw


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