Deleted Added
full compact
bsd.obj.mk (95254) bsd.obj.mk (95306)
1# $FreeBSD: head/share/mk/bsd.obj.mk 95254 2002-04-22 09:12:18Z ru $
1# $FreeBSD: head/share/mk/bsd.obj.mk 95306 2002-04-23 09:03:56Z ru $
2#
3# The include file <bsd.obj.mk> handles creating the 'obj' directory
4# and cleaning up object files, etc.
5#
2#
3# The include file <bsd.obj.mk> handles creating the 'obj' directory
4# and cleaning up object files, etc.
5#
6# Under construction: it also contains the _SUBDIR target (which is used
7# by most `mk' files to recurse into subdirectories) and defaults for the
8# cleandepend, depend and tags targets. It may eventually be merged with
9# with bsd.subdir.mk.
10#
11# +++ variables +++
12#
13# CLEANDIRS Additional directories to remove for the clean target.
14#
15# CLEANFILES Additional files to remove for the clean target.
16#
17# MAKEOBJDIR A pathname for the directory where the targets
18# are built. Note: MAKEOBJDIR is an *enviroment* variable

--- 57 unchanged lines hidden (view full) ---

76.if ${.OBJDIR} == ${.CURDIR}
77 @${ECHO} "Warning: Object directory not changed from original ${.CURDIR}"
78.elif exists(${.CURDIR}/obj.${MACHINE}/) || exists(${.CURDIR}/obj/)
79 @${ECHO} "Warning: Using ${.OBJDIR} as object directory instead of\
80 canonical ${CANONICALOBJDIR}"
81.endif
82.endif
83
6# +++ variables +++
7#
8# CLEANDIRS Additional directories to remove for the clean target.
9#
10# CLEANFILES Additional files to remove for the clean target.
11#
12# MAKEOBJDIR A pathname for the directory where the targets
13# are built. Note: MAKEOBJDIR is an *enviroment* variable

--- 57 unchanged lines hidden (view full) ---

71.if ${.OBJDIR} == ${.CURDIR}
72 @${ECHO} "Warning: Object directory not changed from original ${.CURDIR}"
73.elif exists(${.CURDIR}/obj.${MACHINE}/) || exists(${.CURDIR}/obj/)
74 @${ECHO} "Warning: Using ${.OBJDIR} as object directory instead of\
75 canonical ${CANONICALOBJDIR}"
76.endif
77.endif
78
84.if !target(obj)
85.if defined(NOOBJ)
79.if !target(obj) && !defined(NOOBJ)
86obj:
80obj:
87.else
88obj: _SUBDIR
89 @if ! test -d ${CANONICALOBJDIR}/; then \
90 mkdir -p ${CANONICALOBJDIR}; \
91 if ! test -d ${CANONICALOBJDIR}/; then \
92 ${ECHO} "Unable to create ${CANONICALOBJDIR}."; \
93 exit 1; \
94 fi; \
95 ${ECHO} "${CANONICALOBJDIR} created for ${.CURDIR}"; \
96 fi
97.endif
81 @if ! test -d ${CANONICALOBJDIR}/; then \
82 mkdir -p ${CANONICALOBJDIR}; \
83 if ! test -d ${CANONICALOBJDIR}/; then \
84 ${ECHO} "Unable to create ${CANONICALOBJDIR}."; \
85 exit 1; \
86 fi; \
87 ${ECHO} "${CANONICALOBJDIR} created for ${.CURDIR}"; \
88 fi
89.endif
98.endif
99
100.if !target(objlink)
90
91.if !target(objlink)
101objlink: _SUBDIR
92objlink:
102 @if test -d ${CANONICALOBJDIR}/; then \
103 rm -f ${.CURDIR}/obj; \
104 ln -s ${CANONICALOBJDIR} ${.CURDIR}/obj; \
105 else \
106 echo "No ${CANONICALOBJDIR} to link to - do a make obj."; \
107 fi
108.endif
109

--- 9 unchanged lines hidden (view full) ---

