Merge bsd.obj.mk's version of the _SUBDIR target with bsd.subdir.mk.

Ensure all standard targets honor SUBDIR.  Now `make obj' descends into
SUBDIRs even if NOOBJ is set (some descendants may still need an object
directory, but we do not have such precedents).  Now `make install' in
non-bsd.subdir.mk makefiles runs `afterinstall' target _after_ `install'
in SUBDIRs, like we do in bsd.subdir.mk.  Nothing depended on the wrong
order anyway.

Fixed `distribute' targets (except for the bsd.subdir.mk version) so that
they do not depend on _SUBDIR; `distribute' calls `install' which already
depends on _SUBDIR.

De-standardize `maninstall', otherwise manpages would be installed twice.
(To be revised later.)
This commit is contained in:
Ruslan Ermilov 2002-04-23 09:03:56 +00:00
parent c1deb99469
commit b25a566d47
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=95306
14 changed files with 54 additions and 152 deletions

View File

@ -85,7 +85,7 @@
TGTS= afterdistribute all all-man buildkernel buildworld checkdpadd clean \
cleandepend cleandir depend distribute distribworld everything \
hierarchy includes install installcheck installkernel kernel \
reinstallkernel installmost installworld libraries lint maninstall \
reinstallkernel installmost installworld libraries lint \
mk most obj objlink regress rerelease tags update
PATH= /sbin:/bin:/usr/sbin:/usr/bin

View File

@ -231,9 +231,6 @@ MLINKS+=vpo.4 imm.4
# XXX NOT IMPORTED: man4.hp300 man4.sparc man4.tahoe man4.vax
.if exists(${.CURDIR}/man4.${MACHINE_ARCH})
SUBDIR= man4.${MACHINE_ARCH}
.if make(maninstall)
maninstall:: _SUBDIR
.endif
.endif
.include <bsd.prog.mk>

View File

@ -21,8 +21,4 @@ MLINKS+=rc.8 ${MACHINE_ARCH}/rc.${MACHINE_ARCH}.8
SUBDIR= man8.${MACHINE_ARCH}
.endif
.if make(maninstall)
maninstall:: _SUBDIR
.endif
.include <bsd.prog.mk>

View File

@ -79,7 +79,7 @@ ${_YC}: ${_YSRC}
.if !target(depend)
.if defined(SRCS)
depend: beforedepend ${DEPENDFILE} afterdepend _SUBDIR
depend: beforedepend ${DEPENDFILE} afterdepend
# Different types of sources are compiled with slightly different flags.
# Split up the sources, and filter out headers and non-applicable flags.
@ -115,7 +115,7 @@ ${DEPENDFILE}: _EXTRADEPEND
.ORDER: ${DEPENDFILE} afterdepend
.else
depend: beforedepend afterdepend _SUBDIR
depend: beforedepend afterdepend
.endif
.if !target(beforedepend)
beforedepend:
@ -133,7 +133,7 @@ tags:
.endif
.if !target(tags)
tags: ${SRCS} _SUBDIR
tags: ${SRCS}
@cd ${.CURDIR} && gtags ${GTAGSFLAGS} ${.OBJDIR}
.if defined(HTML)
@cd ${.CURDIR} && htags ${HTAGSFLAGS} -d ${.OBJDIR} ${.OBJDIR}
@ -141,7 +141,7 @@ tags: ${SRCS} _SUBDIR
.endif
.if !target(cleandepend)
cleandepend: _SUBDIR
cleandepend:
.if defined(SRCS)
rm -f ${DEPENDFILE} ${.OBJDIR}/GPATH ${.OBJDIR}/GRTAGS \
${.OBJDIR}/GSYMS ${.OBJDIR}/GTAGS

View File

@ -155,16 +155,4 @@ ${DFILE}: ${SRCS} _stamp.extraobjs
.endif
.endif
.if !target(all-man)
all-man:
.endif
.if !target(maninstall)
maninstall:
.endif
.if !target(regress)
regress:
.endif
.include <bsd.obj.mk>

View File

@ -72,9 +72,6 @@
# install:
# Install the info files.
#
# maninstall:
# Dummy target, do nothing.
#
#
# bsd.obj.mk: cleandir and obj
@ -137,10 +134,10 @@ CLEANFILES+= ${IFILENS}
.if !defined(NOINFOCOMPRESS)
CLEANFILES+= ${IFILENS:S/$/${ICOMPRESS_EXT}/}
IFILES= ${IFILENS:S/$/${ICOMPRESS_EXT}/:S/.html${ICOMPRESS_EXT}/.html/}
all: ${IFILES} _SUBDIR
all: ${IFILES}
.else
IFILES= ${IFILENS}
all: ${IFILES} _SUBDIR
all: ${IFILES}
.endif
.else
all:
@ -165,7 +162,7 @@ ${x:S/$/-install/}: ${DESTDIR}${INFODIR}/${INFODIRFILE}
DISTRIBUTION?= bin
.if !target(distribute)
distribute: _SUBDIR
distribute:
.for dist in ${DISTRIBUTION}
cd ${.CURDIR} ; $(MAKE) install DESTDIR=${DISTDIR}/${dist} SHARED=copies
.endfor
@ -190,7 +187,7 @@ CLEANFILES+= ${INFO:S/$/.info.*.html/} ${INFO:S/$/.info/}
.endif
.if !defined(NOINFO) && defined(INFO)
install: ${INSTALLINFODIRS} _SUBDIR
install: ${INSTALLINFODIRS}
.if ${IFILES:N*.html}
${INSTALL} ${COPY} -o ${INFOOWN} -g ${INFOGRP} -m ${INFOMODE} \
${IFILES:N*.html} ${DESTDIR}${INFODIR}
@ -208,16 +205,4 @@ install: __null_install
__null_install:
.endif
.if !target(all-man)
all-man: _SUBDIR
.endif
.if !target(maninstall)
maninstall: _SUBDIR
.endif
.if !target(regress)
regress:
.endif
.include <bsd.obj.mk>

View File

@ -181,10 +181,10 @@ LINTLIB=llib-l${LIB}.ln
_LIBS+=${LINTLIB}
.endif
all: objwarn ${_LIBS}
.if !defined(NOMAN)
all: objwarn ${_LIBS} all-man _SUBDIR
.else
all: objwarn ${_LIBS} _SUBDIR
all: all-man
.endif
OBJS+= ${SRCS:N*.h:R:S/$/.o/g}
@ -240,7 +240,7 @@ ${LINTLIB}: ${LINTOBJS}
.endif
.if !target(clean)
clean: _SUBDIR
clean:
rm -f a.out ${OBJS} ${STATICOBJS} ${OBJS:S/$/.tmp/} ${CLEANFILES}
rm -f lib${LIB}.a
rm -f ${POBJS} ${POBJS:S/$/.tmp/} lib${LIB}_p.a
@ -298,6 +298,8 @@ _SHLINSTALLFLAGS:= ${_SHLINSTALLFLAGS${ie}}
.endfor
realinstall: beforeinstall
realinstall: _libinstall
_libinstall:
.if !defined(INTERNALLIB)
${INSTALL} -C -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \
${_INSTALLFLAGS} lib${LIB}.a ${DESTDIR}${LIBDIR}
@ -345,40 +347,28 @@ realinstall: beforeinstall
${_INSTALLFLAGS} ${LINTLIB} ${DESTDIR}${LINTLIBDIR}
.endif
install: afterinstall _SUBDIR
.if !defined(NOMAN)
afterinstall: realinstall maninstall
.else
install: afterinstall
afterinstall: realinstall
.if !defined(NOMAN)
afterinstall: maninstall
.endif
.endif
.if !target(regress)
regress:
.endif
DISTRIBUTION?= bin
.if !target(distribute)
distribute: _SUBDIR
distribute:
.for dist in ${DISTRIBUTION}
cd ${.CURDIR} ; $(MAKE) install DESTDIR=${DISTDIR}/${dist} SHARED=copies
.endfor
.endif
.if !target(lint)
lint: ${SRCS:M*.c} _SUBDIR
lint: ${SRCS:M*.c}
${LINT} ${LINTOBJFLAGS} ${CFLAGS:M-[DIU]*} ${.ALLSRC}
.endif
.if !defined(NOMAN)
.include <bsd.man.mk>
.else
.if !target(all-man)
all-man:
.endif
.if !target(maninstall)
maninstall:
.endif
.endif
.include <bsd.dep.mk>

View File

@ -74,7 +74,7 @@ MAN+= ${MAN${sect}}
.endfor
.endif
all-man: _SUBDIR
all-man:
.if defined(NOMANCOMPRESS)

View File

@ -114,17 +114,9 @@ realinstall: beforeinstall nlsinstall links-nls
realinstall: beforeinstall
.endif
all: all-nls _SUBDIR
all: all-nls
install: realinstall afterinstall
.if !target(all-man)
all-man: _SUBDIR
.endif
.if !target(maninstall)
maninstall: _SUBDIR
.endif
DISTRIBUTION?= bin
.if !target(distribute)
distribute:

View File

@ -3,11 +3,6 @@
# The include file <bsd.obj.mk> handles creating the 'obj' directory
# and cleaning up object files, etc.
#
# Under construction: it also contains the _SUBDIR target (which is used
# by most `mk' files to recurse into subdirectories) and defaults for the
# cleandepend, depend and tags targets. It may eventually be merged with
# with bsd.subdir.mk.
#
# +++ variables +++
#
# CLEANDIRS Additional directories to remove for the clean target.
@ -81,11 +76,8 @@ objwarn:
.endif
.endif
.if !target(obj)
.if defined(NOOBJ)
.if !target(obj) && !defined(NOOBJ)
obj:
.else
obj: _SUBDIR
@if ! test -d ${CANONICALOBJDIR}/; then \
mkdir -p ${CANONICALOBJDIR}; \
if ! test -d ${CANONICALOBJDIR}/; then \
@ -95,10 +87,9 @@ obj: _SUBDIR
${ECHO} "${CANONICALOBJDIR} created for ${.CURDIR}"; \
fi
.endif
.endif
.if !target(objlink)
objlink: _SUBDIR
objlink:
@if test -d ${CANONICALOBJDIR}/; then \
rm -f ${.CURDIR}/obj; \
ln -s ${CANONICALOBJDIR} ${.CURDIR}/obj; \
@ -124,7 +115,7 @@ cleanobj:
@if [ -h ${.CURDIR}/obj ]; then rm -f ${.CURDIR}/obj; fi
.if !target(clean)
clean: _SUBDIR
clean:
.if defined(CLEANFILES) && !empty(CLEANFILES)
rm -f ${CLEANFILES}
.endif
@ -134,7 +125,7 @@ clean: _SUBDIR
.endif
.if !target(checkdpadd)
checkdpadd: _SUBDIR
checkdpadd:
.if (defined(DPADD) || defined(LDADD))
checkdpadd:
.if ${OBJFORMAT} != aout
@ -158,29 +149,8 @@ checkdpadd:
.endif
.endif
cleandir: cleanobj _SUBDIR
cleandir: cleanobj
.for __target in cleandepend depend tags
.if !target(${__target})
${__target}: _SUBDIR
.endif
.endfor
_SUBDIR: .USE
.if defined(SUBDIR) && !empty(SUBDIR)
@for entry in ${SUBDIR}; do \
if test -d ${.CURDIR}/$${entry}.${MACHINE_ARCH}; then \
${ECHODIR} "===> ${DIRPRFX}$${entry}.${MACHINE_ARCH}"; \
edir=$${entry}.${MACHINE_ARCH}; \
cd ${.CURDIR}/$${edir}; \
else \
${ECHODIR} "===> ${DIRPRFX}$$entry"; \
edir=$${entry}; \
cd ${.CURDIR}/$${edir}; \
fi; \
${MAKE} ${.TARGET:realinstall=install} \
DIRPRFX=${DIRPRFX}$$edir/; \
done
.endif
.include <bsd.subdir.mk>
.endif !target(__<bsd.obj.mk>__)

