2001-11-28 11:21:46 +01:00
|
|
|
# $NetBSD: bsd.pkg.subdir.mk,v 1.45 2001/11/28 10:21:47 abs Exp $
|
1998-04-15 12:45:05 +02:00
|
|
|
# Derived from: FreeBSD Id: bsd.port.subdir.mk,v 1.19 1997/03/09 23:10:56 wosch Exp
|
1997-08-20 12:21:05 +02:00
|
|
|
# from: @(#)bsd.subdir.mk 5.9 (Berkeley) 2/1/91
|
|
|
|
#
|
1998-04-15 12:45:05 +02:00
|
|
|
# The include file <bsd.pkg.subdir.mk> contains the default targets
|
1997-08-20 12:21:05 +02:00
|
|
|
# for building ports subdirectories.
|
|
|
|
#
|
|
|
|
#
|
|
|
|
# +++ variables +++
|
|
|
|
#
|
1998-02-09 01:47:23 +01:00
|
|
|
# STRIPFLAG The flag passed to the install program to cause the binary
|
1997-08-20 12:21:05 +02:00
|
|
|
# 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]
|
|
|
|
#
|
|
|
|
# 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,
|
1998-05-06 11:33:22 +02:00
|
|
|
# configure, deinstall, depend, describe, extract, fetch, fetch-list,
|
1998-01-28 00:04:48 +01:00
|
|
|
# install, package, readmes, realinstall, reinstall, tags,
|
2000-07-28 02:54:06 +02:00
|
|
|
# mirror-distfiles, bulk-install, bulk-package, ${PKG_MISC_TARGETS}
|
1997-08-20 12:21:05 +02:00
|
|
|
#
|
|
|
|
|
1999-02-21 02:24:22 +01:00
|
|
|
# Pull in stuff from mk.conf - need to check two places as this may be
|
|
|
|
# called from pkgsrc or from pkgsrc/category.
|
|
|
|
.if exists(${.CURDIR}/mk/bsd.prefs.mk)
|
|
|
|
.include "${.CURDIR}/mk/bsd.prefs.mk"
|
|
|
|
.else
|
|
|
|
.if exists(${.CURDIR}/../mk/bsd.prefs.mk)
|
|
|
|
.include "${.CURDIR}/../mk/bsd.prefs.mk"
|
|
|
|
.endif # exists(${.CURDIR}/../mk/bsd.prefs.mk)
|
|
|
|
.endif # exists(${.CURDIR}/mk/bsd.prefs.mk)
|
|
|
|
|
1997-08-20 12:21:05 +02:00
|
|
|
|
|
|
|
.MAIN: all
|
|
|
|
|
|
|
|
.if !defined(DEBUG_FLAGS)
|
1998-02-09 01:47:23 +01:00
|
|
|
STRIPFLAG?= -s
|
1997-08-20 12:21:05 +02:00
|
|
|
.endif
|
|
|
|
|
1999-12-15 16:52:17 +01:00
|
|
|
AWK?= /usr/bin/awk
|
2001-02-16 14:06:17 +01:00
|
|
|
CAT?= /bin/cat
|
1998-09-23 15:09:32 +02:00
|
|
|
BASENAME?= /usr/bin/basename
|
2000-06-03 23:18:47 +02:00
|
|
|
ECHO?= echo
|
1999-05-18 01:34:37 +02:00
|
|
|
ECHO_MSG?= ${ECHO}
|
1998-09-23 15:09:32 +02:00
|
|
|
MV?= /bin/mv
|
|
|
|
RM?= /bin/rm
|
|
|
|
SED?= /usr/bin/sed
|
|
|
|
SORT?= /usr/bin/sort
|
1997-08-20 12:21:05 +02:00
|
|
|
|
|
|
|
_SUBDIRUSE: .USE
|
1999-07-02 14:56:32 +02:00
|
|
|
@for entry in "" ${SUBDIR}; do \
|
|
|
|
if [ "X$$entry" = "X" ]; then continue; fi; \
|
1997-08-20 12:21:05 +02:00
|
|
|
OK=""; \
|
1999-07-02 14:56:32 +02:00
|
|
|
for dud in "" ${DUDS}; do \
|
|
|
|
if [ "X$$dud" = "X" ]; then continue; fi; \
|
1997-08-20 12:21:05 +02:00
|
|
|
if [ $${dud} = $${entry} ]; then \
|
|
|
|
OK="false"; \
|
1999-05-18 00:24:15 +02:00
|
|
|
${ECHO_MSG} "===> ${_THISDIR_}$${entry} skipped"; \
|
1997-08-20 12:21:05 +02:00
|
|
|
fi; \
|
|
|
|
done; \
|
1998-09-23 15:09:32 +02:00
|
|
|
if [ -d ${.CURDIR}/$${entry}.${MACHINE} ]; then \
|
1997-08-20 12:21:05 +02:00
|
|
|
edir=$${entry}.${MACHINE}; \
|
1998-09-23 15:09:32 +02:00
|
|
|
elif [ -d ${.CURDIR}/$${entry} ]; then \
|
1997-08-20 12:21:05 +02:00
|
|
|
edir=$${entry}; \
|
|
|
|
else \
|
|
|
|
OK="false"; \
|
1999-05-18 00:24:15 +02:00
|
|
|
${ECHO_MSG} "===> ${_THISDIR_}$${entry} non-existent"; \
|
1997-08-20 12:21:05 +02:00
|
|
|
fi; \
|
|
|
|
if [ "$$OK" = "" ]; then \
|
|
|
|
cd ${.CURDIR}/$${edir}; \
|
2000-05-29 02:54:25 +02:00
|
|
|
${ECHO_MSG} "===> ${_THISDIR_}$${edir}"; \
|
2000-06-03 17:25:16 +02:00
|
|
|
${MAKE} ${MAKEFLAGS} "_THISDIR_=${_THISDIR_}$${edir}/" \
|
|
|
|
${.TARGET:realinstall=install} || true; \
|
1997-08-20 12:21:05 +02:00
|
|
|
fi; \
|
|
|
|
done
|
|
|
|
|
|
|
|
${SUBDIR}::
|
1998-09-23 15:09:32 +02:00
|
|
|
@if [ -d ${.TARGET}.${MACHINE} ]; then \
|
1997-08-20 12:21:05 +02:00
|
|
|
cd ${.CURDIR}/${.TARGET}.${MACHINE}; \
|
|
|
|
else \
|
|
|
|
cd ${.CURDIR}/${.TARGET}; \
|
|
|
|
fi; \
|
2000-06-03 17:25:16 +02:00
|
|
|
${MAKE} ${MAKEFLAGS} all
|
1997-08-20 12:21:05 +02:00
|
|
|
|
1998-12-29 23:31:53 +01:00
|
|
|
.for __target in all fetch fetch-list package extract configure build clean \
|
|
|
|
cleandir distclean depend describe reinstall tags checksum \
|
2000-05-11 13:23:20 +02:00
|
|
|
makepatchsum mirror-distfiles deinstall show-downlevel \
|
2001-10-26 23:42:44 +02:00
|
|
|
show-pkgsrc-dir show-var show-vars bulk-install bulk-package \
|
2001-03-06 17:14:35 +01:00
|
|
|
${PKG_MISC_TARGETS}
|
1997-08-20 12:21:05 +02:00
|
|
|
.if !target(__target)
|
|
|
|
${__target}: _SUBDIRUSE
|
|
|
|
.endif
|
|
|
|
.endfor
|
|
|
|
|
|
|
|
.if !target(install)
|
|
|
|
.if !target(beforeinstall)
|
|
|
|
beforeinstall:
|
|
|
|
.endif
|
|
|
|
.if !target(afterinstall)
|
|
|
|
afterinstall:
|
|
|
|
.endif
|
|
|
|
install: afterinstall
|
|
|
|
afterinstall: realinstall
|
|
|
|
realinstall: beforeinstall _SUBDIRUSE
|
|
|
|
.endif
|
|
|
|
|
|
|
|
.if !target(readmes)
|
|
|
|
readmes: readme _SUBDIRUSE
|
|
|
|
.endif
|
|
|
|
|
|
|
|
.if !target(readme)
|
|
|
|
readme:
|
1998-09-23 15:09:32 +02:00
|
|
|
@if [ -f README.html ]; then ${MV} -f README.html README.html.BAK ; fi
|
2000-06-03 17:25:16 +02:00
|
|
|
@${MAKE} ${MAKEFLAGS} README.html _README_TYPE=$@
|
1998-09-23 15:09:32 +02:00
|
|
|
.endif
|
|
|
|
|
|
|
|
.if !target(cdrom-readme)
|
|
|
|
cdrom-readme:
|
|
|
|
@if [ -f README.html ]; then ${MV} -f README.html README.html.BAK ; fi
|
2000-06-03 17:25:16 +02:00
|
|
|
@${MAKE} ${MAKEFLAGS} README.html _README_TYPE=$@
|
1997-08-20 12:21:05 +02:00
|
|
|
.endif
|
|
|
|
|
1998-05-15 14:14:24 +02:00
|
|
|
.if defined(PKGSRCTOP)
|
1998-04-24 11:15:57 +02:00
|
|
|
README= templates/README.top
|
1997-08-20 12:21:05 +02:00
|
|
|
.else
|
1998-04-24 11:15:57 +02:00
|
|
|
README= ../templates/README.category
|
1997-08-20 12:21:05 +02:00
|
|
|
.endif
|
|
|
|
|
1998-09-23 15:09:32 +02:00
|
|
|
HTMLIFY= ${SED} -e 's/&/\&/g' -e 's/>/\>/g' -e 's/</\</g'
|
1997-11-21 17:01:54 +01:00
|
|
|
|
1998-05-29 04:34:36 +02:00
|
|
|
README.html: .PRECIOUS
|
1997-08-20 12:21:05 +02:00
|
|
|
@> $@.tmp
|
|
|
|
.for entry in ${SUBDIR}
|
1998-05-15 14:14:24 +02:00
|
|
|
.if defined(PKGSRCTOP)
|
1998-09-23 15:09:32 +02:00
|
|
|
@${ECHO} -n '<TR><TD VALIGN=TOP><a href="'${entry}/README.html'">'"`${ECHO} ${entry} | ${HTMLIFY}`"'</a>: <TD>' >> $@.tmp
|
2001-02-16 14:06:17 +01:00
|
|
|
@${ECHO} `cd ${entry} && ${MAKE} ${MAKEFLAGS} show-comment | ${HTMLIFY}` >> $@.tmp
|
1997-08-20 12:21:05 +02:00
|
|
|
.else
|
2001-02-16 14:06:17 +01:00
|
|
|
@${ECHO} '<TR><TD VALIGN=TOP><a href="'${entry}/README.html'">'"`cd ${entry}; ${MAKE} ${MAKEFLAGS} make-readme-html-help`" >> $@.tmp
|
1997-08-20 12:21:05 +02:00
|
|
|
.endif
|
|
|
|
.endfor
|
1998-09-23 15:09:32 +02:00
|
|
|
@${SORT} -t '>' +3 -4 $@.tmp > $@.tmp2
|
1999-12-15 16:52:17 +01:00
|
|
|
@${AWK} '{ ++n } END { print n }' < $@.tmp2 > $@.tmp4
|
2001-11-28 11:21:46 +01:00
|
|
|
.if exists(${.CURDIR}/DESCR)
|
|
|
|
@${HTMLIFY} ${.CURDIR}/DESCR > $@.tmp3
|
1997-11-21 17:01:54 +01:00
|
|
|
.else
|
|
|
|
@> $@.tmp3
|
|
|
|
.endif
|
2001-02-16 14:06:17 +01:00
|
|
|
@${CAT} ${README} | \
|
1998-09-23 15:09:32 +02:00
|
|
|
${SED} -e 's/%%CATEGORY%%/'"`${BASENAME} ${.CURDIR}`"'/g' \
|
1999-12-07 00:40:55 +01:00
|
|
|
-e '/%%NUMITEMS%%/r$@.tmp4' \
|
|
|
|
-e '/%%NUMITEMS%%/d' \
|
1997-11-21 17:01:54 +01:00
|
|
|
-e '/%%DESCR%%/r$@.tmp3' \
|
1997-08-20 12:21:05 +02:00
|
|
|
-e '/%%DESCR%%/d' \
|
|
|
|
-e '/%%SUBDIR%%/r$@.tmp2' \
|
|
|
|
-e '/%%SUBDIR%%/d' \
|
1999-12-07 00:40:55 +01:00
|
|
|
> $@.tmp5
|
|
|
|
@if cmp -s $@.tmp5 $@.BAK ; then \
|
1998-09-23 15:09:32 +02:00
|
|
|
${MV} $@.BAK $@ ; \
|
1999-12-07 00:40:55 +01:00
|
|
|
${RM} $@.tmp5 ; \
|
1998-07-13 22:39:32 +02:00
|
|
|
else \
|
1999-05-18 00:24:15 +02:00
|
|
|
${ECHO_MSG} "===> Creating README.html for ${_THISDIR_}${.CURDIR:T}" ; \
|
1999-12-07 00:40:55 +01:00
|
|
|
${MV} $@.tmp5 $@ ; \
|
1998-09-23 15:09:32 +02:00
|
|
|
${RM} -f $@.BAK ; \
|
1998-07-13 22:39:32 +02:00
|
|
|
fi
|
1999-12-07 00:40:55 +01:00
|
|
|
@${RM} -f $@.tmp $@.tmp2 $@.tmp3 $@.tmp4
|
1998-01-08 11:59:47 +01:00
|
|
|
.for subdir in ${SUBDIR}
|
2000-06-03 17:25:16 +02:00
|
|
|
@cd ${subdir} && ${MAKE} ${MAKEFLAGS} "_THISDIR_=${_THISDIR_}${.CURDIR:T}/" ${_README_TYPE}
|
1998-01-08 11:59:47 +01:00
|
|
|
.endfor
|
1999-06-28 13:42:28 +02:00
|
|
|
|
2001-02-16 14:06:17 +01:00
|
|
|
show-comment:
|
|
|
|
@if [ "${COMMENT}" ]; then \
|
|
|
|
${ECHO} "${COMMENT:S/"/''/}"; \
|
2001-11-28 11:21:46 +01:00
|
|
|
elif [ -f COMMENT ] ; then \
|
|
|
|
${CAT} COMMENT; \
|
2001-02-16 14:06:17 +01:00
|
|
|
else \
|
|
|
|
${ECHO} '(no description)'; \
|
|
|
|
fi
|
|
|
|
|
1999-06-28 13:42:28 +02:00
|
|
|
.if !target(show-distfiles)
|
|
|
|
show-distfiles:
|
|
|
|
@for entry in ${SUBDIR}; do \
|
|
|
|
if [ -d ${.CURDIR}/$${entry}.${MACHINE} ]; then \
|
|
|
|
edir=$${entry}.${MACHINE}; \
|
|
|
|
elif [ -d ${.CURDIR}/$${entry} ]; then \
|
|
|
|
edir=$${entry}; \
|
|
|
|
else \
|
|
|
|
OK="false"; \
|
|
|
|
${ECHO_MSG} "===> ${_THISDIR_}$${entry} non-existent"; \
|
|
|
|
fi; \
|
|
|
|
if [ "$$OK" = "" ]; then \
|
2000-06-03 17:25:16 +02:00
|
|
|
cd ${.CURDIR}/$${edir} && ${MAKE} ${MAKEFLAGS} show-distfiles; \
|
1999-06-28 13:42:28 +02:00
|
|
|
fi; \
|
|
|
|
done
|
|
|
|
.endif
|