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