%% Patrick Guio <[EMAIL PROTECTED]> writes:
PS. Note you can use [EMAIL PROTECTED] for non-bug, help issues if you
want.
pg> I am trying to have a Makefile that can create both static (.a)
pg> and dynamic (.so) library. I have no problem to build the static
pg> library and updating it if a file is changed. When it comes to the
pg> dynamic library I am able to build the dynamic library but I can
pg> not figure out how to remove the objects *.o without to have to
pg> rebuild the .so In fact I would that my .so should be rebuild only
pg> if one of the .c is newer than the .so file.
First, you can do what you want by using the .INTERMEDIATE:
psuedo-target to convince make that your .o's are intermediate files,
even though they're listed explicitly as prerequisites in the makefile
(here:
pg> $(DYNAMIC): $(OBJ)
). Normally listing the object makes it non-intermediate. See the GNU
make manual for a discussion of intermediate files and how GNU make
handles them, and the .INTERMEDIATE pseudo-target.
Second, you don't want to do what you want to do :).
You will be able to get make to delete the .o's for you by the method I
describe above, but this sucks because then if you change a .c, make
will be forced to rebuild _ALL_ the .o's so it can recreate the shared
library (if there's only one .o in it, then never mind :).
With normal archives, make skirts this issue by having the smarts to
realize that an archive can be incrementally created. It looks into the
archive to see if each individual object needs to be updated, and if so
builds just that object and replaces it in the archive.
But, there's no way to generalize this to non-archive things in make,
that still may be incrementally built.
If you're going to have multiple .o's making up this shared library then
I suggest you instead investigate ways to have the makefile write the
.o's to separate target directories so you can keep both the shared and
non-shared (PIC and non-PIC compiled) .o's around at the same time.
--
-------------------------------------------------------------------------------
Paul D. Smith <[EMAIL PROTECTED]> Network Management Development
"Please remain calm...I may be mad, but I am a professional." --Mad Scientist
-------------------------------------------------------------------------------
These are my opinions---Nortel Networks takes no responsibility for them.