Bear icon indicating copy to clipboard operation
Bear copied to clipboard

Question - how to capture built in compiler options

Open wonk-andy opened this issue 8 months ago • 1 comments

I am trying to use Bear 3.1.4 to generate the compile_commands.json file from a Makefile based project which cross compiles for QNX on a Linux host. The compile command line for one of the source files is:

aarch64-unknown-nto-qnx7.0.0-gcc -std=gnu99 -MMD -MP -Iinclude -o build/1.01.00/src/iMX8.o -c src/iMX8.c

The output for this file that is captured says:

  {
    "arguments": [
      "/opt/tools/qnx700/host/linux/x86_64/usr/bin/aarch64-unknown-nto-qnx7.0.0-gcc",
      "-std=gnu99",
      "-Iinclude",
      "-c",
      "-o",
      "build/1.01.00/src/iMX8.o",
      "src/iMX8.c"
    ],
    "directory": "/opt/samba/customers/xxxx/GetMacAddr",
    "file": "/opt/samba/customers/xxxx/GetMacAddr/src/iMX8.c",
    "output": "/opt/samba/customers/xxxx/GetMacAddr/build/1.01.00/src/iMX8.o"
  }

There are other built-in compiler options that it isn't capturing, for example the compiler defines __QNX__ which is used for conditional compilation within the source files. How do I capture this, and any other, built in variable?

-Andy.

wonk-andy avatar Jun 11 '24 13:06 wonk-andy