version.sh 583 B

1234567891011121314151617181920212223
  1. #!/bin/bash
  2. INCLUDES=$2
  3. BIN=tmp
  4. if [ "$1" = "bt6703" ];
  5. then
  6. SRC=$'#define HARDWARE_BT6703 1\r\n#include <stdio.h>\r\n#include "common_config.h"\r\n'
  7. elif [ "$1" = "bt6707" ];
  8. then
  9. SRC=$'#define HARDWARE_BT6707 1\r\n#include <stdio.h>\r\n#include "common_config.h"\r\n'
  10. elif [ "$1" = "bt6709" ];
  11. then
  12. SRC=$'#define HARDWARE_BT6709 1\r\n#include <stdio.h>\r\n#include "common_config.h"\r\n'
  13. fi
  14. SRC+=$'int main(int argc, char *argv[]) {printf("%s", VERSION);}'
  15. echo "$SRC" > $BIN.c
  16. gcc -w $INCLUDES $BIN.c -o $BIN && chmod +x $BIN && VERSION=$(./$BIN)
  17. rm $BIN $BIN.c
  18. echo $VERSION