main makefile


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers main makefile
# 1  
Old 12-19-2007
Question main makefile

hello everyone..

am having problem with my so-called main makefile

all my files are in the same folder, i was planning to make a single makefile that would make two executable but I got some errors so I separated them and used

Quote:
make -f makefile1
now i was wondering if I could create a single makefile that would call the 2 other makefile..

I made this one


Quote:
PROG = testprog
TRGTS = makefile1 makefile2

$(PROG) : $(TRGTS)

all: $(TRGTS)

makefile1: make -f testMake1
makefile2: make -f testMake2

clean:
make -f testMake1 clean
make -f testMake2 clean
but when i try to run make, it just gave the "Don't know how to make target 'make' "

any advice ?? please Smilie
# 2  
Old 12-19-2007
Code:
PROG = testprog
TRGTS = makefile1 makefile2

$(PROG) : $(TRGTS)

all: $(TRGTS)

makefile1: 
        $(MAKE) -f testMake1 $@

makefile2: 
        $(MAKE) -f testMake2 $@

clean:
        $(MAKE) -f testMake1 $@
        $(MAKE) -f testMake2 $@

# 3  
Old 12-19-2007
Question

thanks for the reply porter

Ive tried it, but I got the error, that it can make target makefile1

i change the macro names, the error is gone but it won't compile Smilie


Code:
PROG = testprog
TRGTS = testMake1 testMake2 

$(PROG) : $(TRGTS)

all: $(TRGTS)

testMake1 : 
        $(MAKE) -f testMake1 $@

testMake2 : 
        $(MAKE) -f testMake2 $@

clean:
        $(MAKE) -f testMake1 $@
        $(MAKE) -f testMake2 $@

# 4  
Old 12-19-2007
Code:
all clean:
        $(MAKE) -f testMake1 $@
        $(MAKE) -f testMake2 $@

# 5  
Old 12-19-2007
i try to run the make clean, and it works just fine

i change everything and reduce it to this

Quote:
PROG = testprog
TRGTS = testMake1 testMake2


all:
$(MAKE) -f testMake1 $@
$(MAKE) -f testMake2 $@
and it works Smilie
# 6  
Old 12-19-2007
See my previous post for a shorter makefile. Smilie

The problem you were having before was the child makefiles should have had a makefile1/2 target rule.
# 7  
Old 12-19-2007
yeah it really worked.. much better too.. thanks the replies.. Smilie
 
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Programming

What is the ruby main method?

I am trying to obtain documentation using ri on my local machine. If I dont require any method in my script and I want to find information on .value or .inspect or anything that is native without calling in a method how can I look that up with ri, or even rdoc? (1 Reply)
Discussion started by: bash_in_my_head
1 Replies

2. Homework & Coursework Questions

Help with Simple Multi-Level Makefile (Extremely New at Makefile)

Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted! 1. The problem statement, all variables and given/known data: Basically, the prompt is make a makefile with various sub makefiles in their respective subdirectories. All code... (1 Reply)
Discussion started by: Tatl
1 Replies

3. Shell Programming and Scripting

$? and main return value

It seems $? can only contain one byte. see below: int main() { return 0x12345678; } After I run the code and check the $? value it output 120, obviously it is the decimal of the last byte of 0x12345678. And if I return a value less than 255, the $? value seems right. Why? and... (3 Replies)
Discussion started by: vistastar
3 Replies

4. UNIX for Advanced & Expert Users

Makefile executing another Makefile first?

I have 2 libraries in 2 different directories that I build with Makefiles. library B depends on library A. If I modify a .cpp file in library A and run lib B's Makefile can I have B's makefile to automatically rebuild library A? I am now rebuilding A, followed by B... but I'd like B to... (0 Replies)
Discussion started by: wwuster
0 Replies

5. UNIX and Linux Applications

Sendmail: help with main.mc

We compile the sendmail.cf file using main.mc. I have managed to place all of our configuration options in main.mc without a problem, with the exception of one. I want to have the HelpFile commented out by default in sendmail.cf. How can I instruct main.mc to place an entry for HelpFile in... (1 Reply)
Discussion started by: dangral
1 Replies

6. UNIX for Advanced & Expert Users

Makefile problem - How to run module load in a Makefile

Hi, I'm trying to run the module load command in a Makefile and i'm getting the following error: make: module: command not found Why is this? Is there any way to run this command in a Makefile? NOTE: command - module load msjava/sunjdk/1.5.0 works fine outside of the Makefile (2 Replies)
Discussion started by: hernandinho
2 Replies

7. Programming

main function

Is it possible to execute any function before main() function in C or C++. (6 Replies)
Discussion started by: arun.viswanath
6 Replies

8. Programming

Main Resursive is it possible

Friends I am Trying this code to call main Recursively But It is showing segmentation errot #include<stdio.h> int main() { int i; for(i=0;i<10;i++) { if(i==5) { exit(0); } else { main(); } } } (7 Replies)
Discussion started by: krishna_sicsr
7 Replies

9. HP-UX

How to go to main prompt

Hi: I am new to HP-UX. After the system starts up, it is written in the documents that press any key within 10 sec to interrupt, and go to the main prompt, where I can select the boot device or boot from CD to recover system. However if I interrupt boot, it goes straight to HPUX> prompt. Please... (2 Replies)
Discussion started by: amitra123
2 Replies
Login or Register to Ask a Question