LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices

Reply
 
LinkBack Search this Thread
Old 11-12-2012, 09:00 AM   #1
5883
Member
 
Registered: Aug 2004
Posts: 144

Rep: Reputation: 0
build doesn't stop even if one of the components failed to build


my Makefile is like this,

all: tgt1 tgt2 tgt3 ... tgt10

tgt1:
$(MAKE) -C src1

tgt2:
$(MAKE) -C src2

...

the problem is, once tgt2 actually failed to build.
The build just continues to tgt10.

How to make it stop if tgt2 failed.
 
Old 11-12-2012, 09:38 AM   #2
rtmistler
Member
 
Registered: Mar 2011
Location: Milford, MA. USA
Distribution: MontaVista, Ubuntu, MINT
Posts: 749
Blog Entries: 6

Rep: Reputation: 383Reputation: 383Reputation: 383Reputation: 383
Couple of things:

1. Normally on an error, the make will stop. Are you invoking it with a "-k" switch? That would make it continue regardless of an error. A dependency which states that tgt10 depends on tgt1, tgt2, tgt3, and so on might be useful to avoid it trying to make future targets when an earlier one fails. You can make a dependency for tgt2 to be tgt1, and so on. But I feel it should stop when it encounters the first target error.

2. If you're invoking via a script and not just running make with a single Makefile, then the script needs to look at the outcome of an embedded make command to cancel further calls. For example, in most scripts you can look at the variable $? which is the outcome of the last command, if it's non-zero, that typically means a problem for a command like make.

3. If you're using GCC to build, or if not then check to verify what switches you have available in your compiler that will cause these sorts of behaviors. -Werror makes every warning an error, therefore if you have a warning, it will stop compiling because it interprets the warning as an error. There is all -Wfatal-errors which will stop it compiling as soon as it encounters an error.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] boost-build failed to build engine Red Hat 4.1.2 and GCC 4.1.2 Fritz_Doll Programming 2 08-10-2012 02:00 PM
self build rpm fails with missing dependencies on build host zhjim Linux - Software 1 09-24-2009 08:47 AM
LXer: Add an Auto-Incrementing Build-Number to Your Build Process LXer Syndicated Linux News 0 07-09-2008 01:00 AM
LXer: Build 'em Right, Build 'em Strong, Build 'em Linux LXer Syndicated Linux News 0 10-01-2007 09:51 PM


All times are GMT -5. The time now is 08:22 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration