9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
* Re: [9fans] mk surprises me
@ 2002-04-02  7:49 Bengt Kleberg
  0 siblings, 0 replies; 10+ messages in thread
From: Bengt Kleberg @ 2002-04-02  7:49 UTC (permalink / raw)
  To: 9fans


> Delivered-To: 9fans@cse.psu.edu
> To: 9fans@cse.psu.edu
> Subject: Re: [9fans] mk surprises me
> From: David Gordon Hogan <dhog@plan9.bell-labs.com>


> > the behaviour i expect (cp f1.c f1, even when f1.c was older than f1,
> > provided that hdr.h was younger than f1) is the one described in
> > plan9v2 documentation. admitedly your suspicion sounds much more
> > logical than the documenation.
> > i have (as well as i can) copied the contents of the mkfile from the book.
> > perhaps this is an error in the book? (there are others).
>
> I can not find your example in the documentation.  Could you
> please provide a reference?  (Name of paper and section name,
> please).

Plan9, The Documents.
Maintaining Files on Plan9 with Mk.
page 191.

This is Plan9 v2 (with Inferno around, making it possible to avoid C, I
never bought Plan9 v3).

...deleted
> Charles' diagnonis of the problem is correct, that
> you have effectively made f1.c depend on hdr.h, but not provided
> a recipe for making f1.c, hence if hdr.h is more recent than
> f1.c, mk complains.  The solution is to change the rule so that the
> source file f1.c doesn't depend on hdr.h.
>

this is fine. thank you.


bengt



^ permalink raw reply	[flat|nested] 10+ messages in thread
* Re: [9fans] mk surprises me
@ 2002-03-28 14:52 David Gordon Hogan
  0 siblings, 0 replies; 10+ messages in thread
From: David Gordon Hogan @ 2002-03-28 14:52 UTC (permalink / raw)
  To: 9fans

> the behaviour i expect (cp f1.c f1, even when f1.c was older than f1,
> provided that hdr.h was younger than f1) is the one described in
> plan9v2 documentation. admitedly your suspicion sounds much more
> logical than the documenation.
> i have (as well as i can) copied the contents of the mkfile from the book. 
> perhaps this is an error in the book? (there are others).

I can not find your example in the documentation.  Could you
please provide a reference?  (Name of paper and section name,
please).

I did find the following rule in an example:

	%.$O: hdr.h

but of course, this avoids the mistake of making _everything_
depend on hdr.h which your example contains.

> or, is there a difference between plan9 mk and inferno mk for host systems?

Not of this magnitude.  Your example should behave the same
way on both.  Charles' diagnonis of the problem is correct, that
you have effectively made f1.c depend on hdr.h, but not provided
a recipe for making f1.c, hence if hdr.h is more recent than
f1.c, mk complains.  The solution is to change the rule so that the
source file f1.c doesn't depend on hdr.h.



^ permalink raw reply	[flat|nested] 10+ messages in thread
* Re: [9fans] mk surprises me
@ 2002-03-28  8:17 Bengt Kleberg
  0 siblings, 0 replies; 10+ messages in thread
From: Bengt Kleberg @ 2002-03-28  8:17 UTC (permalink / raw)
  To: 9fans


> Delivered-To: 9fans@cse.psu.edu
> To: 9fans@cse.psu.edu
> Subject: Re: [9fans] mk surprises me
> From: forsyth@caldo.demon.co.uk


> >>% : hdr.h
> 
> i suspect that because you've said that everything depends on hdr.h, including 
f2.c,
> it decides it had better remake that too, since hdr.h has changed, but doesn't 
know how.

the behaviour i expect (cp f1.c f1, even when f1.c was older than f1,
provided that hdr.h was younger than f1) is the one described in
plan9v2 documentation. admitedly your suspicion sounds much more
logical than the documenation.
i have (as well as i can) copied the contents of the mkfile from the book. 
perhaps this is an error in the book? (there are others).
or, is there a difference between plan9 mk and inferno mk for host systems?

