including libraries in Makefile.am


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting including libraries in Makefile.am
# 8  
Old 06-14-2011
Is there a reason you are using automake? It requires you have configure.ac set-up and is a tool for complex projects.
When invoking 'make test', you are invoking GNU make, and that can't find any Makefile, so is applying a default rule.

Maybe you want to write a Makefile instead of using automake.

---------- Post updated at 05:35 AM ---------- Previous update was at 05:31 AM ----------

simple Makefile works just fine:

Code:
$ cat Makefile
bin_PROGRAMS=test
test_SOURCES=test.cpp
LDFLAGS += -L/usr/lib
test_LDADD = -lQuantLib

${bin_PROGRAMS}: 
    ${CXX} ${CXXFLAGS} ${LDFLAGS} -o $@ ${test_SOURCES} ${test_LDADD}

$ make
g++  -L/usr/lib -o test test.cpp -lQuantLib

# 9  
Old 06-14-2011
Is there a reason you are using automake? for learning-sake...I have setup configure.ac, and my Makefile.in file has also been created, so I wanted to test it out.

When invoking 'make test', you are invoking GNU make, and that can't find any Makefile, so is applying a default rule. ....I see....there should be a way to fix that, right....
# 10  
Old 06-14-2011
Quote:
for learning-sake...
That's a good reason... ok.

Quote:
there should be a way to fix that, right....
There's nothing to fix. You're mixing apples and oranges. You want to run 'automake' not 'make'.

Also, there is a section 'programming' on this forum, where your post would be more appropriate and would be looked at by competent people, that, unlike myself, have experience with automake.
In any case, good luck!

Last edited by mirni; 06-14-2011 at 12:51 PM..
# 11  
Old 06-14-2011
Quote:
Originally Posted by mirni
That's a good reason... ok.
Smilie
There's nothing to fix. You're mixing apples and oranges. You want to run 'automake' not 'make'.
I am obviously not doing something right then....I basically followed the steps for automake from
Automake - Wikipedia, the free encyclopedia
after creating the Makefile.am, I ran automake, and then ./configure, followed by 'make test'...and that's where it started...
this might be a dumb thing I did, but nevertheless, when I type 'automake test', it returns:
Code:
automake: no Automake input file found for `test'
automake: no input file found among supplied arguments

can you please tell me how i should run automake Smilie
# 12  
Old 06-14-2011
So your Makefile has been generated? And since you're getting the error, the library hasn't been included in there, right? So you'll have to go back, and fix <something> to have the correct rule (with the lib) in generated Makefile.

The manual to automake is here:
automake

As much as I'd like to help you, I have no experience with automake and don't know how I could be of more help...
This User Gave Thanks to mirni For This Post:
# 13  
Old 06-14-2011
thanks mirni,
yes, it has been generated and just got that fixed....I had to rename Makefile.am to Makefile, and it worked.
here's what I have in my Makefile:
Code:
AM_LDFLAGS = -L/usr/lib
bin_PROGRAMS = test
_SOURCES = test.cpp
_LDADD = -lQuantLib
${bin_PROGRAMS}:
    ${CXX} ${CXXFLAGS} -o $@ ${_SOURCES} ${AM_LDFLAGS} ${_LDADD}

all I did was issue 'make' and it did it's thingSmilie
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Homework & Coursework Questions

Help with Simple Multi-Level Makefile (Extremely New at Makefile)

Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted! 1. The problem statement, all variables and given/known data: Basically, the prompt is make a makefile with various sub makefiles in their respective subdirectories. All code... (1 Reply)
Discussion started by: Tatl
1 Replies

2. UNIX for Advanced & Expert Users

Makefile executing another Makefile first?

I have 2 libraries in 2 different directories that I build with Makefiles. library B depends on library A. If I modify a .cpp file in library A and run lib B's Makefile can I have B's makefile to automatically rebuild library A? I am now rebuilding A, followed by B... but I'd like B to... (0 Replies)
Discussion started by: wwuster
0 Replies

3. Programming

Error while including libraries

Hi All, When i am trying to include graphics.h ,dos.h and conio.h, its giving error as follows: pgm.c:2:17: dos.h: No such file or directory pgm.c:3:22: graphics.h: No such file or directory pgm.c:4:19: conio.h: No such file or directory Whereas stdio.h, stdlib.h and time.h gets... (3 Replies)
Discussion started by: jisha
3 Replies

4. Solaris

System Libraries used by makefile

Dear All I am looking for all the system libraries that are accessed by my application Build script i.e. make which in turn will processes makefile. Is there any specific command from which i can find all the system libraries used by my build script. Cheers, Ankur (1 Reply)
Discussion started by: sharmaankur85
1 Replies

5. UNIX for Advanced & Expert Users

Makefile problem - How to run module load in a Makefile

Hi, I'm trying to run the module load command in a Makefile and i'm getting the following error: make: module: command not found Why is this? Is there any way to run this command in a Makefile? NOTE: command - module load msjava/sunjdk/1.5.0 works fine outside of the Makefile (2 Replies)
Discussion started by: hernandinho
2 Replies

6. UNIX for Dummies Questions & Answers

Including files

Hi, Is it possible to include files (print with EOF, sort of like ssi) in perl/cgi? Thanks (1 Reply)
Discussion started by: marringi
1 Replies

7. Programming

Error different when including a printf

Hi I am trying to debug a code by including prinf . TO some extended it shows error at one point . If i include an extra printf it is showing at different point . Can anybody please let em know why it is happening .. Thaks, Arun (1 Reply)
Discussion started by: arunkumar_mca
1 Replies

8. Shell Programming and Scripting

including a library file ?????

Whats the syntax for including a library file in a shell script? say my shell script name is <abc.sh> and my library file is present in /user/abc/hello/fsfs/fsfsss/library.lib Please tell how to include this library file in the shell script????? (6 Replies)
Discussion started by: skyineyes
6 Replies

9. Shell Programming and Scripting

PERL: including files

I am wondering how I can include external files in a perl script. I'm currently working on a website, and I'd like to put my menu items in a subroutine for example, and put that in another file such as menu.pl. That way, I can call the subroutine from each page (such as news.pl), and if I want to... (2 Replies)
Discussion started by: LNC
2 Replies

10. Programming

makefile for programs using libraries loaded at runtime

Hi everybody! I would like to set in the makefile a path that should be the path where the program searches for the libraries loaded at run time. Is there such a variable to be set in makefile? Thanks in advance! (1 Reply)
Discussion started by: nadiamihu
1 Replies
Login or Register to Ask a Question