makefileqnxqcc

How to pick find qcc version in a Makefile?


A similar question has been asked before for gcc. However, qcc is a little different (see version output below).

qcc -V
cc: targets available in /opt/qnx641/host/linux/x86/etc/qcc:
    4.3.3,gcc_ntoarmle_cpp
    4.3.3,gcc_ntoshle_acpp
    4.3.3,gcc_ntox86_cpp
    4.3.3,gcc_ntoppcbe
    4.3.3,gcc_ntomipsbe_cpp
    4.3.3,gcc_ntoshle_cpp
    4.3.3,gcc_ntoarmle_gpp
    4.3.3,gcc_ntoshle_ecpp-ne
    4.3.3,gcc_ntoshle_cpp-ne
    4.3.3,gcc_ntomipsbe_gpp
    4.3.3,gcc_ntomipsle_ecpp
    4.3.3,gcc_ntox86        (default)
    4.3.3,gcc_ntoppcbe_cpp-ne
    4.3.3,gcc_ntox86_ecpp-ne
    4.3.3,gcc_ntoshle_acpp-ne
    4.3.3,gcc_ntoppcbespe_acpp
    4.3.3,gcc_ntoppcbe_ecpp-ne
    4.3.3,gcc_ntomipsle
    4.3.3,gcc_ntoppcbe_ecpp
    4.3.3,gcc_ntoarmle_ecpp
    4.3.3,gcc_ntox86_gpp
    4.3.3,gcc_ntoshle_gpp
    4.3.3,gcc_ntoshle
    4.3.3,gcc_ntomipsbe_ecpp-ne
    4.3.3,gcc_ntomipsbe_acpp-ne
    4.3.3,gcc_ntoarmle
    4.3.3,gcc_ntomipsbe_acpp
    4.3.3,gcc_ntomipsle_cpp-ne
    4.3.3,gcc_ntoppcbespe_cpp
    4.3.3,gcc_ntoppcbespe_ecpp-ne
    4.3.3,gcc_ntox86_acpp-ne
    4.3.3,gcc_ntox86_acpp
    4.3.3,gcc_ntomipsle_acpp
    4.3.3,gcc_ntomipsle_acpp-ne
    4.3.3,gcc_ntoarmle_cpp-ne
    4.3.3,gcc_ntomipsbe_cpp-ne
    4.3.3,gcc_ntomipsle_ecpp-ne
    4.3.3,gcc_ntoppcbespe_ecpp
    4.3.3,gcc_ntoppcbespe_cpp-ne
    4.3.3,gcc_ntox86_ecpp
    4.3.3,gcc_ntoshle_ecpp
    4.3.3,gcc_ntoppcbespe_acpp-ne
    4.3.3,gcc_ntoppcbe_gpp
    4.3.3,gcc_ntoppcbe_acpp-ne
    4.3.3,gcc_ntoppcbespe_gpp
    4.3.3,gcc_ntoppcbe_cpp
    4.3.3,gcc_ntomipsbe_ecpp
    4.3.3,gcc_ntoppcbe_acpp
    4.3.3,gcc_ntoarmle_acpp-ne
    4.3.3,gcc_ntox86_cpp-ne
    4.3.3,gcc_ntomipsbe
    4.3.3,gcc_ntomipsle_cpp
    4.3.3,gcc_ntoarmle_acpp
    4.3.3,gcc_ntomipsle_gpp
    4.3.3,gcc_ntoarmle_ecpp-ne
    4.3.3,gcc_ntoppcbespe

I need to make a generic makefile to differentiate between two different compilers: the one above, and version 3.3.5.

I know how to do this with gcc (as seen here: Checking the gcc version in a Makefile?). However, I can't seem to figure out how to use that to create an ifeq or ifdef that will work with the output I get from qcc.

Any ideas?

EDIT Only interested in the ntox86 / ntox86_cpp compiler


Solution

  • Try

    qcc -V | sed -n '/,/{s/,.*//;p;q}'
    

    EDIT:
    How strange. This make take a few iterations. Could you try these two experiments:

    sed --version
    

    and

    qcc -V | sed -n