Deleted Added
full compact
bsd.subdir.mk (270187) bsd.subdir.mk (264303)
1# from: @(#)bsd.subdir.mk 5.9 (Berkeley) 2/1/91
1# from: @(#)bsd.subdir.mk 5.9 (Berkeley) 2/1/91
2# $FreeBSD: stable/10/share/mk/bsd.subdir.mk 270187 2014-08-19 23:33:51Z ian $
2# $FreeBSD: stable/10/share/mk/bsd.subdir.mk 264303 2014-04-09 18:16:58Z dim $
3#
4# The include file <bsd.subdir.mk> contains the default targets
5# for building subdirectories.
6#
7# For all of the directories listed in the variable SUBDIRS, the
8# specified directory will be visited and the target made. There is
9# also a default target which allows the command "make subdir" where
10# subdir is any directory listed in the variable SUBDIRS.

--- 29 unchanged lines hidden (view full) ---

40.for dist in ${DISTRIBUTION}
41 ${_+_}cd ${.CURDIR}; \
42 ${MAKE} install -DNO_SUBDIR DESTDIR=${DISTDIR}/${dist} SHARED=copies
43.endfor
44.endif
45
46_SUBDIR: .USE .MAKE
47.if defined(SUBDIR) && !empty(SUBDIR) && !defined(NO_SUBDIR)
3#
4# The include file <bsd.subdir.mk> contains the default targets
5# for building subdirectories.
6#
7# For all of the directories listed in the variable SUBDIRS, the
8# specified directory will be visited and the target made. There is
9# also a default target which allows the command "make subdir" where
10# subdir is any directory listed in the variable SUBDIRS.

--- 29 unchanged lines hidden (view full) ---

