Support multiple fbs files & no root types in static flatbuffers

In order to improve parity with the existing flatbuffer bazel rules, add
support for:
* Multiple srcs files.
* Generating code for files where no root_type has been specified.

Change-Id: I77d909978fd0bf5125b9e789162c7b629d0fe00d
Signed-off-by: James Kuszmaul <james.kuszmaul@bluerivertech.com>
diff --git a/aos/flatbuffers/generate.sh b/aos/flatbuffers/generate.sh
index aecab26..09bb4dc 100755
--- a/aos/flatbuffers/generate.sh
+++ b/aos/flatbuffers/generate.sh
@@ -15,8 +15,16 @@
   { echo>&2 "ERROR: cannot find $f"; exit 1; }; f=; set -e
 # --- end runfiles.bash initialization v2 ---
 
-BFBS_FILE=$1
-OUT_FILE=$2
+INPUTS=($BFBS_FILES)
+SCHEMA_FILES=($BASE_FILES)
+OUTPUTS=($OUT_FILES)
 
-$(rlocation org_frc971/aos/flatbuffers/generate) --reflection_bfbs "${BFBS_FILE}" --output_file "${OUT_FILE}"
-$(rlocation llvm_k8/bin/clang-format) --style=file:"$(rlocation org_frc971/.clang-format)" -i "${OUT_FILE}"
+LEN=${#INPUTS[@]}
+
+for ((i = 0; i < $LEN; i++)); do
+  $(rlocation org_frc971/aos/flatbuffers/generate) \
+    --reflection_bfbs "${INPUTS[i]}" \
+    --output_file "${OUTPUTS[i]}" \
+    --base_file_name "$(basename ${SCHEMA_FILES[i]})"
+  $(rlocation llvm_k8/bin/clang-format) --style=file:"$(rlocation org_frc971/.clang-format)" -i "${OUTPUTS[i]}"
+done