[BACK]Return to bsd.port.subdir.mk CVS log [TXT][DIR] Up to [local] / src / share / mk

Annotation of src/share/mk/bsd.port.subdir.mk, Revision 1.3

1.3     ! imp         1: #      from: @(#)bsd.subdir.mk 5.9 (Berkeley) 2/1/91
1.2       niklas      2: #      $OpenBSD: bsd.port.subdir.mk,v 1.1 1996/06/03 22:47:11 niklas Exp $
1.3     ! imp         3: #      FreeBSD Id: bsd.port.subdir.mk,v 1.20 1997/08/22 11:16:15 asami Exp
        !             4: #
        !             5: # The include file <bsd.port.subdir.mk> contains the default targets
        !             6: # for building ports subdirectories.
        !             7: #
        !             8: #
        !             9: # +++ variables +++
        !            10: #
        !            11: # STRIP                The flag passed to the install program to cause the binary
        !            12: #              to be stripped.  This is to be used when building your
        !            13: #              own install script so that the entire system can be made
        !            14: #              stripped/not-stripped using a single knob. [-s]
        !            15: #
        !            16: # ECHO_MSG     Used to print all the '===>' style prompts - override this
        !            17: #              to turn them off [echo].
        !            18: #
        !            19: # OPSYS                Get the operating system type [`uname -s`]
        !            20: #
        !            21: # SUBDIR       A list of subdirectories that should be built as well.
        !            22: #              Each of the targets will execute the same target in the
        !            23: #              subdirectories.
        !            24: #
        !            25: #
        !            26: # +++ targets +++
        !            27: #
        !            28: #      README.html:
        !            29: #              Creating README.html for package.
        !            30: #
        !            31: #      afterinstall, all, beforeinstall, build, checksum, clean,
        !            32: #      configure, depend, describe, extract, fetch, fetch-list,
        !            33: #      install, package, readmes, realinstall, reinstall, tags
        !            34: #
        !            35:
1.1       niklas     36:
                     37: .MAIN: all
                     38:
                     39: .if !defined(DEBUG_FLAGS)
                     40: STRIP?=        -s
                     41: .endif
                     42:
1.3     ! imp        43: .if !defined(OPSYS)    # XXX !!
        !            44: OPSYS!=        uname -s
        !            45: .endif
1.1       niklas     46:
                     47: ECHO_MSG?=     echo
                     48:
                     49: _SUBDIRUSE: .USE
                     50:        @for entry in ${SUBDIR}; do \
                     51:                OK=""; \
                     52:                for dud in $$DUDS; do \
                     53:                        if [ $${dud} = $${entry} ]; then \
                     54:                                OK="false"; \
                     55:                                ${ECHO_MSG} "===> ${DIRPRFX}$${entry} skipped"; \
                     56:                        fi; \
                     57:                done; \
1.3     ! imp        58:                if test -d ${.CURDIR}/$${entry}.${MACHINE}; then \
        !            59:                        edir=$${entry}.${MACHINE}; \
        !            60:                elif test -d ${.CURDIR}/$${entry}; then \
        !            61:                        edir=$${entry}; \
        !            62:                else \
        !            63:                        OK="false"; \
        !            64:                        ${ECHO_MSG} "===> ${DIRPRFX}$${entry} non-existent"; \
        !            65:                fi; \
1.1       niklas     66:                if [ "$$OK" = "" ]; then \
1.3     ! imp        67:                        ${ECHO_MSG} "===> ${DIRPRFX}$${edir}"; \
        !            68:                        cd ${.CURDIR}/$${edir}; \
1.1       niklas     69:                        ${MAKE} ${.TARGET:realinstall=install} \
                     70:                                DIRPRFX=${DIRPRFX}$$edir/; \
                     71:                fi; \
                     72:        done
                     73:
                     74: ${SUBDIR}::
                     75:        @if test -d ${.TARGET}.${MACHINE}; then \
                     76:                cd ${.CURDIR}/${.TARGET}.${MACHINE}; \
                     77:        else \
                     78:                cd ${.CURDIR}/${.TARGET}; \
                     79:        fi; \
                     80:        ${MAKE} all
                     81:
                     82: .for __target in all fetch fetch-list package extract configure \
1.3     ! imp        83:                 build clean depend describe distclean reinstall tags checksum
1.1       niklas     84: .if !target(__target)
                     85: ${__target}: _SUBDIRUSE
                     86: .endif
                     87: .endfor
                     88:
                     89: .if !target(install)
                     90: .if !target(beforeinstall)
                     91: beforeinstall:
                     92: .endif
                     93: .if !target(afterinstall)
                     94: afterinstall:
                     95: .endif
                     96: install: afterinstall
                     97: afterinstall: realinstall
                     98: realinstall: beforeinstall _SUBDIRUSE
                     99: .endif
                    100:
                    101: .if !target(readmes)
                    102: readmes: readme _SUBDIRUSE
                    103: .endif
                    104:
                    105: .if !target(readme)
                    106: readme:
                    107:        @rm -f README.html
                    108:        @make README.html
                    109: .endif
                    110:
1.3     ! imp       111: .if (${OPSYS} == "NetBSD")
        !           112: PORTSDIR ?= /usr/opt
        !           113: .else
1.1       niklas    114: PORTSDIR ?= /usr/ports
1.3     ! imp       115: .endif
1.1       niklas    116: TEMPLATES ?= ${PORTSDIR}/templates
                    117: .if defined(PORTSTOP)
                    118: README=        ${TEMPLATES}/README.top
                    119: .else
                    120: README=        ${TEMPLATES}/README.category
                    121: .endif
                    122:
                    123: README.html:
                    124:        @echo "===>  Creating README.html"
                    125:        @> $@.tmp
                    126: .for entry in ${SUBDIR}
                    127: .if defined(PORTSTOP)
                    128:        @echo -n '<a href="'${entry}/README.html'">${entry}</a>: ' >> $@.tmp
                    129: .else
                    130:        @echo -n '<a href="'${entry}/README.html'">'"`cd ${entry}; make package-name`</a>: " >> $@.tmp
                    131: .endif
                    132: .if exists(${entry}/pkg/COMMENT)
                    133:        @cat ${entry}/pkg/COMMENT >> $@.tmp
                    134: .else
                    135:        @echo "(no description)" >> $@.tmp
                    136: .endif
                    137: .endfor
                    138:        @sort -t '>' +1 -2 $@.tmp > $@.tmp2
                    139:        @cat ${README} | \
                    140:                sed -e 's&%%CATEGORY%%&'`echo ${.CURDIR} | sed -e 's.*/\([^/]*\)$$\1'`'&g' \
                    141:                        -e '/%%DESCR%%/r${.CURDIR}/pkg/DESCR' \
                    142:                        -e '/%%DESCR%%/d' \
                    143:                        -e '/%%SUBDIR%%/r$@.tmp2' \
                    144:                        -e '/%%SUBDIR%%/d' \
                    145:                > $@
                    146:        @rm -f $@.tmp $@.tmp2