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