参考:http://stackoverflow.com/questions/4096173/how-do-i-create-a-single-makefile-for-both-32-and-64-bit
例如
g++ -fPIC -g -I SafeNet/include -DUNIX -DARCH=64 -std=c++0x -c -o NetSafe.o NetSafe.cpp
中有对OS架构的依赖,可以改成这样:
ARCH = $(shell getconf LONG_BIT)
g++ -fPIC -g -I SafeNet/include -DUNIX -DARCH=$(ARCH) -std=c++0x -c -o NetSafe.o NetSafe.cpp
本文介绍了一种在Makefile中实现32位和64位跨架构编译的方法。通过获取当前系统的架构信息并将其作为预处理器宏的一部分,使得源代码能够在不同架构下正确编译。

被折叠的 条评论
为什么被折叠?



