Subject: fixing the X11 imake build infrastructure to exit on error
To: Nicolas Joly <njoly@pasteur.fr>
From: Greg A. Woods <woods@weird.com>
List: tech-x11
Date: 07/14/2006 20:18:33
--pgp-sign-Multipart_Fri_Jul_14_20:15:00_2006-1
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: quoted-printable

At Fri, 14 Jul 2006 09:20:59 +0200,
Nicolas Joly wrote:
>=20
> On Thu, Jul 13, 2006 at 08:25:32PM -0400, Greg A. Woods wrote:
> >=20
> > BTW, how the heck to I tell the Imake generated makefiles to _ALWAYS_
> > stop on errors!?!?!?!?  (So far as I can tell "-i" is not in MAKEFLAGS)
>=20
> This is a bug which has been fixed in 4.6.0 :
>=20
> XFree86 4.5.99.901 (6 March 2006)
> [...]
>  230. Fix a problem on NetBSD where a build will continue after an error
>       (David Dawes).
>=20
> Try the following patch (untested) :

I finally figured the same thing out just before I read your post.

I'm not sure why "set -e" doesn't cause an exit within a "for" or
"while" (on un-tested exit status results), nor why a non-zero result in
an "if" statement doesn't trigger an exit either.  I thought they did
once upon a time in real Unix, but I'm too lazy to fire up something
like that to test right now.

Hmmm.... come to think of it I found the same problem with some version
of Bash once upon a time too (three or four years ago).

The following changes actually work, though the whole
MakeFlagsToShellFlags junk should just be eliminated:

(as far as I'm concerned the whole idea behind the implementation of
"make -i" behaviour in imake is complete and utter BS)

First add something like the following to the NetBSD.cf file:
(no diff -- my changes here are too pervasive :-))

=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
/*
 * Turn off the stupid "set +e" crap that allows broken builds to run to
 * completion without exiting on error!
 */
#define MakeFlagsToShellFlags(makeflags,shellcmd)	:
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D

then make the following changes (line numbers will be off, the first
change may not e necessary, though I think it is):

Index: xfree/xc/config/cf/Imake.rules
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
RCS file: /cvs/master/m-NetBSD/main/xsrc/xfree/xc/config/cf/Imake.rules,v
retrieving revision 1.7
diff -u -r1.7 Imake.rules
@@ -2052,7 +2057,7 @@
 	-@(cd $(IMAKESRC) && if [ -f Makefile ]; then \			@@\
 	echo "checking $@ in $(IMAKESRC) first..."; $(MAKE) imakeonly; else \	@@\
 	echo "bootstrapping $@ from Makefile.ini in $(IMAKESRC) first..."; \	@@\
-	$(MAKE) -f Makefile.ini BOOTSTRAPCFLAGS=3D"$(BOOTSTRAPCFLAGS)"; fi; \	@@\
+	$(MAKE) -f Makefile.ini BOOTSTRAPCFLAGS=3D"$(BOOTSTRAPCFLAGS)" || exit 1;=
 fi; \	@@\
 	echo "okay, continuing in $(CURRENT_DIR)")
 #endif /* UseInstalled */
 #endif /* ImakeDependency */
@@ -3035,7 +3040,7 @@
 	for i in dirs ;\						@@\
 	do \								@@\
 		echo verb "in $(CURRENT_DIR)/$$i..."; \			@@\
-		(cd $$i && LANG=3Dlang $(MAKE) $(MFLAGS) flags subname);\ @@\
+		(cd $$i && LANG=3Dlang $(MAKE) $(MFLAGS) flags subname) || exit 1;\ @@\
 	done
 #endif
=20
@@ -3069,7 +3074,7 @@
 	for i in dirs ;\						@@\
 	do \								@@\
 		echo verb "in $(CURRENT_DIR)/$$i..."; \			@@\
-		MakeNamedTargetSubdir($$i,flags,subname); \		@@\
+		MakeNamedTargetSubdir($$i,flags,subname) || exit 1; \	@@\
 	done
 #endif
=20
@@ -3117,7 +3122,7 @@
 /* For BSD 4.4 make */
 #define ForceSubdirs(dirs)						@@\
 dirs:	.EXEC								@@\
-	@cd $@ ; echo "making all in $(CURRENT_DIR)/$@..."; \		@@\
+	@cd $@ && echo "making all in $(CURRENT_DIR)/$@..." && \	@@\
 	$(MAKE) $(MFLAGS) PassCDebugFlags all				@@\
 									@@\
 .EXEC:
@@ -3297,10 +3302,10 @@
 				$(MV) $$i/Makefile $$i/Makefile.bak; \	@@\
 			fi; \						@@\
 		fi; \							@@\
-		$(MAKE) $(MFLAGS) $(MAKE_OPTS) ONESUBDIR=3D$$i ONECURDIR=3D$$curdir IMAK=
ETOP=3D$$imaketop IMAKEPREFIX=3D$$imakeprefix $$i/Makefile; \	@@\
+		$(MAKE) $(MFLAGS) $(MAKE_OPTS) ONESUBDIR=3D$$i ONECURDIR=3D$$curdir IMAK=
ETOP=3D$$imaketop IMAKEPREFIX=3D$$imakeprefix $$i/Makefile || exit 1; \	@@\
 		if [ -d $$i ] ; then \					@@\
 			cd $$i; \					@@\
-			$(MAKE) $(MFLAGS) Makefiles; \			@@\
+			$(MAKE) $(MFLAGS) Makefiles || exit 1; \	@@\
 			cd $$newtop; \					@@\
 		else \							@@\
 			exit 1; \					@@\

--=20
						Greg A. Woods

H:+1 416 218-0098 W:+1 416 489-5852 x122 VE3TCP RoboHack <woods@robohack.ca>
Planix, Inc. <woods@planix.com>       Secrets of the Weird <woods@weird.com>

--pgp-sign-Multipart_Fri_Jul_14_20:15:00_2006-1
Content-Type: application/pgp-signature
Content-Transfer-Encoding: 7bit

-----BEGIN PGP SIGNATURE-----
Version: PGPfreeware 5.0i for non-commercial use
MessageID: /1C0Og7m6V3/g+X7l9vp3Xsp0qMn3WSr

iQA/AwUBRLgzomJ7XxTCWceFEQJJ4wCfSbirlyjIiKnMLCtiwtvUCyLHzsoAoOh7
o85DzMYlBK/mGlvKaZTXItDV
=SX+W
-----END PGP SIGNATURE-----

--pgp-sign-Multipart_Fri_Jul_14_20:15:00_2006-1--