[llvm-dev] Should CPPFLAGS and CFLAGS still be used when compiling .ll to .o?

Peng Yu via llvm-dev llvm-dev at lists.llvm.org
Thu Jan 24 10:23:01 PST 2019


I am trying to use GNU make generating .o from .ll (which is converted from .c)

GNU use the following variable and rule to generate .o from .c. I'd
like to follow its convention.

OUTPUT_OPTION = -o $@
COMPILE.c = $(CC) $(CFLAGS) $(CPPFLAGS) $(TARGET_ARCH) -c

%.o: %.c
#  commands to execute (built-in):
  $(COMPILE.c) $(OUTPUT_OPTION) $<

My understanding is that since $(CFLAGS) $(CPPFLAGS) $(TARGET_ARCH)
already has been used for .c -> .ll conversion, .ll ->.o conversions
doesn't need $(CFLAGS) $(CPPFLAGS) $(TARGET_ARCH) any more. Is it so?

So the following rule should be sufficient?

%.o: %.ll
#  commands to execute (built-in):
  $(CC) $(OUTPUT_OPTION) $<

-- 
Regards,
Peng


More information about the llvm-dev mailing list