xref: /freebsd/contrib/bmake/unit-tests/objdir-writable.mk (revision 994297b01b98816bea1abf45ae4bac1bc69ee7a0)
1# $NetBSD: objdir-writable.mk,v 1.5 2021/07/04 01:28:54 sjg Exp $
2
3# test checking for writable objdir
4
5TMPDIR?= /tmp
6RO_OBJDIR?= ${TMPDIR}/roobj
7
8.if make(do-objdir)
9# this should succeed
10.OBJDIR: ${RO_OBJDIR}
11
12do-objdir:
13.else
14all: no-objdir ro-objdir explicit-objdir
15
16# make it now
17x!= echo; mkdir -p ${RO_OBJDIR};  chmod 555 ${RO_OBJDIR}
18
19.END: rm-objdir
20rm-objdir:
21	@rmdir ${RO_OBJDIR}
22
23no-objdir:
24	@MAKEOBJDIR=${RO_OBJDIR} ${.MAKE} -r -f /dev/null -C ${TMPDIR} -V .OBJDIR
25
26ro-objdir:
27	@MAKEOBJDIR=${RO_OBJDIR} ${.MAKE} -r -f /dev/null -C ${TMPDIR} -V .OBJDIR MAKE_OBJDIR_CHECK_WRITABLE=no
28
29explicit-objdir:
30	@MAKEOBJDIR=${TMPDIR} ${.MAKE} -r -f ${MAKEFILE:tA} -C ${TMPDIR} do-objdir -V .OBJDIR
31.endif
32
33