1994-08-22 10:46:38 +00:00
|
|
|
# from: @(#)bsd.subdir.mk 5.9 (Berkeley) 2/1/91
|
1999-08-25 04:40:22 +00:00
|
|
|
# $FreeBSD$
|
1997-03-09 23:10:56 +00:00
|
|
|
#
|
|
|
|
# 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,
|
1999-04-28 06:20:23 +00:00
|
|
|
# clean-for-cdrom, clean-restricted,
|
|
|
|
# clean-for-cdrom-list, clean-restricted-list,
|
|
|
|
# configure, deinstall,
|
1998-12-12 07:39:30 +00:00
|
|
|
# depend, depends, describe, extract, fetch, fetch-list, ignorelist,
|
2000-08-08 14:56:46 +00:00
|
|
|
# install, makesum, package, readmes, realinstall, reinstall, tags
|
1997-03-09 23:10:56 +00:00
|
|
|
#
|
2000-03-22 20:36:55 +00:00
|
|
|
# search:
|
|
|
|
# Search for ports using either 'make search key=<keyword>'
|
|
|
|
# or 'make search name=<keyword>'.
|
1997-03-09 23:10:56 +00:00
|
|
|
|
1994-08-22 10:46:38 +00:00
|
|
|
|
|
|
|
.MAIN: all
|
|
|
|
|
1994-09-16 14:30:22 +00:00
|
|
|
.if !defined(DEBUG_FLAGS)
|
1994-08-22 10:46:38 +00:00
|
|
|
STRIP?= -s
|
1994-09-16 14:30:22 +00:00
|
|
|
.endif
|
1994-08-22 10:46:38 +00:00
|
|
|
|
1999-07-23 09:36:55 +00:00
|
|
|
.if !defined(NOPRECIOUSMAKEVARS)
|
|
|
|
.if !defined(ARCH)
|
|
|
|
ARCH!= /usr/bin/uname -m
|
|
|
|
.endif
|
|
|
|
.if !defined(OSREL)
|
|
|
|
OSREL!= /usr/bin/uname -r | sed -e 's/[-(].*//'
|
|
|
|
.endif
|
|
|
|
.if !defined(OSVERSION)
|
|
|
|
.if exists(/sbin/sysctl)
|
|
|
|
OSVERSION!= /sbin/sysctl -n kern.osreldate
|
|
|
|
.else
|
|
|
|
OSVERSION!= /usr/sbin/sysctl -n kern.osreldate
|
|
|
|
.endif
|
|
|
|
.endif
|
|
|
|
.if !defined(PORTOBJFORMAT)
|
|
|
|
PORTOBJFORMAT!= test -x /usr/bin/objformat && /usr/bin/objformat || echo aout
|
|
|
|
.endif
|
|
|
|
.endif
|
|
|
|
|
|
|
|
.if !defined(OPSYS)
|
|
|
|
OPSYS!= /usr/bin/uname -s
|
1996-11-01 07:22:37 +00:00
|
|
|
.endif
|
1994-08-22 10:46:38 +00:00
|
|
|
|
1995-03-21 03:59:13 +00:00
|
|
|
ECHO_MSG?= echo
|
|
|
|
|
1999-07-23 09:36:55 +00:00
|
|
|
TARGETS+= all
|
|
|
|
TARGETS+= build
|
|
|
|
TARGETS+= checksum
|
|
|
|
TARGETS+= clean
|
|
|
|
TARGETS+= clean-for-cdrom
|
|
|
|
TARGETS+= clean-for-cdrom-list
|
|
|
|
TARGETS+= clean-restricted
|
|
|
|
TARGETS+= clean-restricted-list
|
|
|
|
TARGETS+= configure
|
|
|
|
TARGETS+= deinstall
|
|
|
|
TARGETS+= depend
|
|
|
|
TARGETS+= depends
|
|
|
|
TARGETS+= describe
|
|
|
|
TARGETS+= distclean
|
|
|
|
TARGETS+= extract
|
|
|
|
TARGETS+= fetch
|
|
|
|
TARGETS+= fetch-list
|
|
|
|
TARGETS+= ignorelist
|
2000-08-08 14:56:46 +00:00
|
|
|
TARGETS+= makesum
|
1999-07-23 09:36:55 +00:00
|
|
|
TARGETS+= package
|
2000-06-14 01:58:13 +00:00
|
|
|
TARGETS+= realinstall
|
1999-07-23 09:36:55 +00:00
|
|
|
TARGETS+= reinstall
|
|
|
|
TARGETS+= tags
|
|
|
|
|
|
|
|
.for __target in ${TARGETS}
|
|
|
|
.if !target(${__target})
|
|
|
|
${__target}: ${SUBDIR:S/$/.${__target}/}
|
|
|
|
.endif
|
|
|
|
.endfor
|
|
|
|
|
|
|
|
.for __target in ${TARGETS} checksubdirs readmes
|
|
|
|
${SUBDIR:S/$/.${__target}/}: _SUBDIRUSE
|
|
|
|
.endfor
|
|
|
|
|
1994-08-22 10:46:38 +00:00
|
|
|
_SUBDIRUSE: .USE
|
1999-07-23 09:36:55 +00:00
|
|
|
@OK=""; sub=${.TARGET:R}; \
|
|
|
|
for dud in $$DUDS; do \
|
|
|
|
if [ $${dud} = $$sub ]; then \
|
1997-01-13 02:13:19 +00:00
|
|
|
OK="false"; \
|
1999-07-23 09:36:55 +00:00
|
|
|
${ECHO_MSG} "===> ${DIRPRFX}$$sub skipped"; \
|
1994-08-22 10:46:38 +00:00
|
|
|
fi; \
|
1999-07-23 09:36:55 +00:00
|
|
|
done; \
|
|
|
|
if test -d ${.CURDIR}/${.TARGET:R}.${MACHINE}; then \
|
|
|
|
edir=$${sub}.${MACHINE}; \
|
|
|
|
elif test -d ${.CURDIR}/$${sub}; then \
|
|
|
|
edir=$${sub}; \
|
1994-08-22 10:46:38 +00:00
|
|
|
else \
|
1999-07-23 09:36:55 +00:00
|
|
|
OK="false"; \
|
|
|
|
${ECHO_MSG} "===> ${DIRPRFX}$${sub} non-existent"; \
|
1994-08-22 10:46:38 +00:00
|
|
|
fi; \
|
1999-07-23 09:36:55 +00:00
|
|
|
if [ "$$OK" = "" ]; then \
|
|
|
|
${ECHO_MSG} "===> ${DIRPRFX}$${edir}"; \
|
|
|
|
cd ${.CURDIR}/$${edir}; \
|
|
|
|
${MAKE} -B ${.TARGET:E:realinstall=install} \
|
|
|
|
DIRPRFX=${DIRPRFX}$$edir/; \
|
|
|
|
fi
|
|
|
|
|
|
|
|
${SUBDIR}:: ${SUBDIR:S/$/.all/}
|
1994-11-17 16:02:56 +00:00
|
|
|
|
1994-08-22 10:46:38 +00:00
|
|
|
.if !target(install)
|
|
|
|
.if !target(beforeinstall)
|
|
|
|
beforeinstall:
|
|
|
|
.endif
|
|
|
|
.if !target(afterinstall)
|
|
|
|
afterinstall:
|
|
|
|
.endif
|
|
|
|
install: afterinstall
|
|
|
|
afterinstall: realinstall
|
1999-07-23 09:36:55 +00:00
|
|
|
realinstall: beforeinstall ${SUBDIR:S/$/.realinstall/}
|
1994-08-22 10:46:38 +00:00
|
|
|
.endif
|
|
|
|
|
1999-01-29 12:51:43 +00:00
|
|
|
IGNOREDIR= CVS Mk Templates Tools distfiles packages pkg
|
1997-11-20 05:31:44 +00:00
|
|
|
|
|
|
|
.if !target(checksubdirs)
|
|
|
|
.if defined(PORTSTOP)
|
1999-07-23 09:36:55 +00:00
|
|
|
checksubdirs: checksubdir ${SUBDIR:S/$/.checksubdirs/}
|
1997-11-20 05:31:44 +00:00
|
|
|
.else
|
|
|
|
checksubdirs: checksubdir
|
|
|
|
.endif
|
|
|
|
.endif
|
|
|
|
|
|
|
|
.if !target(checksubdir)
|
|
|
|
checksubdir:
|
|
|
|
@for d in *; do \
|
|
|
|
if [ -d "$$d" ]; then \
|
|
|
|
found=0; \
|
|
|
|
for s in ${SUBDIR} ${IGNOREDIR}; do \
|
|
|
|
if [ "x$$s" = "x$$d" ]; then \
|
|
|
|
found=1; \
|
|
|
|
break; \
|
|
|
|
fi; \
|
|
|
|
done; \
|
|
|
|
if [ $$found = 0 ]; then \
|
|
|
|
${ECHO} "Warning: directory $$d not in SUBDIR"; \
|
|
|
|
fi; \
|
|
|
|
fi; \
|
|
|
|
done
|
1999-07-23 09:36:55 +00:00
|
|
|
@for s in ${SUBDIR}; do \
|
|
|
|
if ! [ -d ${.CURDIR}/$$s ]; then \
|
1999-07-23 09:38:57 +00:00
|
|
|
${ECHO} "Warning: directory $$s in SUBDIR does not exist"; \
|
1999-07-23 09:36:55 +00:00
|
|
|
fi \
|
|
|
|
done
|
1997-11-20 05:31:44 +00:00
|
|
|
.endif
|
|
|
|
|
1996-04-01 11:13:00 +00:00
|
|
|
.if !target(readmes)
|
1999-07-23 09:36:55 +00:00
|
|
|
readmes: readme ${SUBDIR:S/$/.readmes/}
|
1996-04-01 11:13:00 +00:00
|
|
|
.endif
|
|
|
|
|
|
|
|
.if !target(readme)
|
|
|
|
readme:
|
|
|
|
@rm -f README.html
|
|
|
|
@make README.html
|
|
|
|
.endif
|
|
|
|
|
1996-11-01 07:22:37 +00:00
|
|
|
.if (${OPSYS} == "NetBSD")
|
|
|
|
PORTSDIR ?= /usr/opt
|
|
|
|
.else
|
1996-04-01 11:13:00 +00:00
|
|
|
PORTSDIR ?= /usr/ports
|
1996-11-01 07:22:37 +00:00
|
|
|
.endif
|
1999-01-29 12:51:43 +00:00
|
|
|
TEMPLATES ?= ${PORTSDIR}/Templates
|
1996-04-01 11:13:00 +00:00
|
|
|
.if defined(PORTSTOP)
|
|
|
|
README= ${TEMPLATES}/README.top
|
|
|
|
.else
|
|
|
|
README= ${TEMPLATES}/README.category
|
|
|
|
.endif
|
2000-10-14 11:03:19 +00:00
|
|
|
COMMENT?= ${.CURDIR}/pkg/COMMENT
|
|
|
|
DESCR?= ${.CURDIR}/pkg/DESCR
|
1996-04-01 11:13:00 +00:00
|
|
|
|
1997-11-06 02:20:27 +00:00
|
|
|
HTMLIFY= sed -e 's/&/\&/g' -e 's/>/\>/g' -e 's/</\</g'
|
|
|
|
|
2000-01-21 11:08:23 +00:00
|
|
|
package-name:
|
|
|
|
@echo ${.CURDIR} | sed -e 's^.*/^^'
|
|
|
|
|
1996-04-01 11:13:00 +00:00
|
|
|
README.html:
|
|
|
|
@echo "===> Creating README.html"
|
|
|
|
@> $@.tmp
|
|
|
|
.for entry in ${SUBDIR}
|
|
|
|
.if defined(PORTSTOP)
|
1997-11-06 02:20:27 +00:00
|
|
|
@echo -n '<a href="'${entry}/README.html'">'"`echo ${entry} | ${HTMLIFY}`"'</a>: ' >> $@.tmp
|
1996-04-01 11:13:00 +00:00
|
|
|
.else
|
1997-11-06 02:20:27 +00:00
|
|
|
@echo -n '<a href="'${entry}/README.html'">'"`cd ${entry}; make package-name | ${HTMLIFY}`</a>: " >> $@.tmp
|
1996-04-01 11:13:00 +00:00
|
|
|
.endif
|
2000-10-14 11:03:19 +00:00
|
|
|
@cat `cd ${entry}; make -V COMMENT` | ${HTMLIFY} >> $@.tmp
|
1996-04-01 11:13:00 +00:00
|
|
|
.endfor
|
|
|
|
@sort -t '>' +1 -2 $@.tmp > $@.tmp2
|
2000-10-14 11:03:19 +00:00
|
|
|
.if exists(${DESCR})
|
|
|
|
@${HTMLIFY} ${DESCR} > $@.tmp3
|
1997-11-06 02:20:27 +00:00
|
|
|
.else
|
|
|
|
@> $@.tmp3
|
2000-10-14 11:03:19 +00:00
|
|
|
.endif
|
|
|
|
.if exists(${COMMENT})
|
|
|
|
@${HTMLIFY} ${COMMENT} > $@.tmp4
|
|
|
|
.else
|
|
|
|
@> $@.tmp4
|
1997-11-06 02:20:27 +00:00
|
|
|
.endif
|
1996-04-01 11:13:00 +00:00
|
|
|
@cat ${README} | \
|
1997-11-06 02:20:27 +00:00
|
|
|
sed -e 's/%%CATEGORY%%/'"`basename ${.CURDIR}`"'/g' \
|
2000-10-14 11:03:19 +00:00
|
|
|
-e '/%%COMMENT%%/r$@.tmp4' \
|
|
|
|
-e '/%%COMMENT%%/d' \
|
1997-11-06 02:20:27 +00:00
|
|
|
-e '/%%DESCR%%/r$@.tmp3' \
|
1996-04-01 11:13:00 +00:00
|
|
|
-e '/%%DESCR%%/d' \
|
|
|
|
-e '/%%SUBDIR%%/r$@.tmp2' \
|
|
|
|
-e '/%%SUBDIR%%/d' \
|
|
|
|
> $@
|
2000-10-14 11:03:19 +00:00
|
|
|
@rm -f $@.tmp $@.tmp2 $@.tmp3 $@.tmp4
|
1999-07-23 09:36:55 +00:00
|
|
|
|
|
|
|
.if !defined(NOPRECIOUSMAKEVARS)
|
|
|
|
.MAKEFLAGS: \
|
|
|
|
ARCH="${ARCH:S/"/"'"'"/g:S/\$/\$\$/g:S/\\/\\\\/g}" \
|
|
|
|
OPSYS="${OPSYS:S/"/"'"'"/g:S/\$/\$\$/g:S/\\/\\\\/g}" \
|
|
|
|
OSREL="${OSREL:S/"/"'"'"/g:S/\$/\$\$/g:S/\\/\\\\/g}" \
|
|
|
|
OSVERSION="${OSVERSION:S/"/"'"'"/g:S/\$/\$\$/g:S/\\/\\\\/g}" \
|
|
|
|
PORTOBJFORMAT="${PORTOBJFORMAT:S/"/"'"'"/g:S/\$/\$\$/g:S/\\/\\\\/g}"
|
|
|
|
.endif
|
2000-03-22 20:36:55 +00:00
|
|
|
|
2000-03-22 22:41:05 +00:00
|
|
|
|
|
|
|
|
2000-03-22 20:36:55 +00:00
|
|
|
search: ${PORTSDIR}/INDEX
|
2000-03-22 22:41:05 +00:00
|
|
|
@here=`pwd`; \
|
|
|
|
cd ${PORTSDIR}; \
|
|
|
|
top=`pwd`; \
|
|
|
|
there=`echo "$$here/" | sed s%$$top%${PORTSDIR}%`; \
|
2001-06-29 03:39:54 +00:00
|
|
|
if [ -n "$$key" ]; then \
|
2000-03-22 22:41:05 +00:00
|
|
|
grep $$there ${PORTSDIR}/INDEX | grep -i "${key}" | awk -F\| '{ printf("Port:\t%s\nPath:\t%s\nInfo:\t%s\nMaint:\t%s\nIndex:\t%s\nB-deps:\t%s\nR-deps:\t%s\n\n", $$1, $$2, $$4, $$6, $$7, $$8, $$9); }'; \
|
|
|
|
elif [ $$name ]; then \
|
|
|
|
grep $$there ${PORTSDIR}/INDEX | grep -i "^[^|]*${name}[^|]*|" | awk -F\| '{ printf("Port:\t%s\nPath:\t%s\nInfo:\t%s\nMaint:\t%s\nIndex:\t%s\nB-deps:\t%s\nR-deps:\t%s\n\n", $$1, $$2, $$4, $$6, $$7, $$8, $$9); }'; \
|
|
|
|
else \
|
|
|
|
echo "The search target requires a keyword parameter or name parameter,"; \
|
|
|
|
echo "e.g.: \"make search key=somekeyword\""; \
|
|
|
|
echo "or \"make search name=somekeyword\""; \
|
|
|
|
fi;
|