> try using & for this (similar to % but doesn't match . or /)
> 
> &: hdr.h
> 
> &: &.c
> 	cp $stem.c $target

thank you, & works as expected. unfortunatly i am not actually doing
anything with mk, just trying to figure out the documentation (which
uses % in this case).


bengt



^ permalink raw reply	[flat|nested] 10+ messages in thread
* Re: [9fans] mk surprises me
@ 2002-03-28  8:01 Bengt Kleberg
  2002-03-28 10:50 ` Axel Belinfante
  0 siblings, 1 reply; 10+ messages in thread
From: Bengt Kleberg @ 2002-03-28  8:01 UTC (permalink / raw)
  To: 9fans


> Delivered-To: 9fans@cse.psu.edu
> X-Authentication-Warning: copernicus.cs.utwente.nl: belinfan@localhost didn't 
use HELO protocol
> To: 9fans@cse.psu.edu
> Subject: Re: [9fans] mk surprises me
> From: Axel Belinfante <Axel.Belinfante@cs.utwente.nl>
...deleted
> I tried your example on plan 9 mk, and it seemed to work as expected.

just to check 'work as expected':
the recipe was done (cp f1.c f1), even when f1.c was older than f1,
provided that hdr.h was younger than f1?


bengt



^ permalink raw reply	[flat|nested] 10+ messages in thread
* Re: [9fans] mk surprises me
@ 2002-03-27 14:10 forsyth
  0 siblings, 0 replies; 10+ messages in thread
From: forsyth @ 2002-03-27 14:10 UTC (permalink / raw)
  To: 9fans

>>% : hdr.h

i suspect that because you've said that everything depends on hdr.h, including f2.c,
it decides it had better remake that too, since hdr.h has changed, but doesn't know how.

try using & for this (similar to % but doesn't match . or /)

&: hdr.h

&: &.c
	cp $stem.c $target

otherwise you could use regular expression rules



^ permalink raw reply	[flat|nested] 10+ messages in thread
* [9fans] mk surprises me
@ 2002-03-27 13:10 Bengt Kleberg
  2002-03-27 13:40 ` Axel Belinfante
  0 siblings, 1 reply; 10+ messages in thread
From: Bengt Kleberg @ 2002-03-27 13:10 UTC (permalink / raw)
  To: 9fans

mk does not do what i expect it to do. here are some facts:


the mkfile

% : hdr.h

% : %.c
	cp $stem.c $target


the files
-rw-rw-r--   1 eleberg  avall          0 Mar 20 15:47 f2.c
-rw-rw-r--   1 eleberg  avall          0 Mar 27 13:12 f2
-rw-rw-r--   1 eleberg  avall          0 Mar 27 13:17 hdr.h


the test
; inferno/Solaris/sparc/bin/mk -f mkfile f2
mk: no recipe to make 'f2.c'


according to my interpretation of 'maintaining files on plan9 with mk'
(from plan9v2 documentation), page 188, the mkfile should produce f2
from f2.c if hdr.h is younger then f2. but instead i get the error
message above that i do not understand.
is there anybody that sees where i go wrong?

possible sources of errors:
i use mk from inferno, not plan9
i have only the plan9v2 documentation, not v3 documentation.
i am not very good with mkfiles


bengt



^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2002-04-02  7:49 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-04-02  7:49 [9fans] mk surprises me Bengt Kleberg
  -- strict thread matches above, loose matches on Subject: below --
2002-03-28 14:52 David Gordon Hogan
2002-03-28  8:17 Bengt Kleberg
2002-03-28  8:01 Bengt Kleberg
2002-03-28 10:50 ` Axel Belinfante
2002-03-28 11:04   ` William Josephson
2002-03-27 14:10 forsyth
2002-03-27 13:10 Bengt Kleberg
2002-03-27 13:40 ` Axel Belinfante
2002-03-27 13:56   ` Axel Belinfante

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).