Hello, I'm using autotools to build my little lang. So I want to have something like this in my Makefile.am: mylang_SOURCES = mylang.cpp mylang_LDADD = mylib.a `llvm-config --cppflags --ldflags --libs core jit native ipo` But automake complains: tools/Makefile.am:8: linker flags such as `--cppflags' belong in `mylang_LDFLAGS I tried different workarounds but nothing helps :( The only way I found is to copy llvm-config's output directly to Makefile.am which is non-portable. So actually the question is how to use backticks in Makefile.am, but I posted it here because I hope everybody has already solved the problem :) Thanks, Andrii
Can you use an intermediate variable? TMP = `...` mylang_LDADD = ... $TMP On 2009-05-08, at 04:40, Andrii Vasyliev wrote:> Hello, > > I'm using autotools to build my little lang. > So I want to have something like this in my Makefile.am: > > mylang_SOURCES = mylang.cpp > mylang_LDADD = mylib.a `llvm-config --cppflags --ldflags --libs core > jit native ipo` > > But automake complains: > tools/Makefile.am:8: linker flags such as `--cppflags' belong in > `mylang_LDFLAGS > > I tried different workarounds but nothing helps :( > The only way I found is to copy llvm-config's output directly to > Makefile.am which > is non-portable. > So actually the question is how to use backticks in Makefile.am, but I > posted it here > because I hope everybody has already solved the problem :) > > Thanks, > Andrii > _______________________________________________ > LLVM Developers mailing list > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
I tried it - doesn't work. Automake just passes exact value of variable into mylang_LDADD without calculation, and produces the same error message. Also I tried this: TMP = $(shell llvm-config ...) Doesn't work. 2009/5/8 Gordon Henriksen <gordonhenriksen at me.com>:> Can you use an intermediate variable? > > TMP = `...` > mylang_LDADD = ... $TMP
Hi>>>>> "AV" == Andrii Vasyliev <andrii.vasyliev at gmail.com> writes:AV> Hello, I'm using autotools to build my little lang. So I want to AV> have something like this in my Makefile.am: AV> mylang_SOURCES = mylang.cpp mylang_LDADD = mylib.a `llvm-config AV> --cppflags --ldflags --libs core jit native ipo` AV> But automake complains: tools/Makefile.am:8: linker flags such as AV> `--cppflags' belong in `mylang_LDFLAGS You can use AC_SUBST in configure.ac to set the flags at configure time. I use something like this: AC_SUBST(LLVM_CPPFLAGS, $(llvm-config --cppflags)) AC_SUBST(LLVM_LDADD, $(llvm-config --ldflags --libs core jit native | tr '\n' ' ')) and in Makefile.am: foo_LDADD = $(LLVM_LDADD) ... ... Regards, Julian v. Bock
On 2009-05-08 11:40, Andrii Vasyliev wrote:> Hello, > > I'm using autotools to build my little lang. > So I want to have something like this in my Makefile.am: > > mylang_SOURCES = mylang.cpp > mylang_LDADD = mylib.a `llvm-config --cppflags --ldflags --libs core > jit native ipo` > > But automake complains: > tools/Makefile.am:8: linker flags such as `--cppflags' belong in `mylang_LDFLAGS >Why not do what automake told you to do? mylang_LDFLAGS=`llvm-config --ldflags core` mylang_LDADD=mylib.a `llvm-config --libs core` AM_CPPFLAGS=`llvm-config --cppflags` Best regards, --Edwin