Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>NMAKE pattern rules are a lot like GNU make old-school suffix rules. In your case, you had it almost right to begin with, but you were missing the .SUFFIXES declaration. For example:</p> <pre><code>.SUFFIXES: .bmml .png .bmml.png: @echo Building $@ from $&lt; </code></pre> <p>I think this is only part of your solution though, because you also mentioned wanting to avoid explicitly listing all of the files to be converted. Unfortunately, I don't know of a very clean way to do that in NMAKE, since it only expands wildcards in dependency lists, and what you really want in your dependency list is not the list of files that already exist (the *.bmml files), but the list of files that will be created from those files (the *.png files). Nevertheless, I think you can achieve your goal with a recursive NMAKE invocation like this:</p> <pre><code>all: *.bmml $(MAKE) $(**:.bmml=.png) </code></pre> <p>Here, NMAKE will expand <code>*.bmml</code> in the prereq list for <code>all</code> into the list of .bmml files in the directory, and then it will start a new NMAKE instance, specifying the goals to build as that list of files with all instances of <code>.bmml</code> replaced by <code>.png</code>. So, putting it all together:</p> <pre><code>.SUFFIXES: .bmml .png all: *.bmml @echo Converting $(**) to .png... @$(MAKE) $(**:.bmml=.png) .bmml.png: @echo Building $@ from $&lt; </code></pre> <p>If I create files Test1.bmml and Test2.bmml and then run this makefile, I get the following output:</p> <pre><code>Converting Test1.bmml Test2.bmml to .png... Building Test1.png from Test1.bmml Building Test2.png from Test2.bmml </code></pre> <p>Of course, if you have very many of these .bmml files, you may run afoul of command-line length limitations, so watch out for that. In that case, I recommend either explicitly listing the source files, or using a more capable make tool, like GNU make (which is available for Windows in a variety of forms).</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload