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