2000-02-08 15:38:16 +03:00
|
|
|
# $NetBSD: bsd.obj.mk,v 1.23 2000/02/08 12:38:16 sjg Exp $
|
1999-02-12 07:13:26 +03:00
|
|
|
|
|
|
|
.if !target(__initialized_obj__)
|
|
|
|
__initialized_obj__:
|
|
|
|
.include <bsd.own.mk>
|
|
|
|
.endif
|
1993-08-15 23:26:05 +04:00
|
|
|
|
1999-02-12 04:10:06 +03:00
|
|
|
.if ${MKOBJ} == "no"
|
1993-08-15 23:26:05 +04:00
|
|
|
obj:
|
|
|
|
.else
|
2000-02-08 15:38:16 +03:00
|
|
|
.if defined(MAKEOBJDIRPREFIX) || defined(MAKOBJDIR)
|
|
|
|
.if defined(MAKEOBJDIRPREFIX)
|
|
|
|
__objdir:= ${MAKEOBJDIRPREFIX}${.CURDIR}
|
|
|
|
.else
|
|
|
|
__objdir:= ${MAKEOBJDIR}
|
|
|
|
.endif
|
|
|
|
# MAKEOBJDIR and MAKEOBJDIRPREFIX are env variables supported
|
|
|
|
# by make(1). We simply mkdir -p the specified path.
|
|
|
|
# If that fails - we do a mkdir to get the appropriate error message
|
|
|
|
# before bailing out.
|
|
|
|
obj:
|
|
|
|
@if ! test -d ${__objdir}; then \
|
|
|
|
mkdir -p ${__objdir}; \
|
|
|
|
if ! test -d ${__objdir}; then \
|
|
|
|
mkdir ${__objdir}; exit 1; \
|
|
|
|
fi; \
|
|
|
|
echo "${.CURDIR} -> ${__objdir}"; \
|
|
|
|
fi
|
|
|
|
.else
|
|
|
|
.if defined(OBJMACHINE)
|
1993-10-23 05:32:55 +03:00
|
|
|
__objdir= obj.${MACHINE}
|
|
|
|
.else
|
|
|
|
__objdir= obj
|
|
|
|
.endif
|
|
|
|
|
|
|
|
.if defined(USR_OBJMACHINE)
|
1993-11-07 12:45:04 +03:00
|
|
|
__usrobjdir= ${BSDOBJDIR}.${MACHINE}
|
1993-10-23 05:32:55 +03:00
|
|
|
__usrobjdirpf=
|
|
|
|
.else
|
1993-11-07 12:45:04 +03:00
|
|
|
__usrobjdir= ${BSDOBJDIR}
|
1993-10-23 05:32:55 +03:00
|
|
|
.if defined(OBJMACHINE)
|
|
|
|
__usrobjdirpf= .${MACHINE}
|
|
|
|
.else
|
|
|
|
__usrobjdirpf=
|
|
|
|
.endif
|
|
|
|
.endif
|
|
|
|
|
1999-06-11 00:48:28 +04:00
|
|
|
PAWD?= /bin/pwd
|
1999-06-08 22:28:38 +04:00
|
|
|
|
1997-05-07 21:06:16 +04:00
|
|
|
obj:
|
1999-12-04 05:44:07 +03:00
|
|
|
@cd ${.CURDIR}; \
|
1999-06-11 00:48:28 +04:00
|
|
|
here=`${PAWD}`; subdir=$${here#${BSDSRCDIR}/}; \
|
1993-08-15 23:26:05 +04:00
|
|
|
if test $$here != $$subdir ; then \
|
1993-11-07 12:45:04 +03:00
|
|
|
dest=${__usrobjdir}/$$subdir${__usrobjdirpf} ; \
|
1999-12-04 05:44:07 +03:00
|
|
|
if [ -L $$here/${__objdir} ]; then \
|
|
|
|
curtarg=`ls -ld $$here/${__objdir} | awk '{print $$NF}'` ; \
|
|
|
|
if [ "$$curtarg" = "$$dest" ]; then \
|
|
|
|
: ; \
|
|
|
|
else \
|
|
|
|
echo "$$here/${__objdir} -> $$dest"; \
|
|
|
|
rm -rf ${__objdir}; \
|
|
|
|
ln -s $$dest ${__objdir}; \
|
|
|
|
fi; \
|
|
|
|
else \
|
|
|
|
echo "$$here/${__objdir} -> $$dest"; \
|
|
|
|
rm -rf ${__objdir}; \
|
|
|
|
ln -s $$dest ${__objdir}; \
|
|
|
|
fi; \
|
1993-11-07 12:45:04 +03:00
|
|
|
if test -d ${__usrobjdir} -a ! -d $$dest; then \
|
1993-08-15 23:26:05 +04:00
|
|
|
mkdir -p $$dest; \
|
|
|
|
else \
|
|
|
|
true; \
|
|
|
|
fi; \
|
|
|
|
else \
|
|
|
|
true ; \
|
1993-10-23 05:32:55 +03:00
|
|
|
dest=$$here/${__objdir} ; \
|
1999-12-04 05:44:07 +03:00
|
|
|
if test ! -d ${__objdir} || test -L ${__objdir}; then \
|
1993-08-15 23:26:05 +04:00
|
|
|
echo "making $$dest" ; \
|
1999-12-04 05:44:07 +03:00
|
|
|
rm -f ${__objdir}; \
|
1993-08-15 23:26:05 +04:00
|
|
|
mkdir $$dest; \
|
|
|
|
fi ; \
|
|
|
|
fi;
|
|
|
|
.endif
|
2000-02-08 15:38:16 +03:00
|
|
|
.endif
|
1998-08-27 20:54:59 +04:00
|
|
|
|
1998-08-28 00:33:45 +04:00
|
|
|
print-objdir:
|
1998-08-27 20:54:59 +04:00
|
|
|
@echo ${.OBJDIR}
|