Annotation of src/share/mk/bsd.port.subdir.mk, Revision 1.1
1.1 ! niklas 1: # $OpenBSD: bsd.port.subdir.mk,v 1.14 1996/04/09 22:54:13 wosch Exp $
! 2:
! 3: .MAIN: all
! 4:
! 5: .if !defined(DEBUG_FLAGS)
! 6: STRIP?= -s
! 7: .endif
! 8:
! 9:
! 10: ECHO_MSG?= echo
! 11:
! 12: _SUBDIRUSE: .USE
! 13: @for entry in ${SUBDIR}; do \
! 14: OK=""; \
! 15: for dud in $$DUDS; do \
! 16: if [ $${dud} = $${entry} ]; then \
! 17: OK="false"; \
! 18: ${ECHO_MSG} "===> ${DIRPRFX}$${entry} skipped"; \
! 19: fi; \
! 20: done; \
! 21: if [ "$$OK" = "" ]; then \
! 22: if test -d ${.CURDIR}/$${entry}.${MACHINE}; then \
! 23: ${ECHO_MSG} "===> ${DIRPRFX}$${entry}.${MACHINE}"; \
! 24: edir=$${entry}.${MACHINE}; \
! 25: cd ${.CURDIR}/$${edir}; \
! 26: else \
! 27: ${ECHO_MSG} "===> ${DIRPRFX}$$entry"; \
! 28: edir=$${entry}; \
! 29: cd ${.CURDIR}/$${edir}; \
! 30: fi; \
! 31: ${MAKE} ${.TARGET:realinstall=install} \
! 32: DIRPRFX=${DIRPRFX}$$edir/; \
! 33: fi; \
! 34: done
! 35:
! 36: ${SUBDIR}::
! 37: @if test -d ${.TARGET}.${MACHINE}; then \
! 38: cd ${.CURDIR}/${.TARGET}.${MACHINE}; \
! 39: else \
! 40: cd ${.CURDIR}/${.TARGET}; \
! 41: fi; \
! 42: ${MAKE} all
! 43:
! 44: .for __target in all fetch fetch-list package extract configure \
! 45: build clean depend describe reinstall tags checksum
! 46: .if !target(__target)
! 47: ${__target}: _SUBDIRUSE
! 48: .endif
! 49: .endfor
! 50:
! 51: .if !target(install)
! 52: .if !target(beforeinstall)
! 53: beforeinstall:
! 54: .endif
! 55: .if !target(afterinstall)
! 56: afterinstall:
! 57: .endif
! 58: install: afterinstall
! 59: afterinstall: realinstall
! 60: realinstall: beforeinstall _SUBDIRUSE
! 61: .endif
! 62:
! 63: .if !target(readmes)
! 64: readmes: readme _SUBDIRUSE
! 65: .endif
! 66:
! 67: .if !target(readme)
! 68: readme:
! 69: @rm -f README.html
! 70: @make README.html
! 71: .endif
! 72:
! 73: PORTSDIR ?= /usr/ports
! 74: TEMPLATES ?= ${PORTSDIR}/templates
! 75: .if defined(PORTSTOP)
! 76: README= ${TEMPLATES}/README.top
! 77: .else
! 78: README= ${TEMPLATES}/README.category
! 79: .endif
! 80:
! 81: README.html:
! 82: @echo "===> Creating README.html"
! 83: @> $@.tmp
! 84: .for entry in ${SUBDIR}
! 85: .if defined(PORTSTOP)
! 86: @echo -n '<a href="'${entry}/README.html'">${entry}</a>: ' >> $@.tmp
! 87: .else
! 88: @echo -n '<a href="'${entry}/README.html'">'"`cd ${entry}; make package-name`</a>: " >> $@.tmp
! 89: .endif
! 90: .if exists(${entry}/pkg/COMMENT)
! 91: @cat ${entry}/pkg/COMMENT >> $@.tmp
! 92: .else
! 93: @echo "(no description)" >> $@.tmp
! 94: .endif
! 95: .endfor
! 96: @sort -t '>' +1 -2 $@.tmp > $@.tmp2
! 97: @cat ${README} | \
! 98: sed -e 's&%%CATEGORY%%&'`echo ${.CURDIR} | sed -e 's.*/\([^/]*\)$$\1'`'&g' \
! 99: -e '/%%DESCR%%/r${.CURDIR}/pkg/DESCR' \
! 100: -e '/%%DESCR%%/d' \
! 101: -e '/%%SUBDIR%%/r$@.tmp2' \
! 102: -e '/%%SUBDIR%%/d' \
! 103: > $@
! 104: @rm -f $@.tmp $@.tmp2