40.for dist in ${DISTRIBUTION}
41 ${_+_}cd ${.CURDIR}; \
42 ${MAKE} install -DNO_SUBDIR DESTDIR=${DISTDIR}/${dist} SHARED=copies
43.endfor
44.endif
45
46_SUBDIR: .USE .MAKE
47.if defined(SUBDIR) && !empty(SUBDIR) && !defined(NO_SUBDIR)
48 @${_+_}set -e; for entry in ${SUBDIR:N.WAIT}; do \
48 @${_+_}set -e; for entry in ${SUBDIR}; do \
49 if test -d ${.CURDIR}/$${entry}.${MACHINE_ARCH}; then \
49 if test -d ${.CURDIR}/$${entry}.${MACHINE_ARCH}; then \
50 ${ECHODIR} "===> ${DIRPRFX}$${entry}.${MACHINE_ARCH} (${.TARGET:S,realinstall,install,:S,^_sub.,,})"; \
50 ${ECHODIR} "===> ${DIRPRFX}$${entry}.${MACHINE_ARCH} (${.TARGET:realinstall=install})"; \
51 edir=$${entry}.${MACHINE_ARCH}; \
52 cd ${.CURDIR}/$${edir}; \
53 else \
51 edir=$${entry}.${MACHINE_ARCH}; \
52 cd ${.CURDIR}/$${edir}; \
53 else \
54 ${ECHODIR} "===> ${DIRPRFX}$$entry (${.TARGET:S,realinstall,install,:S,^_sub.,,})"; \
54 ${ECHODIR} "===> ${DIRPRFX}$$entry (${.TARGET:realinstall=install})"; \
55 edir=$${entry}; \
56 cd ${.CURDIR}/$${edir}; \
57 fi; \
55 edir=$${entry}; \
56 cd ${.CURDIR}/$${edir}; \
57 fi; \
58 ${MAKE} ${.TARGET:S,realinstall,install,:S,^_sub.,,} \
58 ${MAKE} ${.TARGET:realinstall=install} \
59 DIRPRFX=${DIRPRFX}$$edir/; \
60 done
61.endif
62
59 DIRPRFX=${DIRPRFX}$$edir/; \
60 done
61.endif
62
63${SUBDIR:N.WAIT}: .PHONY .MAKE
63${SUBDIR}: .PHONY .MAKE
64 ${_+_}@if test -d ${.TARGET}.${MACHINE_ARCH}; then \
65 cd ${.CURDIR}/${.TARGET}.${MACHINE_ARCH}; \
66 else \
67 cd ${.CURDIR}/${.TARGET}; \
68 fi; \
69 ${MAKE} all
70
64 ${_+_}@if test -d ${.TARGET}.${MACHINE_ARCH}; then \
65 cd ${.CURDIR}/${.TARGET}.${MACHINE_ARCH}; \
66 else \
67 cd ${.CURDIR}/${.TARGET}; \
68 fi; \
69 ${MAKE} all
70
71# Work around parsing of .if nested in .for by putting .WAIT string into a var.
72__wait= .WAIT
73.for __target in all all-man checkdpadd clean cleandepend cleandir \
74 cleanilinks depend distribute lint maninstall manlint obj objlink \
75 realinstall regress tags ${SUBDIR_TARGETS}
76.ifdef SUBDIR_PARALLEL
71.for __target in all all-man checkdpadd clean cleandepend cleandir \
72 cleanilinks depend distribute lint maninstall manlint obj objlink \
73 realinstall regress tags ${SUBDIR_TARGETS}
74.ifdef SUBDIR_PARALLEL
77__subdir_targets=
78.for __dir in ${SUBDIR}
75.for __dir in ${SUBDIR}
79.if ${__wait} == ${__dir}
80__subdir_targets+= .WAIT
81.else
82__subdir_targets+= ${__target}_subdir_${__dir}
83__deps=
84.for __dep in ${SUBDIR_DEPEND_${__dir}}
85__deps+= ${__target}_subdir_${__dep}
86.endfor
87${__target}_subdir_${__dir}: .MAKE ${__deps}
88.if !defined(NO_SUBDIR)
76${__target}: ${__target}_subdir_${__dir}
77${__target}_subdir_${__dir}: .MAKE
89 @${_+_}set -e; \
90 if test -d ${.CURDIR}/${__dir}.${MACHINE_ARCH}; then \
91 ${ECHODIR} "===> ${DIRPRFX}${__dir}.${MACHINE_ARCH} (${__target:realinstall=install})"; \
92 edir=${__dir}.${MACHINE_ARCH}; \
93 cd ${.CURDIR}/$${edir}; \
94 else \
95 ${ECHODIR} "===> ${DIRPRFX}${__dir} (${__target:realinstall=install})"; \
96 edir=${__dir}; \
97 cd ${.CURDIR}/$${edir}; \
98 fi; \
99 ${MAKE} ${__target:realinstall=install} \
100 DIRPRFX=${DIRPRFX}$$edir/
78 @${_+_}set -e; \
79 if test -d ${.CURDIR}/${__dir}.${MACHINE_ARCH}; then \
80 ${ECHODIR} "===> ${DIRPRFX}${__dir}.${MACHINE_ARCH} (${__target:realinstall=install})"; \
81 edir=${__dir}.${MACHINE_ARCH}; \
82 cd ${.CURDIR}/$${edir}; \
83 else \
84 ${ECHODIR} "===> ${DIRPRFX}${__dir} (${__target:realinstall=install})"; \
85 edir=${__dir}; \
86 cd ${.CURDIR}/$${edir}; \
87 fi; \
88 ${MAKE} ${__target:realinstall=install} \
89 DIRPRFX=${DIRPRFX}$$edir/
101.endif
102.endif
103.endfor
90.endfor
104${__target}: ${__subdir_targets}
105.else
91.else
106${__target}: _sub.${__target}
107_sub.${__target}: _SUBDIR
92${__target}: _SUBDIR
108.endif
109.endfor
110
111.for __target in files includes
112.for __stage in build install
113${__stage}${__target}:
114.if make(${__stage}${__target})
93.endif
94.endfor
95
96.for __target in files includes
97.for __stage in build install
98${__stage}${__target}:
99.if make(${__stage}${__target})
115${__stage}${__target}: _sub.${__stage}${__target}
116_sub.${__stage}${__target}: _SUBDIR
100${__stage}${__target}: _SUBDIR
117.endif
118.endfor
101.endif
102.endfor
119.if !target(${__target})
120${__target}: .MAKE
121 ${_+_}set -e; cd ${.CURDIR}; ${MAKE} build${__target}; ${MAKE} install${__target}
103${__target}: .MAKE
104 ${_+_}set -e; cd ${.CURDIR}; ${MAKE} build${__target}; ${MAKE} install${__target}
122.endif
123.endfor
124
125.if !target(install)
126.if !target(beforeinstall)
127beforeinstall:
128.endif
129.if !target(afterinstall)
130afterinstall:
131.endif
132install: beforeinstall realinstall afterinstall
133.ORDER: beforeinstall realinstall afterinstall
134.endif
135
136.endif
105.endfor
106
107.if !target(install)
108.if !target(beforeinstall)
109beforeinstall:
110.endif
111.if !target(afterinstall)
112afterinstall:
113.endif
114install: beforeinstall realinstall afterinstall
115.ORDER: beforeinstall realinstall afterinstall
116.endif
117
118.endif