我想要一个 make 文件在 Windows 上编译和链接(到 mylib.dll)和至少两个 Linux 架构,i686 和 armv61(到 mylib.so)。
如果我手动“设置”链接器标志,我的代码可以编译/链接。
但我想根据某些 ARC 值设置链接器标志,请参阅代码片段。
<code>
ARCH = "?"
ARCH = $(shell arch)
$(info ARCH is [$(ARCH)])
LD_FLAGS = "?"
ifeq "$(ARCH)" "i686"
LD_FLAGS = -shared -lSDL
endif
ifeq "$(ARCH)" "armv61"
LD_FLAGS = -shared -lSDL -L/usr/lib/arm-linux-gnueabihf
endif
$(info LD_FLAGS is [$(LD_FLAGS)])
</code>
在我的 i686 上我得到:
<code>
ARCH is [i686]
LD_FLAGS is [-shared -lSDL]
make: Nothing to be done for 'all'.
</code>
在我的 armv61 上我得到:
<code>
ARCH is [armv6l]
LD_FLAGS is ["?"]
... (error stuff!)
</code>
所以 ARCH 设置正常但 LD_FLAGS 不是,我正在用 ifeq 等做一些愚蠢的事情。
知道错误是什么,如何修复 make 文件?
谢谢。
最佳答案
你写了一个1
而不是l
(armv6l
vs armv61
)
关于c++ - makefile 为不同的体系结构设置不同的链接器标志,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43259249/