From bf917b585281f36dcd0b77776310bbed3d2afa75 Mon Sep 17 00:00:00 2001 From: swallace Date: Wed, 18 Sep 1996 06:09:19 +0000 Subject: .TARGETOBJDIR has been removed from make and CANONICALOBJDIR set in bsd.obj.mk. Also, a make target called objwarn checks to see if ${.OBJDIR} != ${.CURDIR} and ${.OBJDIR} != ${CANONICALOBJDIR} and outputs a warning. (No warning for the latter if MAKEOBJDIR or MAKEOBJDIRP REFIX is set). objwarn is called from all targets in bsd.prog.mk, bsd.kmod.mk, and bsd.lib.mk. Reviewed by: bde --- share/mk/bsd.kmod.mk | 4 ++-- share/mk/bsd.lib.mk | 4 ++-- share/mk/bsd.obj.mk | 66 ++++++++++++++++++++++++++++++++++------------------ share/mk/bsd.prog.mk | 4 ++-- 4 files changed, 49 insertions(+), 29 deletions(-) (limited to 'share') diff --git a/share/mk/bsd.kmod.mk b/share/mk/bsd.kmod.mk index 89fd5af..99b41e0 100644 --- a/share/mk/bsd.kmod.mk +++ b/share/mk/bsd.kmod.mk @@ -1,5 +1,5 @@ # From: @(#)bsd.prog.mk 5.26 (Berkeley) 6/25/91 -# $Id: bsd.kmod.mk,v 1.24 1996/06/30 22:16:19 jkh Exp $ +# $Id: bsd.kmod.mk,v 1.25 1996/08/31 14:46:58 bde Exp $ # # The include file handles installing Loadable Kernel Modules. # includes the file named "../Makefile.inc" if it exists, @@ -139,7 +139,7 @@ all-man: .endif .MAIN: all -all: ${PROG} all-man _SUBDIR +all: objwarn ${PROG} all-man _SUBDIR CLEANFILES+=${PROG} ${OBJS} diff --git a/share/mk/bsd.lib.mk b/share/mk/bsd.lib.mk index 4e02330..3320d65 100644 --- a/share/mk/bsd.lib.mk +++ b/share/mk/bsd.lib.mk @@ -1,5 +1,5 @@ # from: @(#)bsd.lib.mk 5.26 (Berkeley) 5/2/91 -# $Id: bsd.lib.mk,v 1.42 1996/08/25 05:16:56 jkh Exp $ +# $Id: bsd.lib.mk,v 1.43 1996/09/05 18:05:06 bde Exp $ # .if exists(${.CURDIR}/../Makefile.inc) @@ -121,7 +121,7 @@ _LIBS+=lib${LIB}_pic.a PICFLAG=-fpic .endif -all: ${_LIBS} all-man _SUBDIR # llib-l${LIB}.ln +all: objwarn ${_LIBS} all-man _SUBDIR # llib-l${LIB}.ln OBJS+= ${SRCS:N*.h:R:S/$/.o/g} diff --git a/share/mk/bsd.obj.mk b/share/mk/bsd.obj.mk index 6ca8645..96af375 100644 --- a/share/mk/bsd.obj.mk +++ b/share/mk/bsd.obj.mk @@ -1,4 +1,4 @@ -# $Id: bsd.obj.mk,v 1.7 1996/07/14 11:09:12 peter Exp $ +# $Id: bsd.obj.mk,v 1.8 1996/09/05 17:53:13 bde Exp $ # # The include file handles creating 'obj' directory # and cleaning up object files, log files etc. @@ -8,16 +8,16 @@ # # CLEANFILES Additional files to remove for the clean and cleandir targets. # -# MAKEOBJDIR Specify somewhere other than /usr/obj to root the object -# tree. Note: MAKEOBJDIR is an *enviroment* variable +# MAKEOBJDIRPREFIX Specify somewhere other than /usr/obj to root the object +# tree. Note: MAKEOBJDIRPREFIX 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=/somewhere/obj make' +# E.g. use `env MAKEOBJDIRPREFIX=/somewhere/obj make' # # NOOBJ Do not create build directory in object tree. # -# OBJLINK Create a symbolic link from ${.TARGETOBJDIR} to ${.CURDIR}/obj +# OBJLINK Create a symbolic link from ${CANONICALOBJDIR} to ${.CURDIR}/obj # Note: This BREAKS the read-only src tree rule! # # +++ targets +++ @@ -32,6 +32,26 @@ # create build directory. # +.if defined(MAKEOBJDIRPREFIX) +CANONICALOBJDIR:=${MAKEOBJDIRPREFIX}${.CURDIR} +.else +CANONICALOBJDIR:=/usr/obj${.CURDIR} +.endif + +# +# Warn of unorthodox object directory +# +objwarn: +.if ${.OBJDIR} == ${.CURDIR} + ${ECHO} "Warning: Object directory not changed from original ${.CURDIR}" +.elif !defined(MAKEOBJDIRPREFIX) && ${.OBJDIR} != ${CANONICALOBJDIR} +.if !defined(MAKEOBJDIR) + ${ECHO} "Warning: Using ${.OBJDIR} as object directory instead of\ + canonical ${CANONICALOBJDIR}" +.endif +.endif + + .if !target(obj) .if defined(NOOBJ) @@ -39,25 +59,25 @@ obj: .else .if !defined(OBJLINK) obj: _SUBDIR - @if ! test -d ${.TARGETOBJDIR}; then \ - mkdir -p ${.TARGETOBJDIR}; \ - if ! test -d ${.TARGETOBJDIR}; then \ - ${ECHO} "Unable to create ${.TARGETOBJDIR}."; \ + @if ! test -d ${CANONICALOBJDIR}; then \ + mkdir -p ${CANONICALOBJDIR}; \ + if ! test -d ${CANONICALOBJDIR}; then \ + ${ECHO} "Unable to create ${CANONICALOBJDIR}."; \ exit 1; \ fi; \ - ${ECHO} "${.TARGETOBJDIR} created for ${.CURDIR}"; \ + ${ECHO} "${CANONICALOBJDIR} created for ${.CURDIR}"; \ fi .else obj: _SUBDIR - @if ! test -d ${.TARGETOBJDIR}; then \ - mkdir -p ${.TARGETOBJDIR}; \ - if ! test -d ${.TARGETOBJDIR}; then \ - ${ECHO} "Unable to create ${.TARGETOBJDIR}."; \ + @if ! test -d ${CANONICALOBJDIR}; then \ + mkdir -p ${CANONICALOBJDIR}; \ + if ! test -d ${CANONICALOBJDIR}; then \ + ${ECHO} "Unable to create ${CANONICALOBJDIR}."; \ exit 1; \ fi; \ rm -f ${.CURDIR}/obj; \ - ln -s ${.TARGETOBJDIR} ${.CURDIR}/obj; \ - ${ECHO} "${.CURDIR} -> ${.TARGETOBJDIR}"; \ + ln -s ${CANONICALOBJDIR} ${.CURDIR}/obj; \ + ${ECHO} "${.CURDIR} -> ${CANONICALOBJDIR}"; \ fi .endif .endif @@ -65,11 +85,11 @@ obj: _SUBDIR .if !target(objlink) objlink: _SUBDIR - @if test -d ${.TARGETOBJDIR}; then \ + @if test -d ${CANONICALOBJDIR}; then \ rm -f ${.CURDIR}/obj; \ - ln -s ${.TARGETOBJDIR} ${.CURDIR}/obj; \ + ln -s ${CANONICALOBJDIR} ${.CURDIR}/obj; \ else \ - echo "No ${.TARGETOBJDIR} to link to - do a make obj."; \ + echo "No ${CANONICALOBJDIR} to link to - do a make obj."; \ fi .endif @@ -81,10 +101,10 @@ whereobj: .if defined(NOOBJ) @echo ${.CURDIR} .else - @if ! test -d ${.TARGETOBJDIR}; then \ + @if ! test -d ${CANONICALOBJDIR}; then \ echo ${.CURDIR}; \ else \ - echo ${.TARGETOBJDIR}; \ + echo ${CANONICALOBJDIR}; \ fi .endif .endif @@ -93,8 +113,8 @@ whereobj: # cleanup # cleanobj: - @if [ -d ${.TARGETOBJDIR} ]; then \ - rm -rf ${.TARGETOBJDIR}; \ + @if [ -d ${CANONICALOBJDIR} ]; then \ + rm -rf ${CANONICALOBJDIR}; \ else \ cd ${.CURDIR} && ${MAKE} clean cleandepend; \ fi diff --git a/share/mk/bsd.prog.mk b/share/mk/bsd.prog.mk index e0fb655..4787212 100644 --- a/share/mk/bsd.prog.mk +++ b/share/mk/bsd.prog.mk @@ -1,5 +1,5 @@ # from: @(#)bsd.prog.mk 5.26 (Berkeley) 6/25/91 -# $Id: bsd.prog.mk,v 1.38 1996/08/25 05:16:56 jkh Exp $ +# $Id: bsd.prog.mk,v 1.39 1996/09/05 18:05:08 bde Exp $ .if exists(${.CURDIR}/../Makefile.inc) .include "${.CURDIR}/../Makefile.inc" @@ -81,7 +81,7 @@ MAN1= ${PROG}.1 # here (or does maninstall always work when nothing is made?), .MAIN: all -all: ${PROG} all-man _SUBDIR +all: objwarn ${PROG} all-man _SUBDIR .if !target(clean) clean: _SUBDIR -- cgit v1.1