Using make to convert files?
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 > Using make to convert files?




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

    Using make to convert files?  
desktop


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


 
04-28-07 06:18 PM

I have a folder "test" containing the folder "pic" where I put some .eps
files now and then. In the test folder I would like to put a makefile
that converts the .eps files to .pdf files (using epstopdf) IF new .eps
files are added or if they have changed.

Is it possible to use make for this??

The problem is that it should find out what the filenames are:

<newfile>.eps:
epstopdf <newfile>.eps


But I don't know how to make this, any ideas?





[ Post a follow-up to this message ]



    Re: Using make to convert files?  
Roberto Waltman


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


 
04-28-07 06:18 PM

desktop wrote:
>...
>The problem is that it should find out what the filenames are:
>
><newfile>.eps:
>	epstopdf <newfile>.eps
>
>
>But I don't know how to make this, any ideas?

See:

http://www.gnu.org/software/make/ma...matic-Variables


Roberto Waltman

[ Please reply to the group,
return address is invalid ]





[ Post a follow-up to this message ]



    Re: Using make to convert files?  
Pascal Bourguignon


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


 
04-28-07 06:18 PM

desktop <fff@sss.com> writes:

> I have a folder "test" containing the folder "pic" where I put some
> .eps files now and then. In the test folder I would like to put a
> makefile that converts the .eps files to .pdf files (using epstopdf)
> IF new .eps files are added or if they have changed.
>
> Is it possible to use make for this??

Yes.

> The problem is that it should find out what the filenames are:
>
> <newfile>.eps:
> 	epstopdf <newfile>.eps
>
>
> But I don't know how to make this, any ideas?


[pjb@thalassa t]$ cat Makefile
.SUFFIXES: .pdf .eps
.eps.pdf: ; epstopdf $<
SRC=$(shell echo *.eps)
EPS=$(SRC:.eps=.pdf)
all:$(EPS)
[pjb@thalassa t]$ ls
./  ../  Makefile  a.eps  b.eps  c.eps
[pjb@thalassa t]$ make -n
epstopdf a.eps
epstopdf b.eps
epstopdf c.eps
[pjb@thalassa t]$


--
__Pascal Bourguignon__                     http://www.informatimago.com/

PLEASE NOTE: Some quantum physics theories suggest that when the
consumer is not directly observing this product, it may cease to
exist or will exist only in a vague and undetermined state.





[ Post a follow-up to this message ]



    Re: Using make to convert files?  
Pascal Bourguignon


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


 
04-28-07 06:18 PM

Pascal Bourguignon <pjb@informatimago.com> writes:

> desktop <fff@sss.com> writes:
> 
>
> Yes.
> 
>
>
> [pjb@thalassa t]$ cat Makefile
> .SUFFIXES: .pdf .eps
> .eps.pdf: ; epstopdf $<
> SRC=$(shell echo *.eps)
> EPS=$(SRC:.eps=.pdf)
> all:$(EPS)
> [pjb@thalassa t]$ ls
> ./  ../  Makefile  a.eps  b.eps  c.eps
> [pjb@thalassa t]$ make -n
> epstopdf a.eps
> epstopdf b.eps
> epstopdf c.eps
> [pjb@thalassa t]$

Of course, s/EPS/PDF/ :

.SUFFIXES: .pdf .eps
.eps.pdf: ; epstopdf $<
SRC=$(shell echo *.eps)
PDF=$(SRC:.eps=.pdf)
all:$(PDF)

--
__Pascal Bourguignon__                     http://www.informatimago.com/
Small brave carnivores
Kill pine cones and mosquitoes
Fear vacuum cleaner





[ Post a follow-up to this message ]



    Re: Using make to convert files?  
Gianni Mariani


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


 
04-29-07 12:19 AM

desktop wrote:
> I have a folder "test" containing the folder "pic" where I put some .eps
> files now and then. In the test folder I would like to put a makefile
> that converts the .eps files to .pdf files (using epstopdf) IF new .eps
> files are added or if they have changed.
>
> Is it possible to use make for this??
>
> The problem is that it should find out what the filenames are:
>
> <newfile>.eps:
>     epstopdf <newfile>.eps
>
>
> But I don't know how to make this, any ideas?

In GNU make...

EPSFILES=$(wildcard *.eps)
PDFFILES=$(EPSFILES:%.eps=%.pdf)

all: $(PDFFILES)

%.pdf : %.eps
echo create $@ from $<
epstopdf $<





[ Post a follow-up to this message ]



    Sponsored Links  




 





   All times are GMT. The time now is 09:27 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