help-make
[Top][All Lists]
Advanced

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

Tip: batching commands


From: Simon De Groot
Subject: Tip: batching commands
Date: Tue, 4 Jan 2005 13:36:52 +0100


I'm using some tool to extract data from one file into another, but it takes the tool minutes to start, and a lot of files are to be operated on. I could use one target rule that calls the tool and runs a tool-specific batch script, but at times I'd like to operate on single files also, and even more importantly, I don't want all files to be extracted, if only one of the source files changes.

I suggest the following approach:

all : top.ts ;

%.ts : %.src
        @echo Making $@
        @touch $@

%.v : %.src
        @echo Making $@
<run tool and extract single file $@ from $*.src>
        @echo "  and creating $*.ts"
        @touch $*.ts
        @echo "  and creating top.ts"
        @touch top.ts

top.ts : een.ts twee.ts drie.ts
        @echo $? were newer than $@
<run tool and extract files $(patsubst %.ts%.v,$?) batched using $(patsubst %.ts,%.src,$?)>
        @echo Making $@
        @touch $@

Now if you'd try to make een.v and top.ts afterwards, only twee.v and drie.v will be re-extracted.

Hope this helps, and any easier alternatives to, or bugs in this solution are appreciated.

Regards,

Simon.

reply via email to

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