#!/bin/bash

INCLUDES=$2
BIN=tmp


if [ "$1" = "bt6703" ];
then
SRC=$'#define HARDWARE_BT6703 1\r\n#include <stdio.h>\r\n#include "common_config.h"\r\n'
elif [ "$1" = "bt6707" ];
then
SRC=$'#define HARDWARE_BT6707 1\r\n#include <stdio.h>\r\n#include "common_config.h"\r\n'
elif [ "$1" = "bt6709" ];
then
SRC=$'#define HARDWARE_BT6709 1\r\n#include <stdio.h>\r\n#include "common_config.h"\r\n'
fi
SRC+=$'int main(int argc, char *argv[]) {printf("%s", VERSION);}'
echo "$SRC" > $BIN.c

gcc -w $INCLUDES $BIN.c -o $BIN && chmod +x $BIN && VERSION=$(./$BIN)
rm $BIN $BIN.c

echo $VERSION