LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   makefiles... (https://www.linuxquestions.org/questions/programming-9/makefiles-719615/)

DEF. 04-16-2009 11:23 AM

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."

paulsm4 04-16-2009 11:40 AM

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

DEF. 04-20-2009 01:46 PM

Thanks.


All times are GMT -5. The time now is 04:36 PM.