version.sh 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738
  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" = "bt6703_rt" ];
  8. then
  9. SRC=$'#define HARDWARE_BT6703_RT 1\r\n#include <stdio.h>\r\n#include "common_config.h"\r\n'
  10. elif [ "$1" = "bt6707" ];
  11. then
  12. SRC=$'#define HARDWARE_BT6707 1\r\n#include <stdio.h>\r\n#include "common_config.h"\r\n'
  13. elif [ "$1" = "bt6709" ];
  14. then
  15. SRC=$'#define HARDWARE_BT6709 1\r\n#include <stdio.h>\r\n#include "common_config.h"\r\n'
  16. elif [ "$1" = "bt6709_mts" ];
  17. then
  18. SRC=$'#define HARDWARE_BT6709_MTS 1\r\n#include <stdio.h>\r\n#include "common_config.h"\r\n'
  19. elif [ "$1" = "bt6710" ];
  20. then
  21. SRC=$'#define HARDWARE_BT6710 1\r\n#include <stdio.h>\r\n#include "common_config.h"\r\n'
  22. elif [ "$1" = "bt6711" ];
  23. then
  24. SRC=$'#define HARDWARE_BT6711 1\r\n#include <stdio.h>\r\n#include "common_config.h"\r\n'
  25. elif [ "$1" = "bt6711_v1" ];
  26. then
  27. SRC=$'#define HARDWARE_BT6711_V1 1\r\n#include <stdio.h>\r\n#include "common_config.h"\r\n'
  28. fi
  29. SRC+=$'int main(int argc, char *argv[]) {printf("%s", VERSION);}'
  30. echo "$SRC" > $BIN.c
  31. gcc -w $INCLUDES $BIN.c -o $BIN && chmod +x $BIN && VERSION=$(./$BIN)
  32. rm $BIN $BIN.c
  33. echo $VERSION