xref: /freebsd/contrib/bmake/unit-tests/objdir-writable.mk (revision d0b2dbfa0ecf2bbc9709efc5e20baf8e4b44bbbf)
1# $NetBSD: objdir-writable.mk,v 1.7 2022/02/09 21:24:29 rillig 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
17_!=	mkdir -p ${RO_OBJDIR}
18_!=	chmod 555 ${RO_OBJDIR}
19
20.END: rm-objdir
21rm-objdir:
22	@rmdir ${RO_OBJDIR}
23
24no-objdir:
25	@MAKEOBJDIR=${RO_OBJDIR} ${.MAKE} -r -f /dev/null -C ${TMPDIR} -V .OBJDIR
26
27ro-objdir:
28	@MAKEOBJDIR=${RO_OBJDIR} ${.MAKE} -r -f /dev/null -C ${TMPDIR} -V .OBJDIR MAKE_OBJDIR_CHECK_WRITABLE=no
29
30explicit-objdir:
31	@MAKEOBJDIR=${TMPDIR} ${.MAKE} -r -f ${MAKEFILE:tA} -C ${TMPDIR} do-objdir -V .OBJDIR
32.endif
33