[Ma-linux] make/rakefile quandry

Jay Berkenbilt ejb at ql.org
Sun Jun 14 10:06:18 EDT 2009


Serge Wroclawski <serge at wroclawski.org> wrote:

> Short version: How do I exclude from deletion in clean/clobber files
> which are special.
>
> . . .

I'm pretty certain that there's no direct way for you to do what you
are trying to do without making an explicit list of some sort, but
there should be a way of doing it without requiring you to duplicate
information, most likely using some kind of naming convention or other
similar trick.

The way I handle cleaning of automatically generated intermediate
files separately from my final files that I want to keep around is to
give the intermediate files special names.  For example, I might have
something like

document.pdf: document.ltx
	pdflatex $<

%.auto.pdf: %.dia
	dia -e $*.pdf $<

clean:
	$(RM) *.auto.*

clobber: clean
	$(RM) *.pdf

I find this technique to be the easiest, though it does mean that
you're referencing whatever.auto.pdf from your LaTeX document as well.
But I don't find that to be problematic.

Another thing might be to have a make variable that lists your
intermediate products which you can use both to generate the targets
and as an argument to $(RM) in your clean target.

There are all sorts of other tricks that will probably get you all
the way there, though I suspect any solution will be more of a trick
like this than something more direct and automatic.

I have a lot of make expertise, so if you are looking for specific
techniques for a specific situation, I might be able to provide some
additional tips.  But hopefully some of these ideas will give you
other things to consider.

--Jay



More information about the Ma-linux mailing list