[BACK]Return to bsd.pkg.subdir.mk CVS log [TXT][DIR] Up to [cvs.NetBSD.org] / pkgsrc / mk

Annotation of pkgsrc/mk/bsd.pkg.subdir.mk, Revision 1.21

1.21    ! agc         1: #      $NetBSD: bsd.pkg.subdir.mk,v 1.20 1998/07/26 03:25:54 lukem Exp $
1.9       agc         2: #      Derived from: FreeBSD Id: bsd.port.subdir.mk,v 1.19 1997/03/09 23:10:56 wosch Exp
1.1       agc         3: #      from: @(#)bsd.subdir.mk 5.9 (Berkeley) 2/1/91
                      4: #
1.9       agc         5: # The include file <bsd.pkg.subdir.mk> contains the default targets
1.1       agc         6: # for building ports subdirectories.
                      7: #
                      8: #
                      9: # +++ variables +++
                     10: #
1.8       hubertf    11: # STRIPFLAG    The flag passed to the install program to cause the binary
1.1       agc        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: # OPSYS                Get the operating system type [`uname -s`]
                     17: #
                     18: # SUBDIR       A list of subdirectories that should be built as well.
                     19: #              Each of the targets will execute the same target in the
                     20: #              subdirectories.
                     21: #
                     22: #
                     23: # +++ targets +++
                     24: #
                     25: #      README.html:
                     26: #              Creating README.html for package.
                     27: #
                     28: #      afterinstall, all, beforeinstall, build, checksum, clean,
1.11      hubertf    29: #      configure, deinstall, depend, describe, extract, fetch, fetch-list,
1.6       hubertf    30: #      install, package, readmes, realinstall, reinstall, tags,
                     31: #      mirror-distfiles
1.1       agc        32: #
                     33:
                     34:
                     35: .MAIN: all
                     36:
                     37: .if !defined(DEBUG_FLAGS)
1.8       hubertf    38: STRIPFLAG?=    -s
1.1       agc        39: .endif
                     40:
                     41: .if !defined(OPSYS)    # XXX !!
                     42: OPSYS!=        uname -s
                     43: .endif
                     44:
1.21    ! agc        45: BASENAME?=     /usr/bin/basename
        !            46: ECHO?=         /bin/echo
        !            47: MV?=           /bin/mv
        !            48: RM?=           /bin/rm
        !            49: SED?=          /usr/bin/sed
        !            50: SORT?=         /usr/bin/sort
1.1       agc        51:
                     52: _SUBDIRUSE: .USE
                     53:        @for entry in ${SUBDIR}; do \
                     54:                OK=""; \
                     55:                for dud in $$DUDS; do \
                     56:                        if [ $${dud} = $${entry} ]; then \
                     57:                                OK="false"; \
1.21    ! agc        58:                                ${ECHO} "===> ${_THISDIR_}$${entry} skipped"; \
1.1       agc        59:                        fi; \
                     60:                done; \
1.21    ! agc        61:                if [ -d ${.CURDIR}/$${entry}.${MACHINE} ]; then \
1.1       agc        62:                        edir=$${entry}.${MACHINE}; \
1.21    ! agc        63:                elif [ -d ${.CURDIR}/$${entry} ]; then \
1.1       agc        64:                        edir=$${entry}; \
                     65:                else \
                     66:                        OK="false"; \
1.21    ! agc        67:                        ${ECHO} "===> ${_THISDIR_}$${entry} non-existent"; \
1.1       agc        68:                fi; \
                     69:                if [ "$$OK" = "" ]; then \
                     70:                        cd ${.CURDIR}/$${edir}; \
1.18      hubertf    71:                        if [ -z "${_THISDIR_}" -a ! -d "files" ]; then \
1.21    ! agc        72:                                ${ECHO} "===> category ${_THISDIR_}$${edir}"; \
1.17      hubertf    73:                                ${MAKE} ${.TARGET:realinstall=install} \
                     74:                                        "_THISDIR_=${_THISDIR_}$${edir}/"; \
                     75:                        else \
1.21    ! agc        76:                                ${ECHO} "===> package ${_THISDIR_}$${edir}"; \
1.17      hubertf    77:                                ${MAKE} ${.TARGET:realinstall=install} \
                     78:                                        "_THISDIR_=${_THISDIR_}$${edir}/" || /usr/bin/true ; \
                     79:                        fi ; \
1.1       agc        80:                fi; \
                     81:        done
                     82:
                     83: ${SUBDIR}::
1.21    ! agc        84:        @if [ -d ${.TARGET}.${MACHINE} ]; then \
1.1       agc        85:                cd ${.CURDIR}/${.TARGET}.${MACHINE}; \
                     86:        else \
                     87:                cd ${.CURDIR}/${.TARGET}; \
                     88:        fi; \
                     89:        ${MAKE} all
                     90:
                     91: .for __target in all fetch fetch-list package extract configure \
