libtool
[Top][All Lists]
Advanced

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

Separate CPPFLAGS for static and shared libs


From: Vikram Ambrose
Subject: Separate CPPFLAGS for static and shared libs
Date: Wed, 04 Jun 2008 09:54:35 -0400
User-agent: Thunderbird 2.0.0.14 (X11/20080501)

Dear All,

I have some code that I am trying to build with the aid of libtool, autoconf and automake. I require both a static and shared library of my code, and libtool provides this functionality beautifully.

However I need to pass separate CPPFLAGS to the objects destined for the shared library as opposed to the objects destined for the library archive.

----------example------------------

gcc file.c -c -DSTATIC
ar cru libfile.a file.o

gcc file.c -c -DSHARED
gcc -shared file.o -o libfile.so.0

-------------------------------------


In my Makefile.am I have

lib_LTLIBRARIES = libfile.la
libfile_la_SOURCES....
libfile_la_CPPFLAGS.....
libfile_la_LDFLAGS......

which then goes to produce libfile.a and libfile.so with the same CPPFLAGS, so I added
- libfile_a_CPPFLAGS.....
but didnt do anything.

So i did AC_DISABLE_STATIC in my configure.ac and added
- lib_LIBRARIES = libfile.a
to my Maakefile.am and used a AM_CONDITIONAL+AC_ARG_ENABLE for my own --enable-static-lib This setup works. But for some odd reason, whenever "make install", is invoked, libfile.so is recompiled again (including all the individual objects). Which is a little redundant but harmless nonetheless.

Can someone suggest a way I can produce both a static and shared library with libtool/autoconf/automake that are compiled with different CPPFLAGS?

Thank you,


Vikram




reply via email to

[Prev in Thread] Current Thread [Next in Thread]