tech-pkg: isn't use of make's ".for" preferred for makefile iteration?

Subject: isn't use of make's ".for" preferred for makefile iteration?
To: NetBSD Packages Technical Discussion List <tech-pkg@NetBSD.ORG>
From: Greg A. Woods <woods@weird.com>
List: tech-pkg
Date: 03/18/2001 13:01:17
I was looking through the security/openssh package module to see if I
could see whether it might be installing things in the wrong place or
not and I discovered what I think is a rather questionable use of a
shell "for" loop instead of a make ".for" loop.
The first obvious problem is that in order for the makefile to clearly
show what it is doing during the build an extra 'echo' statement would
be necessary. Use of make's syntax eliminates this need.
Wouldn't the following change make it more correct?
$ cvs diff Makefile 
Index: Makefile
===================================================================
RCS file: /most/spare/cvs.NetBSD.ORG/pkgsrc/security/openssh/Makefile,v
retrieving revision 1.42
diff -c -r1.42 Makefile
*** Makefile 2001年03月11日 20:42:28 1.42
--- Makefile 2001年03月18日 17:48:43
***************
*** 83,99 ****
	cd ${WRKSRC} && ${LOCALBASE}/bin/autoreconf
 
 post-build:
!	for FILE in \
!		${PKGDIR}/DEINSTALL	\
		${PKGDIR}/INSTALL	\
		${PKGDIR}/INSTALL.SunOS \
		${FILESDIR}/sshd.sh;	\
!	do \
!		${SED} -e 's#@SSH_CONF_DIR@#${SSH_CONF_DIR}#g' \
!			-e 's#@PREFIX@#${PREFIX}#g' \
!			-e 's#@INSTALL_DATA@#${INSTALL_DATA}#g' \
!			< $${FILE} > ${WRKDIR}/`basename $${FILE}`; \
!	done
 
 pre-install:
	PKG_PREFIX=${PREFIX} ${SH} ${INSTALL_FILE} ${PKGNAME} PRE-INSTALL
--- 83,97 ----
	cd ${WRKSRC} && ${LOCALBASE}/bin/autoreconf
 
 post-build:
! .for FILE in ${PKGDIR}/DEINSTALL	\
		${PKGDIR}/INSTALL	\
		${PKGDIR}/INSTALL.SunOS	\
! 		${FILESDIR}/sshd.sh
!	${SED} -e 's#@SSH_CONF_DIR@#${SSH_CONF_DIR}#g'		\
!		-e 's#@PREFIX@#${PREFIX}#g'			\
!		-e 's#@INSTALL_DATA@#${INSTALL_DATA}#g'		\
!		${FILE} > ${WRKDIR}/`basename ${FILE}`
! .endfor
 
 pre-install:
	PKG_PREFIX=${PREFIX} ${SH} ${INSTALL_FILE} ${PKGNAME} PRE-INSTALL
It would probably be even better to list the files in a variable
definition too....
and note also the fix to eliminate silly stdin redirection for sed.
-- 
							Greg A. Woods
+1 416 218-0098 VE3TCP <gwoods@acm.org> <robohack!woods>
Planix, Inc. <woods@planix.com>; Secrets of the Weird <woods@weird.com>

AltStyle によって変換されたページ (->オリジナル) /