[Nagios-devel] top level Makefile ignores some errors w/fix

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
Locked
Guest

[Nagios-devel] top level Makefile ignores some errors w/fix

Post by Guest »

The Nagios top level Makefile ends up with a bunch of lines like this:
cd $(SRC_BASE); $(MAKE) ; cd ..

If something fails in the subsidiary make, the upper make does not
notice - this is because the shell returns the exit status of the
final command on the command line, in this case the "cd .." (which
usually succeeds). This means that build problems can go unnoticed
and scroll off the top of your screen, leading to later confusion.

Additionally, the final "cd .." is superfluous. Each command line
in a Makefile gets run in a separate process (almost always a shell?),
so the shell cd's to the subdirectory, runs make, then cd's back
up and exits. The final cd just serves to give make a misleading
error status.

Those lines are typically better as
cd $(SRC_BASE) && $(MAKE)

A suggested patch to the top Makefile.in follows. There's also
one instance at line 61 in contrib/Makefile.in that I didn't do
a diff for.

Cheers! Thanks!

John
jsellens@generalconcepts.com



Index: Makefile.in
===================================================================
RCS file: /cvsroot/nagios/nagios/Makefile.in,v
retrieving revision 1.3
diff -c -r1.3 Makefile.in
*** Makefile.in 29 Jun 2002 19:15:49 -0000 1.3
--- Makefile.in 22 Aug 2002 18:10:23 -0000
***************
*** 52,60 ****
# FreeBSD make does not support -C option, so we'll use the Apache style... (patch by Stanley Hopcroft 12/27/1999)

all:
! cd $(SRC_BASE); $(MAKE) ; cd ..
! cd $(SRC_CGI); $(MAKE) ; cd ..
! cd $(SRC_HTM); $(MAKE) ; cd ..

@echo ""
@echo "*** Compile finished ***"
--- 52,60 ----
# FreeBSD make does not support -C option, so we'll use the Apache style... (patch by Stanley Hopcroft 12/27/1999)

all:
! cd $(SRC_BASE) && $(MAKE)
! cd $(SRC_CGI) && $(MAKE)
! cd $(SRC_HTM) && $(MAKE)

@echo ""
@echo "*** Compile finished ***"
***************
*** 83,89 ****
@echo ""

nagios:
! cd $(SRC_BASE); $(MAKE) ; cd ..

config:
@echo "Sample config files are automatically generated once you run the"
--- 83,89 ----
@echo ""

nagios:
! cd $(SRC_BASE) && $(MAKE)

config:
@echo "Sample config files are automatically generated once you run the"
***************
*** 91,111 ****
@echo "system by using the 'make install-config' command."

cgis:
! cd $(SRC_CGI); $(MAKE) ; cd ..

html:
! cd $(SRC_HTM); $(MAKE) ; cd ..

contrib:
! cd $(SRC_CONTRIB); $(MAKE) ; cd ..

clean:
! cd $(SRC_BASE); $(MAKE) $@ ; cd ..
! cd $(SRC_CGI); $(MAKE) $@ ; cd ..
! cd $(SRC_COMMON); $(MAKE) $@ ; cd ..
! cd $(SRC_XDATA); $(MAKE) $@ ; cd ..
! cd $(SRC_HTM); $(MAKE) $@ ; cd ..
! cd $(SRC_CONTRIB); $(MAKE) $@ ; cd ..
rm -f *.cfg *.sub core
rm -f *~ */*~
rm -f $(SRC_COMMON)/config.h $(SRC_COMMON)/locations.h $(SRC_COMMON)/snprintf.h
--- 91,111 ----
@echo "system by using the 'make install-config' command."

cgis:
! cd $(SRC_CGI) && $(MAKE)

html:
! cd $(SRC_HTM) && $(MAKE)

contrib:
! cd $(SRC_CONTRIB) && $(MAKE)

clean:
! cd $(SRC_BASE) && $(MAKE) $@
! cd $(SRC_CGI) && $(MAKE) $@
! cd $(SRC_COMMON) && $(MAKE) $@
! cd $(SRC_XDATA) && $(MAKE) $@
! cd $(SRC_HTM) && $(MAKE) $@
! cd $(SRC_CONTRIB) && $(MAKE) $@
rm -f *.cfg *.sub core
rm -f *~ */*~
rm -f $(SRC_COMMON)/config.h $(SRC_COMMON)/locations.h $(SRC_COMMON)/snprintf.h
***************
*** 118,129 ****
devclean: clean

install-html:
! cd $(SRC_HTM); $(MAKE) install ; cd ..

install:
! cd $(SRC_BASE); $(MAKE) $@ ; cd ..
! cd $(SRC_CGI); $(MAKE) $@ ; cd ..
! cd $(SRC_HTM); $(MAKE) $@ ; cd ..
$(INSTALL) -m 775 $(INSTALL_OPTS) -d $(DESTDIR)$(LOGDIR)
$(INSTALL) -m 775 $(INSTALL_OPTS) -d $(DESTDIR)$(LOGDIR)/archives
if [ $(INSTALLPERLSTUFF) = yes ]; then \
--- 118,129 ----
devclean: clean

install-html:
! cd $(SRC_HTM) && $(MAKE) install

install:
! cd $(SRC_BASE) && $(MAKE) $@
! cd $(SRC_CGI) && $(MAKE) $@
! cd $(SRC_HTM) && $(MAKE) $@
$(INSTALL) -m 775 $(INSTALL_OPTS) -d $(DESTDIR)$(LOGDIR)
$(INSTALL) -m 775 $(INSTALL_OPTS) -d $(DESTDIR)$(LOGDIR)/archives
if [ $(INSTALLPERLSTUFF) = yes ]; then \
***************
*** 190,196 ****
$(INSTALL) -m 644 sample-config/template-object/misccommands.cfg $(PACKDIR)$(CFGDIR)/misccommands.cfg.$(V

...[email truncated]...


This post was automatically imported from historical nagios-devel mailing list archives
Original poster: jsellens@generalconcepts.com
Locked