Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 5 Feb 1999 16:26:42 +1100
From:      Bruce Evans <bde@zeta.org.au>
To:        fenner@parc.xerox.com, freebsd-bugs@FreeBSD.ORG
Subject:   Re: misc/9913: make release would fail for lack of /etc/resolv.conf or $DISTFILES/
Message-ID:  <199902050526.QAA11941@godzilla.zeta.org.au>

next in thread | raw e-mail | index | archive | help
> > Interesting! The '-' line and '+' lines are exactly same.
> > What is changed?
> 
> The return value to make, which determines whether or not it continues.
> 
> mango% cat makefile
> a:
>         [ -f /tmp/nosuch ] && echo hi
>         echo Won't get here!
> 
> b:
>         if [ -f /tmp/nosuch ]; then \
>                 echo hi; \
>         fi
>         @echo Got here!
> mango% make a
> [ -f /tmp/nosuch ] && echo hi
> *** Error code 1

The && operator should be avoided anyway since it tends to break
parallel makes:

$ make -j1 a
[ -f /tmp/nosuch ] && echo hi
echo Will get here with -j!!!
Will get here with -j!!!

Fix: use ';' instead of '&&' when you want an early exit.

See the cvs logs of /usr/src/Makefile, rev.177 for more details.

I prefer to use one-liners with `|| true' instead of if statements
to avoid early exits.

Bruce

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-bugs" in the body of the message



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199902050526.QAA11941>