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,
|
1998-10-30 03:28:02 -05:00
|
|
|
# install, package, package-loop, readmes, realinstall, reinstall, tags
|
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
|
|
|
|
TARGETS+= package
|
|
|
|
TARGETS+= package-loop
|
|
|
|
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 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
|
|
|
|
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
|
|
|
|
|
1997-11-05 21:20:27 -05:00
|
|
|
HTMLIFY= sed -e 's/&/\&/g' -e 's/>/\>/g' -e 's/</\</g'
|
|
|
|
|
1996-04-01 06:13:00 -05:00
|
|
|
README.html:
|
|
|
|
@echo "===> Creating README.html"
|
|
|
|
@> $@.tmp
|
|
|
|
.for entry in ${SUBDIR}
|
|
|
|
.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
|
|
|
|
.if exists(${entry}/pkg/COMMENT)
|
1997-11-05 21:20:27 -05:00
|
|
|
@${HTMLIFY} ${entry}/pkg/COMMENT >> $@.tmp
|
1996-04-01 06:13:00 -05:00
|
|
|
.else
|
|
|
|
@echo "(no description)" >> $@.tmp
|
|
|
|
.endif
|
|
|
|
.endfor
|
|
|
|
@sort -t '>' +1 -2 $@.tmp > $@.tmp2
|
1997-11-05 21:20:27 -05:00
|
|
|
.if exists(${.CURDIR}/pkg/DESCR)
|
|
|
|
@${HTMLIFY} ${.CURDIR}/pkg/DESCR > $@.tmp3
|
|
|
|
.else
|
|
|
|
@> $@.tmp3
|
|
|
|
.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' \
|
|
|
|
-e '/%%DESCR%%/r$@.tmp3' \
|
1996-04-01 06:13:00 -05:00
|
|
|
-e '/%%DESCR%%/d' \
|
|
|
|
-e '/%%SUBDIR%%/r$@.tmp2' \
|
|
|
|
-e '/%%SUBDIR%%/d' \
|
|
|
|
> $@
|
1997-11-05 21:20:27 -05:00
|
|
|
@rm -f $@.tmp $@.tmp2 $@.tmp3
|
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
|