#!/bin/bash INCLUDES=$2 BIN=tmp if [ "$1" = "bt6703" ]; then SRC=$'#define HARDWARE_BT6703 1\r\n#include \r\n#include "common_config.h"\r\n' elif [ "$1" = "bt6703_rt" ]; then SRC=$'#define HARDWARE_BT6703_RT 1\r\n#include \r\n#include "common_config.h"\r\n' elif [ "$1" = "bt6707" ]; then SRC=$'#define HARDWARE_BT6707 1\r\n#include \r\n#include "common_config.h"\r\n' elif [ "$1" = "bt6709" ]; then SRC=$'#define HARDWARE_BT6709 1\r\n#include \r\n#include "common_config.h"\r\n' elif [ "$1" = "bt6709_mts" ]; then SRC=$'#define HARDWARE_BT6709_MTS 1\r\n#include \r\n#include "common_config.h"\r\n' elif [ "$1" = "bt6710" ]; then SRC=$'#define HARDWARE_BT6710 1\r\n#include \r\n#include "common_config.h"\r\n' elif [ "$1" = "bt6711" ]; then SRC=$'#define HARDWARE_BT6711 1\r\n#include \r\n#include "common_config.h"\r\n' elif [ "$1" = "bt6711_v1" ]; then SRC=$'#define HARDWARE_BT6711_V1 1\r\n#include \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