From owner-freebsd-current Fri Jun 21 19:19:42 1996 Return-Path: owner-current Received: (from root@localhost) by freefall.freebsd.org (8.7.5/8.7.3) id TAA18833 for current-outgoing; Fri, 21 Jun 1996 19:19:42 -0700 (PDT) Received: from time.cdrom.com (time.cdrom.com [204.216.27.226]) by freefall.freebsd.org (8.7.5/8.7.3) with ESMTP id TAA18819 for ; Fri, 21 Jun 1996 19:19:37 -0700 (PDT) Received: from time.cdrom.com (localhost [127.0.0.1]) by time.cdrom.com (8.7.5/8.6.9) with ESMTP id TAA24934 for ; Fri, 21 Jun 1996 19:19:31 -0700 (PDT) To: current@freebsd.org Subject: Wanted: Testers for an alternate to /usr/obj (as we know it). Date: Fri, 21 Jun 1996 19:19:31 -0700 Message-ID: <24932.835409971@time.cdrom.com> From: "Jordan K. Hubbard" Sender: owner-current@freebsd.org X-Loop: FreeBSD.org Precedence: bulk Well, I sat down this morning with the intention that /usr/obj change its spots before sundown and it looks like I made it with time to spare. Actually, I was surprised at how easy this was and, if anything, I took away more than I added. These files clearly haven't been seriously looked at for awhile, and there were all sorts of redundant .USE macros, missing SUBDIR checks (which probably worked only because we never pushed it) and altogether dusty artifacts from the various "ages" of FreeBSD's build system. Anyway, so I cleaned it up and changed things so that make and the mk macros now support the following paradigm: The MAKEOBJDIR environment variable controls the root of the obj tree, which is by default /usr/obj. ${.CURDIR} always points to the source, ${.OBJDIR} always points to ${MAKEOBJDIR}/${.CURDIR} (essentially). ${.CURDIR} and ${.OBJDIR} never point to the same location. if ${.OBJDIR} exists when make starts, it chdir()s to that location before doing anything else (same as before). I didn't like having to beat on make, but the changes I made to it were very minor and vastly simplified the task of locating the object dir location for a corresponding source (something that was done with some truly gross sed hackery before). None of the existing functionality of /usr/obj has been lost. The obj target now basically does nothing more than create ${.OBJDIR} and the cleandir target blows it away again if it exists. In all scenarios, if ${.OBJDIR} does not exist then everything happens transparently in ${.CURDIR} instead. I haven't tried burning a CD of /usr/src and doing a make world in it yet, but that's my next project. Barring any modules which always stomped /usr/src in the past, it should even work. In case you ISPs out there haven't twigged to the significance of this yet either, with these changes you can now keep a single copy of /usr/src up to date for any number of machines, having simultaneous `make worlds' run from a single NFS mounted source partition on multiple clients with none of the mutual interferance problems we have now. That's why *I* wanted this feature, anyway! :-) If people could help me test this a little, it would be much appreciated. The process of conversion is very easy, assuming that you have a /usr/src (or wherever you keep it) which is reasonably -current: 1. cd /usr/src 2. make cleandir 3. patch -p0 < my-diffs 4. cd usr.bin/make; make all install; cd ../.. 5. cd share/mk; make install; cd ../.. 6. remove tcl from /usr/src/lib/Makefile - it doesn't work with this new system and is going to change substantially enough in the near future that it's not worth converting. Now build the world. Before you start, you can also do a: touch /usr/src/hithere And then do: find /usr/src -newer /usr/src/hithere after your build to see if anything at all in /usr/src was touched. There shouldn't have been, but I haven't finished my own checks yet so let me know if you encounter anything. Thanks! Jordan Unidiffs: --- Index: Makefile =================================================================== RCS file: /home/ncvs/src/Makefile,v retrieving revision 1.83 diff -u -r1.83 Makefile --- Makefile 1996/06/20 18:47:04 1.83 +++ Makefile 1996/06/22 00:16:14 @@ -1,5 +1,5 @@ # -# $Id$ +# $Id: Makefile,v 1.83 1996/06/20 18:47:04 jkh Exp $ # # Make command line options: # -DCLOBBER will remove /usr/include @@ -132,7 +132,7 @@ @echo " Reinstall ${DESTDIR} The whole thing" @echo "--------------------------------------------------------------" @echo - ${MAKE} install + cd ${.CURDIR} && ${MAKE} install cd ${.CURDIR}/share/man && ${MAKE} makedb hierarchy: @@ -166,25 +166,8 @@ @echo "--------------------------------------------------------------" @echo " Cleaning up the source tree, and rebuilding the obj tree" @echo "--------------------------------------------------------------" - @echo - here=`pwd`; dest=/usr/obj`echo $$here | sed 's,^/usr/src,,'`; \ - if test -d /usr/obj -a ! -d $$dest; then \ - mkdir -p $$dest; \ - else \ - true; \ - fi; \ - cd $$dest && rm -rf ${SUBDIR} - find . -name obj | xargs rm -rf -.if defined(MAKE_LOCAL) & exists(local) & exists(local/Makefile) - # The cd is done as local may well be a symbolic link - -cd local && find . -name obj | xargs rm -rf -.endif -.if defined(MAKE_PORTS) & exists(ports) & exists(ports/Makefile) - # The cd is done as local may well be a symbolic link - -cd ports && find . -name obj | xargs rm -rf -.endif - ${MAKE} cleandir - ${MAKE} obj + cd ${.CURDIR} && ${MAKE} cleandir + cd ${.CURDIR} && ${MAKE} obj .endif installmost: @@ -229,7 +212,7 @@ @echo "--------------------------------------------------------------" @echo " Rebuilding ${DESTDIR}/usr/share/mk" @echo "--------------------------------------------------------------" - cd ${.CURDIR}/share/mk && ${MAKE} install + cd ${.CURDIR}/share/mk && ${MAKE} install includes: @echo "--------------------------------------------------------------" #ifndef lint Index: share/mk/Makefile =================================================================== RCS file: /home/ncvs/src/share/mk/Makefile,v retrieving revision 1.10 diff -u -r1.10 Makefile --- Makefile 1996/04/12 11:13:29 1.10 +++ Makefile 1996/06/21 21:50:19 @@ -1,4 +1,4 @@ -# $Id$ +# $Id: Makefile,v 1.10 1996/04/12 11:13:29 wosch Exp $ # From: @(#)Makefile 8.1 (Berkeley) 6/8/93 FILES= bsd.README @@ -11,7 +11,7 @@ all clean cleandir depend lint tags: afterinstall: - ${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 444 ${FILES} \ + cd ${.CURDIR} && ${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 444 ${FILES} \ ${DESTDIR}${BINDIR}/mk .include Index: share/mk/bsd.dep.mk =================================================================== RCS file: /home/ncvs/src/share/mk/bsd.dep.mk,v retrieving revision 1.4 diff -u -r1.4 bsd.dep.mk --- bsd.dep.mk 1996/05/25 23:09:46 1.4 +++ bsd.dep.mk 1996/06/22 01:08:09 @@ -1,4 +1,4 @@ -# $Id$ +# $Id: bsd.dep.mk,v 1.4 1996/05/25 23:09:46 wosch Exp $ # # The include file handles Makefile dependencies. # @@ -33,7 +33,7 @@ # some of the rules involve .h sources, so remove them from mkdep line .if !target(depend) -depend: beforedepend ${DEPENDFILE} afterdepend ${_DEPSUBDIR} +depend: beforedepend ${DEPENDFILE} afterdepend _SUBDIR .if defined(SRCS) # .if defined ${SRCS:M*.[sS]} does not work @@ -58,7 +58,7 @@ .endif .else -${DEPENDFILE}: ${_DEPSUBDIR} +${DEPENDFILE}: _SUBDIR .endif .if !target(beforedepend) beforedepend: @@ -70,17 +70,33 @@ .if !target(tags) .if defined(SRCS) -tags: ${SRCS} +tags: ${SRCS} _SUBDIR -cd ${.CURDIR}; ctags -f /dev/stdout ${.ALLSRC:N*.h} | \ sed "s;\${.CURDIR}/;;" > tags .else -tags: +tags: _SUBDIR .endif .endif .if defined(SRCS) -clean: -cleandir: cleandepend -cleandepend: - rm -f ${DEPENDFILE} ${.CURDIR}/tags +.if !target(clean) +clean: _SUBDIR +.endif +.if !target(cleandepend) +cleandepend: _SUBDIR + rm -f ${DEPENDFILE} tags +.endif +.endif + +_SUBDIR: .USE +.if defined(SUBDIR) && !empty(SUBDIR) + @for entry in ${SUBDIR}; do \ + (${ECHODIR} "===> ${DIRPRFX}$$entry"; \ + if test -d ${.CURDIR}/$${entry}.${MACHINE}; then \ + cd ${.CURDIR}/$${entry}.${MACHINE}; \ + else \ + cd ${.CURDIR}/$${entry}; \ + fi; \ + ${MAKE} ${.TARGET:S/realinstall/install/:S/.depend/depend/} DIRPRFX=${DIRPRFX}$$entry/); \ + done .endif Index: share/mk/bsd.doc.mk =================================================================== RCS file: /home/ncvs/src/share/mk/bsd.doc.mk,v retrieving revision 1.24 diff -u -r1.24 bsd.doc.mk --- bsd.doc.mk 1996/03/09 23:48:53 1.24 +++ bsd.doc.mk 1996/06/21 23:46:57 @@ -1,5 +1,5 @@ # from: @(#)bsd.doc.mk 5.3 (Berkeley) 1/2/91 -# $Id$ +# $Id: bsd.doc.mk,v 1.24 1996/03/09 23:48:53 wosch Exp $ PRINTER?= ascii @@ -70,29 +70,10 @@ .endif .endif -.if !target(obj) -.if defined(NOOBJ) -obj: -.else -obj: - @cd ${.CURDIR}; rm -f obj; \ - here=`pwd`; dest=/usr/obj`echo $$here | sed 's,^/usr/src,,'`; \ - ${ECHO} "$$here -> $$dest"; ln -s $$dest obj; \ - if test -d /usr/obj -a ! -d $$dest; then \ - mkdir -p $$dest; \ - else \ - true; \ - fi; -.endif -.endif - clean: rm -f ${DOC}.${PRINTER} ${DOC}.ps ${DOC}.ascii \ ${DOC}.ps.gz ${DOC}.ascii.gz Errs errs mklog ${CLEANFILES} -cleandir: clean - cd ${.CURDIR}; rm -rf obj - FILES?= ${SRCS} realinstall: @if [ ! -d "${DESTDIR}${BINDIR}/${VOLUME}" ]; then \ @@ -151,10 +132,11 @@ .if !target(depend) depend: - .endif .if !target(maninstall) maninstall: - .endif + +.include +.include Index: share/mk/bsd.info.mk =================================================================== RCS file: /home/ncvs/src/share/mk/bsd.info.mk,v retrieving revision 1.17 diff -u -r1.17 bsd.info.mk --- bsd.info.mk 1996/03/07 23:39:45 1.17 +++ bsd.info.mk 1996/06/21 23:25:17 @@ -1,4 +1,4 @@ -# $Id$ +# $Id: bsd.info.mk,v 1.17 1996/03/07 23:39:45 wosch Exp $ BINMODE= 444 BINDIR?= /usr/share/info @@ -17,10 +17,10 @@ .if !defined(NOINFOCOMPRESS) IFILES= ${INFO:S/$/.info.gz/g} -all: ${IFILES} +all: ${IFILES} _SUBDIR .else IFILES= ${INFO:S/$/.info/g} -all: ${IFILES} +all: ${IFILES} _SUBDIR .endif GZIPCMD?= gzip @@ -37,7 +37,7 @@ .endif .if !target(distribute) -distribute: +distribute: _SUBDIR cd ${.CURDIR} ; $(MAKE) install DESTDIR=${DISTDIR}/${DISTRIBUTION} SHARED=copies .endif @@ -46,32 +46,13 @@ ${MAKEINFO} ${MAKEINFOFLAGS} -I ${.CURDIR} ${SRCS:S/^/${.CURDIR}\//g} -o ${INFO}.info .endif -depend: +depend: _SUBDIR @echo -n -.if !target(obj) -.if defined(NOOBJ) -obj: -.else -obj: - @cd ${.CURDIR}; rm -f obj; \ - here=`pwd`; dest=/usr/obj`echo $$here | sed 's,^/usr/src,,'`; \ - ${ECHO} "$$here -> $$dest"; ln -s $$dest obj; \ - if test -d /usr/obj -a ! -d $$dest; then \ - mkdir -p $$dest; \ - else \ - true; \ - fi; -.endif -.endif - -clean: +clean: _SUBDIR rm -f ${INFO:S/$/.info*/g} Errs errs mklog ${CLEANFILES} -cleandir: clean - cd ${.CURDIR}; rm -rf obj - -install: +install: _SUBDIR @if [ ! -d "${DESTDIR}${BINDIR}" ]; then \ /bin/rm -f ${DESTDIR}${BINDIR} ; \ mkdir -p ${DESTDIR}${BINDIR} ; \ @@ -84,6 +65,8 @@ ${IFILES} ${DESTDIR}${BINDIR} .if !target(maninstall) -maninstall: - +maninstall: _SUBDIR .endif + +.include +.include Index: share/mk/bsd.kmod.mk =================================================================== RCS file: /home/ncvs/src/share/mk/bsd.kmod.mk,v retrieving revision 1.22 diff -u -r1.22 bsd.kmod.mk --- bsd.kmod.mk 1996/06/17 15:11:10 1.22 +++ bsd.kmod.mk 1996/06/21 23:28:00 @@ -1,5 +1,5 @@ # From: @(#)bsd.prog.mk 5.26 (Berkeley) 6/25/91 -# $Id$ +# $Id: bsd.kmod.mk,v 1.22 1996/06/17 15:11:10 bde Exp $ # # The include file handles installing Loadable Kernel Modules. # includes the file named "../Makefile.inc" if it exists, @@ -134,25 +134,12 @@ .endif .elif !target(maninstall) -maninstall: +maninstall: _SUBDIR all-man: .endif -_PROGSUBDIR: .USE -.if defined(SUBDIR) && !empty(SUBDIR) - @for entry in ${SUBDIR}; do \ - (${ECHODIR} "===> $$entry"; \ - if test -d ${.CURDIR}/$${entry}.${MACHINE}; then \ - cd ${.CURDIR}/$${entry}.${MACHINE}; \ - else \ - cd ${.CURDIR}/$${entry}; \ - fi; \ - ${MAKE} ${.TARGET:S/realinstall/install/:S/.depend/depend/}); \ - done -.endif - .MAIN: all -all: ${PROG} all-man _PROGSUBDIR +all: ${PROG} all-man _SUBDIR CLEANFILES+=${PROG} ${OBJS} @@ -164,7 +151,7 @@ afterinstall: .endif -realinstall: _PROGSUBDIR +realinstall: _SUBDIR ${INSTALL} ${COPY} -o ${KMODOWN} -g ${KMODGRP} -m ${KMODMODE} \ ${INSTALLFLAGS} ${PROG} ${DESTDIR}${KMODDIR} .if defined(LINKS) && !empty(LINKS) @@ -180,7 +167,7 @@ done; true .endif -install: afterinstall +install: afterinstall _SUBDIR .if !defined(NOMAN) afterinstall: realinstall maninstall .else @@ -191,12 +178,12 @@ DISTRIBUTION?= bin .if !target(distribute) -distribute: +distribute: _SUBDIR cd ${.CURDIR} ; $(MAKE) install DESTDIR=${DISTDIR}/${DISTRIBUTION} SHARED=copies .endif .if !target(tags) -tags: ${SRCS} _PROGSUBDIR +tags: ${SRCS} _SUBDIR .if defined(PROG) -cd ${.CURDIR}; ctags -f /dev/stdout ${.ALLSRC} | \ sed "s;\${.CURDIR}/;;" > tags @@ -221,8 +208,5 @@ ./vnode_if.h: vnode_if.h -_DEPSUBDIR= _PROGSUBDIR -_SUBDIRUSE: _PROGSUBDIR -.include .include - +.include Index: share/mk/bsd.lib.mk =================================================================== RCS file: /home/ncvs/src/share/mk/bsd.lib.mk,v retrieving revision 1.35 diff -u -r1.35 bsd.lib.mk --- bsd.lib.mk 1996/06/17 15:59:51 1.35 +++ bsd.lib.mk 1996/06/21 23:44:58 @@ -1,5 +1,5 @@ # from: @(#)bsd.lib.mk 5.26 (Berkeley) 5/2/91 -# $Id$ +# $Id: bsd.lib.mk,v 1.35 1996/06/17 15:59:51 phk Exp $ # .if exists(${.CURDIR}/../Makefile.inc) @@ -124,20 +124,7 @@ PICFLAG=-fpic .endif -_LIBSUBDIR: .USE -.if defined(SUBDIR) && !empty(SUBDIR) - @for entry in ${SUBDIR}; do \ - (${ECHODIR} "===> ${DIRPRFX}$$entry"; \ - if test -d ${.CURDIR}/$${entry}.${MACHINE}; then \ - cd ${.CURDIR}/$${entry}.${MACHINE}; \ - else \ - cd ${.CURDIR}/$${entry}; \ - fi; \ - ${MAKE} ${.TARGET:S/realinstall/install/:S/.depend/depend/} DIRPRFX=${DIRPRFX}$$entry/); \ - done -.endif - -all: ${_LIBS} all-man _LIBSUBDIR # llib-l${LIB}.ln +all: ${_LIBS} all-man _SUBDIR # llib-l${LIB}.ln OBJS+= ${SRCS:N*.h:R:S/$/.o/g} @@ -184,29 +171,15 @@ ${LINT} -C${LIB} ${CFLAGS} ${.ALLSRC:M*.c} .if !target(clean) -clean: _LIBSUBDIR - rm -f a.out Errs errs mklog ${CLEANFILES} ${OBJS} - rm -f lib${LIB}.a llib-l${LIB}.ln - rm -f ${POBJS} profiled/*.o lib${LIB}_p.a - rm -f ${SOBJS} shared/*.o - rm -f lib${LIB}.so.*.* lib${LIB}_pic.a -.if defined(CLEANDIRS) - rm -rf ${CLEANDIRS} -.endif -.endif - -.if !target(cleandir) -cleandir: _LIBSUBDIR +clean: _SUBDIR rm -f a.out Errs errs mklog ${CLEANFILES} ${OBJS} rm -f lib${LIB}.a llib-l${LIB}.ln - rm -f ${.CURDIR}/tags .depend rm -f ${POBJS} profiled/*.o lib${LIB}_p.a rm -f ${SOBJS} shared/*.o rm -f lib${LIB}.so.*.* lib${LIB}_pic.a .if defined(CLEANDIRS) rm -rf ${CLEANDIRS} .endif - cd ${.CURDIR}; rm -rf obj; .endif .if defined(SRCS) @@ -259,7 +232,7 @@ done; true .endif -install: afterinstall _LIBSUBDIR +install: afterinstall _SUBDIR .if !defined(NOMAN) afterinstall: realinstall maninstall .else @@ -269,7 +242,7 @@ DISTRIBUTION?= bin .if !target(distribute) -distribute: _LIBSUBDIR +distribute: _SUBDIR cd ${.CURDIR} ; $(MAKE) install DESTDIR=${DISTDIR}/${DISTRIBUTION} SHARED=copies .endif @@ -278,7 +251,7 @@ .endif .if !target(tags) -tags: ${SRCS} +tags: ${SRCS} _SUBDIR -cd ${.CURDIR}; ctags -f /dev/stdout ${.ALLSRC:M*.c} | \ sed "s;\${.CURDIR}/;;" > tags .endif @@ -290,21 +263,5 @@ all-man: .endif -.if !target(obj) -.if defined(NOOBJ) -obj: _LIBSUBDIR -.else -obj: _LIBSUBDIR - @cd ${.CURDIR}; rm -rf obj; \ - here=`pwd`; dest=/usr/obj`echo $$here | sed 's,^/usr/src,,'`; \ - ${ECHO} "$$here -> $$dest"; ln -s $$dest obj; \ - if test -d /usr/obj -a ! -d $$dest; then \ - mkdir -p $$dest; \ - else \ - true; \ - fi; -.endif -.endif - -_DEPSUBDIR= _LIBSUBDIR .include +.include Index: share/mk/bsd.man.mk =================================================================== RCS file: /home/ncvs/src/share/mk/bsd.man.mk,v retrieving revision 1.12 diff -u -r1.12 bsd.man.mk --- bsd.man.mk 1996/05/25 23:09:48 1.12 +++ bsd.man.mk 1996/05/25 23:09:48 @@ -1,4 +1,4 @@ -# $Id$ +# $Id: bsd.man.mk,v 1.12 1996/05/25 23:09:48 wosch Exp $ # # The include file handles installing manual pages and # their links. includes the file named "../Makefile.inc" Index: share/mk/bsd.obj.mk =================================================================== RCS file: /home/ncvs/src/share/mk/bsd.obj.mk,v retrieving revision 1.4 diff -u -r1.4 bsd.obj.mk --- bsd.obj.mk 1996/05/27 23:05:54 1.4 +++ bsd.obj.mk 1996/06/22 01:11:25 @@ -1,4 +1,4 @@ -# $Id$ +# $Id: bsd.obj.mk,v 1.4 1996/05/27 23:05:54 wosch Exp $ # # The include file handles creating 'obj' directory # and cleaning up object files, log files etc. @@ -6,25 +6,16 @@ # # +++ 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] -# # CLEANFILES Additional files to remove for the clean and cleandir targets. # -# MAKEOBJDIR A file name to the directory where the targets -# are built. Note: MAKEOBJDIR is an *enviroment* variable +# MAKEOBJDIR Specify somewhere other than /usr/obj to root the object +# tree. 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' +# E.g. use `env MAKEOBJDIR=/somewhere/obj make' # -# 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] +# NOOBJ Do not create build directory in object tree. # # # +++ targets +++ @@ -33,67 +24,52 @@ # 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. +# remove the build directory (and all its contents) created by obj # # obj: -# create 'obj' directory. +# create build directory. # -.if defined(MAKEOBJDIR) && !empty(MAKEOBJDIR) -__objdir = ${MAKEOBJDIR} -.else - -.if defined(MACHINE) && !empty(MACHINE) -__objdir = obj # obj.${MACHINE} -.else -__objdir = obj -.endif -.endif - - .if !target(obj) .if defined(NOOBJ) obj: .else - -obj: _SUBDIRUSE cleanobj -.if defined(NOOBJLINK) - mkdir ${.CURDIR}/${__objdir} -.else - @if test -d ${BSDOBJDIR}; then \ - cd ${.CURDIR}; here=${.CURDIR}; \ - dest=${BSDOBJDIR}`echo $$here | \ - sed "s,^${BSDSRCDIR},,"`/${__objdir}; \ - ${ECHO} "$$here/${__objdir} -> $$dest"; \ - ln -s $$dest ${__objdir}; \ - if test ! -d $$dest; then \ - mkdir -p $$dest; \ - fi; \ - else \ - ${ECHO} "obj tree \"${BSDOBJDIR}\" does not exist."; \ +obj: _SUBDIR + @if ! test -d ${.OBJDIR}; then \ + ${ECHO} "${.OBJDIR} created for ${.CURDIR}"; \ + mkdir -p ${.OBJDIR}; \ + if ! test -d ${.OBJDIR}; then \ + ${ECHO} "Unable to create ${.OBJDIR}."; \ + exit 1; \ + fi; \ fi .endif .endif -.endif # # cleanup # -cleanobj: - rm -f -r ${.CURDIR}/${__objdir} +cleanobj: + @if [ -d ${.OBJDIR} ]; then \ + rm -rf ${.OBJDIR}; \ + else \ + cd ${.CURDIR} && ${MAKE} clean cleandepend; \ + fi +.if !target(cleanfiles) cleanfiles: rm -f a.out Errs errs mklog ${CLEANFILES} +.endif # see bsd.dep.mk .if !target(cleandepend) cleandepend: + @rm -f .depend .endif .if !target(clean) -clean: _SUBDIRUSE cleanfiles +clean: cleanfiles _SUBDIR .endif -cleandir: _SUBDIRUSE cleanfiles cleandepend cleanobj +cleandir: cleanobj _SUBDIR Index: share/mk/bsd.own.mk =================================================================== RCS file: /home/ncvs/src/share/mk/bsd.own.mk,v retrieving revision 1.6 diff -u -r1.6 bsd.own.mk --- bsd.own.mk 1996/05/25 23:09:49 1.6 +++ bsd.own.mk 1996/06/21 21:42:32 @@ -1,4 +1,4 @@ -# $Id$ +# $Id: bsd.own.mk,v 1.6 1996/05/25 23:09:49 wosch Exp $ # # The include file set common variables for owner, # group, mode, and directories. Defaults are in brackets. @@ -6,16 +6,6 @@ # # +++ variables +++ # -# where the system object and source trees are kept; can be configurable -# by the user in case they want them in ~/foosrc and ~/fooobj, for example -# where the system object and source trees are kept; can be configurable -# by the user in case they want them in ~/foosrc and ~/fooobj, for example -# BSDOBJDIR The real path to the system 'obj' tree, so that 'make obj' -# will work correctly. [/usr/obj] -# -# BSDSRCDIR The real path to the system sources, so that 'make obj' -# will work correctly. [/usr/src] -# # DESTDIR Change the tree where the file gets installed. [not set] # # DISTDIR Change the tree where the file for a distribution @@ -115,10 +105,6 @@ # # NLSMODE National Language Support files mode. [${NONBINMODE}] # - - -BSDSRCDIR?= /usr/src -BSDOBJDIR?= /usr/obj # Binaries Index: share/mk/bsd.port.mk =================================================================== RCS file: /home/ncvs/src/share/mk/bsd.port.mk,v retrieving revision 1.212 diff -u -r1.212 bsd.port.mk --- bsd.port.mk 1996/06/20 23:52:45 1.212 +++ bsd.port.mk 1996/06/21 22:29:09 @@ -3,7 +3,7 @@ # bsd.port.mk - 940820 Jordan K. Hubbard. # This file is in the public domain. # -# $Id$ +# $Id: bsd.port.mk,v 1.212 1996/06/20 23:52:45 jkh Exp $ # # Please view me with 4 column tabs! @@ -210,8 +210,8 @@ # Support for an encapsulation in /usr/src - these are essentially simplied ports # and have a number of defaults we can presume right off the bat. .if defined(SRC_ENCAPSULATION) -.if exists (${.CURDIR}/obj) -WRKDIR=${.CURDIR}/obj +.if exists (${BSDOBJDIR}/${.CURDIR}) +WRKDIR=${BSDOBJDIR}/${.CURDIR} .else NO_WRKDIR= yes .endif @@ -226,28 +226,7 @@ # Finally, give us working obj and cleandir targets to make us more compatible # with "traditional" /usr/src ports. -.if !target(obj) -.if defined(NOOBJ) -obj: - @${DO_NADA} -.else -obj: - @cd ${.CURDIR}; rm -rf obj; here=`pwd`; \ - dest=/usr/obj`echo $$here | sed 's,^/usr/src,,'`; ${ECHO} "$$here -> $$dest"; \ - ln -s $$dest obj; if test -d /usr/obj -a ! -d $$dest; then mkdir -p $$dest; fi -.endif -.endif - -.if !target(cleandir) -.if defined(NOCLEANDIR) -cleandir: - @${DO_NADA} -.else -cleandir: clean - @if [ "${WRKDIR}" != "${.CURDIR}" ]; then ${RM} -rf ${WRKDIR}/; fi - @rm -f ${.CURDIR}/obj -.endif -.endif +.include .if !target(distribute) distribute: @@ -1002,7 +981,7 @@ .if !target(clean) clean: pre-clean @${ECHO_MSG} "===> Cleaning for ${PKGNAME}" -.if !defined(NO_WRKDIR) && !exists(${.CURDIR}/obj) +.if !defined(NO_WRKDIR) @${RM} -rf ${WRKDIR} .else @${RM} -f ${WRKDIR}/.*_done Index: share/mk/bsd.prog.mk =================================================================== RCS file: /home/ncvs/src/share/mk/bsd.prog.mk,v retrieving revision 1.32 diff -u -r1.32 bsd.prog.mk --- bsd.prog.mk 1996/06/17 15:59:52 1.32 +++ bsd.prog.mk 1996/06/21 23:40:00 @@ -1,5 +1,5 @@ # from: @(#)bsd.prog.mk 5.26 (Berkeley) 6/25/91 -# $Id$ +# $Id: bsd.prog.mk,v 1.32 1996/06/17 15:59:52 phk Exp $ .if exists(${.CURDIR}/../Makefile.inc) .include "${.CURDIR}/../Makefile.inc" @@ -129,53 +129,27 @@ .endif .endif -_PROGSUBDIR: .USE -.if defined(SUBDIR) && !empty(SUBDIR) - @for entry in ${SUBDIR}; do \ - (${ECHODIR} "===> ${DIRPRFX}$$entry"; \ - if test -d ${.CURDIR}/$${entry}.${MACHINE}; then \ - cd ${.CURDIR}/$${entry}.${MACHINE}; \ - else \ - cd ${.CURDIR}/$${entry}; \ - fi; \ - ${MAKE} ${.TARGET:S/realinstall/install/:S/.depend/depend/} DIRPRFX=${DIRPRFX}$$entry/); \ - done -.endif - # XXX I think MANDEPEND is only used for groff. It should be named more # generally and perhaps not be in the maninstall dependencies now it is # here (or does maninstall always work when nothing is made?), .MAIN: all -all: ${PROG} all-man _PROGSUBDIR +all: ${PROG} all-man _SUBDIR .if !target(clean) -clean: _PROGSUBDIR +clean: _SUBDIR rm -f a.out Errs errs mklog ${PROG} ${OBJS} ${CLEANFILES} .if defined(CLEANDIRS) rm -rf ${CLEANDIRS} .endif .endif -.if !target(cleandir) -cleandir: _PROGSUBDIR - rm -f a.out Errs errs mklog ${PROG} ${OBJS} ${CLEANFILES} - rm -f ${.CURDIR}/tags .depend -.if defined(CLEANDIRS) - rm -rf ${CLEANDIRS} -.endif - cd ${.CURDIR}; rm -rf obj; -.endif - .if !target(install) .if !target(beforeinstall) beforeinstall: .endif -.if !target(afterinstall) -afterinstall: -.endif -realinstall: _PROGSUBDIR +realinstall: beforeinstall .if defined(PROG) ${INSTALL} ${COPY} ${STRIP} -o ${BINOWN} -g ${BINGRP} -m ${BINMODE} \ ${INSTALLFLAGS} ${PROG} ${DESTDIR}${BINDIR} @@ -197,46 +171,29 @@ done; true .endif -install: afterinstall +install: afterinstall _SUBDIR .if !defined(NOMAN) afterinstall: realinstall maninstall .else afterinstall: realinstall .endif -realinstall: beforeinstall .endif DISTRIBUTION?= bin .if !target(distribute) -distribute: +distribute: _SUBDIR cd ${.CURDIR} ; $(MAKE) install DESTDIR=${DISTDIR}/${DISTRIBUTION} SHARED=copies .endif .if !target(lint) -lint: ${SRCS} _PROGSUBDIR +lint: ${SRCS} _SUBDIR .if defined(PROG) @${LINT} ${LINTFLAGS} ${CFLAGS} ${.ALLSRC} | more 2>&1 .endif .endif -.if !target(obj) -.if defined(NOOBJ) -obj: _PROGSUBDIR -.else -obj: _PROGSUBDIR - @cd ${.CURDIR}; rm -rf obj; \ - here=`pwd`; dest=/usr/obj`echo $$here | sed 's,^/usr/src,,'`; \ - ${ECHO} "$$here -> $$dest"; ln -s $$dest obj; \ - if test -d /usr/obj -a ! -d $$dest; then \ - mkdir -p $$dest; \ - else \ - true; \ - fi; -.endif -.endif - .if !target(tags) -tags: ${SRCS} _PROGSUBDIR +tags: ${SRCS} _SUBDIR .if defined(PROG) -cd ${.CURDIR}; ctags -f /dev/stdout ${.ALLSRC} | \ sed "s;\${.CURDIR}/;;" > tags @@ -250,5 +207,5 @@ all-man: .endif -_DEPSUBDIR= _PROGSUBDIR .include +.include Index: share/mk/bsd.sgml.mk =================================================================== RCS file: /home/ncvs/src/share/mk/bsd.sgml.mk,v retrieving revision 1.5 diff -u -r1.5 bsd.sgml.mk --- bsd.sgml.mk 1996/05/27 23:12:15 1.5 +++ bsd.sgml.mk 1996/06/21 23:42:40 @@ -1,7 +1,7 @@ # bsd.sgml.mk - 8 Sep 1995 John Fieber # This file is in the public domain. # -# $Id$ +# $Id: bsd.sgml.mk,v 1.5 1996/05/27 23:12:15 wosch Exp $ # # The include file handles installing sgml documents. # includes the file named "../Makefile.inc" if it exists, @@ -81,7 +81,6 @@ .if !target(print) print: ${FORMATS:S/^/print-/g} - .endif spell: ${SRCS} @@ -146,10 +145,11 @@ .endfor -.for __target in beforeinstall afterinstall maninstall depend _SUBDIRUSE +.for __target in beforeinstall afterinstall maninstall depend _SUBDIR .if !target(__target) ${__target}: .endif .endfor +.include .include Index: usr.bin/make/main.c =================================================================== RCS file: /home/ncvs/src/usr.bin/make/main.c,v retrieving revision 1.3 diff -u -r1.3 main.c --- main.c 1995/05/30 06:32:00 1.3 +++ main.c 1996/06/21 22:12:57 @@ -375,6 +375,7 @@ char mdpath[MAXPATHLEN + 1]; char obpath[MAXPATHLEN + 1]; char cdpath[MAXPATHLEN + 1]; + char *realobjdir; /* Where we'd like to go */ struct utsname utsname; char *machine = getenv("MACHINE"); @@ -424,12 +425,10 @@ * and modify the paths for the Makefiles apropriately. The * current directory is also placed as a variable for make scripts. */ - if (!(path = getenv("MAKEOBJDIR"))) { + if (!(path = getenv("MAKEOBJDIR"))) path = _PATH_OBJDIR; - (void) sprintf(mdpath, "%s.%s", path, machine); - } - else - (void) strncpy(mdpath, path, MAXPATHLEN + 1); + (void) snprintf(mdpath, MAXPATHLEN, "%s%s", path, curdir); + realobjdir = mdpath; /* This is where we'd _like_ to be, anyway */ if (stat(mdpath, &sb) == 0 && S_ISDIR(sb.st_mode)) { @@ -447,27 +446,8 @@ objdir = mdpath; } } - else { - if (stat(path, &sb) == 0 && S_ISDIR(sb.st_mode)) { - - if (chdir(path)) { - (void)fprintf(stderr, "make warning: %s: %s.\n", - path, strerror(errno)); - objdir = curdir; - } - else { - if (path[0] != '/') { - (void) sprintf(obpath, "%s/%s", curdir, - path); - objdir = obpath; - } - else - objdir = obpath; - } - } - else - objdir = curdir; - } + else + objdir = curdir; setenv("PWD", objdir, 1); @@ -509,7 +489,7 @@ if (objdir != curdir) Dir_AddDir(dirSearchPath, curdir); Var_Set(".CURDIR", curdir, VAR_GLOBAL); - Var_Set(".OBJDIR", objdir, VAR_GLOBAL); + Var_Set(".OBJDIR", realobjdir, VAR_GLOBAL); /* * Initialize various variables. Index: usr.bin/make/pathnames.h =================================================================== RCS file: /home/ncvs/src/usr.bin/make/pathnames.h,v retrieving revision 1.2 diff -u -r1.2 pathnames.h --- pathnames.h 1995/01/23 21:01:52 1.2 +++ pathnames.h 1996/06/21 21:25:23 @@ -31,10 +31,10 @@ * SUCH DAMAGE. * * from: @(#)pathnames.h 5.2 (Berkeley) 6/1/90 - * $Id$ + * $Id: pathnames.h,v 1.2 1995/01/23 21:01:52 jkh Exp $ */ -#define _PATH_OBJDIR "obj" +#define _PATH_OBJDIR "/usr/obj" #define _PATH_DEFSHELLDIR "/bin" #define _PATH_DEFSYSMK "/usr/share/mk/sys.mk" #define _PATH_DEFSYSPATH "/usr/share/mk"