1*06b9b3e0SSimon J. Gerraty# $NetBSD: suff-rebuild.mk,v 1.6 2020/11/21 12:01:16 rillig Exp $ 2956e45f6SSimon J. Gerraty# 3956e45f6SSimon J. Gerraty# Demonstrates what happens to transformation rules (called inference rules 4956e45f6SSimon J. Gerraty# by POSIX) when all suffixes are deleted. 5956e45f6SSimon J. Gerraty 6956e45f6SSimon J. Gerratyall: suff-rebuild-example 7956e45f6SSimon J. Gerraty 8*06b9b3e0SSimon J. Gerraty.MAKEFLAGS: -dpst 9*06b9b3e0SSimon J. Gerraty 10956e45f6SSimon J. Gerraty.SUFFIXES: 11956e45f6SSimon J. Gerraty 12956e45f6SSimon J. Gerraty.SUFFIXES: .a .b .c 13956e45f6SSimon J. Gerraty 14956e45f6SSimon J. Gerratysuff-rebuild-example.a: 15*06b9b3e0SSimon J. Gerraty : Making ${.TARGET} out of nothing. 16956e45f6SSimon J. Gerraty 17956e45f6SSimon J. Gerraty.a.b: 18*06b9b3e0SSimon J. Gerraty : Making ${.TARGET} from ${.IMPSRC}. 19956e45f6SSimon J. Gerraty.b.c: 20*06b9b3e0SSimon J. Gerraty : Making ${.TARGET} from ${.IMPSRC}. 21956e45f6SSimon J. Gerraty.c: 22*06b9b3e0SSimon J. Gerraty : Making ${.TARGET} from ${.IMPSRC}. 23956e45f6SSimon J. Gerraty 24*06b9b3e0SSimon J. Gerraty# XXX: At a quick glance, the code in SuffUpdateTarget looks as if it were 25956e45f6SSimon J. Gerraty# possible to delete the suffixes in the middle of the makefile, add back 26956e45f6SSimon J. Gerraty# the suffixes from before, and have the transformation rules preserved. 27956e45f6SSimon J. Gerraty# 28956e45f6SSimon J. Gerraty# As of 2020-09-25, uncommenting the following line results in the error 29956e45f6SSimon J. Gerraty# message "don't know how to make suff-rebuild-example" though. 30956e45f6SSimon J. Gerraty# 31*06b9b3e0SSimon J. Gerraty# If this is a bug, the actual cause is probably that when a suffix 32*06b9b3e0SSimon J. Gerraty# transformation rule is defined, it is not added to the global list of 33*06b9b3e0SSimon J. Gerraty# targets, see Suff_EndTransform. Later, UpdateTargets iterates over exactly 34*06b9b3e0SSimon J. Gerraty# this global list of targets though. 35*06b9b3e0SSimon J. Gerraty# 36*06b9b3e0SSimon J. Gerraty# If UpdateTargets were to iterate over 'transforms' as well, it still 37*06b9b3e0SSimon J. Gerraty# wouldn't work because the condition 'ptr == target->name' skips these 38*06b9b3e0SSimon J. Gerraty# transformation rules. 39*06b9b3e0SSimon J. Gerraty 40956e45f6SSimon J. Gerraty#.SUFFIXES: 41956e45f6SSimon J. Gerraty 42956e45f6SSimon J. Gerraty# Add the suffixes back. It should not matter that the order of the suffixes 43956e45f6SSimon J. Gerraty# is different from before. 44956e45f6SSimon J. Gerraty.SUFFIXES: .c .b .a 45