version.sh 703 B

1234567891011121314151617181920212223242526
  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. elif [ "$1" = "bt6710" ];
  14. then
  15. SRC=$'#define HARDWARE_BT6710 1\r\n#include <stdio.h>\r\n#include "common_config.h"\r\n'
  16. fi
  17. SRC+=$'int main(int argc, char *argv[]) {printf("%s", VERSION);}'
  18. echo "$SRC" > $BIN.c
  19. gcc -w $INCLUDES $BIN.c -o $BIN && chmod +x $BIN && VERSION=$(./$BIN)
  20. rm $BIN $BIN.c
  21. echo $VERSION