Home | History | Annotate | Line # | Download | only in mk
bsd.obj.mk revision 1.14
      1 #	$NetBSD: bsd.obj.mk,v 1.14 1998/08/27 16:54:59 tv Exp $
      2 
      3 .if defined(NOOBJ)
      4 obj:
      5 .else
      6 
      7 .if defined(OBJMACHINE)
      8 __objdir=	obj.${MACHINE}
      9 .else
     10 __objdir=	obj
     11 .endif
     12 
     13 .if defined(USR_OBJMACHINE)
     14 __usrobjdir=	${BSDOBJDIR}.${MACHINE}
     15 __usrobjdirpf=	
     16 .else
     17 __usrobjdir=	${BSDOBJDIR}
     18 .if defined(OBJMACHINE)
     19 __usrobjdirpf=	.${MACHINE}
     20 .else
     21 __usrobjdirpf=
     22 .endif
     23 .endif
     24 
     25 obj:
     26 	@cd ${.CURDIR}; rm -f ${__objdir} > /dev/null 2>&1 || true; \
     27 	here=`/bin/pwd`; subdir=$${here#${BSDSRCDIR}/}; \
     28 	if test $$here != $$subdir ; then \
     29 		dest=${__usrobjdir}/$$subdir${__usrobjdirpf} ; \
     30 		echo "$$here/${__objdir} -> $$dest"; \
     31 		rm -rf ${__objdir}; \
     32 		ln -s $$dest ${__objdir}; \
     33 		if test -d ${__usrobjdir} -a ! -d $$dest; then \
     34 			mkdir -p $$dest; \
     35 		else \
     36 			true; \
     37 		fi; \
     38 	else \
     39 		true ; \
     40 		dest=$$here/${__objdir} ; \
     41 		if test ! -d ${__objdir} ; then \
     42 			echo "making $$dest" ; \
     43 			mkdir $$dest; \
     44 		fi ; \
     45 	fi;
     46 .endif
     47 
     48 show-objdir:
     49 	@echo ${.OBJDIR}
     50