2020-11-21 15:01:16 +03:00
|
|
|
# $NetBSD: suff-rebuild.mk,v 1.6 2020/11/21 12:01:16 rillig Exp $
|
2020-09-25 21:18:25 +03:00
|
|
|
#
|
|
|
|
# Demonstrates what happens to transformation rules (called inference rules
|
|
|
|
# by POSIX) when all suffixes are deleted.
|
|
|
|
|
|
|
|
all: suff-rebuild-example
|
|
|
|
|
2020-11-21 14:55:57 +03:00
|
|
|
.MAKEFLAGS: -dpst
|
|
|
|
|
2020-09-25 21:18:25 +03:00
|
|
|
.SUFFIXES:
|
|
|
|
|
|
|
|
.SUFFIXES: .a .b .c
|
|
|
|
|
|
|
|
suff-rebuild-example.a:
|
2020-11-21 11:51:57 +03:00
|
|
|
: Making ${.TARGET} out of nothing.
|
2020-09-25 21:18:25 +03:00
|
|
|
|
|
|
|
.a.b:
|
2020-11-21 11:51:57 +03:00
|
|
|
: Making ${.TARGET} from ${.IMPSRC}.
|
2020-09-25 21:18:25 +03:00
|
|
|
.b.c:
|
2020-11-21 11:51:57 +03:00
|
|
|
: Making ${.TARGET} from ${.IMPSRC}.
|
2020-09-25 21:18:25 +03:00
|
|
|
.c:
|
2020-11-21 11:51:57 +03:00
|
|
|
: Making ${.TARGET} from ${.IMPSRC}.
|
2020-09-25 21:18:25 +03:00
|
|
|
|
2020-11-21 11:23:36 +03:00
|
|
|
# XXX: At a quick glance, the code in SuffUpdateTarget looks as if it were
|
2020-09-25 21:18:25 +03:00
|
|
|
# possible to delete the suffixes in the middle of the makefile, add back
|
|
|
|
# the suffixes from before, and have the transformation rules preserved.
|
|
|
|
#
|
|
|
|
# As of 2020-09-25, uncommenting the following line results in the error
|
|
|
|
# message "don't know how to make suff-rebuild-example" though.
|
|
|
|
#
|
2020-11-21 15:01:16 +03:00
|
|
|
# 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.
|
|
|
|
|
2020-09-25 21:18:25 +03:00
|
|
|
#.SUFFIXES:
|
|
|
|
|
|
|
|
# Add the suffixes back. It should not matter that the order of the suffixes
|
|
|
|
# is different from before.
|
|
|
|
.SUFFIXES: .c .b .a
|