Solved

Recursive Make

Posted on 2004-10-03
5
250 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
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

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

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

Suggested Solutions

Summary: This tutorial covers some basics of pointer, pointer arithmetic and function pointer. What is a pointer: A pointer is a variable which holds an address. This address might be address of another variable/address of devices/address of fu…
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 and use pointers in the C programming language.
Video by: Grant
The goal of this video is to provide viewers with basic examples to understand and use for-loops in the C programming language.

830 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