I have some questions on the post http://groups.google.com/group/gnu.utils.help/browse_thread/thread/c73e3e9d136a8fa2/80b2c1f60ea8120e?lnk=gst&q=Makefile+Multiple+Targets+in+a+Rule+&rnum=8# 1. [quote] Paul D. Smith View profile More options Mar 4 1998, 4:00 pm Newsgroups: gnu.utils.help From: [EMAIL PROTECTED] (Paul D. Smith) Date: 1998/03/04 Subject: Re: Make - mulitple targets but from lists Reply to author | Forward | Print | Individual message | Show original | Report this message | Find messages by this author
%% John Hetherington <[EMAIL PROTECTED]> writes: jh> # Can anyone help me ? jh> # jh> # I need this makefile to generate the following output, jh> # jh> # Created r.x.c from x.c jh> # Created s.x.c from x.c jh> # Created t.x.c from x.c jh> # Created r.y.c from y.c jh> # Created s.y.c from y.c jh> # Created t.y.c from y.c jh> # jh> # but only using the contents of the two lists, SRCS and PREFIXES. jh> SRCS = x.c y.c jh> PREFIXES = r s t I don't see any excellent way to do it. However, here are two alternatives: The first uses pattern rules. However, remember that a pattern rule with multiple patterns for targets means that a single invocation of this rule builds all the targets; that's not actually what you want but there's no way to avoid it, so you'll have to really do that: [/quote] I dont understand "However, remember that a pattern rule with multiple patterns for targets means that a single invocation of this rule builds all the targets" I could not find the same statement in the Make Manual. it's better if there are more explaintations and more examples. 2. [quote] .SUFFIXES: SRCS = x.c y.c PREFIXES = r s t PATTERN = $(foreach p,$(PREFIXES),$(p).%) ALL = $(foreach p,$(PREFIXES),$(foreach s,$(SRCS),$(p).$(s))) all: $(ALL) $(PATTERN):: % @for p in $(PREFIXES); do \ echo Created $$p.$< from $<; \ done Here we use a shell loop in the pattern rule to run the command once per prefix. [/quote] I could understand why double colon needed here. anyone could resolve my questions? TIA [EMAIL PROTECTED]