openbsd-ports/infrastructure/mk/bsd.port.subdir.mk

174 lines
4.8 KiB
Makefile
Raw Normal View History

#-*- mode: Makefile; tab-width: 4; -*-
# ex:ts=4 sw=4 filetype=make:
# from: @(#)bsd.subdir.mk 5.9 (Berkeley) 2/1/91
# $OpenBSD: bsd.port.subdir.mk,v 1.82 2007/03/19 21:32:35 espie Exp $
# FreeBSD Id: bsd.port.subdir.mk,v 1.20 1997/08/22 11:16:15 asami Exp
#
# The include file <bsd.port.subdir.mk> contains the default targets
# for building ports subdirectories.
#
#
# +++ variables +++
#
# STRIP The flag passed to the install program to cause the binary
# to be stripped. This is to be used when building your
# own install script so that the entire system can be made
# stripped/not-stripped using a single knob. [-s]
#
# ECHO_MSG Used to print all the '===>' style prompts - override this
# to turn them off [echo].
#
# OPSYS Get the operating system type [`uname -s`]
#
# SUBDIR A list of subdirectories that should be built as well.
# Each of the targets will execute the same target in the
# subdirectories.
#
#
# +++ targets +++
#
# README.html:
# Creating README.html for package.
#
# afterinstall, all, beforeinstall, build, checksum, clean,
# configure, depend, describe, extract, fetch, fetch-list,
# install, package, readmes, deinstall, reinstall,
1999-07-30 04:57:39 -04:00
# tags
#
# recent /usr/share/mk/* should include bsd.own.mk, guard for older versions
.if !defined(BSD_OWN_MK)
. include <bsd.own.mk>
.endif
2006-07-09 07:10:16 -04:00
.if defined(verbose-show)
.MAIN: verbose-show
.elif defined(show)
.MAIN: show
.elif defined(clean)
.MAIN: clean
.else
.MAIN: all
.endif
.if !defined(DEBUG_FLAGS)
STRIP ?= -s
.endif
1999-11-20 12:56:57 -05:00
.if !defined(OPSYS) # XXX !!
OPSYS = OpenBSD
1999-11-20 12:56:57 -05:00
.endif
.include "${PORTSDIR}/infrastructure/mk/pkgpath.mk"
ECHO_MSG ?= echo
# create a full list of SUBDIRS...
.if empty(PKGPATH)
_FULLSUBDIR := ${SUBDIR}
.else
_FULLSUBDIR := ${SUBDIR:S@^@${PKGPATH}/@g}
2001-03-28 05:55:52 -05:00
.endif
_SKIPPED =
.for i in ${SKIPDIR}
_SKIPPED :+= ${_FULLSUBDIR:M$i}
_FULLSUBDIR := ${_FULLSUBDIR:N$i}
.endfor
TEMPLATES ?= ${PORTSDIR}/infrastructure/templates
.if defined(PORTSTOP)
README = ${TEMPLATES}/README.top
.else
README = ${TEMPLATES}/README.category
.endif
_subdir_fragment = \
: $${echo_msg:=${ECHO_MSG:Q}}; \
: $${target:=${.TARGET}}; \
for i in ${_SKIPPED}; do \
eval $${echo_msg} "===\> $$i skipped"; \
done; \
for subdir in ${_FULLSUBDIR}; do \
${_flavor_fragment}; \
eval $${echo_msg} "===\> $$subdir"; \
if ! (eval $$toset exec ${MAKE} $$target); then \
${REPORT_PROBLEM}; \
fi; \
done
2004-09-26 05:59:14 -04:00
.for __target in all fetch package fake extract patch configure \
build distclean deinstall install update \
reinstall checksum fetch-makefile \
link-categories unlink-categories regress lib-depends-check \
newlib-depends-check manpages-check license-check \
print-package-signature
${__target}:
@${_subdir_fragment}
.endfor
.for __target in describe show verbose-show dump-vars \
homepage-links print-plist print-plist-contents \
print-plist-all print-plist-with-depends print-plist-all-with-depends
${__target}:
@DESCRIBE_TARGET=Yes; export DESCRIBE_TARGET; ${_subdir_fragment}
.endfor
.for __target in all-dir-depends build-dir-depends run-dir-depends regress-dir-depends
${__target}:
@${_depfile_fragment}; echo_msg=:; ${_subdir_fragment}
.endfor
2003-08-04 10:45:31 -04:00
clean:
.if defined(clean) && ${clean:L:Mdepends}
@{ target=all-dir-depends; echo_msg=:; \
${_depfile_fragment}; ${_subdir_fragment}; }| tsort -r| \
while read subdir; do \
2003-08-04 10:45:31 -04:00
${_flavor_fragment}; \
eval $$toset ${MAKE} _CLEANDEPENDS=No clean; \
done
.else
@${_subdir_fragment}
2003-08-04 10:45:31 -04:00
.endif
2003-08-04 09:31:26 -04:00
.if defined(clean) && ${clean:L:Mreadmes}
rm -f ${READMES_TOP}/${PKGPATH}/README.html
.endif
readmes:
@DESCRIBE_TARGET=Yes; export DESCRIBE_TARGET; ${_subdir_fragment}
@tmpdir=`mktemp -d ${TMPDIR}/readme.XXXXXX`; \
trap 'rm -r $$tmpdir' 0 1 2 3 13 15; \
cd ${.CURDIR} && ${MAKE} TMPDIR=$$tmpdir \
${READMES_TOP}/${PKGPATH}/README.html
${READMES_TOP}/${PKGPATH}/README.html:
@mkdir -p ${@D}
@>${TMPDIR}/subdirs
.for d in ${_FULLSUBDIR}
@subdir=$d; DESCRIBE_TARGET=yes; export DESCRIBE_TARGET; \
${_flavor_fragment}; \
if name=`eval $$toset ${MAKE} _print-packagename`; then \
comment=`eval $$toset ${MAKE} show=_COMMENT|sed -e 's,^",,' -e 's,"$$,,' |${HTMLIFY}`; \
else \
comment=''; \
fi; \
cd ${.CURDIR}; \
echo "<dt><a href=\"${PKGDEPTH}$$dir/$$name.html\">$d</a><dd>$$comment" >>${TMPDIR}/subdirs
.endfor
@sed -e 's%%CATEGORY%%'`echo ${.CURDIR} | sed -e 's.*/\([^/]*\)$$\1'`'g' \
-e '/%%DESCR%%/r${.CURDIR}/pkg/DESCR' -e '//d' \
-e '/%%SUBDIR%%/r${TMPDIR}/subdirs' -e '//d' \
${README} > $@
@rm ${TMPDIR}/subdirs
2003-08-14 20:35:10 -04:00
.PHONY: all fetch package fake extract configure \
build describe distclean deinstall install update \
2006-07-09 07:10:16 -04:00
reinstall checksum show verbose-show dump-vars fetch-makefile \
2003-08-14 20:35:10 -04:00
link-categories unlink-categories regress lib-depends-check \
2004-11-21 06:28:31 -05:00
newlib-depends-check \
2003-08-14 20:35:10 -04:00
homepage-links manpages-check license-check \
all-dir-depends build-dir-depends run-dir-depends regress-dir-depends \
clean readmes print-package-signature