1.20      lukem      92:                 build clean distclean depend describe reinstall tags checksum \
1.11      hubertf    93:                 mirror-distfiles deinstall
1.1       agc        94: .if !target(__target)
                     95: ${__target}: _SUBDIRUSE
                     96: .endif
                     97: .endfor
                     98:
                     99: .if !target(install)
                    100: .if !target(beforeinstall)
                    101: beforeinstall:
                    102: .endif
                    103: .if !target(afterinstall)
                    104: afterinstall:
                    105: .endif
                    106: install: afterinstall
                    107: afterinstall: realinstall
                    108: realinstall: beforeinstall _SUBDIRUSE
                    109: .endif
                    110:
                    111: .if !target(readmes)
                    112: readmes: readme _SUBDIRUSE
                    113: .endif
                    114:
                    115: .if !target(readme)
                    116: readme:
1.21    ! agc       117:        @if [ -f README.html ]; then ${MV} -f README.html README.html.BAK ; fi
        !           118:        @${MAKE} README.html _README_TYPE=$@
        !           119: .endif
        !           120:
        !           121: .if !target(cdrom-readme)
        !           122: cdrom-readme:
        !           123:        @if [ -f README.html ]; then ${MV} -f README.html README.html.BAK ; fi
        !           124:        @${MAKE} README.html _README_TYPE=$@
1.1       agc       125: .endif
                    126:
1.14      agc       127: .if defined(PKGSRCTOP)
1.10      agc       128: README=        templates/README.top
1.1       agc       129: .else
1.10      agc       130: README=        ../templates/README.category
1.1       agc       131: .endif
                    132:
1.21    ! agc       133: HTMLIFY=       ${SED} -e 's/&/\&amp;/g' -e 's/>/\&gt;/g' -e 's/</\&lt;/g'
1.4       agc       134:
1.15      hubertf   135: README.html: .PRECIOUS
1.1       agc       136:        @> $@.tmp
                    137: .for entry in ${SUBDIR}
1.14      agc       138: .if defined(PKGSRCTOP)
1.21    ! agc       139:        @${ECHO} -n '<TR><TD VALIGN=TOP><a href="'${entry}/README.html'">'"`${ECHO} ${entry} | ${HTMLIFY}`"'</a>: <TD>' >> $@.tmp
1.1       agc       140: .else
1.21    ! agc       141:        @${ECHO} -n '<TR><TD VALIGN=TOP><a href="'${entry}/README.html'">'"`cd ${entry}; ${MAKE} package-name | ${HTMLIFY}`</a>: <TD>" >> $@.tmp
1.1       agc       142: .endif
                    143: .if exists(${entry}/pkg/COMMENT)
1.4       agc       144:        @${HTMLIFY} ${entry}/pkg/COMMENT >> $@.tmp
1.1       agc       145: .else
1.21    ! agc       146:        @${ECHO} "(no description)" >> $@.tmp
1.1       agc       147: .endif
                    148: .endfor
1.21    ! agc       149:        @${SORT} -t '>' +3 -4 $@.tmp > $@.tmp2
1.4       agc       150: .if exists(${.CURDIR}/pkg/DESCR)
                    151:        @${HTMLIFY} ${.CURDIR}/pkg/DESCR > $@.tmp3
                    152: .else
                    153:        @> $@.tmp3
                    154: .endif
1.1       agc       155:        @cat ${README} | \
1.21    ! agc       156:                ${SED} -e 's/%%CATEGORY%%/'"`${BASENAME} ${.CURDIR}`"'/g' \
1.4       agc       157:                        -e '/%%DESCR%%/r$@.tmp3' \
1.1       agc       158:                        -e '/%%DESCR%%/d' \
                    159:                        -e '/%%SUBDIR%%/r$@.tmp2' \
                    160:                        -e '/%%SUBDIR%%/d' \
1.19      hubertf   161:                > $@.tmp4
                    162:        @if cmp -s $@.tmp4 $@.BAK ; then \
1.21    ! agc       163:                ${MV} $@.BAK $@ ; \
        !           164:                ${RM} $@.tmp4 ; \
1.19      hubertf   165:        else \
1.21    ! agc       166:                ${ECHO} "===>  Creating README.html for ${_THISDIR_}${.CURDIR:T}" ; \
        !           167:                ${MV} $@.tmp4 $@ ; \
        !           168:                ${RM} -f $@.BAK ; \
1.19      hubertf   169:        fi
1.21    ! agc       170:        @${RM} -f $@.tmp $@.tmp2 $@.tmp3
1.5       agc       171: .for subdir in ${SUBDIR}
1.21    ! agc       172:        @cd ${subdir} && ${MAKE} "_THISDIR_=${_THISDIR_}${.CURDIR:T}/" ${_README_TYPE}
1.5       agc       173: .endfor

CVSweb <webmaster@jp.NetBSD.org>