mirror of
https://github.com/freebsd/freebsd-src
synced 2024-11-05 18:22:52 +00:00
New variable NOOBJLINK
Create 'obj' directory in current directory instead a symbolic link to the 'obj' tree if defined. [not set] Print a warning if 'obj' tree (/usr/obj) does not exist. Change default 'obj' directory from ``obj.${MACHINE}'' back to ``obj'', unfortunately many Makefiles are wired with the name ``obj''. Add some comments for variables and targets.
This commit is contained in:
parent
b34b86510b
commit
44d97e5b42
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=15353
1 changed files with 46 additions and 9 deletions
|
@ -1,15 +1,46 @@
|
||||||
# $Id: bsd.obj.mk,v 1.1 1996/03/24 22:49:16 wosch Exp $
|
# $Id: bsd.obj.mk,v 1.2 1996/04/09 22:43:33 wosch Exp $
|
||||||
|
#
|
||||||
|
# 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]
|
||||||
|
#
|
||||||
|
# MAKEOBJDIR A file name to the directory where the targets
|
||||||
|
# are built. [obj]
|
||||||
|
#
|
||||||
|
# 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.
|
||||||
|
#
|
||||||
|
|
||||||
# _SUBDIRUSE:
|
|
||||||
# BSDSRCDIR?=/usr/src
|
|
||||||
# BSDOBJDIR?=/usr/obj
|
|
||||||
|
|
||||||
.if defined(MAKEOBJDIR) && !empty(MAKEOBJDIR)
|
.if defined(MAKEOBJDIR) && !empty(MAKEOBJDIR)
|
||||||
__objdir = ${MAKEOBJDIR}
|
__objdir = ${MAKEOBJDIR}
|
||||||
.else
|
.else
|
||||||
|
|
||||||
.if defined(MACHINE) && !empty(MACHINE)
|
.if defined(MACHINE) && !empty(MACHINE)
|
||||||
__objdir = obj.${MACHINE}
|
__objdir = obj # obj.${MACHINE}
|
||||||
.else
|
.else
|
||||||
__objdir = obj
|
__objdir = obj
|
||||||
.endif
|
.endif
|
||||||
|
@ -22,17 +53,24 @@ obj:
|
||||||
.else
|
.else
|
||||||
|
|
||||||
obj: _SUBDIRUSE cleanobj
|
obj: _SUBDIRUSE cleanobj
|
||||||
@cd ${.CURDIR}; here=${.CURDIR}; \
|
.if defined(NOOBJLINK)
|
||||||
dest=${BSDOBJDIR}`echo $$here | sed "s,^${BSDSRCDIR},,"`/${__objdir}; \
|
mkdir ${.CURDIR}/${__objdir}
|
||||||
if test -d ${BSDOBJDIR}; then \
|
.else
|
||||||
|
@if test -d ${BSDOBJDIR}; then \
|
||||||
|
cd ${.CURDIR}; here=${.CURDIR}; \
|
||||||
|
dest=${BSDOBJDIR}`echo $$here | \
|
||||||
|
sed "s,^${BSDSRCDIR},,"`/${__objdir}; \
|
||||||
${ECHO} "$$here/${__objdir} -> $$dest"; \
|
${ECHO} "$$here/${__objdir} -> $$dest"; \
|
||||||
ln -s $$dest ${__objdir}; \
|
ln -s $$dest ${__objdir}; \
|
||||||
if test ! -d $$dest; then \
|
if test ! -d $$dest; then \
|
||||||
mkdir -p $$dest; \
|
mkdir -p $$dest; \
|
||||||
fi; \
|
fi; \
|
||||||
|
else \
|
||||||
|
${ECHO} "obj tree \"${BSDOBJDIR}\" does not exist."; \
|
||||||
fi
|
fi
|
||||||
.endif
|
.endif
|
||||||
.endif
|
.endif
|
||||||
|
.endif
|
||||||
|
|
||||||
#
|
#
|
||||||
# cleanup
|
# cleanup
|
||||||
|
@ -48,7 +86,6 @@ cleanfiles:
|
||||||
cleandepend:
|
cleandepend:
|
||||||
.endif
|
.endif
|
||||||
|
|
||||||
|
|
||||||
.if !target(clean)
|
.if !target(clean)
|
||||||
clean: _SUBDIRUSE cleanfiles
|
clean: _SUBDIRUSE cleanfiles
|
||||||
.endif
|
.endif
|
||||||
|
|
Loading…
Reference in a new issue