Propagate target OS from configure to Makefile

Propagate target OS from configure to Makefile (CONFIG_TARGET_OS) to avoid
duplicating the check in Makefile.  Also allow CROSS_COMPILE for the toolchain
prefix, which is common (e.g. Linux).

Signed-off-by: Aaron Carroll <aaronc@cse.unsw.edu.au>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
diff --git a/configure b/configure
index d364971..1fa9b63 100755
--- a/configure
+++ b/configure
@@ -126,6 +126,7 @@
 targetos=""
 cpu=""
 
+cross_prefix=${cross_prefix-${CROSS_COMPILE}}
 cc="${CC-${cross_prefix}gcc}"
 
 show_help="no"
@@ -173,6 +174,12 @@
   targetos=`uname -s`
 fi
 
+echo "# Automatically generated by configure - do not modify" > $config_host_mak
+printf "# Configured with:" >> $config_host_mak
+printf " '%s'" "$0" "$@" >> $config_host_mak
+echo >> $config_host_mak
+echo "CONFIG_TARGET_OS=$targetos" >> $config_host_mak
+
 # Some host OSes need non-standard checks for which CPU to use.
 # Note that these checks are broken for cross-compilation: if you're
 # cross-compiling to one of these OSes then you'll need to specify
@@ -929,11 +936,6 @@
 
 #############################################################################
 
-echo "# Automatically generated by configure - do not modify" > $config_host_mak
-printf "# Configured with:" >> $config_host_mak
-printf " '%s'" "$0" "$@" >> $config_host_mak
-echo >> $config_host_mak
-
 if test "$wordsize" = "64" ; then
   output_sym "CONFIG_64BIT"
 elif test "$wordsize" = "32" ; then