From owner-freebsd-hackers Wed Nov 11 23:15:15 1998 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id XAA05962 for freebsd-hackers-outgoing; Wed, 11 Nov 1998 23:15:15 -0800 (PST) (envelope-from owner-freebsd-hackers@FreeBSD.ORG) Received: from detlev.UUCP (79.camalott.com [208.203.140.79]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id XAA05957 for ; Wed, 11 Nov 1998 23:15:12 -0800 (PST) (envelope-from joelh@gnu.org) Received: (from joelh@localhost) by detlev.UUCP (8.9.1/8.9.1) id BAA18575; Thu, 12 Nov 1998 01:04:06 -0600 (CST) (envelope-from joelh) To: David Holland Cc: kline@tao.thought.org (Gary Kline), hackers@FreeBSD.ORG Subject: Re: bsd make to gnu make conversion, anyone?? References: <98Nov11.234727edt.37814-2936@qew.cs.toronto.edu> From: Joel Ray Holveck Date: 12 Nov 1998 01:04:05 -0600 In-Reply-To: David Holland's message of "Wed, 11 Nov 1998 23:47:27 -0500" Message-ID: <86hfw5ie8q.fsf@detlev.UUCP> Lines: 60 X-Mailer: Gnus v5.5/Emacs 20.3 Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG >>> Are there any makefile senior Wizards out there who can clue me >>> in on the translation of this pmake > gmake doesn't have an equivalent for .for, so you're stuck with making > a mess. Using gmake's 'foreach' and sh's 'for' may be useful. >> for lang in ${LANGS} >> ${lang}.mv.cat: ${.CURDIR}/nls/${lang}/mv.msg >> gencat -new ${.TARGET} ${.ALLSRC} >> .endfor > %.mv.cat: ${.CURDIR}/nls/%/mv.msg > gencat -new $@ $^ This is the cleanest solution. Still, if you want alternatives, I haven't tried this, but foreach may work here, as a generalization of for: define do-lang $(lang).mv.cat: $(.CURDIR)/nls/$(lang)/mv.msg gencat -new $(.TARGET) $(.ALLSRC) endef $(foreach lang,$(LANGS),$(do-lang)) and similarly for the other one. Note that lang either should not have been defined yet, or defined with =, not :=. Again, I personally think that your % rule is by far cleaner. >> beforeinstall: >> .for lang in ${LANGS} >> ${INSTALL} ${COPY} -o ${BINOWN} -g ${BINGRP} -m ${NOBINMODE} \ >> ${lang}.mv.cat ${DESTDIR}${NLSDIR}/${lang}/mv.cat >> .endfor > ${patsubst %, install-%, ${LANGS}}: install-%: > ${INSTALL} -c -o root -m 644 ${patsubst install-%, %.mv.cat, $@} \ > ${DESTDIR}${NLSDIR}/${patsubst install-%, %, $@}/mv.cat > > beforeinstall: ${patsubst %, install-%, ${LANGS}} What's wrong with using sh like God intended? beforeinstall: for lang in ${LANGS} ; do \ ${INSTALL} ${COPY} -o ${BINOWN} -g ${BINGRP} -m ${NOBINMODE} \ $${lang}.mv.cat ${DESTDIR}${NLSDIR}/$${lang}/mv.cat ; \ done Note the $${lang}, so that sh interprets the variable instead of make. (Using foreach may also work here.) Happy hacking, joelh -- Joel Ray Holveck - joelh@gnu.org Fourth law of programming: Anything that can go wrong wi sendmail: segmentation violation - core dumped To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message