?
Solved

Recursive Make

Posted on 2004-10-03
5
Medium Priority
?
257 Views
Last Modified: 2010-05-18
How to create a recursive make?
I read from my lecture notes that Make can be recursive.
If possible, can also code out some .c or .h files to illustrate that?
A very simple one will do.

FYI, I am using Solaris Unix and GNU make.

I also read this on my lecture notes. What does the below mean? Can illustrate?
        Advise: call ${MAKE} instead of make


Thanks a lot
0
Comment
Question by:ee_guest
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
5 Comments
 
LVL 33

Assisted Solution

by:hongjun
hongjun earned 80 total points
ID: 12212374
0
 
LVL 22

Expert Comment

by:grg99
ID: 12213722
"make" is intrinsically recursive.  that is, if you tell it to make "foo", and there's a rule saying "foo" depends on "goo", then make has to do an internal "make goo", which can lead to yet more makes for things that goo depends on.


Example:

foo:  goo


goo:   zoo bloo

zoo:   zoo.c   zoo.h

bloo:  bloo.c  bloo.h


0
 

Author Comment

by:ee_guest
ID: 12214530
then can anyone explain this?
    Advise: call ${MAKE} instead of make
0
 
LVL 22

Expert Comment

by:grg99
ID: 12221015
On many systems there's more than one copy or version of "make".  There may be Solaris Make, dgpp make, Gnu make, watcom make, Microsoft Make, Borland make, etc...   All with slightly different or sometimes wildly different syntax and semantics and options and bugs.

So to select one particular make you can define a system environment variable somewhere  in your .login or autoexec.bat file:

SET MAKE=C:\\sr\local\bin\watcom\nt\make.exe

... then when you use the "CALL ${MAKE}" line, it expands to calling the make program defined above.

0
 
LVL 1

Accepted Solution

by:
rghome earned 100 total points
ID: 12231092
Your lecturer might have been refering to the fact that you can call make from within a makefile. Often, you will use this if you want to make something in a different directory that has its own makefile. Although you can include makefiles within makefiles, this is not really recursive. The rules iin make are recursively applied, but if you want to run another makefile, you have to re-inovke make.

For example:

tests:
    $(MAKE) -f tests/makefile

The Macro $(MAKE) is used because you might want to change the make program that you use.
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

An Outlet in Cocoa is a persistent reference to a GUI control; it connects a property (a variable) to a control.  For example, it is common to create an Outlet for the text field GUI control and change the text that appears in this field via that Ou…
Examines three attack vectors, specifically, the different types of malware used in malicious attacks, web application attacks, and finally, network based attacks.  Concludes by examining the means of securing and protecting critical systems and inf…
The goal of this video is to provide viewers with basic examples to understand how to use strings and some functions related to them in the C programming language.
The goal of this video is to provide viewers with basic examples to understand and use conditional statements in the C programming language.
Suggested Courses

801 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question