moved all of the downloaded and generated stuff to a single folder

This makes the separation between our source code and everything else
much cleaner. It also makes it easier to ignore all of the output code
etc etc. The deploy etc commands haven't been tested yet, but I don't
think I broke them.
diff --git a/aos/build/build.sh b/aos/build/build.sh
index 9ec745a..4b36e7e 100755
--- a/aos/build/build.sh
+++ b/aos/build/build.sh
@@ -20,37 +20,37 @@
 [ "${DEBUG}" == "yes" -o "${DEBUG}" == "no" ] || ( echo Debug "(${DEBUG})" must be '"yes" or "no"'. ; exit 1 )
 
 AOS=`dirname $0`/..
-NINJA_RELEASE=v1.4.0
-NINJA_DIR=${AOS}/externals/ninja-${NINJA_RELEASE}
-NINJA=${NINJA_DIR}/ninja
-# From chromium@154360:trunk/src/DEPS.
-GYP_REVISION=1738
-GYP_DIR=${AOS}/externals/gyp-${GYP_REVISION}
-GYP=${GYP_DIR}/gyp
 
-OUTDIR=${AOS}/../out_${PLATFORM}
-BUILD_NINJA=${OUTDIR}/Default/build.ninja
+OUTDIR=${AOS}/../output/${PLATFORM}
+BUILD_NINJA=${OUTDIR}/build.ninja
 
-[ -d ${NINJA_DIR} ] || git clone --branch ${NINJA_RELEASE} https://github.com/martine/ninja.git ${NINJA_DIR}
-[ -x ${NINJA} ] || ${NINJA_DIR}/bootstrap.py
-[ -d ${GYP_DIR} ] || ( svn co http://gyp.googlecode.com/svn/trunk -r ${GYP_REVISION} ${GYP_DIR} && patch -p1 -d ${GYP_DIR} < ${AOS}/externals/gyp.patch )
 ${AOS}/build/download_externals.sh
+. $(dirname $0)/tools_config
 
 # The exciting quoting is so that it ends up with -DWHATEVER='"'`a command`'"'.
 # The '"' at either end is so that it creates a string constant when expanded
 #   in the C/C++ code.
 COMMONFLAGS='-DLOG_SOURCENAME='"'\"'"'`basename $in`'"'\"' "
-if [ ${PLATFORM} == crio ]; then
-  COMMONFLAGS+='-DAOS_INITNAME=aos_init_function_`readlink -f $out | sed \"s/[\/.]/_/g\"` '
-fi
 
 if [[ "${ACTION}" != "clean" && ( ! -d ${OUTDIR} || -n \
   			"`find ${AOS}/.. -newer ${BUILD_NINJA} \( -name '*.gyp' -or -name '*.gypi' \)`" ) ]]; then
-  ${GYP} \
-    --check --depth=${AOS}/.. --no-circular-check -f ninja \
-    -I${AOS}/build/aos.gypi -Goutput_dir=out_${PLATFORM} \
-    -DOS=${PLATFORM} -DWIND_BASE=${WIND_BASE} -DDEBUG=${DEBUG} \
-    ${GYP_MAIN}
+  # This is a gyp "file" that we pipe into gyp so that it will put the output
+  # in a directory named what we want where we want it.
+  GYP_INCLUDE=$(cat <<END
+{
+  'target_defaults': {
+    'configurations': {
+	  '${PLATFORM}': {}
+    }
+  }
+}
+END
+)
+  echo "${GYP_INCLUDE}" | ${GYP} \
+      --check --depth=${AOS}/.. --no-circular-check -f ninja \
+      -I${AOS}/build/aos.gypi -I/dev/stdin -Goutput_dir=output \
+      -DOS=${PLATFORM} -DWIND_BASE=${WIND_BASE} -DDEBUG=${DEBUG} \
+      ${GYP_MAIN}
   # Have to substitute "command = $compiler" so that it doesn't try to
   #   substitute them in the linker commands, where it doesn't work.
   sed -i "s:command = \$cc:\\0 ${COMMONFLAGS}:g ; \
@@ -69,28 +69,28 @@
   else
     NINJA_ACTION=
   fi
-  ${NINJA} -C ${OUTDIR}/Default ${NINJA_ACTION} "$@"
+  ${NINJA} -C ${OUTDIR} ${NINJA_ACTION} "$@"
   if [[ ${ACTION} == deploy || ${ACTION} == redeploy ]]; then
     [ ${PLATFORM} == atom ] && \
       rsync --progress -c -r \
-        ${OUTDIR}/Default/outputs/* \
+        ${OUTDIR}/outputs/* \
         driver@`${AOS}/build/get_ip fitpc`:/home/driver/robot_code/bin
 	  ssh driver@`${AOS}/build/get_ip fitpc` "sync; sync; sync"
     [ ${PLATFORM} == crio ] && \
       ncftpput `${AOS}/build/get_ip robot` / \
-      ${OUTDIR}/Default/lib/FRC_UserProgram.out
+      ${OUTDIR}/lib/FRC_UserProgram.out
   fi
   if [[ ${ACTION} == redeploy ]]; then
     if [[ ${PLATFORM} != crio ]]; then
       echo "Platform ${PLATFORM} does not support redeploy." 1>&2
       exit 1
     fi
-    ${OUTDIR}/../out_atom/Default/outputs/netconsole <<"END"
+    ${OUTDIR}/../out_atom/outputs/netconsole <<"END"
 unld "FRC_UserProgram.out"
 ld < FRC_UserProgram.out
 END
   fi
   if [[ ${ACTION} == tests ]]; then
-    find ${OUTDIR}/Default/tests -executable -exec {} \;
+    find ${OUTDIR}/tests -executable -exec {} \;
   fi
 fi