[Top][All Lists]

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

Re: Need help with problem...

From: Guido Draheim
Subject: Re: Need help with problem...
Date: Tue, 25 Sep 2001 23:21:33 +0200

use the easy way.
the maintanance problems of the hard way have no real benefit over doing
some renamings. 

And if there are other reasons that you are not supposed to 
rename something, well, then you could use the rename trick.
this is - you add the following two pattern rules to your makefile

%-coo.c : %.c
        cp $< $@

%-cpp.cpp : %.cpp
        cp $< $@

and make the link target dependent on objects one-coo.o and one-cpp.o!!!!

.... in automake-speak:

libtest_la_SOURCES = one-cpp.cpp one-coo.c

%-cpp.cpp : %.cpp
        cp $< $@

%-coo.c : %.c
        cp $< $@

... which will instantly compile with the following

HTH, cheers, Guido

Eric Lemings wrote:
> Hello all,
> Suppose you have the following
> libfoo_la_SOURCES = \
>     one.c \
>     one.cpp \
>     two.c \
>     two.cpp
> I need the library to contain both the C object files and the C++ object 
> files.  There are two ways that I can think of to do
> this: the easy way and the hard way.  The easy way would be two rename either 
> the C or the C++ source files so that they do
> not have the same basename and thus the object files would have different 
> names.
> The hard way would be to add additional variables and rules to so 
> that the object files use different suffixes.
> Suppose you use .co, .clo, .o, and .lo suffixes for the static C object file, 
> shared C object file, static C++ object file,
> and shared C++ object file respectively.  Using the latest versions of 
> Autoconf, Automake, and Libtool, you would first need
> implicit rules to create the .co and .clo files.
> .SUFFIXES: .c .clo .co .lo .o .obj
>         source='$<' object='$@' libtool=no \
>         depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' \
>         $(CCDEPMODE) $(depcomp) \
>         $(COMPILE) -c `test -f $< || echo '$(srcdir)/'`$< -o $@
> .c.clo:
>         source='$<' object='$@' libtool=yes \
>         depfile='$(DEPDIR)/$*.Plo' tmpdepfile='$(DEPDIR)/$*.TPlo' \
>         $(CCDEPMODE) $(depcomp) \
>         $(LTCOMPILE) -c -o $@ `test -f $< || echo '$(srcdir)/'`$< -o $@
> Now you'd have to link the C object files with the new suffixes into the 
> target shared library.
> libfoo_la_COBJECTS = $(libfoo_la_OBJECTS:.lo=.clo)
> $(libfoo_la_COBJECTS) $(libfoo_la_OBJECTS) 
> $(libfoo_la_DEPENDENCIES)
>         $(LINK) $(libfoo_la_LDFLAGS) $(libfoo_la_COBJECTS) 
> $(libfoo_la_OBJECTS) $(libfoo_la_LIBADD) $(LIBS)
> So how would the static library get built?  Did I get the shared library 
> parts right?
> Thanks,
> Eric.

-- guido                            Edel sei der Mensch, hilfreich und gut
GCS/E/S/P C++$++++ ULHS L++w- N++@ d(+-) s+a- r+@>+++ y++ 5++X- (geekcode)

reply via email to

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