Makefile使用多个编译器构建,但只有一个指定

时间:2017-11-05 17:45:17

标签: c++ makefile clang llvm

在我的makefile中,我指定如下:

CXX ?= /usr/local/Cellar/llvm/5.0.0/bin/clang++
LINK ?= /usr/local/Cellar/llvm/5.0.0/bin/clang++

...

all: /Users/zeno/polynomialOpticsNuke/src/polynomialOpticsBlur.dylib

.PRECIOUS : %.os
%.os: %.cpp
    $(CXX) --version $(CXXFLAGS) $(CXXFLAGSPOLYNOMIALOPTICS) ${OPTFLAGSPOLYNOMIALOPTICS} -o $(@) $<
%.dylib: %.os
    $(LINK) --version $(LDFLAGSPOLYNOMIALOPTICS) $(LINKFLAGS) $(LIBS) $(FRAMEWORKS) -o $(@) $<
%.a: %.cpp
    $(CXX) --version $(CXXFLAGS) $(CXXFLAGSPOLYNOMIALOPTICS) ${OPTFLAGSPOLYNOMIALOPTICS} -o lib$(@) $<

运行时,我得到多个编译器版本..(我剥离了无关的输出)

c++ --version /Users/zeno/polynomialOpticsNuke/src/polynomialOpticsBlur.os /Users/zeno/polynomialOpticsNuke/src/polynomialOpticsBlur.cpp
Apple LLVM version 9.0.0 (clang-900.0.38)
Target: x86_64-apple-darwin16.7.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin

/usr/local/Cellar/llvm/5.0.0/bin/clang++ --version /Users/zeno/polynomialOpticsNuke/src/polynomialOpticsBlur.dylib /Users/zeno/polynomialOpticsNuke/src/polynomialOpticsBlur.os
clang version 5.0.0 (tags/RELEASE_500/final)
Target: x86_64-apple-darwin16.7.0
Thread model: posix
InstalledDir: /usr/local/Cellar/llvm/5.0.0/bin

编译器如何使用apple clang(3.9)和链接clang(5.0)?我已将它们设置为相同的路径..

我也有这些环境变量:

export PATH="/usr/local/opt/llvm/bin:$PATH"
export LD_LIBRARY_PATH=/usr/local/opt/llvm/lib:$LD_LIBRARY_PATH
export LIBRARY_PATH=/usr/local/opt/llvm/lib:$LIBRARY_PATH

0 个答案:

没有答案