help-make
[Top][All Lists]
Advanced

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

Pulling parts from a filename.


From: Todd Showalter
Subject: Pulling parts from a filename.
Date: Tue, 8 Jun 2010 22:24:14 -0400

    I've got a (perhaps somewhat interesting) problem that I can't see
a particularly easy solution to.  I'm taking an opentype font and
baking several raster fonts from it using a tool.  If my target is
(say) foo14.fnt, I want to call:

fontgen -p 14 foo.otf foo14.fnt

    The target filename indicates the point size at which the font
needs to be generated, and I'd rather automate it.  The important
thing here is that there may be several fonts; I don't want to have to
hardcode the font names if I don't have to.

    I can't see any obvious way to do this in make:

%.fnt: ???
    fontgen -p ??? ??? $@

    I *think* if I require the targets to be of the form foo_14.fnt I
can use $(patsubst) to isolate the parts.

%,fnt: ???
    fontgen -p $(patsubst %_,,$@) $(patsubst _%,.otf,$@) $@

    But I'm at a when it comes to the dependency.  I'm not sure how to
tell make that x_y.fnt depends on x.otf for arbitrary x and y.

    Am I missing something?

                                                         Todd.

-- 
 Todd Showalter, President,
 Electron Jump Games, Inc.



reply via email to

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