Add files from parent branch HEAD:
[pkgsrcv2.git] / Makefile
1 # $NetBSD: Makefile,v 1.46 2001/12/17 02:33:46 dmcmahill Exp $
2 #
3
4 .include "mk/bsd.prefs.mk"
5
6 .ifdef SPECIFIC_PKGS
7 SUBDIR+=        ${SITE_SPECIFIC_PKGS}
8 SUBDIR+=        ${HOST_SPECIFIC_PKGS}
9 SUBDIR+=        ${GROUP_SPECIFIC_PKGS}
10 SUBDIR+=        ${USER_SPECIFIC_PKGS}
11 .else
12 SUBDIR += archivers
13 SUBDIR += audio
14 SUBDIR += benchmarks
15 SUBDIR += biology
16 SUBDIR += cad
17 SUBDIR += chat
18 SUBDIR += comms
19 SUBDIR += converters
20 SUBDIR += cross
21 SUBDIR += databases
22 SUBDIR += devel
23 SUBDIR += editors
24 SUBDIR += emulators
25 SUBDIR += finance
26 SUBDIR += fonts
27 SUBDIR += games
28 SUBDIR += graphics
29 SUBDIR += ham
30 SUBDIR += inputmethod
31 SUBDIR += lang
32 SUBDIR += mail
33 SUBDIR += math
34 SUBDIR += mbone
35 SUBDIR += meta-pkgs
36 SUBDIR += misc
37 SUBDIR += net
38 SUBDIR += news
39 SUBDIR += parallel
40 SUBDIR += pkgtools
41 SUBDIR += print
42 SUBDIR += security
43 SUBDIR += shells
44 SUBDIR += sysutils
45 SUBDIR += time
46 SUBDIR += textproc
47 SUBDIR += wm
48 SUBDIR += www
49 SUBDIR += x11
50 .endif
51
52 PKGSRCTOP=      yes
53
54 .include "mk/bsd.pkg.subdir.mk"
55
56 # the bulk-cache and clean-bulk-cache targets are a global-pkgsrc
57 # thing and thus it makes sense to run it from the top level pkgsrc
58 # directory.
59 .if make(bulk-cache) || make(clean-bulk-cache)
60 .include "${.CURDIR}/mk/bulk/bsd.bulk-pkg.mk"
61 _PKGSRCDIR?=${.CURDIR}
62 .endif
63
64 index:
65         @rm -f ${.CURDIR}/INDEX
66         @${MAKE} ${.CURDIR}/INDEX
67
68 ${.CURDIR}/INDEX:
69         @${ECHO} -n "Generating INDEX - please wait.."
70         @${MAKE} describe ECHO_MSG="${ECHO} > /dev/null" > ${.CURDIR}/INDEX
71         @${ECHO} " Done."
72
73 print-index:    ${.CURDIR}/INDEX
74         @awk -F\| '{ printf("Port:\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
75
76 search: ${.CURDIR}/INDEX
77 .if !defined(key)
78         @${ECHO} "The search target requires a keyword parameter,"
79         @${ECHO} "e.g.: \"${MAKE} search key=somekeyword\""
80 .else
81         @grep ${key} ${.CURDIR}/INDEX | awk -F\| '{ printf("Port:\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); }'
82 .endif
83
84
85
86 # Generate list of all packages by extracting information from
87 # the category/README.html pages
88 #
89 readme-all:
90         @if [ -f README-all.html ]; then \
91                 mv README-all.html README-all.html.BAK ; \
92         fi
93         @${MAKE} README-all.html
94         @if cmp -s README-all.html README-all.html.BAK  ; then \
95                 mv README-all.html.BAK README-all.html ; \
96         else \
97                 rm -f README-all.html.BAK ; \
98         fi
99
100 README-all.html:
101         @rm -f $@.new
102         @rm -f $@.newsorted
103         @${ECHO} -n "Processing categories for $@:"
104 .for category in ${SUBDIR}
105         @if [ -f ${category}/README.html ]; then \
106                 ${ECHO} -n ' ${category}' ; \
107                 grep '^<TR>' ${category}/README.html \
108                 | sed -e 's|"|"${category}/|' \
109                       -e 's| <TD>| <TD>(<A HREF="${category}/README.html">${category}</A>) <TD>|' \
110                       -e 's|<TR>|<TR VALIGN=TOP>|' \
111                       -e 's|<TD VALIGN=TOP>|<TD>|' \
112                 >> $@.new ; \
113         fi
114 .endfor
115         @${ECHO} "."
116         @sort -f -t '">' +2 <$@.new >$@.newsorted
117         @wc -l $@.newsorted | awk '{ print $$1 }'  >$@.npkgs
118         @cat templates/README.all \
119         | ${SED} \
120                 -e '/%%NPKGS%%/r$@.npkgs' \
121                 -e '/%%NPKGS%%/d' \
122                 -e '/%%PKGS%%/r$@.newsorted' \
123                 -e '/%%PKGS%%/d' \
124                 > $@ 
125         @rm -f $@.npkgs
126         @rm -f $@.new
127         @rm -f $@.newsorted
128
129
130
131 readme-ipv6:
132         @if [ -f README-IPv6.html ]; then \
133                 mv README-IPv6.html README-IPv6.html.BAK ; \
134         fi
135         @${MAKE} README-IPv6.html
136         @if cmp -s README-IPv6.html README-IPv6.html.BAK  ; then \
137                 mv README-IPv6.html.BAK README-IPv6.html ; \
138         else \
139                 rm -f README-IPv6.html.BAK ; \
140         fi
141
142 README-IPv6.html:
143         @grep -l '^BUILD_DEFS.*=.*USE_INET6' */*/Makefile \
144          | sed s,Makefile,, >$@.pkgs
145         @fgrep -f $@.pkgs README-all.html | sort -t/ +1 >$@.trs
146         @cat templates/README.ipv6 \
147         | ${SED} \
148                 -e '/%%TRS%%/r$@.trs' \
149                 -e '/%%TRS%%/d' \
150                 >$@
151         @${RM} $@.trs
152         @${RM} $@.pkgs
153
154 show-host-specific-pkgs:
155         @${ECHO} "HOST_SPECIFIC_PKGS= \\";                                      \
156         ${MAKE} show-pkgsrc-dir | awk '/^===/ { next; } { printf("%s \\\n", $$1) }'; \
157         ${ECHO} ""