[LCP]statically linking argtable and other libraries

robert at ncdesigns.net robert at ncdesigns.net
Fri Jul 16 02:33:01 UTC 2004


> Then the question is:  Why use libtool at all?
> 
> 
> 

I've encountered this problem myself. In theory, it it supposed
to allow you to write generic enough Makefiles so that it can
make a port to another *Nix variant easier. In practice I've had
more trouble getting this to work then using standard Makefile macros.

If your using Linux then your using automake and since this is Linux C
Programming, it's easier to learn the macros.

Consider this makefile:
====================================
CFLAGS=-O2 -Wall
LIBS=strings.o fileio.o parser.o

all=libmystuff.a

.c.o: $(LIBS)
        $(CC) -c $(CFLAGS) $<

libmystuff.a: $(LIBS)
        $(AR) -cr $@ $(LIBS)

clean:
        $(RM) $(LIBS)

====================================

I've started with this sort of template and it scales fine...
The whole automake/autoconf M4 macros add way too much headache
it is easier to find the differences, and make your Makefile
make the decisions.

Just my .2 cents after attempting libtool.

P.S.
I had to modify the "packaged" version of libtool to correctly
add a dynamic module to the Apache2 build tree...all attempts
to make it easier have made it more of a hassle.

-Robert




More information about the linuxCprogramming mailing list