version.sh 583 B

1234567891011121314151617181920212223
  1. #!/bin/bash
  2. INCLUDES=$2
  3. BIN=tmp
  4. if [ "$1" = "bt6702" ];
  5. then
  6. SRC=$'#define HARDWARE_BT6702 1\r\n#include <stdio.h>\r\n#include "common_config.h"\r\n'
  7. elif [ "$1" = "bt6706" ];
  8. then
  9. SRC=$'#define HARDWARE_BT6706 1\r\n#include <stdio.h>\r\n#include "common_config.h"\r\n'
  10. elif [ "$1" = "bt6708" ];
  11. then
  12. SRC=$'#define HARDWARE_BT6708 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