LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 04-17-2012, 02:13 AM   #1
joloboff
LQ Newbie
 
Registered: Apr 2012
Posts: 6

Rep: Reputation: Disabled
building library with automake


I want to build a library with automake
But the library objects come from two parts
say A_SOURCES and B_SOURCES
and the compilation options for A are different from B

If I use
lib_LIBRARIES = mylib.a
then if I have
mylib_a_SOURCES = list of files for A and B
they will be all compiled with the same options

I want to have something like
lib_LIBRARIES = mylib.a

mylib_a_OBJS = $(A_OBJS) $(B_OBJS)

A_SOURCES = a_list
A_CPPFLAGS = FLAGS_FOR_A

B_SOURCES = b_list
B_CPPFALGS = FLAGS_FOR_B

How to do this ?
 
Old 04-17-2012, 04:01 AM   #2
joloboff
LQ Newbie
 
Registered: Apr 2012
Posts: 6

Original Poster
Rep: Reputation: Disabled
found a solution

I have found a solution myself:

lib_LIBRARIES= mylib.a

then declare the library with only the A subset
mylib_a_SOURCES = A_list
mylib_a_CXXFLAGS = A_FLAGS

then declare a second library not installed
noinst_LIBRARIES = libB.a
with its own sources and compile options
libB_a_SOURCES= B-list
libB_a_CXXFLAGS = B_FLAGS

then simply add one line

mylib_a_LIBADD = libB.a

automake will generate the Makefile that will compile
the A objects then compile the B objects,
build the B library and then it will include B
to build mylib and call ranlib.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Inter library dependency and automake chocopie1986 Programming 6 09-19-2011 06:00 AM
using automake for so-library Ephracis Programming 3 10-28-2008 09:06 PM
C++ Dynamically Loaded Libraries & Automake (invalid ELF library error) roby1984 Programming 8 09-12-2008 08:59 AM
Scribus installation problem, sez I need automake 1.6 when automake 1.9 is istalled Rockgod2099 Linux - Software 13 11-14-2004 06:37 PM
Guidelines for building a C++ Class library. liguorir Programming 2 12-05-2003 09:40 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 02:04 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration