title: GNU Make ignoring a phony rule specified by wildcard?
body: <p>I am learning some courses about compiling some C code into specific assembly. I decided that the generated assembly should be manually inspected, so I came up with <code>less something.s</code> as a "test" rule.</p>
  
  <p>As a fan-but-newbie of Make, I wrote this Makefile:</p>
  
  <pre><code>CODES := a
  
  LESS ?= less
  CODES_TEST := $(patsubst %,%-test,${CODES})
  
  .PHONY: all test ${CODES_TEST} clean
  
  all: $(patsubst %,%.s,${CODES})
  
  test: all
  
  %-test: %.s
          ${LESS} $^
  
  %.s: %.c
          ${CC} ${CFLAGS} -S -o $@ $^
  
  clean:
          rm -f *.o *.s
  </code></pre>
  
  <p>And I have this minimal <code>a.c</code> file:</p>
  
  <pre class="lang-c prettyprint-override"><code>int asdfg(void) { return 54321; }
  </code></pre>
  
  <p>I then typed <code>make a-test</code> in Bash, expecting <code>less</code> showing up with the content of <code>a.s</code>, only to be told this:</p>
  
  <pre class="lang-none prettyprint-override"><code>make: Nothing to be done for 'a-test'.
  </code></pre>
  
  <p>I got the above response regardless of the presence of <code>a.s</code>, which generates normally if I do <code>make a.s</code> or just <code>make</code> (implicitly runs the first rule, <code>all</code>).</p>
  
  <p>I checked my Makefile and I don't think I made a typo or another simple mistake.</p>
  
  <ol>
  <li>What did I miss with the above <code>Makefile</code>?</li>
  <li>How can I get Make to execute <code>less a.s</code> when I run <code>make a-test</code>?</li>
  </ol>