xref: /freebsd/contrib/bmake/unit-tests/meta-cmd-cmp.mk (revision 1d3f2ddc32fc37e4835aa5a51eabc8696c1e8114)
1*1d3f2ddcSSimon J. Gerraty# $NetBSD: meta-cmd-cmp.mk,v 1.6 2022/03/02 19:32:15 sjg Exp $
206b9b3e0SSimon J. Gerraty#
306b9b3e0SSimon J. Gerraty# Tests META_MODE command line comparison
406b9b3e0SSimon J. Gerraty#
506b9b3e0SSimon J. Gerraty
606b9b3e0SSimon J. Gerraty.MAIN: all
706b9b3e0SSimon J. Gerraty
8*1d3f2ddcSSimon J. Gerraty.MAKE.MODE= meta verbose silent=yes curdirok=yes nofilemon
906b9b3e0SSimon J. Gerratytf:= .${.PARSEFILE:R}
1006b9b3e0SSimon J. Gerraty
1106b9b3e0SSimon J. Gerraty.if ${.TARGETS:Nall} == ""
129f45a3c8SSimon J. Gerratyall: prep one two change1 change2 filter0 filter1 filter2 filter3 post
1306b9b3e0SSimon J. Gerraty
1406b9b3e0SSimon J. GerratyCLEANFILES= ${tf}*
1506b9b3e0SSimon J. Gerraty
1606b9b3e0SSimon J. Gerratyprep post: .PHONY
1706b9b3e0SSimon J. Gerraty	@rm -f ${CLEANFILES}
1806b9b3e0SSimon J. Gerraty
1906b9b3e0SSimon J. Gerraty.endif
2006b9b3e0SSimon J. Gerraty
2106b9b3e0SSimon J. GerratyFLAGS?=
2206b9b3e0SSimon J. GerratyFLAGS2?=
2306b9b3e0SSimon J. Gerraty
2406b9b3e0SSimon J. Gerratytests= ${tf}.cmp ${tf}.nocmp ${tf}.cmp2
259f45a3c8SSimon J. Gerratyfilter_tests= ${tf}.filter
2606b9b3e0SSimon J. Gerraty
2706b9b3e0SSimon J. Gerraty${tf}.cmp:
2806b9b3e0SSimon J. Gerraty	@echo FLAGS=${FLAGS:Uempty} > $@
2906b9b3e0SSimon J. Gerraty
3006b9b3e0SSimon J. Gerraty${tf}.nocmp: .NOMETA_CMP
3106b9b3e0SSimon J. Gerraty	@echo FLAGS=${FLAGS:Uempty} > $@
3206b9b3e0SSimon J. Gerraty
3306b9b3e0SSimon J. Gerraty# a line containing ${.OODATE} will not be compared
3406b9b3e0SSimon J. Gerraty# this allows the trick below
3506b9b3e0SSimon J. Gerraty${tf}.cmp2:
3606b9b3e0SSimon J. Gerraty	@echo FLAGS2=${FLAGS2:Uempty} > $@
3706b9b3e0SSimon J. Gerraty	@echo This line not compared FLAGS=${FLAGS:Uempty} ${.OODATE:MNOMETA_CMP}
3806b9b3e0SSimon J. Gerraty
39*1d3f2ddcSSimon J. GerratyCOMPILER_WRAPPERS= ccache distcc icecc
409f45a3c8SSimon J. GerratyWRAPPER?= ccache
419f45a3c8SSimon J. Gerraty.ifdef WITH_CMP_FILTER
429f45a3c8SSimon J. Gerraty.MAKE.META.CMP_FILTER+= ${COMPILER_WRAPPERS:S,^,N,}
439f45a3c8SSimon J. Gerraty.endif
449f45a3c8SSimon J. Gerraty.ifdef WITH_LOCAL_CMP_FILTER
459f45a3c8SSimon J. Gerraty# local variable
469f45a3c8SSimon J. Gerraty${tf}.filter: .MAKE.META.CMP_FILTER= ${COMPILER_WRAPPERS:S,^,N,}
479f45a3c8SSimon J. Gerraty.endif
489f45a3c8SSimon J. Gerraty
499f45a3c8SSimon J. Gerraty${tf}.filter:
509f45a3c8SSimon J. Gerraty	@echo ${WRAPPER} cc -c foo.c > $@
519f45a3c8SSimon J. Gerraty
5206b9b3e0SSimon J. Gerraty# these do the same
5306b9b3e0SSimon J. Gerratyone two: .PHONY
5406b9b3e0SSimon J. Gerraty	@echo $@:
5506b9b3e0SSimon J. Gerraty	@${.MAKE} -dM -r -C ${.CURDIR} -f ${MAKEFILE} ${tests}
5606b9b3e0SSimon J. Gerraty
5706b9b3e0SSimon J. Gerratychange1: .PHONY
5806b9b3e0SSimon J. Gerraty	@echo $@:
5906b9b3e0SSimon J. Gerraty	@${.MAKE} -dM -r -C ${.CURDIR} -f ${MAKEFILE} FLAGS=changed ${tests}
6006b9b3e0SSimon J. Gerraty
6106b9b3e0SSimon J. Gerratychange2: .PHONY
6206b9b3e0SSimon J. Gerraty	@echo $@:
6306b9b3e0SSimon J. Gerraty	@${.MAKE} -dM -r -C ${.CURDIR} -f ${MAKEFILE} FLAGS2=changed ${tests}
6406b9b3e0SSimon J. Gerraty
659f45a3c8SSimon J. Gerratyfilter0: .PHONY
669f45a3c8SSimon J. Gerraty	@echo $@:
679f45a3c8SSimon J. Gerraty	@${.MAKE} -dM -r -C ${.CURDIR} -f ${MAKEFILE} ${filter_tests}
689f45a3c8SSimon J. Gerraty
699f45a3c8SSimon J. Gerratyfilter1: .PHONY
709f45a3c8SSimon J. Gerraty	@echo $@:
719f45a3c8SSimon J. Gerraty	@${.MAKE} -dM -r -C ${.CURDIR} -f ${MAKEFILE} WRAPPER= ${filter_tests}
729f45a3c8SSimon J. Gerraty
739f45a3c8SSimon J. Gerratyfilter2: .PHONY
749f45a3c8SSimon J. Gerraty	@echo $@:
759f45a3c8SSimon J. Gerraty	@${.MAKE} -dM -r -C ${.CURDIR} -f ${MAKEFILE} -DWITH_CMP_FILTER \
769f45a3c8SSimon J. Gerraty		WRAPPER=distcc ${filter_tests}
779f45a3c8SSimon J. Gerraty
789f45a3c8SSimon J. Gerratyfilter3: .PHONY
799f45a3c8SSimon J. Gerraty	@echo $@:
809f45a3c8SSimon J. Gerraty	@${.MAKE} -dM -r -C ${.CURDIR} -f ${MAKEFILE} -DWITH_LOCAL_CMP_FILTER \
819f45a3c8SSimon J. Gerraty		WRAPPER=icecc ${filter_tests}
829f45a3c8SSimon J. Gerraty
8306b9b3e0SSimon J. Gerraty# don't let gcov mess up the results
8406b9b3e0SSimon J. Gerraty.MAKE.META.IGNORE_PATTERNS+= *.gcda
85