0

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

Community
  • 1
  • 1
Sagar
  • 9,456
  • 6
  • 54
  • 96
  • I take it the output above is from v4.3.3, and the output from v3.3.5 would have the same format. So you want to know how to get "4.3.3" or "3.5.5", and then use the `ifeq` technique, is that right? – Beta Mar 30 '12 at 01:30
  • That is correct. I've tried using ` | grep ntox86` to cut the list down but that did not work. – Sagar Mar 30 '12 at 13:15

1 Answers1

2

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
Beta
  • 96,650
  • 16
  • 149
  • 150
  • No joy. It printed out exactly the same thing as above, including the entire list – Sagar Mar 30 '12 at 15:49
  • "qcc -V | sed -n" printed the usage, immediately followed by the same list above. – Sagar Apr 03 '12 at 13:15
  • It turns out qcc was sending its list to stderr rather than stdout. I used your method, except I had to add 2>&1 to the command. – Sagar Sep 21 '12 at 20:16