xref: /freebsd/contrib/bmake/unit-tests/meta-cmd-cmp.mk (revision cfd6422a5217410fbd66f7a7a8a64d9d85e61229)
1# $NetBSD: meta-cmd-cmp.mk,v 1.2 2020/12/05 22:51:34 sjg Exp $
2#
3# Tests META_MODE command line comparison
4#
5
6.MAIN: all
7
8.MAKE.MODE= meta verbose silent=yes curdirok=yes
9tf:= .${.PARSEFILE:R}
10
11.if ${.TARGETS:Nall} == ""
12all: prep one two change1 change2 post
13
14CLEANFILES= ${tf}*
15
16prep post: .PHONY
17	@rm -f ${CLEANFILES}
18
19.endif
20
21FLAGS?=
22FLAGS2?=
23
24tests= ${tf}.cmp ${tf}.nocmp ${tf}.cmp2
25
26${tf}.cmp:
27	@echo FLAGS=${FLAGS:Uempty} > $@
28
29${tf}.nocmp: .NOMETA_CMP
30	@echo FLAGS=${FLAGS:Uempty} > $@
31
32# a line containing ${.OODATE} will not be compared
33# this allows the trick below
34${tf}.cmp2:
35	@echo FLAGS2=${FLAGS2:Uempty} > $@
36	@echo This line not compared FLAGS=${FLAGS:Uempty} ${.OODATE:MNOMETA_CMP}
37
38# these do the same
39one two: .PHONY
40	@echo $@:
41	@${.MAKE} -dM -r -C ${.CURDIR} -f ${MAKEFILE} ${tests}
42
43change1: .PHONY
44	@echo $@:
45	@${.MAKE} -dM -r -C ${.CURDIR} -f ${MAKEFILE} FLAGS=changed ${tests}
46
47change2: .PHONY
48	@echo $@:
49	@${.MAKE} -dM -r -C ${.CURDIR} -f ${MAKEFILE} FLAGS2=changed ${tests}
50
51# don't let gcov mess up the results
52.MAKE.META.IGNORE_PATTERNS+= *.gcda
53