List Info

Thread: how to pass the error status of a submake to a parent make




how to pass the error status of a submake to a parent make
user name
2006-05-27 08:16:44
Dear all,
 
Currently i'm invoking a make from an ant build file using the ant exec task.
But even though there are errors in make the ant displays as if the build is suceesful.
 
When i asked the ant forums thry replied me that ant will take the final return code of make which in my case is successful.
I want to know how to pass the error status of a submake to the parent make which means even if the submake has errors the parent make should exit and it should not build other directories.
 
For example my make displays like this
 
Built subdirs: src successfully!
ar crs ../../../pdf_src/build/PCS_2.0/release/SunOS/5.8/sparc-32/expat/libexpat.a ../../../pdf_src/build/PCS_2.0/release/SunOS/5.8/sparc-32/expat/xmlparse.o ../../../pdf_src/build/PCS_2.0/release/SunOS/5.8/sparc-32/expat/xmlrole.o ../../../pdf_src/build/PCS_2.0/release/SunOS/5.8/sparc-32/expat/xmltok.o
cc -G  ../../../pdf_src/build/PCS_2.0/release/SunOS/5.8/sparc-32/expat/xmlparse.o ../../../pdf_src/build/PCS_2.0/release/SunOS/5.8/sparc-32/expat/xmlrole.o ../../../pdf_src/build/PCS_2.0/release/SunOS/5.8/sparc-32/expat/xmltok.o -o ../../../pdf_src/build/PCS_2.0/release/SunOS/5.8/sparc-32/expat/libexpat.so
make[4]: Leaving directory `/vobs/pdf_src/pdfcore/expat'
cd src && make -e -w
make[4]: Entering directory `/vobs/pdf_src/pdfcore/src'
CC -features=%all -mt -D_POSIX_PTHREAD_SEMANTICS -c -xO2 -DNDEBUG -KPIC ; -DSOLARIS -L../../build/PCS_2.0/release/SunOS/5.8/sparc-32/expat -I/usr/local/include -I. -I../../../ims_cxif/DiameterApiRFC/api/ -I../../../ims_cxif/DiameterApiRFC/controller/ -I../../../ims_cxif/DiameterApiRFC/dict/ -I../../../ims_cxif/DiameterApiRFC/fsm/ -I../../../ims_cxif/DiameterApiRFC/message/ -I../../../ims_cxif/DiameterApiRFC/utility/ -I../../pdfgq/ -I../../pdfgx/ -I../../pdfcommon/src/ -I../../pdf/src/ -I../../pdfpktmm/ -I../../pdfpktmm/pktmm2/ -I../../pdfpktmm/pktmm3/ -I../../pdfpktmm/pktmm4/ -I../../pdfpktmm/pktmmobjects/ -I../../pdfgo/ -I../expat/src CCoPktMMGateReportStateProcessor.cxx -o ../../build/PCS_2.0/release/SunOS/5.8/sparc-32/pdfcore/CCoPktMMGateReportStateProcessor.o
"../../pdfpktmm//CPktMM4ConnNotify.h", line 129: Warning: pdfpktmm::CPktMM4RKSEntry::toString hides the virtual function pdf::CPdfObject::toString() const.
"../../pdfpktmm//CPktMM4ConnNotify.h";, line 267: Warning: pdfpktmm::CPktMM4ConnNotify::toString hides the virtual function CPktMMMsg::toString() const.
"CCoPktMMGateReportStateProcessor.cxx";, line 31: Error: There is extra text on this line.
1 Error(s) and 2 Warning(s) detected.
make[4]: *** [../../build/PCS_2.0/release/SunOS/5.8/sparc-32/pdfcore/CCoPktMMGateReportStateProcessor.o] Error 1
make[4]: Leaving directory `/vobs/pdf_src/pdfcore/src'
make[3]: *** [../build/PCS_2.0/release/SunOS/5.8/sparc-32/pdfcore/libpdfcore.so] Error 2
make[3]: Leaving directory `/vobs/pdf_src/pdfcore'
make[2]: *** [../../build/PCS_2.0/release/SunOS/5.8/sparc-32/pdfcore/libpdfcore.so] Error 2
make[2]: Leaving directory `/vobs/pdf_src/pdf/src'
Built src
Built subdirs: src successfully!

make[1]: Leaving directory `/vobs/pdf_src/pdf'
Built pdf
Built subdirs: pdfcommon pdfgo ../ims_cxif/DiameterApiRFC pdfgq pdfgx pdfpktmm pdfcore pdf successfully!
 
So I want to know how to pass the return code of a submake to the parent make?
 
Please let me know as early as possible.
 
 
Thanks in advance,
Geraldin
 
how to pass the error status of a submake to a parent make
user name
2006-05-27 08:42:47
On 5/27/06, Geraldin Arthy <arthy.geraldingmail.com> wrote:
> I want to know how to pass the error status of a
submake to the parent make
> which means even if the submake has errors the parent
make should exit and
> it should not build other directories.
...
> So I want to know how to pass the return code of a
submake to the parent
> make?

By default, if any of the commands for a target fail then
make will
exit with a non-zero status.  There are a few ways to tell
make to
ignore the exit status of some or all commands (c.f. the GNU
make info
pages, section "5.5 Errors in Commands"). 
Alternatively, the commands
in the makefile may have been written such that they always
return
success.  For example, in this rule:

all:
        $(MAKE) -C subdir all  ||  echo "subdir
failed"

the command invoked won't fail unless both the sub-make
_and_ the 'echo' fail.


If the above isn't sufficient to let you see the problem in
your
makefile, then you'll need to post the rule w/commands that
are
involved from the makefile where the error stops
propagating.


Philip Guenther


_______________________________________________
Help-make mailing list
Help-makegnu.org
http:
//lists.gnu.org/mailman/listinfo/help-make
[1-2]

about | contact  Other archives ( Real Estate discussion Medical topics )