help-make
[Top][All Lists]
Advanced

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

Re: Pulling parts from a filename.


From: Oleksandr Gavenko
Subject: Re: Pulling parts from a filename.
Date: Wed, 09 Jun 2010 11:46:56 +0300
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.1.9) Gecko/20100317 Thunderbird/3.0.4

On 2010.06.09 5:24, Todd Showalter wrote:
     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?

Try


FOO_FNT = foo_14.fnt foo_13.fnt foo_10.fnt
BAR_FNT = bar_12.fnt bar_9.fnt

FNT = $(FOO_FNT) $(BAR_FNT)

all:  $(FNT)

$(FOO_FNT): foo_%.fnt: foo.otf
        fontgen -f $* $< $@

$(BAR_FNT): bar_%.fnt: bar.otf
        fontgen -f $* $< $@


Look how it work:

  $ make -n bar_12.fnt
fontgen -f 12 bar.otf bar_12.fnt

  $ make -n foo_14.fnt
fontgen -f 14 foo.otf foo_14.fnt

--
С уважением, Александр Гавенко.



reply via email to

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