3/10/2014

make gcc to compile 32 bit programs on 64 bit platform


-- Ubuntu 12.04 LTS - 64 bit.

gcc for 32 bit application build.

gcc -m32

-- get linux 32 bit or 64 bit.

-- Makefile

...

LBITS := $(shell getconf LONG_BIT)
ifeq ($(LBITS),64)
   # do 64 bit stuff here, like set some CFLAGS
else
   CFLAGS+=-m32
endif

...

댓글 없음: