1 # $NetBSD: meta-ignore.inc,v 1.2 2023/02/25 19:30:32 sjg Exp $ 2 3 # common logic for testing .MAKE.META.IGNORE_* 4 5 # we want a directory outside of .OBJDIR to drop a file 6 # that our meta file refers to. 7 # Note: these tests will not work if TMPDIR is /tmp or /var/tmp 8 # or a subdir thereof 9 IGNORE:= ${TMPDIR}/ignore 10 OBJ:= ${TMPDIR}/obj 11 12 # this is always ignored so make sure it isn't used above 13 TMPDIR= /tmp/nothanks 14 15 all: one two three 16 17 setup: 18 @mkdir -p ${IGNORE} ${OBJ} 19 @echo > ${IGNORE}/check 20 @rm -f ${OBJ}/check-ignore 21 22 makefile:= ${.INCLUDEDFROMDIR}/${.INCLUDEDFROMFILE} 23 TEST:= ${.INCLUDEDFROMFILE:R:C,.*meta-,,:S,-,_,g:tu} 24 25 DESC.one= Initialize check-ignore.meta 26 DESC.two= Use .MAKE.META.${TEST} - check-ignore is up to date 27 DESC.three= Skip .MAKE.META.${TEST} - check-ignore is out of date 28 29 # just in case someone runs us with -jN 30 .ORDER: one two three 31 one two three: .MAKE setup 32 @echo "${DESC.${.TARGET}}"; \ 33 ${MAKE} -C ${.CURDIR} -f ${makefile} check-ignore parent=${.TARGET} 34 35 .if make(check-ignore) 36 .MAKEFLAGS: -dM 37 .MAKE.MODE = meta verbose silent=yes 38 .OBJDIR: ${OBJ} 39 .if ${parent} == "two" 40 .if ${TEST} == "IGNORE_PATHS" 41 # this is a prefix list - any path that matches 42 # one of these prefixes will be ignored 43 .MAKE.META.IGNORE_PATHS = ${IGNORE} 44 .elif ${TEST} == "IGNORE_PATTERNS" 45 # more flexible but more expensive 46 # this example is equivalent to M*/ignore/* 47 # a match means ignore 48 .MAKE.META.IGNORE_PATTERNS = */ignore/* 49 .elif ${TEST} == "IGNORE_FILTER" 50 # this is the most flexible, but also most expensive 51 # if this expands to nothing - ignore the path 52 .MAKE.META.IGNORE_FILTER = N${IGNORE}/* 53 .endif 54 .endif 55 56 # : < just reads from ${IGNORE}/check 57 # so that our filemon trace will have a reference to it 58 # we ensure it is always newer than the target. 59 check-ignore: .META .NOPATH 60 @: < ${IGNORE}/check > ${.TARGET} 61 @sleep 1; echo ${.TARGET} > ${IGNORE}/check 62 63 .endif 64