Skip site navigation (1)Skip section navigation (2)
Date:      12 Nov 1998 01:04:05 -0600
From:      Joel Ray Holveck <joelh@gnu.org>
To:        David Holland <dholland@cs.toronto.edu>
Cc:        kline@tao.thought.org (Gary Kline), hackers@FreeBSD.ORG
Subject:   Re: bsd make to gnu make conversion, anyone??
Message-ID:  <86hfw5ie8q.fsf@detlev.UUCP>
In-Reply-To: David Holland's message of "Wed, 11 Nov 1998 23:47:27 -0500"
References:  <98Nov11.234727edt.37814-2936@qew.cs.toronto.edu>

next in thread | previous in thread | raw e-mail | index | archive | help
>>> 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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?86hfw5ie8q.fsf>