Why does Make use ASFLAGS for both gcc and as when their flags aren't compatible?
<p>I want to assemble and link some code for a 32-bit target from a 64-bit host, and I'm trying to use <code>make</code>'s implicit rules as much as possible.</p>

<p>If I put <code>-m32</code> in <code>ASFLAGS</code> it works fine for linking and assembling in one step, as <code>make</code> will use <code>gcc</code> for this. But if one of my executables needs separate linking, everything breaks, because <code>make</code> will then use <code>as</code> for assembling, and <code>as</code> doesn't understand <code>-m32</code>. To solve this I can use <code>--32</code> instead, but this will of course not work with <code>gcc</code>.</p>

<pre><code>$ cat Makefile
ASFLAGS = -m32

all: prog1 prog2

prog2: prog2.o

$ make
cc -m32   prog1.s   -o prog1
as -m32  -o prog2.o prog2.s
as: unrecognized option '-m32'
&lt;builtin&gt;: recipe for target 'prog2.o' failed
make: *** [prog2.o] Error 1
</code></pre>

<p>Why does <code>make</code> use <code>ASFLAGS</code> for both <code>gcc</code> and <code>as</code> when their flags aren't compatible? Am I not supposed to specify the architecture this way? Do I really have to hack my way around this (i.e. actually write something in my Makefile), or is there something I've missed?</p>