clean-up and speed-up dependency generation.

thanks to nikolay, naddy, and others for comments.
This commit is contained in:
espie 2003-07-30 19:31:31 +00:00
parent 3bd53498c5
commit 39307efa3b

View File

@ -1,6 +1,6 @@
#-*- mode: Makefile; tab-width: 4; -*- #-*- mode: Makefile; tab-width: 4; -*-
# ex:ts=4 sw=4 filetype=make: # ex:ts=4 sw=4 filetype=make:
# $OpenBSD: bsd.port.mk,v 1.566 2003/07/30 10:40:43 espie Exp $ # $OpenBSD: bsd.port.mk,v 1.567 2003/07/30 19:31:31 espie Exp $
# $FreeBSD: bsd.port.mk,v 1.264 1996/12/25 02:27:44 imp Exp $ # $FreeBSD: bsd.port.mk,v 1.264 1996/12/25 02:27:44 imp Exp $
# $NetBSD: bsd.port.mk,v 1.62 1998/04/09 12:47:02 hubertf Exp $ # $NetBSD: bsd.port.mk,v 1.62 1998/04/09 12:47:02 hubertf Exp $
# #
@ -44,20 +44,7 @@ ERRORS+= "Fatal: Use 'env SUBPACKAGE=${SUBPACKAGE} ${MAKE}' instead."
# DEPENDS_TARGET - The target to execute when a port is calling a # DEPENDS_TARGET - The target to execute when a port is calling a
# dependency (default: "install"). # dependency (default: "install").
# #
# readme - Create a README.html file describing the category or package
# (somewhat broken due to NEW_DEPENDS)
# Somewhat obsolete targets:
# list-distfiles- list the distribution and patch files used by a port.
# Typical use is (from the top level of the ports tree)
# make ECHO_MSG=: list-distfiles | tee some-file
# (rely on mirror-maker instead)
# print-depends - print all dependencies for the given package
# (for new dependencies, use
# build-depends-list/run-depends-list instead)
#
#
# Default sequence for "all" is: fetch checksum extract patch configure build # Default sequence for "all" is: fetch checksum extract patch configure build
# #
# Please read the comments in the targets section below, you # Please read the comments in the targets section below, you
@ -694,8 +681,15 @@ ${WRKPKG}/PLIST${SUBPACKAGE}: ${PLIST} ${WRKPKG}/depends${SUBPACKAGE}
.endif .endif
${WRKPKG}/depends${SUBPACKAGE}: ${WRKPKG}/depends${SUBPACKAGE}:
@touch $@ @mkdir -p ${WRKPKG}
@self=${FULLPKGNAME${SUBPACKAGE}} _depends_result=$@ exec ${MAKE} _solve-package-depends @>$@
.if (defined(RUN_DEPENDS) && !empty(RUN_DEPENDS)) || (!defined(NO_SHARED_LIBS) && defined(LIB_DEPENDS) && !empty(LIB_DEPENDS))
@: $${_DEPENDS_FILE:=`mktemp /tmp/depends.XXXXXXXXXX`}; \
export _DEPENDS_FILE; \
echo "|${FULLPKGNAME${SUBPACKAGE}}|" >>$${_DEPENDS_FILE}; \
self=${FULLPKGNAME${SUBPACKAGE}} _depends_result=$@ ${MAKE} _recurse-solve-package-depends; \
rm -f $${_DEPENDS_FILE}
.endif
MTREE_FILE?= MTREE_FILE?=
MTREE_FILE+=${PORTSDIR}/infrastructure/db/fake.mtree MTREE_FILE+=${PORTSDIR}/infrastructure/db/fake.mtree
@ -713,7 +707,6 @@ ${WRKPKG}/mtree.spec: ${MTREE_FILE}
PKG_TMPDIR?= /var/tmp PKG_TMPDIR?= /var/tmp
PKG_CMD?= /usr/sbin/pkg_create PKG_CMD?= /usr/sbin/pkg_create
PKG_DELETE?= /usr/sbin/pkg_delete PKG_DELETE?= /usr/sbin/pkg_delete
_SORT_DEPENDS?=tsort|tail -r
# Fill out package command, and package dependencies # Fill out package command, and package dependencies
_PKG_PREREQ= ${WRKPKG}/PLIST${SUBPACKAGE} ${WRKPKG}/DESCR${SUBPACKAGE} ${WRKPKG}/COMMENT${SUBPACKAGE} _PKG_PREREQ= ${WRKPKG}/PLIST${SUBPACKAGE} ${WRKPKG}/DESCR${SUBPACKAGE} ${WRKPKG}/COMMENT${SUBPACKAGE}
@ -771,9 +764,6 @@ SH?= /bin/sh
# Used to print all the '===>' style prompts - override this to turn them off. # Used to print all the '===>' style prompts - override this to turn them off.
ECHO_MSG?= echo ECHO_MSG?= echo
# XXX
_DEPEND_ECHO?= echo
# basic master sites configuration # basic master sites configuration
.if exists(${PORTSDIR}/infrastructure/db/network.conf) .if exists(${PORTSDIR}/infrastructure/db/network.conf)
@ -847,7 +837,7 @@ _EVERYTHING+=${PATCHFILES}
ALLFILES+= ${_PATCHFILES} ALLFILES+= ${_PATCHFILES}
.endif .endif
.if make(makesum) || make(addsum) || make(list-distfiles) || defined(__FETCH_ALL) .if make(makesum) || make(addsum) || defined(__FETCH_ALL)
. if defined(SUPDISTFILES) . if defined(SUPDISTFILES)
_EVERYTHING+= ${SUPDISTFILES} _EVERYTHING+= ${SUPDISTFILES}
ALLFILES+= ${SUPDISTFILES:C/:[0-9]$//} ALLFILES+= ${SUPDISTFILES:C/:[0-9]$//}
@ -1159,8 +1149,13 @@ depends: lib-depends build-depends run-depends regress-depends
# and the rules for the actual dependencies # and the rules for the actual dependencies
_FULL_PACKAGE_NAME?=No
_print-packagename: _print-packagename:
.if ${_FULL_PACKAGE_NAME:L} == "yes"
@echo '${PKGPATH}/${FULLPKGNAME${SUBPACKAGE}}'
.else
@echo ${FULLPKGNAME${SUBPACKAGE}} @echo ${FULLPKGNAME${SUBPACKAGE}}
.endif
.for _DEP in build run lib regress .for _DEP in build run lib regress
_DEP${_DEP}_COOKIES= _DEP${_DEP}_COOKIES=
@ -1202,7 +1197,7 @@ ${WRKDIR}/.${_DEP}${_i:C,[|:./<=>*],-,g}: ${_WRKDIR_COOKIE}
fi;; \ fi;; \
esac; \ esac; \
${ECHO_MSG} "===> Verifying $$target for $$what in $$dir"; \ ${ECHO_MSG} "===> Verifying $$target for $$what in $$dir"; \
if eval $$toset ${MAKE} ${_DEPEND_THRU} $$target; then \ if eval $$toset ${MAKE} $$target; then \
${ECHO_MSG} "===> Returning to build of ${FULLPKGNAME${SUBPACKAGE}}${_MASTER}"; \ ${ECHO_MSG} "===> Returning to build of ${FULLPKGNAME${SUBPACKAGE}}${_MASTER}"; \
else \ else \
exit 1; \ exit 1; \
@ -1271,9 +1266,10 @@ uninstall deinstall fake package lib-depends-check manpages-check:
# going to be tweaked as a result of running lib-depends-check. # going to be tweaked as a result of running lib-depends-check.
# #
lib-depends-check: ${_LIBLIST} ${_BUILDLIBLIST} lib-depends-check: ${_LIBLIST} ${_BUILDLIBLIST}
@LIB_DEPENDS="`${MAKE} _recurse-lib-depends`" PKG_DBDIR='${PKG_DBDIR}' \ @_DEPENDS_FILE=`mktemp /tmp/depends.XXXXXXXXX`; export _DEPENDS_FILE; LIB_DEPENDS="`${MAKE} _recurse-lib-depends-check`" PKG_DBDIR='${PKG_DBDIR}' \
perl ${PORTSDIR}/infrastructure/install/check-libs \ perl ${PORTSDIR}/infrastructure/install/check-libs \
${_LIBLIST} ${_BUILDLIBLIST} ${_LIBLIST} ${_BUILDLIBLIST}; \
rm -f ${_DEPENDS_FILE}
manpages-check: ${_FAKE_COOKIE} manpages-check: ${_FAKE_COOKIE}
@cd ${WRKINST}${TRUEPREFIX}/man && \ @cd ${WRKINST}${TRUEPREFIX}/man && \
@ -1805,22 +1801,6 @@ ${_F}:
. endif . endif
.endfor .endfor
# list the distribution and patch files used by a port. Typical
# use is make ECHO_MSG=: list-distfiles | tee some-file
#
list-distfiles:
@echo "${FULLPKGNAME}"
@for file in ${ALLFILES}; do \
if [ "$$file" != "${EXTRACT_SUFX}" ]; then \
if [ -z "${DIST_SUBDIR}" ]; then \
printf "\t$$file\n"; \
else \
printf "\t${DIST_SUBDIR}/$$file\n"; \
fi \
fi \
done
@echo ""
# Some support rules for do-package # Some support rules for do-package
package-links: package-links:
@ -1842,55 +1822,18 @@ delete-package-links:
@rm -f ${${_l}_PACKAGES}/${FULLPKGNAME${SUBPACKAGE}}${PKG_SUFX} @rm -f ${${_l}_PACKAGES}/${FULLPKGNAME${SUBPACKAGE}}${PKG_SUFX}
.endfor .endfor
delete-package:
@cd ${.CURDIR} && exec ${MAKE} clean=package
# Checkpatch
#
# Special target to verify patches
checkpatch:
@cd ${.CURDIR} && exec ${MAKE} PATCH_CHECK_ONLY=Yes patch
# Reinstall
#
# Special target to re-run install
reinstall:
@cd ${.CURDIR} && exec ${MAKE} clean=install
@cd ${.CURDIR} && DEPENDS_TARGET=${DEPENDS_TARGET} exec ${MAKE} install
# Force rebuild of a package
repackage:
@cd ${.CURDIR} && exec ${MAKE} clean=packages
@cd ${.CURDIR} && exec ${MAKE} package
# Rebuild
#
# Special target to re-run build
rebuild:
@rm -f ${_BUILD_COOKIE}
@cd ${.CURDIR} && exec ${MAKE} build
# Deinstall
#
# Special target to remove installation
uninstall deinstall:
@${ECHO_MSG} "===> Deinstalling for ${FULLPKGNAME${SUBPACKAGE}}"
@${SUDO} ${PKG_DELETE} -f ${FULLPKGNAME${SUBPACKAGE}}
################################################################
# Some more targets supplied for users' convenience
################################################################
# Cleaning up # Cleaning up
_CLEANDEPENDS?=Yes
clean: clean:
.if ${clean:L:Mdepends} .if ${clean:L:Mdepends} && ${_CLEANDEPENDS:L} == "yes"
@cd ${.CURDIR} && exec ${MAKE} clean-depends @unset FLAVOR SUBPACKAGE || true; \
.endif ${MAKE} all-dir-depends|tsort -r|while read dir; do \
${_flavor_fragment}; \
eval $$toset ${MAKE} _CLEANDEPENDS=No clean; \
done
.else
@${ECHO_MSG} "===> Cleaning for ${FULLPKGNAME${SUBPACKAGE}}" @${ECHO_MSG} "===> Cleaning for ${FULLPKGNAME${SUBPACKAGE}}"
. if ${clean:L:Mfake} . if ${clean:L:Mfake}
@if cd ${WRKINST} 2>/dev/null; then ${SUDO} rm -rf ${WRKINST}; fi @if cd ${WRKINST} 2>/dev/null; then ${SUDO} rm -rf ${WRKINST}; fi
@ -1940,6 +1883,7 @@ clean:
. if ${clean:L:Mbulk} . if ${clean:L:Mbulk}
rm -f ${_BULK_COOKIE} rm -f ${_BULK_COOKIE}
. endif . endif
.endif
distclean: distclean:
@${MAKE} clean=dist @${MAKE} clean=dist
@ -1962,7 +1906,7 @@ plist update-plist: fake ${_DEPrun_COOKIES}
@DESTDIR=${WRKINST} PREFIX=${WRKINST}${PREFIX} LDCONFIG="${LDCONFIG}" \ @DESTDIR=${WRKINST} PREFIX=${WRKINST}${PREFIX} LDCONFIG="${LDCONFIG}" \
MTREE_FILE=${WRKPKG}/mtree.spec \ MTREE_FILE=${WRKPKG}/mtree.spec \
INSTALL_PRE_COOKIE=${_INSTALL_PRE_COOKIE} \ INSTALL_PRE_COOKIE=${_INSTALL_PRE_COOKIE} \
DEPS="`${MAKE} package-depends|tsort`" \ DEPS="`${MAKE} full-run-depends`" \
PKGREPOSITORY=${PKGREPOSITORY} \ PKGREPOSITORY=${PKGREPOSITORY} \
PLIST=${PLIST} \ PLIST=${PLIST} \
PFRAG=${PKGDIR}/PFRAG \ PFRAG=${PKGDIR}/PFRAG \
@ -1992,6 +1936,13 @@ _ALLFILES=${ALLFILES:S/^/${DIST_SUBDIR}\//}
_ALLFILES=${ALLFILES} _ALLFILES=${ALLFILES}
.endif .endif
_FMN=${PKGPATH}/${FULLPKGNAME}
.if defined(MULTI_PACKAGES)
. for _S in ${MULTI_PACKAGES}
_FMN+= ${PKGPATH}/${FULLPKGNAME${_S}}
. endfor
.endif
fetch-makefile: fetch-makefile:
.if !defined(COMES_WITH) .if !defined(COMES_WITH)
@echo -n "all" @echo -n "all"
@ -2001,18 +1952,18 @@ fetch-makefile:
. if ${PERMIT_DISTFILES_CDROM:L} == "yes" . if ${PERMIT_DISTFILES_CDROM:L} == "yes"
@echo -n " cdrom" @echo -n " cdrom"
. endif . endif
@echo ":: ${PKGPATH}/${FULLPKGNAME}" @echo ":: ${_FMN}"
@cd ${.CURDIR} && exec ${MAKE} __FETCH_ALL=Yes __ARCH_OK=Yes NO_IGNORE=Yes _fetch-makefile-helper # write generic package dependencies
@echo ".PHONY: ${_FMN}"
. if ${RECURSIVE_FETCH_LIST:L} == "yes"
@echo "${_FMN}: ${_ALLFILES} "`_FULL_PACKAGE_NAME=Yes ${MAKE} full-all-depends`
. else
@echo "${_FMN}: ${_ALLFILES}"
. endif
@exec ${MAKE} __FETCH_ALL=Yes __ARCH_OK=Yes NO_IGNORE=Yes _fetch-makefile
.endif .endif
_fetch-makefile-helper: _fetch-makefile:
# write generic package dependencies
@name='${PKGPATH}/${FULLPKGNAME}'; \
echo ".PHONY: $${name}"; \
case '${RECURSIVE_FETCH_LIST:L}' in yes) \
echo "$${name}:: "`${MAKE} depends-list package-depends FULL_PACKAGE_NAME=Yes |${_SORT_DEPENDS}`;; \
esac; \
echo "$${name}:: ${_ALLFILES}"
.if !empty(ALLFILES) .if !empty(ALLFILES)
. for _F in ${_ALLFILES} . for _F in ${_ALLFILES}
@echo '${_F}: $$F' @echo '${_F}: $$F'
@ -2052,21 +2003,6 @@ _fetch-makefile-helper:
@echo @echo
# The README.html target needs full information (this is passed via
# depends-list and package-depends)
FULL_PACKAGE_NAME?=No
# Make variables to pass along on recursive builds
_DEPEND_THRU=FULL_PACKAGE_NAME=${FULL_PACKAGE_NAME}
# XXX
package-name:
. if (${FULL_PACKAGE_NAME:L} == "yes")
@${_DEPEND_ECHO} '${PKGPATH}/${FULLPKGNAME${SUBPACKAGE}}'
. else
@${_DEPEND_ECHO} '${FULLPKGNAME${SUBPACKAGE}}'
. endif
# Internal variables, used by dependencies targets # Internal variables, used by dependencies targets
# Only keep pkg:dir spec # Only keep pkg:dir spec
.if defined(LIB_DEPENDS) .if defined(LIB_DEPENDS)
@ -2096,26 +2032,6 @@ _BUILD_DEP=
_LIB_DEP2= ${LIB_DEPENDS} _LIB_DEP2= ${LIB_DEPENDS}
_clean-depends:
.if !empty(_ALWAYS_DEP) || !empty(_BUILD_DEP) || !empty(_RUN_DEP)
@unset FLAVOR SUBPACKAGE || true; \
for dir in ${_ALWAYS_DEP} ${_RUN_DEP} ${_BUILD_DEP}; do \
if fgrep -q "|$$dir|" $${_DEPENDS_FILE}; then :; else \
echo "|$$dir|" >>$${_DEPENDS_FILE}; \
${_flavor_fragment}; \
eval $$toset ${MAKE} CLEANDEPENDS=No ${_DEPEND_THRU} clean _clean-depends; \
fi; \
done
.endif
clean-depends:
.if !empty(_ALWAYS_DEP) || !empty(_BUILD_DEP) || !empty(_RUN_DEP)
@: $${_DEPENDS_FILE:=`mktemp /tmp/depends.XXXXXXXXXX`}; \
export _DEPENDS_FILE; \
${MAKE} _clean-depends; \
rm -f $${_DEPENDS_FILE}
.endif
# This target generates an index entry suitable for aggregation into # This target generates an index entry suitable for aggregation into
# a large index. Format is: # a large index. Format is:
# #
@ -2124,8 +2040,13 @@ clean-depends:
# for-arch|package-cdrom|package-ftp|distfiles-cdrom|distfiles-ftp # for-arch|package-cdrom|package-ftp|distfiles-cdrom|distfiles-ftp
# #
describe: describe:
.if !defined(PACKAGING) && defined(MULTI_PACKAGES) .if defined(MULTI_PACKAGES) && !defined(PACKAGING)
@cd ${.CURDIR} && SUBPACKAGE='${SUBPACKAGE}' FLAVOR='${FLAVOR}' PACKAGING='${SUBPACKAGE}' exec ${MAKE} describe @cd ${.CURDIR} && SUBPACKAGE='${SUBPACKAGE}' FLAVOR='${FLAVOR}' PACKAGING='${SUBPACKAGE}' exec ${MAKE} describe
. if empty(SUBPACKAGE)
. for _sub in ${MULTI_PACKAGES}
@cd ${.CURDIR} && SUBPACKAGE='${_sub}' FLAVOR='${FLAVOR}' PACKAGING='${_sub}' exec ${MAKE} describe
. endfor
. endif
.else .else
@echo -n "${FULLPKGNAME${SUBPACKAGE}}|${FULLPKGPATH}|" @echo -n "${FULLPKGNAME${SUBPACKAGE}}|${FULLPKGPATH}|"
. if ${PREFIX} == ${LOCALBASE} . if ${PREFIX} == ${LOCALBASE}
@ -2178,179 +2099,79 @@ describe:
@echo "n" @echo "n"
. endif . endif
. endif . endif
. if defined(MULTI_PACKAGES) && empty(SUBPACKAGE) .endif
README_NAME?= ${TEMPLATES}/README.port
readme readmes:
.if defined(MULTI_PACKAGES) && !defined(PACKAGING)
@cd ${.CURDIR} && SUBPACKAGE='${SUBPACKAGE}' FLAVOR='${FLAVOR}' PACKAGING='${SUBPACKAGE}' exec ${MAKE} readme
. if empty(SUBPACKAGE)
. for _sub in ${MULTI_PACKAGES} . for _sub in ${MULTI_PACKAGES}
@cd ${.CURDIR} && SUBPACKAGE='${_sub}' FLAVOR='${FLAVOR}' PACKAGING='${_sub}' exec ${MAKE} describe @cd ${.CURDIR} && SUBPACKAGE='${_sub}' FLAVOR='${FLAVOR}' PACKAGING='${_sub}' exec ${MAKE} readme
. endfor . endfor
. endif . endif
.else
@rm -f ${FULLPKGNAME${SUBPACKAGE}}.html
@cd ${.CURDIR} && exec ${MAKE} README_NAME=${README_NAME} ${FULLPKGNAME${SUBPACKAGE}}.html
.endif .endif
README.html: HTMLIFY= sed -e 's/&/\&amp;/g' -e 's/>/\&gt;/g' -e 's/</\&lt;/g'
${FULLPKGNAME${SUBPACKAGE}}.html:
@echo ${_COMMENT} >$@.tmp-comment
@echo ${FULLPKGNAME${SUBPACKAGE}} | ${HTMLIFY} > $@.tmp3 @echo ${FULLPKGNAME${SUBPACKAGE}} | ${HTMLIFY} > $@.tmp3
.if !empty(_ALWAYS_DEP) || !empty(_BUILD_DEP)
@cd ${.CURDIR} && ${MAKE} depends-list FULL_PACKAGE_NAME=Yes | ${_SORT_DEPENDS}>$@.tmp1
.endif
.if !empty(_ALWAYS_DEP) || !empty(_RUN_DEP)
@cd ${.CURDIR} && ${MAKE} package-depends FULL_PACKAGE_NAME=Yes | ${_SORT_DEPENDS} >$@.tmp2
.endif
.if defined(HOMEPAGE) .if defined(HOMEPAGE)
@echo 'See <a href="${HOMEPAGE}">${HOMEPAGE}</a> for details.' >$@.tmp4 @echo 'See <a href="${HOMEPAGE}">${HOMEPAGE}</a> for details.' >$@.tmp4
.else .else
@echo "" >$@.tmp4 @echo "" >$@.tmp4
.endif .endif
.for I in 1 2 .for _I in build run
@if [ -s $@.tmp$I ]; then \ . if !empty(_ALWAYS_DEP) || !empty(_${_I:U}_DEP)
{ cat $@.tmp$I | while read n; do \ @cd ${.CURDIR} && ${MAKE} full-${_I}-depends _FULL_PACKAGE_NAME=Yes| \
while read n; do \
j=`dirname $$n|${HTMLIFY}`; k=`basename $$n|${HTMLIFY}`; \ j=`dirname $$n|${HTMLIFY}`; k=`basename $$n|${HTMLIFY}`; \
echo "<li><a href=\"${PKGDEPTH}/$$j/README.html\">$$k</a>"; \ echo "<li><a href=\"${PKGDEPTH}/$$j/$$k.html\">$$k</a>"; \
done; } >$@.tmp$Ia; \ done >$@.tmp-${_I}
else \ . else
echo "<li>(none)" > $@.tmp$Ia; \ @echo "<li>none" >$@.tmp${_I}
fi . endif
.endfor .endfor
@cat ${README_NAME} | \ @cat ${README_NAME} | \
sed -e 's|%%PORT%%|'"`echo ${PKGPATH} | ${HTMLIFY}`"'|g' \ sed -e 's|%%PORT%%|'"`echo ${PKGPATH} | ${HTMLIFY}`"'|g' \
-e '/%%PKG%%/r$@.tmp3' -e '//d' \ -e '/%%PKG%%/r$@.tmp3' -e '//d' \
-e '/%%COMMENT%%/r${PKGDIR}/COMMENT' -e '//d' \ -e '/%%COMMENT%%/r$@.tmp-comment' -e '//d' \
-e '/%%DESCR%%/r${PKGDIR}/DESCR' -e '//d' \ -e '/%%DESCR%%/r${PKGDIR}/DESCR' -e '//d' \
-e '/%%HOMEPAGE%%/r$@.tmp4' -e '//d' \ -e '/%%HOMEPAGE%%/r$@.tmp4' -e '//d' \
-e '/%%BUILD_DEPENDS%%/r$@.tmp1a' -e '//d' \ -e '/%%BUILD_DEPENDS%%/r$@.tmp-build' -e '//d' \
-e '/%%RUN_DEPENDS%%/r$@.tmp2a' -e '//d' \ -e '/%%RUN_DEPENDS%%/r$@.tmp-run' -e '//d' \
>> $@ >> $@
@rm -f $@.tmp* @rm -f $@.tmp*
print-depends-list:
print-build-depends:
.if !empty(_ALWAYS_DEP) || !empty(_BUILD_DEP) .if !empty(_ALWAYS_DEP) || !empty(_BUILD_DEP)
@echo -n 'This port requires package(s) "' @echo -n 'This port requires package(s) "'
@unset FLAVOR SUBPACKAGE || true; \ @${MAKE} full-build-depends|tr '\012' '\040'|sed -e 's, $$,,'
echo -n `cd ${.CURDIR} && ${MAKE} ${_DEPEND_THRU} depends-list | ${_SORT_DEPENDS}`
@echo '" to build.' @echo '" to build.'
.endif .endif
print-package-depends: print-run-depends:
.if !empty(_ALWAYS_DEP) || !empty(_RUN_DEP) .if !empty(_ALWAYS_DEP) || !empty(_RUN_DEP)
@echo -n 'This port requires package(s) "' @echo -n 'This port requires package(s) "'
@unset FLAVOR SUBPACKAGE || true; \ @${MAKE} full-run-depends|tr '\012' '\040'|sed -e 's, $$,,'
echo -n `cd ${.CURDIR} && ${MAKE} ${_DEPEND_THRU} package-depends | ${_SORT_DEPENDS}`
@echo '" to run.' @echo '" to run.'
.endif .endif
.for _i in build all run
recurse-build-depends: full-${_i}-depends:
.if !empty(_ALWAYS_DEP) || !empty(_BUILD_DEP) || !empty(_RUN_DEP)
@pname=`cd ${.CURDIR} && ${MAKE} _DEPEND_ECHO='echo -n' package-name ${_DEPEND_THRU}`; \
unset FLAVOR SUBPACKAGE || true; \
for dir in `echo ${_ALWAYS_DEP} ${_BUILD_DEP} ${_RUN_DEP} \
| tr '\040' '\012' | sort -u`; do \
${_flavor_fragment}; \
if ! eval $$toset ${MAKE} _DEPEND_ECHO=\"echo $$pname\" package-name recurse-build-depends ${_DEPEND_THRU}; then \
echo 1>&2 "*** Problem checking deps in \"$$dir\"."; \
exit 1; \
fi; \
done
.else
@pname=`cd ${.CURDIR} && ${MAKE} _DEPEND_ECHO='echo -n' package-name`; echo $$pname $$pname
.endif
depends-list:
.if !empty(_ALWAYS_DEP) || !empty(_BUILD_DEP)
@unset FLAVOR SUBPACKAGE || true; \ @unset FLAVOR SUBPACKAGE || true; \
for dir in `echo ${_ALWAYS_DEP} ${_BUILD_DEP} \ ${MAKE} ${_i}-dir-depends|tsort -r|sed -e '$$d'|while read dir; do \
| tr '\040' '\012' | sort -u`; do \
${_flavor_fragment}; \ ${_flavor_fragment}; \
if ! eval $$toset ${MAKE} recurse-build-depends ${_DEPEND_THRU}; then \ eval $$toset ${MAKE} _print-packagename ; \
echo 1>&2 "*** Problem checking deps in \"$$dir\"."; \
exit 1; \
fi; \
done done
.endif
# Build (recursively) a list of package dependencies suitable for tsort
recurse-package-depends:
.if !empty(_ALWAYS_DEP) || !empty(_RUN_DEP)
@pname=`cd ${.CURDIR} && ${MAKE} _DEPEND_ECHO='echo -n' package-name ${_DEPEND_THRU}`; \
unset FLAVOR SUBPACKAGE || true; \
for dir in `echo ${_ALWAYS_DEP} ${_RUN_DEP} \
| tr '\040' '\012' | sort -u`; do \
${_flavor_fragment}; \
if ! eval $$toset ${MAKE} _DEPEND_ECHO=\"echo $$pname\" package-name recurse-package-depends ${_DEPEND_THRU}; then \
echo 1>&2 "*** Problem checking deps in \"$$dir\"." ; \
exit 1; \
fi; \
done
.else
@pname=`cd ${.CURDIR} && ${MAKE} _DEPEND_ECHO='echo -n' package-name`; echo $$pname $$pname
.endif
# Print list of all libraries we're allowed to depend upon.
_recurse-lib-depends:
.for _i in ${LIB_DEPENDS}
@unset FLAVOR SUBPACKAGE || true; \
echo '${_i}' | { \
IFS=:; read dep pkg dir target; \
${_flavor_fragment}; \
IFS=,; for j in $$dep; do echo $$j; done; \
eval $$toset ${MAKE} ${_DEPEND_THRU} _recurse-lib-depends; \
}
.endfor .endfor
.for _i in ${RUN_DEPENDS}
@unset FLAVOR SUBPACKAGE || true; \
echo '${_i}' | { \
IFS=:; read dep pkg dir target; \
${_flavor_fragment}; \
eval $$toset ${MAKE} ${_DEPEND_THRU} _recurse-lib-depends; \
}
.endfor
package-depends:
.if !empty(_ALWAYS_DEP) || !empty(_RUN_DEP)
@unset FLAVOR SUBPACKAGE || true; \
for dir in `echo ${_ALWAYS_DEP} ${_RUN_DEP} \
| tr '\040' '\012' | sort -u`; do \
${_flavor_fragment}; \
if ! eval $$toset ${MAKE} recurse-package-depends ${_DEPEND_THRU}; then \
echo 1>&2 "*** Problem checking deps in \"$$dir\"." ; \
exit 1; \
fi; \
done
.endif
# recursively build a list of dirs to pass to tsort...
_recurse-dir-depends:
.if !empty(_ALWAYS_DEP) || !empty(_BUILD_DEP) || !empty(_RUN_DEP)
@unset FLAVOR SUBPACKAGE || true; \
for dir in `echo ${_ALWAYS_DEP} ${_BUILD_DEP} ${_RUN_DEP} \
| tr '\040' '\012' | sort -u`; do \
echo "$$self $$dir"; \
self2="$$dir"; \
${_flavor_fragment}; \
toset="$$toset self=\"$$self2\""; \
if ! eval $$toset ${MAKE} _recurse-dir-depends ${_DEPEND_THRU}; then \
echo 1>&2 "*** Problem checking deps in \"$$dir\"."; \
exit 1; \
fi; \
done
.endif
# recursively build a list of dirs to pass to tsort...
dir-depends:
.if !empty(_ALWAYS_DEP) || !empty(_BUILD_DEP)
@unset FLAVOR SUBPACKAGE || true; \
for dir in `echo ${_ALWAYS_DEP} ${_BUILD_DEP} \
| tr '\040' '\012' | sort -u`; do \
echo "${FULLPKGPATH} $$dir"; \
self2="$$dir"; \
${_flavor_fragment}; \
toset="$$toset self=\"$$self2\""; \
if ! eval $$toset ${MAKE} _recurse-dir-depends ${_DEPEND_THRU}; then \
echo 1>&2 "*** Problem checking deps in \"$$dir\"."; \
exit 1; \
fi; \
done
.else
@echo "${FULLPKGPATH} ${FULLPKGPATH}"
.endif
.for _i in RUN BUILD LIB .for _i in RUN BUILD LIB
${_i:L}-depends-list: ${_i:L}-depends-list:
@ -2368,64 +2189,57 @@ ${_i:L}-depends-list:
. endif . endif
.endfor .endfor
# recursively build a list of dirs to pass to tsort... # recursive depend targets
_package-recurse-dir-depends:
.if !empty(_ALWAYS_DEP) || !empty(_RUN_DEP)
@unset FLAVOR SUBPACKAGE || true; \
for dir in `echo ${_ALWAYS_DEP} ${_RUN_DEP} \
| tr '\040' '\012' | sort -u`; do \
echo "$$self $$dir"; \
self2="$$dir"; \
${_flavor_fragment}; \
toset="$$toset self=\"$$self2\""; \
if ! eval $$toset ${MAKE} _package-recurse-dir-depends ${_DEPEND_THRU}; then \
echo 1>&2 "*** Problem checking deps in \"$$dir\"."; \
exit 1; \
fi; \
done
.endif
# recursively build a list of dirs to pass to tsort... # Print list of all libraries that we may depend upon.
package-dir-depends: _recurse-lib-depends-check:
.if !empty(_ALWAYS_DEP) || !empty(_RUN_DEP) .for _i in ${LIB_DEPENDS}
@unset FLAVOR SUBPACKAGE || true; \ @unset FLAVOR SUBPACKAGE || true; \
for dir in `echo ${_ALWAYS_DEP} ${_RUN_DEP} \ echo '${_i}' | { \
| tr '\040' '\012' | sort -u`; do \ IFS=:; read dep pkg dir target; \
echo "${FULLPKGPATH} $$dir"; \ if fgrep -q "|$$dir|" $${_DEPENDS_FILE}; then :; else \
self2="$$dir"; \ echo "|$$dir|" >>$${_DEPENDS_FILE}; \
${_flavor_fragment}; \ ${_flavor_fragment}; \
toset="$$toset self=\"$$self2\""; \ IFS=,; for j in $$dep; do echo $$j; done; \
if ! eval $$toset ${MAKE} _package-recurse-dir-depends ${_DEPEND_THRU}; then \ eval $$toset ${MAKE} _recurse-lib-depends-check; \
echo 1>&2 "*** Problem checking deps in \"$$dir\"."; \
exit 1; \
fi; \ fi; \
done }
.else .endfor
@echo "${FULLPKGPATH} ${FULLPKGPATH}" .for _i in ${RUN_DEPENDS}
.endif
_solve-package-depends:
.if !empty(_RUN_DEP2)
@unset FLAVOR SUBPACKAGE || true; \ @unset FLAVOR SUBPACKAGE || true; \
: $${self:=self}; \ echo '${_i}' | { \
for spec in `echo '${_RUN_DEP2}' \ IFS=:; read dep pkg dir target; \
| tr '\040' '\012' | sort -u`; do \ if fgrep -q "|$$dir|" $${_DEPENDS_FILE}; then :; else \
dir=$${spec#*:}; pkg=$${spec%:*}; \ echo "|$$dir|" >>$${_DEPENDS_FILE}; \
${_flavor_fragment}; \
eval $$toset ${MAKE} _recurse-lib-depends-check; \
fi; \
}
.endfor
# Write a correct list of dependencies for packages.
_recurse-solve-package-depends:
.for _i in ${RUN_DEPENDS}
@unset FLAVOR SUBPACKAGE || true; \
echo '${_i}' |{ \
IFS=:; read dep pkg dir target; \
${_flavor_fragment}; \ ${_flavor_fragment}; \
default=`eval $$toset ${MAKE} _print-packagename`; \ default=`eval $$toset ${MAKE} _print-packagename`; \
: $${pkg:=$$default}; \ : $${pkg:=$$default}; \
echo "@newdepend $$self:$$pkg:$$default" >>$${_depends_result}; \ echo "@newdepend $$self:$$pkg:$$default" >>$${_depends_result}; \
if fgrep -q "|$$default|" ${_DEPENDS_FILE}; then : ; else \
echo "|$$default|" >>${_DEPENDS_FILE}; \
toset="$$toset self=\"$$default\""; \ toset="$$toset self=\"$$default\""; \
if ! eval $$toset ${MAKE} _solve-package-depends; then \ if ! eval $$toset ${MAKE} _recurse-solve-package-depends; then \
echo 1>&2 "*** Problem checking deps in \"$$dir\"." ; \ echo 1>&2 "*** Problem checking deps in \"$$dir\"." ; \
exit 1; \ exit 1; \
fi; \ fi; \
done fi; }
.endif .endfor
.if !defined(NO_SHARED_LIBS) && defined(LIB_DEPENDS) && !empty(LIB_DEPENDS) .if !defined(NO_SHARED_LIBS)
. for _i in ${LIB_DEPENDS} . for _i in ${LIB_DEPENDS}
@unset FLAVOR SUBPACKAGE || true; \ @unset FLAVOR SUBPACKAGE || true; \
: $${self:=self}; \
echo '${_i}'|{ \ echo '${_i}'|{ \
IFS=:; read dep pkg dir target; \ IFS=:; read dep pkg dir target; \
${_flavor_fragment}; \ ${_flavor_fragment}; \
@ -2454,26 +2268,103 @@ _solve-package-depends:
X) ;;\ X) ;;\
*) \ *) \
echo "@libdepend $$self:$$libspecs:$$pkg:$$default" >>$${_depends_result}; \ echo "@libdepend $$self:$$libspecs:$$pkg:$$default" >>$${_depends_result}; \
if fgrep -q "|$$default|" ${_DEPENDS_FILE}; then : ; else \
echo "lib|$$default|" >>${_DEPENDS_FILE}; \
toset="$$toset self=\"$$default\""; \ toset="$$toset self=\"$$default\""; \
if ! eval $$toset ${MAKE} _solve-package-depends; then \ if ! eval $$toset ${MAKE} _recurse-solve-package-depends; then \
echo 1>&2 "*** Problem checking deps in \"$$dir\"." ; \ echo 1>&2 "*** Problem checking deps in \"$$dir\"." ; \
exit 1; \ exit 1; \
fi; \
fi;; \ fi;; \
esac; \ esac; \
} }
. endfor . endfor
.endif .endif
README_NAME?= ${TEMPLATES}/README.port # recursively build a list of dirs for package running, ready for tsort
_recurse-run-dir-depends:
.for _dir in ${_ALWAYS_DEP} ${_RUN_DEP}
@unset FLAVOR SUBPACKAGE || true; \
echo "$$self ${_dir}"; \
if fgrep -q "|${_dir}|" ${_DEPENDS_FILE}; then : ; else \
echo "|${_dir}|" >> ${_DEPENDS_FILE}; \
dir=${_dir}; \
${_flavor_fragment}; \
toset="$$toset self=\"${_dir}\""; \
if ! eval $$toset ${MAKE} _recurse-run-dir-depends; then \
echo 1>&2 "*** Problem checking deps in \"$$dir\"."; \
exit 1; \
fi; \
fi
.endfor
readme readmes: run-dir-depends:
@rm -f README.html .if !empty(_ALWAYS_DEP) || !empty(_RUN_DEP)
@cd ${.CURDIR} && exec ${MAKE} README_NAME=${README_NAME} README.html @: $${_DEPENDS_FILE:=`mktemp /tmp/depends.XXXXXXXXXX`}; \
export _DEPENDS_FILE; \
echo "|${FULLPKGPATH}|" >>$${_DEPENDS_FILE}; \
self=${FULLPKGPATH} ${MAKE} _recurse-run-dir-depends; \
rm -f $${_DEPENDS_FILE}
.else
@echo "${FULLPKGPATH} ${FULLPKGPATH}"
.endif
HTMLIFY= sed -e 's/&/\&amp;/g' -e 's/>/\&gt;/g' -e 's/</\&lt;/g' # recursively build a list of dirs for package building, ready for tsort
# second and further stages need _RUN_DEP.
_recurse-all-dir-depends:
.for _dir in ${_ALWAYS_DEP} ${_BUILD_DEP} ${_RUN_DEP}
@unset FLAVOR SUBPACKAGE || true; \
echo "$$self ${_dir}"; \
if fgrep -q "|${_dir}|" ${_DEPENDS_FILE}; then : ; else \
echo "|${_dir}|" >> ${_DEPENDS_FILE}; \
dir=${_dir}; \
${_flavor_fragment}; \
toset="$$toset self=\"${_dir}\""; \
if ! eval $$toset ${MAKE} _recurse-all-dir-depends; then \
echo 1>&2 "*** Problem checking deps in \"$$dir\"."; \
exit 1; \
fi; \
fi
.endfor
print-depends: # first stage does not need _RUN_DEP
@cd ${.CURDIR} && exec ${MAKE} FULL_PACKAGE_NAME=Yes print-depends-list print-package-depends _build-dir-depends:
.for _dir in ${_ALWAYS_DEP} ${_BUILD_DEP}
@unset FLAVOR SUBPACKAGE || true; \
echo "$$self ${_dir}"; \
if fgrep -q "|${_dir}|" ${_DEPENDS_FILE}; then : ; else \
echo "|${_dir}|" >> ${_DEPENDS_FILE}; \
dir=${_dir}; \
${_flavor_fragment}; \
toset="$$toset self=\"${_dir}\""; \
if ! eval $$toset ${MAKE} _recurse-all-dir-depends; then \
echo 1>&2 "*** Problem checking deps in \"$$dir\"."; \
exit 1; \
fi; \
fi
.endfor
build-dir-depends:
.if !empty(_ALWAYS_DEP) || !empty(_BUILD_DEP)
@: $${_DEPENDS_FILE:=`mktemp /tmp/depends.XXXXXXXXXX`}; \
export _DEPENDS_FILE; \
echo "|${FULLPKGPATH}|" >>$${_DEPENDS_FILE}; \
self=${FULLPKGPATH} ${MAKE} _build-dir-depends; \
rm -f $${_DEPENDS_FILE}
.else
@echo "${FULLPKGPATH} ${FULLPKGPATH}"
.endif
all-dir-depends:
.if !empty(_ALWAYS_DEP) || !empty(_BUILD_DEP) || !empty(_RUN_DEP)
@: $${_DEPENDS_FILE:=`mktemp /tmp/depends.XXXXXXXXXX`}; \
export _DEPENDS_FILE; \
echo "|${FULLPKGPATH}|" >>$${_DEPENDS_FILE}; \
self=${FULLPKGPATH} ${MAKE} _recurse-all-dir-depends; \
rm -f $${_DEPENDS_FILE}
.else
@echo "${FULLPKGPATH} ${FULLPKGPATH}"
.endif
link-categories: link-categories:
.for _CAT in ${CATEGORIES} .for _CAT in ${CATEGORIES}
@ -2508,6 +2399,35 @@ homepage-links:
. include "${PORTSDIR}/infrastructure/mk/old-install.mk" . include "${PORTSDIR}/infrastructure/mk/old-install.mk"
.endif .endif
#####################################################
# convenience targets, not really needed
#####################################################
checkpatch:
@cd ${.CURDIR} && exec ${MAKE} PATCH_CHECK_ONLY=Yes patch
clean-depends:
@exec ${MAKE} clean=depends
delete-package:
@cd ${.CURDIR} && exec ${MAKE} clean=package
reinstall:
@cd ${.CURDIR} && exec ${MAKE} clean=install
@cd ${.CURDIR} && DEPENDS_TARGET=${DEPENDS_TARGET} exec ${MAKE} install
repackage:
@cd ${.CURDIR} && exec ${MAKE} clean=packages
@cd ${.CURDIR} && exec ${MAKE} package
rebuild:
@rm -f ${_BUILD_COOKIE}
@cd ${.CURDIR} && exec ${MAKE} build
uninstall deinstall:
@${ECHO_MSG} "===> Deinstalling for ${FULLPKGNAME${SUBPACKAGE}}"
@${SUDO} ${PKG_DELETE} -f ${FULLPKGNAME${SUBPACKAGE}}
.if defined(ERRORS) .if defined(ERRORS)
.BEGIN: .BEGIN:
. for _m in ${ERRORS} . for _m in ${ERRORS}
@ -2525,18 +2445,18 @@ homepage-links:
describe distclean do-build do-configure do-extract \ describe distclean do-build do-configure do-extract \
do-fetch do-install do-package do-patch extract list-distfiles \ do-fetch do-install do-package do-patch extract list-distfiles \
fetch install lib-depends makesum \ fetch install lib-depends makesum \
package package-depends package-links package-name \ package package-depends package-links \
package-noinstall patch plist update-plist update-patches post-build \ package-noinstall patch plist update-plist update-patches post-build \
post-configure post-extract post-fetch post-install post-package \ post-configure post-extract post-fetch post-install post-package \
post-patch pre-build pre-configure \ post-patch pre-build pre-configure \
pre-extract pre-fetch pre-install pre-package pre-patch \ pre-extract pre-fetch pre-install pre-package pre-patch \
print-depends-list print-package-depends readme \ readme readmes rebuild reinstall \
readmes rebuild reinstall \
repackage run-depends uninstall fetch-all print-depends \ repackage run-depends uninstall fetch-all print-depends \
recurse-build-depends recurse-package-depends \ recurse-build-depends recurse-package-depends \
distpatch do-distpatch post-distpatch show \ distpatch do-distpatch post-distpatch show \
link-categories unlink-categories _package _solve-package-depends \ link-categories unlink-categories _package \
dir-depends _recurse-dir-depends package-dir-depends \ lib-depends-check homepage-links manpages-check \
_package-recurse-dir-depends recursebuild-depends-list run-depends-list \ _recurse-lib-depends-check _recurse-solve-package-depends \
_recurse-lib-depends lib-depends-check \ _recurse-run-dir-depends run-dir-depends _recurse-all-dir-depends \
homepage-links manpages-check _build-dir-depends build-dir-depends all-dir-depends \
fetch-makefile _fetch-makefile