1 # $NetBSD: bsd.pkg.subdir.mk,v 1.69 2007/10/13 11:04:16 dsl Exp $
2 # Derived from: FreeBSD Id: bsd.port.subdir.mk,v 1.19 1997/03/09 23:10:56 wosch Exp
3 # from: @(#)bsd.subdir.mk 5.9 (Berkeley) 2/1/91
5 # The include file <bsd.pkg.subdir.mk> contains the default targets
6 # for building ports subdirectories.
11 # OPSYS Get the operating system type [`uname -s`]
13 # SUBDIR A list of subdirectories that should be built as well.
14 # Each of the targets will execute the same target in the
21 # Creating README.html for package.
23 # afterinstall, all, beforeinstall, build, checksum, clean,
24 # configure, deinstall, depend, describe, extract, fetch, fetch-list,
25 # install, package, readmes, realinstall, reinstall, tags,
26 # mirror-distfiles, bulk-install, bulk-package, ${PKG_MISC_TARGETS}
29 .include "misc/common.mk"
33 BASENAME?= /usr/bin/basename
42 @for entry in "" ${SUBDIR}; do \
43 if [ "X$$entry" = "X" ]; then continue; fi; \
45 for dud in "" ${DUDS}; do \
46 if [ "X$$dud" = "X" ]; then continue; fi; \
47 if [ $${dud} = $${entry} ]; then \
49 ${ECHO_MSG} "===> ${_THISDIR_}$${entry} skipped"; \
52 if [ -d ${.CURDIR}/$${entry}.${MACHINE} ]; then \
53 edir=$${entry}.${MACHINE}; \
54 elif [ -d ${.CURDIR}/$${entry} ]; then \
58 ${ECHO_MSG} "===> ${_THISDIR_}$${entry} non-existent"; \
60 if [ "$$OK" = "" ]; then \
61 cd ${.CURDIR}/$${edir}; \
62 ${ECHO_MSG} "===> ${_THISDIR_}$${edir}"; \
63 ${RECURSIVE_MAKE} ${MAKEFLAGS} "_THISDIR_=${_THISDIR_}$${edir}/" \
64 ${.TARGET:realinstall=install} || true; \
68 .for __target in all fetch package extract configure build clean \
69 cleandir distclean depend describe reinstall tags checksum \
70 makedistinfo makepatchsum makesum mirror-distfiles deinstall \
71 show-downlevel show-pkgsrc-dir show-var show-vars \
72 bulk-install bulk-package fetch-list-one-pkg \
73 fetch-list-recursive update clean-update lint \
74 check-vulnerable pbulk-index \
78 ${__target}: _SUBDIRUSE
83 .if !target(beforeinstall)
86 .if !target(afterinstall)
90 afterinstall: realinstall
91 realinstall: beforeinstall _SUBDIRUSE
95 readmes: readme _SUBDIRUSE
100 @${RECURSIVE_MAKE} ${MAKEFLAGS} README.html _README_TYPE_FLAG=--ftp _README_TYPE=$@
103 .if !target(cdrom-readme)
105 @${RECURSIVE_MAKE} ${MAKEFLAGS} README.html _README_TYPE_FLAG=--cdrom README_TYPE=$@
108 .if defined(PKGSRCTOP)
109 README= templates/README.top
111 README= ../templates/README.category
114 HTMLIFY= ${SED} -e 's/&/\&/g' -e 's/>/\>/g' -e 's/</\</g'
117 @if [ ${COMMENT:Q}"" ]; then \
118 ${ECHO} ${COMMENT:Q}; \
119 elif [ -f COMMENT ] ; then \
122 ${ECHO} '(no description)'; \
125 .if !target(show-distfiles)
127 @for entry in ${SUBDIR}; do \
128 if [ -d ${.CURDIR}/$${entry}.${MACHINE} ]; then \
129 edir=$${entry}.${MACHINE}; \
130 elif [ -d ${.CURDIR}/$${entry} ]; then \
134 ${ECHO_MSG} "===> ${_THISDIR_}$${entry} non-existent"; \
136 if [ "$$OK" = "" ]; then \
137 cd ${.CURDIR}/$${edir} && ${RECURSIVE_MAKE} ${MAKEFLAGS} show-distfiles; \
142 .PHONY: show-subdir-var
144 @${ECHO} ${${VARNAME}:Q}
146 # Print out a script to fetch all needed files (no checksumming).
148 # When invoked at the top or category level, this target needs to be
149 # handled specially, to elide the "===>" messages that would otherwise
152 .if !target(fetch-list)
158 @${ECHO} '# This is an auto-generated script, the result of running'
159 @${ECHO} '# `make fetch-list'"'"' in directory "'"`${PWD_CMD}`"'"'
160 @${ECHO} '# on host "'"`${UNAME} -n`"'" on "'"`date`"'".'
162 .if defined(PKGSRCTOP) && !defined(SPECIFIC_PKGS)
163 # Recursing over dependencies would be pointless, in this case.
164 @${RECURSIVE_MAKE} ${MAKEFLAGS} fetch-list-one-pkg \
166 function do_block () { \
167 if (FoundSomething) { \
168 for (line = 0; line < c; line++) \
174 /^[^#=]/ { FoundSomething = 1 } \
175 /^unsorted/ { gsub(/[[:space:]]+/, " \\\n\t") } \
176 /^echo/ { gsub(/;[[:space:]]+/, "\n") } \
177 !/^=/ { block[c++] = $$0 } \
178 /^=/ { do_block() } \
182 @${RECURSIVE_MAKE} ${MAKEFLAGS} fetch-list-recursive \
185 .endif # !target(fetch-list)