Set up flags of library in Makefile

Asked by At

I'm compiling with library mylib.so, in which there are several flags to be set up, flagA and flagB. The following is my current Makefile:

MYLIBS=$(realpath ../lib/mylib.so)
MYLIBS_OPTS=-mllvm -flagA=true -mllvm -flagB=true
MYCXX=$(realpath ../bin/clang++) -Xclang++ $(MYLIBS) $(MYLIBS_OPTS)
CXXFLAGS = -Wall -ggdb

Then I compile the library with my code by

mycode: mycode.c
    $(MYCXX) $(CXXFLAGS) -c -o [email protected] $^

But when I run make mycode in terminal, I got the following errors:

clang (LLVM option parsing): Unknown command line argument '-flagA=true'.  Try: 'clang (LLVM option parsing) -help'
clang (LLVM option parsing): Unknown command line argument '-flagB=true'.  Try: 'clang (LLVM option parsing) -help'

I think I might have missed something. Really appreciate any help!

0 Answers