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)
4obj:
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
25obj:
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
48show-objdir:
49	@echo ${.OBJDIR}
50