How to do this with make ?
Web Server forum
Back To The Forum Home!Search!Private Messaging System

Web Server Talk Web Server Talk > Unix and Linux reviews > Free Unix support > Unix Programming > How to do this with make ?




  Last Thread   Next Thread Next
  Show Printable Version Email this Page Subscribe to this Thread      Post New Thread    Post A Reply      

    How to do this with make ?  
Olivier Scalbert


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
04-30-04 01:34 PM

Hello,

I need to convert a set of svg files located in the 'svg' directory in a
set of png files located in the 'png' directory.
Suppose the conversion tool is called 'conv', I need to do:
conv svg/image0001.svg png/image0001.png
conv svg/image0002.svg png/image0002.png
conv svg/image0003.svg png/image0003.png
...

How can I automate this with a makefile, in such way that if a svg is
changed then only the corresponding png is regenerated ?
I am using gnu make.

Thanks very much!

Olivier







[ Post a follow-up to this message ]



    Re: How to do this with make ?  
Måns Rullgård


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
04-30-04 01:34 PM

Olivier Scalbert <olivier.scalbert@algosyn.com> writes:

> Hello,
>
> I need to convert a set of svg files located in the 'svg' directory in
> a set of png files located in the 'png' directory.
> Suppose the conversion tool is called 'conv', I need to do:
> conv svg/image0001.svg png/image0001.png
> conv svg/image0002.svg png/image0002.png
> conv svg/image0003.svg png/image0003.png
> ...
>
> How can I automate this with a makefile, in such way that if a svg is
> changed then only the corresponding png is regenerated ?
> I am using gnu make.

%.png: %.svg
conv $^ $@

That's a tab on the second line.

--
Måns Rullgård
mru@kth.se





[ Post a follow-up to this message ]



    Re: How to do this with make ?  
Ralf Fassel


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
04-30-04 02:34 PM

* Måns Rullgård <mru@kth.se>
| %.png: %.svg

png/%.png: svg/%.svg

?

If I read the OP correctly, the .png and .svg files were meant to go
to different directories...

R'





[ Post a follow-up to this message ]



    Re: How to do this with make ?  
Olivier Scalbert


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
04-30-04 02:34 PM

Måns Rullgård wrote:

>Olivier Scalbert <olivier.scalbert@algosyn.com> writes:
>
>
> 
>
>%.png: %.svg
>	conv $^ $@
>
>That's a tab on the second line.
>
>
>
Thanks for the answer !
However make says: no targets ans stop ...






[ Post a follow-up to this message ]



    Re: How to do this with make ?  
Måns Rullgård


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
04-30-04 02:34 PM

Ralf Fassel <ralfixx@gmx.de> writes:

> * Måns Rullgård <mru@kth.se>
> | %.png: %.svg
>
> png/%.png: svg/%.svg
>
> ?
>
> If I read the OP correctly, the .png and .svg files were meant to go
> to different directories...

Sorry, my mistake.  Your version should work, if I am not mistaken.



--
Måns Rullgård
mru@kth.se





[ Post a follow-up to this message ]



    Re: How to do this with make ?  
Måns Rullgård


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
04-30-04 02:34 PM

Olivier Scalbert <olivier.scalbert@algosyn.com> writes:

> Måns Rullgård wrote:
> 
> Thanks for the answer !
> However make says: no targets ans stop ...

You'll need to add the png files as dependencies to some target.  See
also another reply about the different directories for the svg and the
png files.  To convert all svg files into png files you could do
something like this (untested):

PNGS = $(subst svg,png,$(wildcard svg/*.svg))

all: $(PNGS)

png/%.png: svg:%.svg
conv $^ $@

--
Måns Rullgård
mru@kth.se





[ Post a follow-up to this message ]



    Re: How to do this with make ?  
Olivier Scalbert


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
04-30-04 02:34 PM

Måns Rullgård wrote:

>Olivier Scalbert <olivier.scalbert@algosyn.com> writes:
>
>
> 
>
>You'll need to add the png files as dependencies to some target.  See
>also another reply about the different directories for the svg and the
>png files.  To convert all svg files into png files you could do
>something like this (untested):
>
>PNGS = $(subst svg,png,$(wildcard svg/*.svg))
>
>all: $(PNGS)
>
>png/%.png: svg:%.svg
>	conv $^ $@
>
>
>
Thanks very much, it works perfectly !
Do you know a good book or article on make ?
Thanks
Olivier





[ Post a follow-up to this message ]



    Re: How to do this with make ?  
Måns Rullgård


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
04-30-04 02:34 PM

Olivier Scalbert <olivier.scalbert@algosyn.com> writes:
 
> Thanks very much, it works perfectly !
> Do you know a good book or article on make ?

The texinfo manual that comes with gnu make is pretty good.

--
Måns Rullgård
mru@kth.se





[ Post a follow-up to this message ]



    Re: How to do this with make ?  
Olivier Scalbert


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
04-30-04 02:34 PM

Måns Rullgård wrote:

>Olivier Scalbert <olivier.scalbert@algosyn.com> writes:
>
>
> 
>
>The texinfo manual that comes with gnu make is pretty good.
>
>
>
thx





[ Post a follow-up to this message ]



    Re: How to do this with make ?  
Mohun Biswas


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
04-30-04 02:34 PM

Måns Rullgård wrote:
> The texinfo manual that comes with gnu make is pretty good.

Same data, different format:
http://www.gnu.org/software/make/ma..._mono/make.html





[ Post a follow-up to this message ]



    Sponsored Links  




 





   All times are GMT. The time now is 10:06 PM.      Post New Thread    Post A Reply      
  Last Thread   Next Thread Next


Most Popular forums 

Forum Jump:
Rate This Thread:

Forum Rules:
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is OFF
vB code is ON
Smilies are ON
[IMG] code is OFF
 
Medical and Health forum | Computer Games Reviews | Graphics design forum

Back To The Top
Home | Usercp | Faq | Register