extractors: Split 32/64 makefiles

* $TARGET_ARCH isn't defined when we include the makefile.

Change-Id: I2dd6c30814b6a8926b4eb48932fca1865f1f966b
diff --git a/extractors/extract-files.sh b/extractors/extract-files.sh
index 7c15395..9d4a60c 100755
--- a/extractors/extract-files.sh
+++ b/extractors/extract-files.sh
@@ -40,8 +40,15 @@
 SUBSYSTEM=$3
 
 # Initialize the helper for common device
-setup_vendor "$DEVICE/$PLATFORM/$SUBSYSTEM" "$VENDOR" "$CM_ROOT" true true $SUBSYSTEM
+if [ -f "$MY_DIR"/"$SUBSYSTEM"-"$PLATFORM"-32.txt -a -f "$MY_DIR"/"$SUBSYSTEM"-"$PLATFORM"-64.txt ]; then
+    setup_vendor "$DEVICE/${PLATFORM}-32/$SUBSYSTEM" "$VENDOR" "$CM_ROOT" true true $SUBSYSTEM
+    extract "$MY_DIR"/"$SUBSYSTEM"-"$PLATFORM"-32.txt "$SRC"
 
-extract "$MY_DIR"/"$SUBSYSTEM"-"$PLATFORM".txt "$SRC"
+    setup_vendor "$DEVICE/${PLATFORM}-64/$SUBSYSTEM" "$VENDOR" "$CM_ROOT" true true $SUBSYSTEM
+    extract "$MY_DIR"/"$SUBSYSTEM"-"$PLATFORM"-64.txt "$SRC"
+else
+    setup_vendor "$DEVICE/$PLATFORM/$SUBSYSTEM" "$VENDOR" "$CM_ROOT" true true $SUBSYSTEM
+    extract "$MY_DIR"/"$SUBSYSTEM"-"$PLATFORM".txt "$SRC"
+fi
 
 "$MY_DIR"/setup-makefiles.sh
diff --git a/extractors/setup-makefiles.sh b/extractors/setup-makefiles.sh
index da84d36..a8ee382 100755
--- a/extractors/setup-makefiles.sh
+++ b/extractors/setup-makefiles.sh
@@ -39,7 +39,7 @@
 SUBSYSTEM=graphics
 
 # Initialize the helper
-setup_vendor "$DEVICE/$PLATFORM/$SUBSYSTEM" "$VENDOR" "$CM_ROOT" true true $SUBSYSTEM
+setup_vendor "$DEVICE/${PLATFORM}-32/$SUBSYSTEM" "$VENDOR" "$CM_ROOT" true true $SUBSYSTEM
 
 # Copyright headers and guards
 write_headers $PLATFORM TARGET_BOARD_PLATFORM
@@ -50,11 +50,24 @@
 
 write_makefiles "$MY_DIR"/"$SUBSYSTEM-$PLATFORM"-32.txt
 
-printf '\n%s\n' "ifneq (\$(TARGET_ARCH), arm)" >> "$PRODUCTMK"
-write_makefiles "$MY_DIR"/"$SUBSYSTEM-$PLATFORM"-64.txt
-echo "endif" >> "$PRODUCTMK"
+printf "endif" >> "$PRODUCTMK"
 
-printf '\n%s\n' "endif" >> "$PRODUCTMK"
+# We are done!
+write_footers
+
+# Initialize the helper
+setup_vendor "$DEVICE/${PLATFORM}-64/$SUBSYSTEM" "$VENDOR" "$CM_ROOT" true true $SUBSYSTEM
+
+# Copyright headers and guards
+write_headers $PLATFORM TARGET_BOARD_PLATFORM
+
+# Qualcomm BSP blobs - we put a conditional around here
+# in case the BSP is actually being built
+echo "ifeq (\$(QCPATH),)" >> "$PRODUCTMK"
+
+write_makefiles "$MY_DIR"/"$SUBSYSTEM-$PLATFORM"-64.txt
+
+printf "endif" >> "$PRODUCTMK"
 
 # We are done!
 write_footers