View File

@ -77,7 +77,6 @@ all: objwarn ${PROG} ${SCRIPTS} ${FILES}
.if !defined(NOMAN)
all: all-man
.endif
all: _SUBDIR
CLEANFILES+= ${PROG} ${OBJS}
@ -105,6 +104,8 @@ _INSTALLFLAGS:= ${_INSTALLFLAGS${ie}}
.endfor
realinstall: beforeinstall
realinstall: _proginstall
_proginstall:
.if defined(PROG)
.if defined(PROGNAME)
${INSTALL} ${COPY} ${STRIP} -o ${BINOWN} -g ${BINGRP} -m ${BINMODE} \
@ -118,6 +119,8 @@ realinstall: beforeinstall
(cd ${DESTDIR}${ORIGBINDIR}; ln -fs dm ${PROG}; \
chown -h ${BINOWN}:${ORIGBINGRP} ${PROG})
.endif
realinstall:
.if defined(LINKS) && !empty(LINKS)
@set ${LINKS}; \
while test $$# -ge 2; do \
@ -195,24 +198,23 @@ _FILESINS_${file:T}: ${file}
.endfor
.endif
install: afterinstall _SUBDIR
.if !defined(NOMAN)
afterinstall: realinstall maninstall
.else
install: afterinstall
afterinstall: realinstall
.if !defined(NOMAN)
afterinstall: maninstall
.endif
.endif
DISTRIBUTION?= bin
.if !target(distribute)
distribute: _SUBDIR
distribute:
.for dist in ${DISTRIBUTION}
cd ${.CURDIR} ; $(MAKE) install DESTDIR=${DISTDIR}/${dist} SHARED=copies
.endfor
.endif
.if !target(lint)
lint: ${SRCS} _SUBDIR
lint: ${SRCS}
.if defined(PROG)
${LINT} ${LINTFLAGS} ${CFLAGS:M-[DIU]*} ${.ALLSRC} | more 2>&1
.endif
@ -223,7 +225,7 @@ tags:
.endif
.if !target(tags)
tags: ${SRCS} _SUBDIR
tags: ${SRCS}
.if defined(PROG)
@cd ${.CURDIR} && gtags ${GTAGSFLAGS} ${.OBJDIR}
.if defined(HTML)
@ -234,17 +236,6 @@ tags: ${SRCS} _SUBDIR
.if !defined(NOMAN)
.include <bsd.man.mk>
.else
.if !target(all-man)
all-man:
.endif
.if !target(maninstall)
maninstall:
.endif
.endif
.if !target(regress)
regress:
.endif
.if ${OBJFORMAT} != aout || make(checkdpadd) || defined(NEED_LIBNAMES)

