tech-toolchain archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: Changing "make clean" and "make cleandir"



>>.if "${OBJDIR}" == "${.CURDIR}"
>>.error "Building without objdirs"
>>.endif
>
>That part's easy, but how would you tell make whether or not to 
>use that rule?  The policy should be per source tree, so a global 
>mk.conf would not be the right place for it.

If you look at sys.mk in the mk.tar.gz I mentioned earlier, 
it provides a useful means of dealing with these sorts of things.

.-include <local.sys.mk>

I use that model in a number of my *.mk files so that local policy can
be added to the generic logic.

I run make via a wrapper script (mk) to condition the environment.
Most of what it does could now be done within make itself, except for
setting MAKEOBJDIR.

Eg. if SB=the sandbox (basically the dir where 'mk' found
.sandbox-env)
we might have

export SRCTOP=$SB/src
export OBJROOT=$SB/obj/
export OBJTOP='${OBJROOT}${MACHINE}'
export MAKEOBJDIR='${.CURDIR:S,${SRCTOP},${OBJTOP},}'

I don't use ${OBJROOT}${MACHINE} directly in MAKEOBJDIR so that

.if ${MACHINE} == "host"
OBJTOP= ${OBJROOT}${HOST_TARGET}
.endif

can work to ensure we get $SB/obj/netbsd5-i386/ when building on that
and $SB/obj/netbsd5-amd64/ when building on that etc.

Anyway, exporting MAKEOBJDIR "correctly", isn't something I've been able
to trick make into doing ;-)



Home | Main Index | Thread Index | Old Index