Module Name: src Committed By: rillig Date: Sat Oct 24 02:25:02 UTC 2020
Modified Files: src/distrib/sets/lists/tests: mi src/usr.bin/make/unit-tests: Makefile Added Files: src/usr.bin/make/unit-tests: suff-lookup.exp suff-lookup.mk Log Message: make(1): add test for looking up suffixes To generate a diff of this commit: cvs rdiff -u -r1.949 -r1.950 src/distrib/sets/lists/tests/mi cvs rdiff -u -r1.174 -r1.175 src/usr.bin/make/unit-tests/Makefile cvs rdiff -u -r0 -r1.1 src/usr.bin/make/unit-tests/suff-lookup.exp \ src/usr.bin/make/unit-tests/suff-lookup.mk Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/distrib/sets/lists/tests/mi diff -u src/distrib/sets/lists/tests/mi:1.949 src/distrib/sets/lists/tests/mi:1.950 --- src/distrib/sets/lists/tests/mi:1.949 Fri Oct 23 19:54:35 2020 +++ src/distrib/sets/lists/tests/mi Sat Oct 24 02:25:02 2020 @@ -1,4 +1,4 @@ -# $NetBSD: mi,v 1.949 2020/10/23 19:54:35 rillig Exp $ +# $NetBSD: mi,v 1.950 2020/10/24 02:25:02 rillig Exp $ # # Note: don't delete entries from here - mark them as "obsolete" instead. # @@ -4999,6 +4999,8 @@ ./usr/tests/usr.bin/make/unit-tests/suff-clear-regular.mk tests-usr.bin-tests compattestfile,atf ./usr/tests/usr.bin/make/unit-tests/suff-clear-single.exp tests-usr.bin-tests compattestfile,atf ./usr/tests/usr.bin/make/unit-tests/suff-clear-single.mk tests-usr.bin-tests compattestfile,atf +./usr/tests/usr.bin/make/unit-tests/suff-lookup.exp tests-usr.bin-tests compattestfile,atf +./usr/tests/usr.bin/make/unit-tests/suff-lookup.mk tests-usr.bin-tests compattestfile,atf ./usr/tests/usr.bin/make/unit-tests/suff-main.exp tests-usr.bin-tests compattestfile,atf ./usr/tests/usr.bin/make/unit-tests/suff-main.mk tests-usr.bin-tests compattestfile,atf ./usr/tests/usr.bin/make/unit-tests/suff-rebuild.exp tests-usr.bin-tests compattestfile,atf Index: src/usr.bin/make/unit-tests/Makefile diff -u src/usr.bin/make/unit-tests/Makefile:1.174 src/usr.bin/make/unit-tests/Makefile:1.175 --- src/usr.bin/make/unit-tests/Makefile:1.174 Fri Oct 23 19:54:35 2020 +++ src/usr.bin/make/unit-tests/Makefile Sat Oct 24 02:25:02 2020 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.174 2020/10/23 19:54:35 rillig Exp $ +# $NetBSD: Makefile,v 1.175 2020/10/24 02:25:02 rillig Exp $ # # Unit tests for make(1) # @@ -254,6 +254,7 @@ TESTS+= shell-sh TESTS+= suff-add-later TESTS+= suff-clear-regular TESTS+= suff-clear-single +TESTS+= suff-lookup TESTS+= suff-main TESTS+= suff-rebuild TESTS+= suff-transform-endless Added files: Index: src/usr.bin/make/unit-tests/suff-lookup.exp diff -u /dev/null src/usr.bin/make/unit-tests/suff-lookup.exp:1.1 --- /dev/null Sat Oct 24 02:25:02 2020 +++ src/usr.bin/make/unit-tests/suff-lookup.exp Sat Oct 24 02:25:02 2020 @@ -0,0 +1,37 @@ +defining transformation from `.ccc' to `.cc' +inserting ".ccc" (3) at end of list +inserting ".cc" (2) at end of list +transformation .ccc.cc complete +defining transformation from `.c' to `.ccc' +inserting ".c" (1) at end of list +inserting ".ccc" (3) at end of list +transformation .c.ccc complete +defining transformation from `.short' to `.c' +inserting ".short" (4) at end of list +inserting ".c" (1) at end of list +transformation .short.c complete +defining transformation from `.sho' to `.c' +inserting ".sho" (5) at end of list +inserting ".c" (1) at end of list +transformation .sho.c complete +Wildcard expanding "all"...SuffFindDeps (all) + No known suffix on all. Using .NULL suffix +adding suffix rules +Wildcard expanding "suff-main.cc"...suffix is ".cc"...SuffFindDeps (suff-main.cc) + trying suff-main.ccc...not there + trying suff-main.c...not there + trying suff-main.short...not there + trying suff-main.sho...got it + applying .sho -> .c to "suff-main.c" + applying .c -> .ccc to "suff-main.ccc" + applying .ccc -> .cc to "suff-main.cc" +suffix is ".ccc"...suffix is ".c"...suffix is ".sho"...SuffFindDeps (suff-main.sho) +suffix is ".sho"...: 'Making suff-main.sho out of nothing.' +: 'Making suff-main.c from suff-main.sho.' +: 'Making suff-main.ccc from suff-main.c.' +: 'Making suff-main.cc from suff-main.ccc.' +Wildcard expanding "all"...SuffFindDeps (.END) + No known suffix on .END. Using .NULL suffix +adding suffix rules +Wildcard expanding ".END"... +exit status 0 Index: src/usr.bin/make/unit-tests/suff-lookup.mk diff -u /dev/null src/usr.bin/make/unit-tests/suff-lookup.mk:1.1 --- /dev/null Sat Oct 24 02:25:02 2020 +++ src/usr.bin/make/unit-tests/suff-lookup.mk Sat Oct 24 02:25:02 2020 @@ -0,0 +1,34 @@ +# $NetBSD: suff-lookup.mk,v 1.1 2020/10/24 02:25:02 rillig Exp $ +# +# Demonstrate name resolution for suffixes. +# +# See also: +# FindSuffByName + +.MAKEFLAGS: -ds + +all: suff-main.cc + +.SUFFIXES: .c .cc .ccc + +# Register '.short' before '.sho'. When searching for the transformation +# '.sho.c', the suffix '.short' must not be found even though it starts with +# the correct characters. +.SUFFIXES: .short .sho + +# From long to short suffix. +.ccc.cc: + : 'Making ${.TARGET} from ${.IMPSRC}.' + +# From short to long suffix. +.c.ccc: + : 'Making ${.TARGET} from ${.IMPSRC}.' + +.short.c: + : 'Making ${.TARGET} from ${.IMPSRC}.' +.sho.c: + : 'Making ${.TARGET} from ${.IMPSRC}.' + +suff-main.sho: + : 'Making ${.TARGET} out of nothing.' +