?
Solved

Is there a way to stop in a makefile based on target?

Posted on 2007-10-10
3
Medium Priority
?
206 Views
Last Modified: 2011-09-20
Hi,
Is there a way to stop in a makefile based on target?
i.e.
If I run "make exe", I want to not run this build target on certain directories.
Can I do something like this in the makefile?
If (target == 'exe') then
skip this directory
endif

Thanks
Jamie
0
Comment
Question by:jamie_lynn
3 Comments
 
LVL 53

Expert Comment

by:Infinity08
ID: 20050651
If I understand you correctly, you can just make an empty exe target in the makefile ... ?
0
 
LVL 15

Expert Comment

by:bpmurray
ID: 20052204
It depends on which make you're using. Most makes have conditionals, but the specifics depend on the one you're using.
0
 
LVL 39

Accepted Solution

by:
itsmeandnobodyelse earned 2000 total points
ID: 20094453
You can use !IF, !ELSE, !IFDEF, !ENDIF control structures similar to a batchfile. Note, any empty line stops execution for a target.

>>>> Is there a way to stop in a makefile based on target?
Normally you wouldn't use a negative target list but a positive one. That means you would only have these directories in the dependency list which must be processed. To fill the dependencies you might use direct target lists like

TGT:  STGT1 STGT3 STGT5

what means that the target TGT is dependent on sub targets STGT1, STGT3 and STGT5

or by calling make/nmake recursively with a new target or target lists.

 TGT:
 $(THIS) NTGT

Regards, Alex
0

Featured Post

Industry Leaders: 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…
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 structures in the C programming language.
The goal of this video is to provide viewers with basic examples to understand opening and reading files in the C programming language.
Suggested Courses
Course of the Month14 days, 7 hours left to enroll

839 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