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

Bug#295326: gcc-3.3: Request the ability to write a static library archive



On Wed, Feb 16, 2005 at 12:29:10AM +0100, Falk Hueffner wrote:
> Justin Pryzby <justinpryzby@users.sf.net> writes:
> 
> > I'd love to be able to create a static library archive with a
> > command like gcc -o libfoo.a -c {a,b,c,d}.c.
> 
> Why? What would be the advantage over using ar rc?
gcc acts as a frontend to cpp, g77, ld, etc, so it seems like it
should be able to do the same with ar.  It would simplify the creation
of pic/nonpic libraries, as you could use one makefile rule
duplicated:

libfoo.so:
	gcc -o $@ -shared $(CFLAGS) $(LDFLAGS) $(LDLIBS)
libfoo.a:
	gcc -o $@ -fPIC $(CFLAGS) $(LDFLAGS) $(LDLIBS)

There's probably even a way to write that in one line.

Justin



Reply to: