libtool
[Top][All Lists]
Advanced

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

Re: libtool c++ compiler for *.c source files


From: Ralf Wildenhues
Subject: Re: libtool c++ compiler for *.c source files
Date: Sun, 24 May 2009 16:59:29 +0200
User-agent: Mutt/1.5.18 (2008-05-17)

Hello Andreas,

* Andreas Otto wrote on Fri, May 22, 2009 at 01:17:50PM CEST:
>       2.      I create a "C" libraray using a couple of *.c files

lib_LTLIBRARIES = libceelib.la
libceelib_la_SOURCES = foo.c bar.c

>       3.      now I want to create a "C++" library from the same *.c input 
> files

lib_LTLIBRARIES += libceepluspluslib.la
libceepluspluslib_la_SOURCES = $(libceelib_la_SOURCES)
EXTRA_libceepluspluslib_la_SOURCES = dummy.cpp

See `info Automake "How the Linker is Chosen"'.

>       4.      I have a directoty called "src" with all the *.h and *.c files.
>                       -> this directory create a libraray called libmsgque.so
>       5.      for the "C++" library I have a directory called "cppmsgque"

Why do you have a separate directory for this?
But yes, this is possible.

>       6.      I don't want to copy the "*.c" and "*.h" files to the 
> "cppmsgque"
>                       directory

You can use relative paths from the one directory to the other
  libceepluspluslib_la_SOURCES = ../foo/foo.c

or you can just remove both Makefile.am files altogether, move one level
up and do a nonrecursive build of these directories:

  lib_LTLIBRARIES = sub1/libfoo.la sub2/libbar.la
  sub1_libfoo_la_SOURCES = ...
  sub2_libfoo_la_SOURCES = $(sub1_libfoo_la_SOURCES)

You will probably want
  AUTOMAKE_OPTIONS = subdir-objects

in this case.  See `info Automake Alternative' for more information.

>       1. Ilibtool don't understand the VPATH environment variable

No, but Automake/Autoconf will add an appropriate VPATH statement into
the Makefile anyway, so you won't have to do this.

>               -> I have to prefix every *.c file with a path to the "C" 
> source directory
>                       -> right ?

See above.

>       2. how I can force the"libtool" to use the "g++" (CXX) compiler for 
> files 
>               which end with "*.c"

See above.

Hope that helps.

Cheers,
Ralf




reply via email to

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