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