Solved

Recursive Make

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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
stack 22 164
C dll call freezes 5 101
Problem to scan all sheets 3 103
IIS Log files on Exchange 2013 server 6 118
Have you thought about creating an iPhone application (app), but didn't even know where to get started? Here's how: ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ Important pre-programming comments: I’ve never tri…
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…
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.
The goal of this video is to provide viewers with basic examples to understand how to create, access, and change arrays in the C programming language.

786 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