LinuxQuestions.org
Share your knowledge at the LQ Wiki.
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-16-2009, 12:23 PM   #1
DEF.
Member
 
Registered: Apr 2009
Posts: 96

Rep: Reputation: 23
makefiles...


Three questions please:

1) Can I define all my paths used in, for example, g++ in a single text file and then use that text file with my makefiles? For example:

textfile:
PATHS := /foldera/folderb

makefile:
g++ ${PATHS} etc...


2) Can a makefile invoke another makefile and how?


3) I can't seem to use bash shell scripts in my makefile. For example (a simple not very useful example):

makefile:
echo "hello"
g++ ${PATHS} etc...

This will always give the error message "*** missing separator. Stop."
 
Old 04-16-2009, 12:40 PM   #2
paulsm4
Guru
 
Registered: Mar 2004
Distribution: SusE 8.2
Posts: 5,863
Blog Entries: 1

Rep: Reputation: Disabled
Hi -

Quote:
1) Can I define all my paths used in, for example, g++ in a single text file and then use that text file with my makefiles?
Sure. Just say "include":
http://www.gnu.org/software/make/man...e.html#Include

Quote:
2) Can a makefile invoke another makefile and how?
Sure. Just have some action do a "make":

Quote:
3) I can't seem to use bash shell scripts in my makefile. For example (a simple not very useful
...
This will always give the error message "*** missing separator. Stop."
If the script doesn't happen to be in your $PATH, you might have to qualify the name (e.g. "./MYSCRIPT.SH" instead of "MYSCRIPT.SH".

And don't forget to include the <tab> before every action ;-)

Here are a couple of links:
http://www.gnu.org/software/make/man...ode/index.html
http://linuxgazette.net/issue83/heriyanto.html

And remember:
Quote:
every rule line begins with a tab, not spaces. Forgetting to insert a tab at the beginning of the rule line is the most common mistakes in constructing makefiles. Fortunately, this kind of error is very easy to be spotted, because make program will complain about it.
'Hope that helps .. PSM

Last edited by paulsm4; 04-16-2009 at 12:42 PM.
 
Old 04-20-2009, 02:46 PM   #3
DEF.
Member
 
Registered: Apr 2009
Posts: 96

Original Poster
Rep: Reputation: 23
Thanks.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
makefiles wmoti Programming 5 09-21-2005 04:26 AM
Makefiles deveshs Linux - Software 2 05-02-2005 06:26 AM
Those makefiles... boku Programming 10 03-01-2005 09:19 AM
Makefiles and Me dpottinger Linux - Newbie 5 07-25-2004 12:14 AM
MAKEFILEs shinpadsmt Linux - Newbie 3 02-21-2004 03:52 AM


All times are GMT -5. The time now is 01:50 PM.

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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration