Simon J. Gerraty 06b9b3e0ad Merge bmake-20210110
Quite a lot of churn on style, but lots of
good work refactoring complicated functions
and lots more unit-tests.
Thanks mostly to rillig at NetBSD

Some interesting entries from ChangeLog

o .MAKE.{UID,GID} represent uid and gid running make.

o allow env var MAKE_OBJDIR_CHECK_WRITABLE=no to skip writable
  checks in InitObjdir.  Explicit .OBJDIR target always allows
  read-only directory.

o add more unit tests for META MODE

Merge commit '8e11a9b4250be3c3379c45fa820bff78d99d5946' into main

Change-Id: I464fd4c013067f0915671c1ccc96d2d8090b2b9c
2021-01-13 22:21:37 -08:00

53 lines
1.1 KiB
Makefile

# $NetBSD: meta-cmd-cmp.mk,v 1.2 2020/12/05 22:51:34 sjg Exp $
#
# Tests META_MODE command line comparison
#
.MAIN: all
.MAKE.MODE= meta verbose silent=yes curdirok=yes
tf:= .${.PARSEFILE:R}
.if ${.TARGETS:Nall} == ""
all: prep one two change1 change2 post
CLEANFILES= ${tf}*
prep post: .PHONY
@rm -f ${CLEANFILES}
.endif
FLAGS?=
FLAGS2?=
tests= ${tf}.cmp ${tf}.nocmp ${tf}.cmp2
${tf}.cmp:
@echo FLAGS=${FLAGS:Uempty} > $@
${tf}.nocmp: .NOMETA_CMP
@echo FLAGS=${FLAGS:Uempty} > $@
# a line containing ${.OODATE} will not be compared
# this allows the trick below
${tf}.cmp2:
@echo FLAGS2=${FLAGS2:Uempty} > $@
@echo This line not compared FLAGS=${FLAGS:Uempty} ${.OODATE:MNOMETA_CMP}
# these do the same
one two: .PHONY
@echo $@:
@${.MAKE} -dM -r -C ${.CURDIR} -f ${MAKEFILE} ${tests}
change1: .PHONY
@echo $@:
@${.MAKE} -dM -r -C ${.CURDIR} -f ${MAKEFILE} FLAGS=changed ${tests}
change2: .PHONY
@echo $@:
@${.MAKE} -dM -r -C ${.CURDIR} -f ${MAKEFILE} FLAGS2=changed ${tests}
# don't let gcov mess up the results
.MAKE.META.IGNORE_PATTERNS+= *.gcda