www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/01/26/06:45:37

From: mdruiter AT cs DOT vu DOT nl (Ruiter de M)
Newsgroups: comp.os.msdos.djgpp
Subject: Re: How do I do this with make?
Date: 26 Jan 1998 11:30:17 GMT
Organization: Fac. Wiskunde & Informatica, VU, Amsterdam
Message-ID: <6ahs49$89r$1@star.cs.vu.nl>
References: <69nuae$492$1 AT star DOT cs DOT vu DOT nl> <6a805f$dij$1 AT news DOT ox DOT ac DOT uk> <6aac5a$7po$1 AT star DOT cs DOT vu DOT nl> <6ab9fs$8a3$1 AT news DOT ox DOT ac DOT uk>
NNTP-Posting-Host: sloep109.cs.vu.nl
Lines: 70
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

George Foot (mert0407 AT sable DOT ox DOT ac DOT uk) wrote:
> I don't really see what you're trying to do here, I'm afraid.  Surely
> if you use the same set of commands to generate the files in each
> subdirectory, they'll all be the same?  Or did you mean `some'
> commands, not `same' commands?

Eh, well, I really meant `same', but by using something like $(dir $@)
I can let the same commands do something different. :-)

> You might be able to use $(<F), which is the filename only of the
> first dependency -- i.e. it strips off the directory part.  To get
> this to work, you might have to set `VPATH = .' -- otherwise the
> pattern matching will probably not work.

> Or, thinking about it more:
> > VPATH = .
> > %.jpg: %.pgm
> >         @echo "Make $@ from $<"
> >         @touch $@

Great idea!

> I can't suggest what to put in the TARGETS variable because I don't
> understand what you want to do well enough.  You could do a patsubst
> replacing %.pgm with %.jpg on all the files in the current directory,
> and addprefix the subdirectory names to that, but I don't know how you
> know which files should be in which subdirectories.

Yes, I can do all that myself. JFYI: I have a bunch of .pgm's, which I
convert to .jpg's with different qualities (10, 20, etc.) in different
subdirectories. I need them, to convert the .pgm's to .enc's
corresponding with the .jpg's (lossy wavelet compression, with
approximately the same size as the .jpg's). So:

FILES=a.pgm b.pgm
DIRS=10 20

results in:

a.pgm -> 10/a.jpg -> 10/a.enc
b.pgm -> 10/b.jpg -> 10/b.enc
a.pgm -> 20/a.jpg -> 20/a.enc
b.pgm -> 20/b.jpg -> 20/b.enc

I think I can do it right now.

> 10/%.jpg: %.pgm
>         @echo "10: Make $@ from $<"
>         @touch $@

> 20/%.jpg: %.pgm
>         @echo "20: Make $@ from $<"
>         @touch $@

> 30/%.jpg: %.pgm
>         @echo "30: Make $@ from $<"
>         @touch $@

This is what I did. I just hoped to have some way not to have a
dependancy for every dir. And I think with your `VPATH=.' trick I can
do it.

Thanx for putting so much work in this. Especially in understanding
what I meant to do exactly, sorry for not describing things enough.

-- 
Groeten, Michel.        http://www.cs.vu.nl/~mdruiter
 \----/==\----/
  \  /    \  /          "You know, Beavis, you need things that suck,
   \/      \/           to have things that are cool", Butt-Head.

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019