119.if ${CANONICALOBJDIR} != ${.CURDIR} && exists(${CANONICALOBJDIR}/)
120 @rm -rf ${CANONICALOBJDIR}
121.else
122 @cd ${.CURDIR} && ${MAKE} clean cleandepend
123.endif
124 @if [ -h ${.CURDIR}/obj ]; then rm -f ${.CURDIR}/obj; fi
125
126.if !target(clean)
93 @if test -d ${CANONICALOBJDIR}/; then \
94 rm -f ${.CURDIR}/obj; \
95 ln -s ${CANONICALOBJDIR} ${.CURDIR}/obj; \
96 else \
97 echo "No ${CANONICALOBJDIR} to link to - do a make obj."; \
98 fi
99.endif
100

--- 9 unchanged lines hidden (view full) ---

110.if ${CANONICALOBJDIR} != ${.CURDIR} && exists(${CANONICALOBJDIR}/)
111 @rm -rf ${CANONICALOBJDIR}
112.else
113 @cd ${.CURDIR} && ${MAKE} clean cleandepend
114.endif
115 @if [ -h ${.CURDIR}/obj ]; then rm -f ${.CURDIR}/obj; fi
116
117.if !target(clean)
127clean: _SUBDIR
118clean:
128.if defined(CLEANFILES) && !empty(CLEANFILES)
129 rm -f ${CLEANFILES}
130.endif
131.if defined(CLEANDIRS) && !empty(CLEANDIRS)
132 rm -rf ${CLEANDIRS}
133.endif
134.endif
135
136.if !target(checkdpadd)
119.if defined(CLEANFILES) && !empty(CLEANFILES)
120 rm -f ${CLEANFILES}
121.endif
122.if defined(CLEANDIRS) && !empty(CLEANDIRS)
123 rm -rf ${CLEANDIRS}
124.endif
125.endif
126
127.if !target(checkdpadd)
137checkdpadd: _SUBDIR
128checkdpadd:
138.if (defined(DPADD) || defined(LDADD))
139checkdpadd:
140.if ${OBJFORMAT} != aout
141 @ldadd=`echo \`for lib in ${DPADD} ; do \
142 echo $$lib | sed 's;^/usr/lib/lib\(.*\)\.a;-l\1;' ; \
143 done \`` ; \
144 ldadd1=`echo ${LDADD}` ; \
145 if [ "$$ldadd" != "$$ldadd1" ] ; then \

--- 7 unchanged lines hidden (view full) ---

153 echo ${.CURDIR} ; \
154 echo "LDADD -> $$dpadd" ; \
155 echo "DPADD = ${DPADD}" ; \
156 fi
157.endif
158.endif
159.endif
160
129.if (defined(DPADD) || defined(LDADD))
130checkdpadd:
131.if ${OBJFORMAT} != aout
132 @ldadd=`echo \`for lib in ${DPADD} ; do \
133 echo $$lib | sed 's;^/usr/lib/lib\(.*\)\.a;-l\1;' ; \
134 done \`` ; \
135 ldadd1=`echo ${LDADD}` ; \
136 if [ "$$ldadd" != "$$ldadd1" ] ; then \

--- 7 unchanged lines hidden (view full) ---

144 echo ${.CURDIR} ; \
145 echo "LDADD -> $$dpadd" ; \
146 echo "DPADD = ${DPADD}" ; \
147 fi
148.endif
149.endif
150.endif
151
161cleandir: cleanobj _SUBDIR
152cleandir: cleanobj
162
153
163.for __target in cleandepend depend tags
164.if !target(${__target})
165${__target}: _SUBDIR
166.endif
167.endfor
154.include <bsd.subdir.mk>
168
155
169_SUBDIR: .USE
170.if defined(SUBDIR) && !empty(SUBDIR)
171 @for entry in ${SUBDIR}; do \
172 if test -d ${.CURDIR}/$${entry}.${MACHINE_ARCH}; then \
173 ${ECHODIR} "===> ${DIRPRFX}$${entry}.${MACHINE_ARCH}"; \
174 edir=$${entry}.${MACHINE_ARCH}; \
175 cd ${.CURDIR}/$${edir}; \
176 else \
177 ${ECHODIR} "===> ${DIRPRFX}$$entry"; \
178 edir=$${entry}; \
179 cd ${.CURDIR}/$${edir}; \
180 fi; \
181 ${MAKE} ${.TARGET:realinstall=install} \
182 DIRPRFX=${DIRPRFX}$$edir/; \
183 done
184.endif
185
186.endif !target(__<bsd.obj.mk>__)
156.endif !target(__<bsd.obj.mk>__)