%% Cyril Bouthors <[EMAIL PROTECTED]> writes:

  cb> I'm wondering how to generate multiple files with different extensions
  cb> from one centralized file source (source in m4 in my application but I
  cb> won't explains unwanted details here).

Well, you generate them however you generate them!  It's not make's
place to say _how_ the build scripts it invokes work, it just expects
them to do so.

Your problem is that your rule _doesn't_.

  cb> The Makefile looks like (as simple as possible):

  cb> LIST = file.out1 file.out2

  cb> all: $(LIST)

  cb> %.out1 %.out2: %.source
  cb>   cat $< > $@

You're building only $@ here.  $@ is set to whatever target caused this
rule to be invoked.

IOW, your rule says that the script will build two targets, but your
script only builds one.  Make expects that the makefile accurately
reflects what the script will do; if your script doesn't do that it's
either a bug in the script, or in your makefile.

In this case, it's a bug in the script.  You want something like this:

 %.out1 %.out2: %.source
        cat $< > $*.out1
        cat $< > $*.out2

so that the script builds _both_ output files.

  cb> I just don't understand why make can't build several files from the
  cb> same target at the same time...

Make doesn't build anything.  Your scripts build things.  The makefile
tells make what scripts to invoke when it wants something built, and
what it should expect the script to build when it's invoked.

If your script doesn't build what your makefile told make it would, then
make is not going to work the way you expect.

-- 
-------------------------------------------------------------------------------
 Paul D. Smith <[EMAIL PROTECTED]>          Find some GNU make tips at:
 http://www.gnu.org                      http://www.ultranet.com/~pauld/gmake/
 "Please remain calm...I may be mad, but I am a professional." --Mad Scientist

Reply via email to