I have the following bits in my makefile:
GLFW_FLAG := -m32 -O2 -Iglfw/include -Iglfw/lib -Iglfw/lib/cocoa $(CFLAGS)
...
$(BUILD_DIR)/%.o : %.c
$(CC) -c $(GLFW_FLAG) $< -o $@
$(BUILD_DIR)/%.o : %.m
$(CC) -c $(GLFW_FLAG) $< -o $@
The -m32
instructs GCC to generate 32bit code. It's there because on some configurations GHC is set to build 32bit code but GCC's default is sometimes 64bit. I would like to generalize this so that it autodetects whether GHC is building 32bit or 64bit code and then passes the correct flag to GCC.
Question: How can I ask GHC what type of code (32bit vs. 64bit) it will build?
PS: My cabal file calls this makefile during the build to workaround limitations in cabal. I do wish I could just list these as c-sources in my cabal file.
ghc -e 'print (maxBound :: Int)'
which should differ depending on whether you have 32bit or 64bit GHC... – hvrghc --info
gives the platform information among other things (like("Gcc Linker flags","[\"-m64\"]")
) – Ed'ka