View File

@ -199,7 +199,7 @@ CLEANFILES+= ${DOC}.${_XFORMAT}
.endfor
.for __target in beforeinstall afterinstall all-man maninstall _SUBDIR
.for __target in beforeinstall afterinstall all-man
.if !target(${__target})
${__target}:
.endif

View File

@ -25,15 +25,16 @@
# put the stuff into the right "distribution".
#
# afterdistribute, afterinstall, all, all-man, beforeinstall, checkdpadd,
# clean, cleandepend, cleandir, depend, install, lint, maninstall,
# clean, cleandepend, cleandir, depend, install, lint,
# obj, objlink, realinstall, regress, tags
#
.include <bsd.init.mk>
_SUBDIRUSE: .USE
_SUBDIR: .USE
.if defined(SUBDIR) && !empty(SUBDIR)
@for entry in ${SUBDIR}; do \
(if test -d ${.CURDIR}/$${entry}.${MACHINE_ARCH}; then \
if test -d ${.CURDIR}/$${entry}.${MACHINE_ARCH}; then \
${ECHODIR} "===> ${DIRPRFX}$${entry}.${MACHINE_ARCH}"; \
edir=$${entry}.${MACHINE_ARCH}; \
cd ${.CURDIR}/$${edir}; \
@ -43,8 +44,9 @@ _SUBDIRUSE: .USE
cd ${.CURDIR}/$${edir}; \
fi; \
${MAKE} ${.TARGET:realinstall=install} \
DIRPRFX=${DIRPRFX}$$edir/); \
DIRPRFX=${DIRPRFX}$$edir/; \
done
.endif
${SUBDIR}::
@if test -d ${.TARGET}.${MACHINE_ARCH}; then \
@ -56,11 +58,9 @@ ${SUBDIR}::
.for __target in all all-man checkdpadd clean cleandepend cleandir depend lint \
maninstall obj objlink regress tags \
obj objlink realinstall regress tags \
install.debug reinstall.debug
.if !target(${__target})
${__target}: _SUBDIRUSE
.endif
${__target}: _SUBDIR
.endfor
.if !target(install)
@ -72,7 +72,7 @@ afterinstall:
.endif
install: afterinstall
afterinstall: realinstall
realinstall: beforeinstall _SUBDIRUSE
realinstall: beforeinstall
.endif
DISTRIBUTION?= bin
@ -80,7 +80,7 @@ DISTRIBUTION?= bin
afterdistribute:
.endif
.if !target(distribute)
distribute: _SUBDIRUSE
distribute: _SUBDIR
.for dist in ${DISTRIBUTION}
cd ${.CURDIR} ; ${MAKE} afterdistribute DESTDIR=${DISTDIR}/${dist}
.endfor

