bsd.obj.mk revision 1.18 1 # $NetBSD: bsd.obj.mk,v 1.18 1999/06/08 18:28:38 kim 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 PWD?= /bin/pwd
31
32 obj:
33 @cd ${.CURDIR}; rm -f ${__objdir} > /dev/null 2>&1 || true; \
34 here=`${PWD}`; subdir=$${here#${BSDSRCDIR}/}; \
35 if test $$here != $$subdir ; then \
36 dest=${__usrobjdir}/$$subdir${__usrobjdirpf} ; \
37 echo "$$here/${__objdir} -> $$dest"; \
38 rm -rf ${__objdir}; \
39 ln -s $$dest ${__objdir}; \
40 if test -d ${__usrobjdir} -a ! -d $$dest; then \
41 mkdir -p $$dest; \
42 else \
43 true; \
44 fi; \
45 else \
46 true ; \
47 dest=$$here/${__objdir} ; \
48 if test ! -d ${__objdir} ; then \
49 echo "making $$dest" ; \
50 mkdir $$dest; \
51 fi ; \
52 fi;
53 .endif
54
55 print-objdir:
56 @echo ${.OBJDIR}
57