1996-05-27 23:05:54 +00:00
|
|
|
# $Id: bsd.obj.mk,v 1.3 1996/04/22 23:31:39 wosch Exp $
|
1996-04-22 23:31:39 +00:00
|
|
|
#
|
|
|
|
# The include file <bsd.obj.mk> handles creating 'obj' directory
|
|
|
|
# and cleaning up object files, log files etc.
|
|
|
|
#
|
|
|
|
#
|
|
|
|
# +++ variables +++
|
|
|
|
#
|
|
|
|
# BSDSRCDIR The real path to the system sources, so that 'make obj'
|
|
|
|
# will work correctly. [/usr/src]
|
|
|
|
#
|
|
|
|
# BSDOBJDIR The real path to the system 'obj' tree, so that 'make obj'
|
|
|
|
# will work correctly. [/usr/obj]
|
|
|
|
#
|
1996-05-27 23:05:54 +00:00
|
|
|
# CLEANFILES Additional files to remove for the clean and cleandir targets.
|
|
|
|
#
|
1996-04-22 23:31:39 +00:00
|
|
|
# MAKEOBJDIR A file name to the directory where the targets
|
1996-05-27 23:05:54 +00:00
|
|
|
# are built. Note: MAKEOBJDIR is an *enviroment* variable
|
|
|
|
# and does work proper only if set as enviroment variable,
|
|
|
|
# not as global or command line variable! [obj]
|
|
|
|
#
|
|
|
|
# E.g. use `env MAKEOBJDIR=obj-amd make'
|
1996-04-22 23:31:39 +00:00
|
|
|
#
|
|
|
|
# NOOBJ Do not create 'obj' directory if defined. [not set]
|
|
|
|
#
|
|
|
|
# NOOBJLINK Create 'obj' directory in current directory instead
|
|
|
|
# a symbolic link to the 'obj' tree if defined. [not set]
|
|
|
|
#
|
|
|
|
#
|
|
|
|
# +++ targets +++
|
|
|
|
#
|
|
|
|
# clean:
|
|
|
|
# remove a.out Errs errs mklog ${CLEANFILES}
|
|
|
|
#
|
|
|
|
# cleandir:
|
|
|
|
# remove all of the files removed by the target clean,
|
|
|
|
# cleandepend (see bsd.dep.mk) and 'obj' directory.
|
|
|
|
#
|
|
|
|
# obj:
|
|
|
|
# create 'obj' directory.
|
|
|
|
#
|
1996-03-24 22:49:16 +00:00
|
|
|
|
|
|
|
|
|
|
|
.if defined(MAKEOBJDIR) && !empty(MAKEOBJDIR)
|
|
|
|
__objdir = ${MAKEOBJDIR}
|
|
|
|
.else
|
|
|
|
|
|
|
|
.if defined(MACHINE) && !empty(MACHINE)
|
1996-04-22 23:31:39 +00:00
|
|
|
__objdir = obj # obj.${MACHINE}
|
1996-03-24 22:49:16 +00:00
|
|
|
.else
|
|
|
|
__objdir = obj
|
|
|
|
.endif
|
|
|
|
.endif
|
|
|
|
|
|
|
|
|
|
|
|
.if !target(obj)
|
|
|
|
.if defined(NOOBJ)
|
|
|
|
obj:
|
|
|
|
.else
|
|
|
|
|
|
|
|
obj: _SUBDIRUSE cleanobj
|
1996-04-22 23:31:39 +00:00
|
|
|
.if defined(NOOBJLINK)
|
|
|
|
mkdir ${.CURDIR}/${__objdir}
|
|
|
|
.else
|
|
|
|
@if test -d ${BSDOBJDIR}; then \
|
|
|
|
cd ${.CURDIR}; here=${.CURDIR}; \
|
|
|
|
dest=${BSDOBJDIR}`echo $$here | \
|
|
|
|
sed "s,^${BSDSRCDIR},,"`/${__objdir}; \
|
1996-03-24 22:49:16 +00:00
|
|
|
${ECHO} "$$here/${__objdir} -> $$dest"; \
|
|
|
|
ln -s $$dest ${__objdir}; \
|
|
|
|
if test ! -d $$dest; then \
|
|
|
|
mkdir -p $$dest; \
|
|
|
|
fi; \
|
1996-04-22 23:31:39 +00:00
|
|
|
else \
|
|
|
|
${ECHO} "obj tree \"${BSDOBJDIR}\" does not exist."; \
|
1996-03-24 22:49:16 +00:00
|
|
|
fi
|
|
|
|
.endif
|
|
|
|
.endif
|
1996-04-22 23:31:39 +00:00
|
|
|
.endif
|
1996-03-24 22:49:16 +00:00
|
|
|
|
1996-04-09 22:43:33 +00:00
|
|
|
#
|
|
|
|
# cleanup
|
|
|
|
#
|
|
|
|
cleanobj:
|
1996-03-24 22:49:16 +00:00
|
|
|
rm -f -r ${.CURDIR}/${__objdir}
|
1996-04-09 22:43:33 +00:00
|
|
|
|
|
|
|
cleanfiles:
|
|
|
|
rm -f a.out Errs errs mklog ${CLEANFILES}
|
|
|
|
|
|
|
|
# see bsd.dep.mk
|
|
|
|
.if !target(cleandepend)
|
|
|
|
cleandepend:
|
|
|
|
.endif
|
|
|
|
|
|
|
|
.if !target(clean)
|
|
|
|
clean: _SUBDIRUSE cleanfiles
|
|
|
|
.endif
|
|
|
|
|
|
|
|
cleandir: _SUBDIRUSE cleanfiles cleandepend cleanobj
|