bsd.obj.mk revision 1.17 1 # $NetBSD: bsd.obj.mk,v 1.17 1999/02/12 04:13:26 lukem Exp $
2
3 .if !target(__initialized_obj__)
4 __initialized_obj__:
5 .include <bsd.own.mk>
6 .endif
7
8 .if ${MKOBJ} == "no"
9 obj:
10 .else
11
12 .if defined(OBJMACHINE)
13 __objdir= obj.${MACHINE}
14 .else
15 __objdir= obj
16 .endif
17
18 .if defined(USR_OBJMACHINE)
19 __usrobjdir= ${BSDOBJDIR}.${MACHINE}
20 __usrobjdirpf=
21 .else
22 __usrobjdir= ${BSDOBJDIR}
23 .if defined(OBJMACHINE)
24 __usrobjdirpf= .${MACHINE}
25 .else
26 __usrobjdirpf=
27 .endif
28 .endif
29
30 obj:
31 @cd ${.CURDIR}; rm -f ${__objdir} > /dev/null 2>&1 || true; \
32 here=`/bin/pwd`; subdir=$${here#${BSDSRCDIR}/}; \
33 if test $$here != $$subdir ; then \
34 dest=${__usrobjdir}/$$subdir${__usrobjdirpf} ; \
35 echo "$$here/${__objdir} -> $$dest"; \
36 rm -rf ${__objdir}; \
37 ln -s $$dest ${__objdir}; \
38 if test -d ${__usrobjdir} -a ! -d $$dest; then \
39 mkdir -p $$dest; \
40 else \
41 true; \
42 fi; \
43 else \
44 true ; \
45 dest=$$here/${__objdir} ; \
46 if test ! -d ${__objdir} ; then \
47 echo "making $$dest" ; \
48 mkdir $$dest; \
49 fi ; \
50 fi;
51 .endif
52
53 print-objdir:
54 @echo ${.OBJDIR}
55