Annotation of pkgsrc/Makefile, Revision 1.74
1.74 ! jlam 1: # $NetBSD: Makefile,v 1.73 2005/06/06 22:30:19 kristerw Exp $
1.1 agc 2: #
3:
1.70 wiz 4: # tools used by this Makefile
1.74 ! jlam 5: USE_TOOLS+= [ awk cat cmp echo env expr false fgrep grep mv rm sed \
! 6: sort wc
1.69 jlam 7:
1.70 wiz 8: # additional tools used by bsd.pkg.subdir.mk
1.74 ! jlam 9: USE_TOOLS+= basename touch
1.68 jlam 10:
11: # additional tools used by bsd.bulk-pkg.mk
1.74 ! jlam 12: USE_TOOLS+= egrep find ls sh tee true tsort
1.68 jlam 13:
1.22 hubertf 14: .include "mk/bsd.prefs.mk"
1.19 agc 15:
16: .ifdef SPECIFIC_PKGS
17: SUBDIR+= ${SITE_SPECIFIC_PKGS}
18: SUBDIR+= ${HOST_SPECIFIC_PKGS}
19: SUBDIR+= ${GROUP_SPECIFIC_PKGS}
20: SUBDIR+= ${USER_SPECIFIC_PKGS}
21: .else
1.1 agc 22: SUBDIR += archivers
23: SUBDIR += audio
24: SUBDIR += benchmarks
1.23 rh 25: SUBDIR += biology
1.9 frueauf 26: SUBDIR += cad
1.41 wiz 27: SUBDIR += chat
1.1 agc 28: SUBDIR += comms
29: SUBDIR += converters
1.14 tv 30: SUBDIR += cross
1.73 kristerw 31: SUBDIR += crosspkgtools
1.1 agc 32: SUBDIR += databases
33: SUBDIR += devel
34: SUBDIR += editors
35: SUBDIR += emulators
1.38 wiz 36: SUBDIR += finance
1.35 sakamoto 37: SUBDIR += fonts
1.1 agc 38: SUBDIR += games
1.60 agc 39: SUBDIR += geography
1.1 agc 40: SUBDIR += graphics
1.24 frueauf 41: SUBDIR += ham
1.47 seb 42: SUBDIR += inputmethod
1.1 agc 43: SUBDIR += lang
44: SUBDIR += mail
1.9 frueauf 45: SUBDIR += math
1.1 agc 46: SUBDIR += mbone
1.13 agc 47: SUBDIR += meta-pkgs
1.1 agc 48: SUBDIR += misc
1.61 jmmv 49: SUBDIR += multimedia
1.1 agc 50: SUBDIR += net
51: SUBDIR += news
1.17 garbled 52: SUBDIR += parallel
1.16 agc 53: SUBDIR += pkgtools
1.1 agc 54: SUBDIR += print
1.65 jlam 55: #SUBDIR += regress
1.1 agc 56: SUBDIR += security
57: SUBDIR += shells
58: SUBDIR += sysutils
1.55 hubertf 59: SUBDIR += textproc
1.42 wiz 60: SUBDIR += time
1.39 wiz 61: SUBDIR += wm
1.1 agc 62: SUBDIR += www
63: SUBDIR += x11
1.53 cjep 64: .endif
65:
66: .ifdef USER_ADDITIONAL_PKGS
67: SUBDIR+= ${USER_ADDITIONAL_PKGS}
1.19 agc 68: .endif
1.1 agc 69:
1.22 hubertf 70: PKGSRCTOP= yes
1.51 dmcmahil 71:
72:
1.66 jlam 73: # If PACKAGES is set to the default (${PKGSRCDIR}/packages), the current
1.51 dmcmahil 74: # ${MACHINE_ARCH} and "release" (uname -r) will be used. Otherwise a directory
75: # structure of ...pkgsrc/packages/`uname -r`/${MACHINE_ARCH} is assumed.
76: # The PKG_URL is set from FTP_PKG_URL_* or CDROM_PKG_URL_*, depending on
77: # the target used to generate the README.html file.
78: .PHONY: README.html
79: _README_TYPE_FLAG?= none
80: README.html: .PRECIOUS
81: .if ${_README_TYPE_FLAG} == "--ftp" || ${_README_TYPE_FLAG} == "--cdrom"
1.52 wiz 82: ${SETENV} TMPDIR=${TMPDIR:U/tmp}/mkreadme \
1.71 dmcmahil 83: BMAKE=${MAKE} \
1.51 dmcmahil 84: ./mk/scripts/mkreadme --pkgsrc ${.CURDIR} \
1.71 dmcmahil 85: --packages ${PACKAGES} ${_README_TYPE_FLAG} \
1.54 jmmv 86: --prune
1.51 dmcmahil 87: .else
88: @${ECHO} "ERROR: please do not use the README.html target directly."
89: @${ECHO} " Instead use either the \"readme\" or \"cdrom-readme\""
90: @${ECHO} " target."
91: @${FALSE}
92: .endif
1.22 hubertf 93:
94: .include "mk/bsd.pkg.subdir.mk"
1.45 dmcmahil 95:
96: # the bulk-cache and clean-bulk-cache targets are a global-pkgsrc
97: # thing and thus it makes sense to run it from the top level pkgsrc
98: # directory.
99: .if make(bulk-cache) || make(clean-bulk-cache)
100: .include "${.CURDIR}/mk/bulk/bsd.bulk-pkg.mk"
101: .endif
1.1 agc 102:
1.63 grant 103: .PHONY: ${.CURDIR}/PKGDB
1.57 grant 104: ${.CURDIR}/PKGDB:
105: @${RM} -f ${.CURDIR}/PKGDB
1.56 dmcmahil 106: @${ECHO_MSG} "Extracting complete dependency database. This may take a while..."
1.57 grant 107: @DB=${.CURDIR}/PKGDB ; \
1.56 dmcmahil 108: PKGSRCDIR=${.CURDIR} ; \
109: npkg=1; \
1.57 grant 110: list=`${GREP} '^[[:space:]]*'SUBDIR */Makefile | ${SED} 's,/Makefile.*=[[:space:]]*,/,'` ; \
1.56 dmcmahil 111: for pkgdir in $$list ; do \
112: if [ ! -d $$pkgdir ]; then \
113: echo " " ; \
1.67 rillig 114: echo "WARNING: the package directory $$pkgdir is listed in" > /dev/stderr ; \
115: echo $$pkgdir | ${SED} 's;/.*;/Makefile;g' > /dev/stderr ; \
1.56 dmcmahil 116: echo "but the directory does not exist. Please fix this!" > /dev/stderr ; \
117: else \
118: cd $$pkgdir ; \
119: l=`${MAKE} print-summary-data` ; \
120: if [ $$? != 0 ]; then \
121: echo "WARNING (printdepends): the package in $$pkgdir had problem with" \
122: > /dev/stderr ; \
123: echo " ${MAKE} print-summary-data" > /dev/stderr ; \
124: echo " database information for this package" > /dev/stderr ; \
125: echo " will be dropped." > /dev/stderr ; \
126: ${MAKE} print-summary-data 2>&1 > /dev/stderr ; \
127: else \
128: echo "$$l" >> $$DB ; \
129: fi ; \
130: fi ; \
131: echo -n "." ; \
132: if [ `${EXPR} $$npkg % 100 = 0` -eq 1 ]; then \
133: echo " " ; \
134: echo "$$npkg" ; \
135: fi ; \
136: npkg=`${EXPR} $$npkg + 1` ; \
137: cd $$PKGSRCDIR ; \
138: done
1.57 grant 139:
140: .PHONY: index
141: index: ${.CURDIR}/INDEX
142:
143: ${.CURDIR}/INDEX: ${.CURDIR}/PKGDB
1.56 dmcmahil 144: @${RM} -f ${.CURDIR}/INDEX
1.57 grant 145: @${AWK} -f ./mk/scripts/genindex.awk PKGSRCDIR=${.CURDIR} SORT=${SORT} ${.CURDIR}/PKGDB
146: @${RM} -f ${.CURDIR}/PKGDB
1.1 agc 147:
1.58 grant 148: print-index: ${.CURDIR}/INDEX
1.62 grant 149: @${AWK} -F\| '{ printf("Pkg:\t%s\nPath:\t%s\nInfo:\t%s\nMaint:\t%s\nIndex:\t%s\nB-deps:\t%s\nR-deps:\t%s\nArch:\t%s\n\n", $$1, $$2, $$4, $$6, $$7, $$8, $$9, $$10); }' < ${.CURDIR}/INDEX
1.1 agc 150:
1.58 grant 151: search: ${.CURDIR}/INDEX
1.1 agc 152: .if !defined(key)
1.43 hubertf 153: @${ECHO} "The search target requires a keyword parameter,"
154: @${ECHO} "e.g.: \"${MAKE} search key=somekeyword\""
1.1 agc 155: .else
1.62 grant 156: @${GREP} ${key} ${.CURDIR}/INDEX | ${AWK} -F\| '{ printf("Pkg:\t%s\nPath:\t%s\nInfo:\t%s\nMaint:\t%s\nIndex:\t%s\nB-deps:\t%s\nR-deps:\t%s\nArch:\t%s\n\n", $$1, $$2, $$4, $$6, $$7, $$8, $$9, $$10); }'
1.1 agc 157: .endif
1.19 agc 158:
1.48 wiz 159: #
1.25 hubertf 160: # Generate list of all packages by extracting information from
161: # the category/README.html pages
162: #
163: readme-all:
1.29 hubertf 164: @if [ -f README-all.html ]; then \
1.50 salo 165: ${MV} README-all.html README-all.html.BAK ; \
1.29 hubertf 166: fi
1.25 hubertf 167: @${MAKE} README-all.html
1.50 salo 168: @if ${CMP} -s README-all.html README-all.html.BAK ; then \
169: ${MV} README-all.html.BAK README-all.html ; \
1.25 hubertf 170: else \
1.50 salo 171: ${RM} -f README-all.html.BAK ; \
1.25 hubertf 172: fi
173:
174: README-all.html:
1.50 salo 175: @${RM} -f $@.new
176: @${RM} -f $@.newsorted
1.43 hubertf 177: @${ECHO} -n "Processing categories for $@:"
1.25 hubertf 178: .for category in ${SUBDIR}
179: @if [ -f ${category}/README.html ]; then \
1.43 hubertf 180: ${ECHO} -n ' ${category}' ; \
1.50 salo 181: ${GREP} '^<TR>' ${category}/README.html \
182: | ${SED} -e 's|"|"${category}/|' \
1.25 hubertf 183: -e 's| <TD>| <TD>(<A HREF="${category}/README.html">${category}</A>) <TD>|' \
184: -e 's|<TR>|<TR VALIGN=TOP>|' \
1.27 hubertf 185: -e 's|<TD VALIGN=TOP>|<TD>|' \
1.25 hubertf 186: >> $@.new ; \
187: fi
188: .endfor
1.43 hubertf 189: @${ECHO} "."
1.59 jmmv 190: @if [ ! -f $@.new ]; then \
191: ${ECHO} "There are no categories with README.html files available."; \
192: ${ECHO} "You need to run \`${MAKE} readme' to generate them before running this target."; \
193: ${FALSE}; \
194: fi
1.50 salo 195: @${SORT} -f -t '">' +2 <$@.new >$@.newsorted
196: @${WC} -l $@.newsorted | ${AWK} '{ print $$1 }' >$@.npkgs
197: @${CAT} templates/README.all \
1.25 hubertf 198: | ${SED} \
1.46 dmcmahil 199: -e '/%%NPKGS%%/r$@.npkgs' \
200: -e '/%%NPKGS%%/d' \
201: -e '/%%PKGS%%/r$@.newsorted' \
202: -e '/%%PKGS%%/d' \
1.48 wiz 203: > $@
1.50 salo 204: @${RM} -f $@.npkgs
205: @${RM} -f $@.new
206: @${RM} -f $@.newsorted
1.30 hubertf 207:
208: readme-ipv6:
209: @if [ -f README-IPv6.html ]; then \
1.50 salo 210: ${MV} README-IPv6.html README-IPv6.html.BAK ; \
1.30 hubertf 211: fi
212: @${MAKE} README-IPv6.html
1.50 salo 213: @if ${CMP} -s README-IPv6.html README-IPv6.html.BAK ; then \
214: ${MV} README-IPv6.html.BAK README-IPv6.html ; \
1.30 hubertf 215: else \
1.50 salo 216: ${RM} -f README-IPv6.html.BAK ; \
1.30 hubertf 217: fi
218:
219: README-IPv6.html:
1.72 wiz 220: @${GREP} -l -e '^BUILD_DEFS.*=.*USE_INET6' -e '^PKG_SUPPORTED_OPTIONS.*=.*inet6' \
221: */*/Makefile */*/options.mk \
222: | ${SED} -e s,Makefile,, -e s,options.mk,, >$@.pkgs
1.50 salo 223: @${FGREP} -f $@.pkgs README-all.html | ${SORT} -t/ +1 >$@.trs
224: @${CAT} templates/README.ipv6 \
1.30 hubertf 225: | ${SED} \
1.48 wiz 226: -e '/%%TRS%%/r$@.trs' \
227: -e '/%%TRS%%/d' \
1.30 hubertf 228: >$@
1.72 wiz 229: @${RM} $@.pkgs $@.trs
1.33 agc 230:
231: show-host-specific-pkgs:
1.43 hubertf 232: @${ECHO} "HOST_SPECIFIC_PKGS= \\"; \
1.50 salo 233: ${MAKE} show-pkgsrc-dir | ${AWK} '/^===/ { next; } { printf("%s \\\n", $$1) }'; \
1.43 hubertf 234: ${ECHO} ""
1.64 wiz 235:
236: # list all packages that depend on a particular package; needs the INDEX file
237: # usage: 'make show-deps PKG=openssl'
238: # PKG: name of the package
239: show-deps:
240: @if [ ! -f "${.CURDIR}/INDEX" ]; then ${ECHO} "No index available -- please build it with 'make index'" >&2; ${FALSE}; fi
241: @if [ -z "${PKG}" ]; then ${ECHO} "PKG variable not set" >&2; ${FALSE}; fi
242: @${GREP} -E "^([^|]*\|){7}([^|]* |)${PKG}>=" ${.CURDIR}/INDEX | ${SED} -n "s/^[^|]*|\([^|]*\)|.*/\1/p" | ${SORT}
CVSweb <webmaster@jp.NetBSD.org>