# Don't try to extract debug info from ${PROG}.
MK_DEBUG_FILES= no
+# Set a default SRCDIR for each for simpler handling below.
+.for D in ${CRUNCH_SRCDIRS}
+.for P in ${CRUNCH_PROGS_${D}}
+CRUNCH_SRCDIR_${P}?= ${.CURDIR}/../../${D}/${P}
+.endfor
+.endfor
+
# Program names and their aliases contribute hardlinks to 'rescue' executable,
# except for those that get suppressed.
.for D in ${CRUNCH_SRCDIRS}
.for P in ${CRUNCH_PROGS_${D}}
-.ifdef CRUNCH_SRCDIR_${P}
${OUTPUTS}: ${CRUNCH_SRCDIR_${P}}/Makefile
-.else
-${OUTPUTS}: ${.CURDIR}/../../${D}/${P}/Makefile
-.endif
.if ${CRUNCH_GENERATE_LINKS} == "yes"
.ifndef CRUNCH_SUPPRESS_LINK_${P}
LINKS+= ${BINDIR}/${PROG} ${BINDIR}/${P}
.for D in ${CRUNCH_SRCDIRS}
.for P in ${CRUNCH_PROGS_${D}}
echo progs ${P} >>${.TARGET}
-.ifdef CRUNCH_SRCDIR_${P}
echo special ${P} srcdir ${CRUNCH_SRCDIR_${P}} >>${.TARGET}
-.else
- echo special ${P} srcdir ${.CURDIR}/../../${D}/${P} >>${.TARGET}
-.endif
.ifdef CRUNCH_BUILDOPTS_${P}
echo special ${P} buildopts DIRPRFX=${DIRPRFX}${P}/ \
${CRUNCH_BUILDOPTS_${P}} >>${.TARGET}
.for __target in clean cleandepend cleandir obj objlink
.for D in ${CRUNCH_SRCDIRS}
.for P in ${CRUNCH_PROGS_${D}}
-.ifdef CRUNCH_SRCDIR_${P}
-__dir= ${CRUNCH_SRCDIR_${P}}
-.else
-__dir= ${.CURDIR}/../../${D}/${P}
-.endif
${__target}_crunchdir_${P}: .PHONY .MAKE
- ${_+_}cd ${__dir} && \
+ ${_+_}cd ${CRUNCH_SRCDIR_${P}} && \
${CRUNCHENV} MAKEOBJDIRPREFIX=${CANONICALOBJDIR} ${MAKE} \
DIRPRFX=${DIRPRFX}${P}/ ${CRUNCH_BUILDOPTS} ${__target}
${__target}: ${__target}_crunchdir_${P}