make(1): add explanation for test suff-rebuild
This commit is contained in:
parent
416a199000
commit
bbdb624c98
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: suff.c,v 1.257 2020/11/21 10:36:01 rillig Exp $ */
|
||||
/* $NetBSD: suff.c,v 1.258 2020/11/21 12:01:16 rillig Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1988, 1989, 1990, 1993
|
||||
|
@ -114,7 +114,7 @@
|
|||
#include "dir.h"
|
||||
|
||||
/* "@(#)suff.c 8.4 (Berkeley) 3/21/94" */
|
||||
MAKE_RCSID("$NetBSD: suff.c,v 1.257 2020/11/21 10:36:01 rillig Exp $");
|
||||
MAKE_RCSID("$NetBSD: suff.c,v 1.258 2020/11/21 12:01:16 rillig Exp $");
|
||||
|
||||
#define SUFF_DEBUG0(text) DEBUG0(SUFF, text)
|
||||
#define SUFF_DEBUG1(fmt, arg1) DEBUG1(SUFF, fmt, arg1)
|
||||
|
@ -642,6 +642,16 @@ SuffUpdateTarget(GNode *target, GNode **inout_main, Suff *suff, Boolean *r)
|
|||
if (target->type == OP_TRANSFORM)
|
||||
return FALSE;
|
||||
|
||||
/*
|
||||
* XXX: What is the purpose of the 'ptr == target->name' condition here?
|
||||
* In suff-rebuild.mk in the line '.SUFFIXES: .c .b .a', it prevents the
|
||||
* rule '.b.c' from being added again during Suff_AddSuffix(".b").
|
||||
*/
|
||||
/*
|
||||
* XXX: What about a transformation ".cpp.c"? If ".c" is added as a new
|
||||
* suffix, it seems wrong that this transformation would be skipped just
|
||||
* because ".c" happens to be a prefix of ".cpp".
|
||||
*/
|
||||
if ((ptr = strstr(target->name, suff->name)) == NULL ||
|
||||
ptr == target->name)
|
||||
return FALSE;
|
||||
|
|
|
@ -30,7 +30,7 @@ defining transformation from `.c' to `'
|
|||
inserting ".c" (3) at end of list
|
||||
inserting "" (0) at end of list
|
||||
ParseReadLine (22): ' : Making ${.TARGET} from ${.IMPSRC}.'
|
||||
ParseReadLine (35): '.SUFFIXES: .c .b .a'
|
||||
ParseReadLine (44): '.SUFFIXES: .c .b .a'
|
||||
transformation .c complete
|
||||
ParseDoDependency(.SUFFIXES: .c .b .a)
|
||||
Adding ".END" to all targets.
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# $NetBSD: suff-rebuild.mk,v 1.5 2020/11/21 11:55:57 rillig Exp $
|
||||
# $NetBSD: suff-rebuild.mk,v 1.6 2020/11/21 12:01:16 rillig Exp $
|
||||
#
|
||||
# Demonstrates what happens to transformation rules (called inference rules
|
||||
# by POSIX) when all suffixes are deleted.
|
||||
|
@ -28,6 +28,15 @@ suff-rebuild-example.a:
|
|||
# As of 2020-09-25, uncommenting the following line results in the error
|
||||
# message "don't know how to make suff-rebuild-example" though.
|
||||
#
|
||||
# If this is a bug, the actual cause is probably that when a suffix
|
||||
# transformation rule is defined, it is not added to the global list of
|
||||
# targets, see Suff_EndTransform. Later, UpdateTargets iterates over exactly
|
||||
# this global list of targets though.
|
||||
#
|
||||
# If UpdateTargets were to iterate over 'transforms' as well, it still
|
||||
# wouldn't work because the condition 'ptr == target->name' skips these
|
||||
# transformation rules.
|
||||
|
||||
#.SUFFIXES:
|
||||
|
||||
# Add the suffixes back. It should not matter that the order of the suffixes
|
||||
|
|
Loading…
Reference in New Issue