View File

@ -167,16 +167,9 @@ ${KMOD}.kld: ${OBJS}
.endif
.if !target(all-man)
all-man: _SUBDIR
.endif
.if !target(maninstall)
maninstall: _SUBDIR
.endif
_ILINKS=@ machine
all: objwarn ${PROG} _SUBDIR
all: objwarn ${PROG}
beforedepend: ${_ILINKS}
@rm -f .depend
@ -225,11 +218,11 @@ _INSTALLFLAGS:= ${INSTALLFLAGS}
_INSTALLFLAGS:= ${_INSTALLFLAGS${ie}}
.endfor
install.debug: _SUBDIR
install.debug:
${INSTALL} ${COPY} -o ${KMODOWN} -g ${KMODGRP} -m ${KMODMODE} \
${_INSTALLFLAGS} ${FULLPROG} ${DESTDIR}${KMODDIR}/
realinstall: _SUBDIR
realinstall:
${INSTALL} ${COPY} -o ${KMODOWN} -g ${KMODGRP} -m ${KMODMODE} \
${_INSTALLFLAGS} ${PROG} ${DESTDIR}${KMODDIR}/
.if defined(LINKS) && !empty(LINKS)
@ -258,14 +251,14 @@ realinstall: _SUBDIR
-kldxref ${DESTDIR}${KMODDIR}
.endif
install: afterinstall _SUBDIR
install: afterinstall
afterinstall: realinstall
realinstall: beforeinstall
.endif
DISTRIBUTION?= bin
.if !target(distribute)
distribute: _SUBDIR
distribute:
.for dist in ${DISTRIBUTION}
cd ${.CURDIR} ; $(MAKE) install DESTDIR=${DISTDIR}/${dist} SHARED=copies
.endfor