die() can be invoked inside a separate output_context, if the
$(error ...) function is expanded as part of a recipe.
if (output_context)
{
- assert (output_context == &make_sync);
+ /* die() might be called in a recipe output context due to an
+ $(error ...) function. */
+ output_close (output_context);
+
+ if (output_context != &make_sync)
+ output_close (&make_sync);
+
OUTPUT_UNSET ();
- output_close (&make_sync);
}
output_close (NULL);
rmfiles($m1);
+# Test $(error ...) functions in recipes
+
+run_make_test(q!
+foo: $(OBJS) ; echo $(or $(filter %.o,$^),$(error fail))
+!,
+ '-O', "#MAKEFILE#:2: *** fail. Stop.\n", 512);
+
# This tells the test driver that the perl test script executed properly.
1;