Solved

Recursive Make

Posted on 2004-10-03
5
253 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 20 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 25 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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Preface I don't like visual development tools that are supposed to write a program for me. Even if it is Xcode and I can use Interface Builder. Yes, it is a perfect tool and has helped me a lot, mainly, in the beginning, when my programs were small…
Windows programmers of the C/C++ variety, how many of you realise that since Window 9x Microsoft has been lying to you about what constitutes Unicode (http://en.wikipedia.org/wiki/Unicode)? They will have you believe that Unicode requires you to use…
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.
Video by: Grant
The goal of this video is to provide viewers with basic examples to understand and use while-loops in the C programming language.

695 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