bug-make
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Make feature rq: Non-pattern rules with multi-target commands


From: Paul D. Smith
Subject: Re: Make feature rq: Non-pattern rules with multi-target commands
Date: Sun, 20 Oct 2002 21:18:46 -0400

%% Henning Makholm <address@hidden> writes:

  hm> I think it would be cool if there was some way to write a
  hm> non-pattern rule that tells Make that this particular command
  hm> creates more than one file simultaneously. I.e., a multi-target
  hm> rule that works like multi-target pattern rules.

Yes, it would be.

  hm> Here is why I need it: I use a compiler, `mosmlc', that reads a
  hm> `*.sml' source file and write a `*.uo' file with object code and a
  hm> `*.ui' file with a machine-readable interface summary.

OK... I don't see why the standard pattern rules won't do the trick
here?

  %.uo %.ui : %.sml
        mosmlc $<

?  I'm not saying that explicit multi-target commands is not desirable,
just that I don't see why you need them in this case.

  hm> I have tried to think of alternatives like letting foobar.ui be
  hm> the sole target of the mosmlc command and then having foobar.uo
  hm> depend on foobar.ui with empty commands, or vice versa, but
  hm> neither seems to get the timing right.

Generally you have to do something like this:

  .foobar.temp: foobar.sml
        mosmlc $<
        touch $@

  binary: .foobar.temp

Gross, but it usually works.

  hm> [It also seems that for a pattern rule Make's ideas about whether
  hm> foobar.sml "exists or ought to exist" are somehow stricter than for
  hm> explicit rules. At least I have had reports that my Makefile confuse
  hm> the Win32/Cygwin build of make 3.79.1 - it refuses to apply the
  hm> pattern rule, but builds happily (with two compliations) when the
  hm> percent sign is replaced by full stops. I suspect that some foul play
  hm> with capitalization of the directory parts of the file names is
  hm> involved.]

Could be.  Unfortunately I know little to nothing about the changes
Cygnus has made to their version of GNU make.

  hm> Have I overlooked some syntax that would allow me to do what I
  hm> want, or is there an easy workaround?

No, and no.

  hm> If not, would a patch that adds an explicit syntax for non-pattern
  hm> many-targets-at-once rules have a chance of being considered?

Sure; this feature is definitely on the list of "really should be done".
It's probably not even all that difficult; one of the main problems will
be coming up with the right syntax to express it in the makefile.
Please run any proposed syntax past address@hidden before commencing
any serious work.

-- 
-------------------------------------------------------------------------------
 Paul D. Smith <address@hidden>          Find some GNU make tips at:
 http://www.gnu.org                      http://make.paulandlesley.org
 "Please remain calm...I may be mad, but I am a professional." --Mad Scientist




reply via email to

[Prev in Thread] Current Thread [Next in Thread]