Search code examples
macosgcc64-bitosx-snow-leopard32-bit

How to force /usr/bin/gcc -> /usr/bin/gcc -m32?


I have bad Makefile(s) of a large bundled software distribution. In some point compiler always "forgets" that I want to compile in 32 bit program. This causes that part of the programs have 64 bit libraries and others have 32 bit libraries.

How can I force -m32 option every time that I run gcc?

br,
Juha

P.S. My environment is mixed 32/64 bit (macbook5.1, snow leopard). Alternatively: How can I make my system purely 32 or 64 bits?

edit: Emphasis on the bad Makefiles that override the global variables. Thats why I chosed the hack that works.


Solution

  • If you want a crappy hack, you could replace /usr/bin/gcc with this shell script:

    #!/bin/bash
    /usr/bin/gcc-4.whatever -m32 "$@"