title: Compiling to 32-bit using make
body: <p>I am trying to compile a very simple program using the -m32 flag.
  <br> If I try to do this using gcc -m32 it works just fine(I have the needed libs)<br></p>
  
  <p>Yet, when I add this flag to my flags in a makefile, I get a weird error<br>
  This is the makefile that I have</p>
  
  <pre><code>CC=gcc
  CFLAGS=-m32 -O1 -W -Wall -pedantic -std=c99
  
  all: main.o 
      $(CC) -o main main.o 
      rm main.o 
  
  clean: 
      rm main
  </code></pre>
  
  <p>The error that I receive is the following</p>
  
  <pre><code>gcc -o main main.o
  /usr/bin/ld: i386 architecture of input file `main.o' is incompatible with i386:x86-64 output
  collect2: ld returned 1 exit status
  make: *** [all] Error 1
  </code></pre>
  
  <p>Can someone please tell me what does this mean? and how can I fix it?</p>
  
  <p>As for the code, the code does NOTHING except printing 'hello world'</p>
  
  <p>I am using GCC 4.4.3 under Linux 2.6.35 64-bits </p>