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