rename pdk build: pdk1 to pdk_eng, pdk2 to pdk_rel
external/clang and llvm for frameworks/compile
header cleanup after camera refactoring

Change-Id: Ie4a7dce7d07b1b0ebcd76ae13f4d80ae5665987b
diff --git a/build/copy_pdk1_bins.py b/build/copy_pdk_bins.py
similarity index 95%
rename from build/copy_pdk1_bins.py
rename to build/copy_pdk_bins.py
index 5b8dac0..9ab4140 100755
--- a/build/copy_pdk1_bins.py
+++ b/build/copy_pdk_bins.py
@@ -14,7 +14,7 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 #
-# script to copy PDK1 build result into a dir for PDK2 build
+# script to copy PDK_eng build result into a dir for PDK_rel build
 
 import os, string, sys, shutil
 import copy_utils as cu
@@ -118,18 +118,18 @@
   "target/product/maguro/system/etc/security",
   "target/product/maguro/system/framework",
   "target/product/maguro/system/lib",
-  # tools for debugging, not all of them are built in pdk2 build
+  # tools for debugging, not all of them are built in pdk_rel build
   "target/product/maguro/system/xbin"
   ]
 
 # from host/linux-x86/obj/STATIC_LIBRARIES/XYZ_intermediates
 host_a_list = [
-  "libandroidfw"
+  "libandroidfw",
+  "libRS"
   ]
 
 # from host/linux-x86/obj/lib
 host_so_list = [
-  "libbcc"
   ]
 
 # from host/commom/JAVA_LIBRARIES/XYZ_intermediates
@@ -157,13 +157,13 @@
   "libnativehelper",
   "libemoji",
   "libdrmframework",
-  "libbcc",
   "libdvm",
   "libchromium_net",
   "libcamera_client",
   "libmedia",
   "libstagefright",
-  "libstagefright_foundation"
+  "libstagefright_foundation",
+  "libRS"
   ]
 
 
@@ -195,13 +195,13 @@
   "target/product/maguro/system/lib/libSEC_OMX*.so",
   "target/product/maguro/system/lib/libWiMAX*.so",
   "target/product/maguro/system/lib/libOMX.TI.*.so",
-  "target/product/maguro/system/lib/libOMX_Core.so",
+  "target/product/maguro/system/lib/libOMX_Core.so"
   ]
 
 def main(argv):
   if len(argv) != 4:
-    print "Usage: copy_pdk1_bins.py src_top_dir dest_top_dir src_target_device"
-    print "   ex: copy_pdk1_bins.py ../master vendor/pdk_bin_j_arm maguro"
+    print "Usage: copy_pdk_bins.py src_top_dir dest_top_dir src_target_device"
+    print "   ex: copy_pdk_bins.py ../master vendor/pdk_bin_j_arm maguro"
     sys.exit(1)
   src_top_dir = argv[1]
   src_out_dir = argv[1] + "/out/"
diff --git a/build/copy_pdk_data.py b/build/copy_pdk_data.py
index 88a00bb..efd2482 100755
--- a/build/copy_pdk_data.py
+++ b/build/copy_pdk_data.py
@@ -35,13 +35,13 @@
   for dir_name in tree.prev_copy_dir_list:
     cu.copy_dir(previous_branch, dest_top + "/vendor/pdk_data", dir_name)
 
-  for dir_name in tree.prev_copy_dir_pdk1_list:
+  for dir_name in tree.prev_copy_dir_pdk_eng_list:
     cu.copy_dir(previous_branch, dest_top + "/vendor/pdk_data_internal", dir_name)
 
-  for dir_name in tree.additional_dir_pdk2_list:
+  for dir_name in tree.additional_dir_pdk_rel_list:
     cu.copy_dir(current_branch, dest_top + "/vendor/pdk_data", dir_name)
 
-  for file_name in tree.copy_files_pdk2_list:
+  for file_name in tree.copy_files_pdk_rel_list:
     cu.copy_files(current_branch, dest_top + "/vendor/pdk_data", file_name)
 
 if __name__ == '__main__':
diff --git a/build/create_source_tree.py b/build/create_source_tree.py
index 6ee02da..c3ab193 100755
--- a/build/create_source_tree.py
+++ b/build/create_source_tree.py
@@ -15,7 +15,7 @@
 # limitations under the License.
 #
 
-# script to create minimal source tree for pdk2 build
+# script to create minimal source tree for pdk_eng / pdk_rel build
 # pdk/build/pdk.mk file will be checked to detect necessary files
 # together with additional addition in this script for build dependency
 
@@ -67,6 +67,8 @@
   "dalvik",
   "development",
   "external",
+  "external/clang",
+  "external/llvm",
   "libcore",
   "pdk",
   "prebuilt",
@@ -83,24 +85,24 @@
 
 # these dirs will be direcly pulled as the whole git.
 # so these files will not go under vendor/pdk_data
-additional_dir_pdk2_list_git = [
+additional_dir_pdk_rel_list_git = [
   "external/libnl-headers",
   "external/proguard",
 ]
 
-additional_dir_pdk2_list = [
+additional_dir_pdk_rel_list = [
   "frameworks/base/build",
   "frameworks/base/cmds/dumpstate",
   "frameworks/base/include/androidfw",
   "frameworks/base/include/android_runtime",
-  "frameworks/base/include/camera",
   "frameworks/base/native/include",
   "dalvik/libnativehelper/include",
   "external/v8/include",
   "external/safe-iop/include",
   "system/media/audio_effects/include", # should be removed after refactoring
-  "frameworks/base/include/drm", # for building legacy audio HAL, not in PDK release
-  "frameworks/base/include/media", # for building legacy audio HAL, not in PDK release
+  "frameworks/base/include/drm", # for building legacy HAL, not in PDK release?
+  "frameworks/base/include/media", # for building legacy HAL, not in PDK release?
+  "frameworks/base/libs/rs/scriptc" # may remove after refactoring RS
   ]
 
 # only files under the dir is copied, not subdirs
@@ -111,18 +113,18 @@
   "Makefile"
   ]
 
-copy_files_pdk2_list = [
+copy_files_pdk_rel_list = [
   "frameworks/base/media/libeffects/data/audio_effects.conf",
   "development/data/etc/apns-conf_sdk.xml",
-  "development/data/etc/vold.conf",
+  "development/data/etc/vold.conf"
   ]
 
 prev_copy_dir_list = [
   "frameworks/base/data"
   ]
 
-# for PDK1 build only, use old version
-prev_copy_dir_pdk1_list = [
+# for PDK_ENG build only, use old version
+prev_copy_dir_pdk_eng_list = [
   "packages/apps/Bluetooth",
   "packages/inputmethods/LatinIME",
   "packages/providers/ApplicationsProvider",
@@ -145,14 +147,15 @@
   "vendor/samsung/crespo", # should be removed when crespo is supproted
   "vendor/nvidia/proprietary-tegra3",
   "packages/providers/BrowserProvider",
+  "hardware/ti/omap4xxx/test/CameraHal" # cannot build with PDK source
   ]
 
 def main(argv):
   if len(argv) < 5:
-    print "Usage: create_source_tree.py pdk_type(1 or 2) current_src_top_dir prev_src_top_tree dest_top_dir"
-    print "   ex: create_source_tree.py 1 ../jb_master ../ics_master /pdk1_source"
+    print "Usage: create_source_tree.py pdk_type(eng or rel) current_src_top_dir prev_src_top_tree dest_top_dir"
+    print "   ex: create_source_tree.py eng ../jb_master ../ics_master /pdk_eng_source"
     sys.exit(1)
-  pdk1 = (argv[1] == "1")
+  pdk_eng = (argv[1] == "eng")
   src_top_dir = os.path.abspath(argv[2])
   prev_src_top_dir = os.path.abspath(argv[3])
   dest_top_dir = os.path.abspath(argv[4])
@@ -166,15 +169,18 @@
   if full_copy:
     dir_list += extract_build_dir(src_top_dir + "/pdk/build/pdk.mk", "BUILD_PDK_SUBDIRS")
     dir_list += extract_build_dir(src_top_dir + "/pdk/build/pdk_google.mk", "BUILD_PDK_SUBDIRS")
-    if pdk1:
-      dir_list += extract_build_dir(src_top_dir + "/pdk/build/pdk.mk", "BUILD_PDK1_SUBDIRS")
+    if pdk_eng:
+      dir_list += extract_build_dir(src_top_dir + "/pdk/build/pdk.mk", "BUILD_PDK_ENG_SUBDIRS")
     else:
-      dir_list += extract_build_dir(src_top_dir + "/pdk/build/pdk.mk", "BUILD_PDK2_SUBDIRS")
+      dir_list += extract_build_dir(src_top_dir + "/pdk/build/pdk.mk", "BUILD_PDK_REL_SUBDIRS")
 
   dir_list += additional_dir_list
-  if not pdk1:
-    dir_list += additional_dir_pdk2_list_git
-    dir_list += additional_dir_pdk2_list
+  if not pdk_eng:
+    dir_list += additional_dir_pdk_rel_list_git
+    dir_list += additional_dir_pdk_rel_list
+  for dir_prev_version in prev_copy_dir_list:
+    if dir_prev_version in dir_list:
+      dir_list.remove(dir_prev_version)
   print "copy list", dir_list
 
   os.system("mkdir -p " + dest_top_dir)
@@ -188,8 +194,8 @@
     cu.copy_dir_only_file(src_top_dir, dest_top_dir, "/" + dir_name)
 
   copy_files_list_ = copy_files_list
-  if not pdk1:
-    copy_files_list_ += copy_files_pdk2_list
+  if not pdk_eng:
+    copy_files_list_ += copy_files_pdk_rel_list
   for file_name in copy_files_list_:
     cu.copy_files(src_top_dir, dest_top_dir, "/" + file_name)
 
@@ -201,8 +207,8 @@
 
   prev_copy_dir_list_ = []
   prev_copy_dir_list_ += prev_copy_dir_list
-  if pdk1:
-    prev_copy_dir_list_ += prev_copy_dir_pdk1_list
+  if pdk_eng:
+    prev_copy_dir_list_ += prev_copy_dir_pdk_eng_list
   print "use ICS version for ", prev_copy_dir_list_
   for dir_name in prev_copy_dir_list_:
     os.system("rm -rf " + dest_top_dir + "/" + dir_name)
diff --git a/build/pdk.mk b/build/pdk.mk
index b787543..aa7f694 100644
--- a/build/pdk.mk
+++ b/build/pdk.mk
@@ -14,8 +14,8 @@
 # limitations under the License.
 #
 
-# common build dirs for pdk1 and pdk2
-# this list should be minimal to make pdk2 build fast
+# common build dirs for pdk_eng and pdk_rel builds
+# this list should be minimal to make pdk_rel build fast
 
 # BUILD_PDK_SUBDIRS is parsed by a script to extract source tree list automatically.
 # To make that parsing simple, the first line should not include any explicit directory name.
@@ -31,7 +31,7 @@
 
 
 # if pdk_vendor.mk exist, do not include pdk_google.mk
-# pdk_vendor.mk should add more dirs for pdk2 build
+# pdk_vendor.mk should add more dirs for pdk_rel build
 # that is, it should include BUILD_PDK_SUBDIRS += \ to add additional dir for build
 ifneq (,$(wildcard $(TOPDIR)pdk/build/pdk_vendor.mk))
 include $(TOPDIR)pdk/build/pdk_vendor.mk
@@ -39,9 +39,9 @@
 include $(TOPDIR)pdk/build/pdk_google.mk
 endif
 
-ifeq ($(PDK_BUILD_TYPE), pdk1)
-# addition for pdk1
-BUILD_PDK1_SUBDIRS := \
+ifeq ($(PDK_BUILD_TYPE), pdk_eng)
+# addition for pdk_eng
+BUILD_PDK_ENG_SUBDIRS := \
 	dalvik \
 	development \
 	external \
@@ -56,7 +56,7 @@
 	system
 
 
-BUILD_PDK_SUBDIRS += $(BUILD_PDK1_SUBDIRS)
+BUILD_PDK_SUBDIRS += $(BUILD_PDK_ENG_SUBDIRS)
 
 ifeq ($(TARGET_CPU_SMP), true)
 PDK_BIN_NAME := pdk_bin_$(TARGET_ARCH_VARIANT)_true
@@ -76,19 +76,20 @@
 # It is too early and INSTALLED_SYSTEMIMAGE is not defined yet.
 $(OUT_DIR)/target/$(PDK_BIN_NAME): $(OUT_DIR)/target/product/$(TARGET_DEVICE)/boot.img \
                                    $(OUT_DIR)/target/product/$(TARGET_DEVICE)/system.img
-	python $(TOPDIR)pdk/build/copy_pdk1_bins.py . $(OUT_DIR)/target/$(PDK_BIN_NAME) $(TARGET_DEVICE)
+	python $(TOPDIR)pdk/build/copy_pdk_bins.py . $(OUT_DIR)/target/$(PDK_BIN_NAME) $(TARGET_DEVICE)
 
-else # pdk2
+else # pdk_rel
 
-# overwrite the definition from conflig.mk, no package build in pdk2
+# overwrite the definition from conflig.mk, no package build in pdk_rel
 BUILD_PACKAGE :=
 
-# addition for pdk2
-BUILD_PDK2_SUBDIRS := \
+# addition for pdk_rel
+BUILD_PDK_REL_SUBDIRS := \
 	external/antlr \
 	external/bluetooth \
 	external/bsdiff \
 	external/bzip2 \
+	external/clang \
 	external/dbus \
 	external/doclava \
 	external/expat \
@@ -107,6 +108,7 @@
 	external/liblzf \
 	external/libpng \
 	external/libvpx \
+	external/llvm \
 	external/mksh \
 	external/openssl \
 	external/protobuf \
@@ -120,6 +122,7 @@
 	external/wpa_supplicant_8 \
 	external/yaffs2 \
 	external/zlib \
+	frameworks/compile \
 	frameworks/native \
 	system/bluetooth \
 	system/core \
@@ -131,7 +134,7 @@
 
 # system should be put back to common list once system/media is refactored
 
-BUILD_PDK_SUBDIRS += $(BUILD_PDK2_SUBDIRS)
+BUILD_PDK_SUBDIRS += $(BUILD_PDK_REL_SUBDIRS)
 
 # naming convention for bin repository: pdk_bin_CPUArch_SMPSupport
 # ex: pdk_bin_armv7-a_true (armv7-a with SMP support)
@@ -167,9 +170,9 @@
 endif
 
 ifeq (,$(wildcard $(OUT_DIR)/target/product/$(TARGET_DEVICE)/PDK_BIN_COPIED))
-$(error PDK binaries necessary for pdk2 build are not there! Did you run setup_pdk2_bin.py? )
+$(error PDK binaries necessary for pdk_rel build are not there! Did you run setup_pdk_rel.py? )
 endif # PDK_BIN_COPIED
 
 PRODUCT_PACKAGES += core core-junit
 
-endif # pdk2
+endif # pdk_rel
diff --git a/build/pdk_google.mk b/build/pdk_google.mk
index 16474b5..66b2db7 100644
--- a/build/pdk_google.mk
+++ b/build/pdk_google.mk
@@ -14,7 +14,7 @@
 # limitations under the License.
 #
 
-# subdirs for building pdk1/pdk2 for maruro/crespo
+# subdirs for building pdk_eng/pdk_rel for maruro/crespo
 BUILD_PDK_SUBDIRS += \
 	vendor/broadcom \
 	vendor/invensense \
diff --git a/build/pdk_prebuilt.mk b/build/pdk_prebuilt.mk
index e0bb8ed..82a2eb9 100644
--- a/build/pdk_prebuilt.mk
+++ b/build/pdk_prebuilt.mk
@@ -14,13 +14,9 @@
 # limitations under the License.
 #
 
-# build list for PDK1
-# This build filters out most applications
-# The outcome of this build is to create a binary release to allow chipset vendors
-# to create a minimum UI image to bring up their H/W
 
-# This file under pdk/build is the template for the same file under vendor/pdk_XYZ
-# The file under vendor is automatically generated, and do not edit.
+# This file under pdk/build is the template for the same file under vendor/pdk
+# The file under vendor/pdk is automatically generated, and should not be manually edited.
 
 LOCAL_PATH := $(call my-dir)
 
diff --git a/build/setup_pdk2_bin.py b/build/setup_pdk_rel.py
similarity index 87%
rename from build/setup_pdk2_bin.py
rename to build/setup_pdk_rel.py
index 0b1c382..4dcbd01 100755
--- a/build/setup_pdk2_bin.py
+++ b/build/setup_pdk_rel.py
@@ -15,8 +15,9 @@
 # limitations under the License.
 #
 
-# script to prepare pdk2 branches for build.
+# script to prepare pdk_rel branches for build.
 # This should be run after every make clean as necessary files will be deleted
+# TODO : set up source code as well
 
 import os, re, string, sys
 
@@ -43,8 +44,8 @@
 
 def main(argv):
   if len(argv) != 4:
-    print "Usage: setup_pdk2_bin.py top_dir cpu_conf target_hw"
-    print "   ex: setup_pdk2_bin.py pdk2_source armv7-a-neon_true maguro"
+    print "Usage: setup_pdk_rel.py top_dir cpu_conf target_hw"
+    print "   ex: setup_pdk_rel.py pdk_rel_source armv7-a-neon_true maguro"
     sys.exit(1)
   top_dir = argv[1]
   cpu_conf = argv[2]
@@ -67,8 +68,9 @@
   pdk_bin_path = top_dir + PDK_BIN_TOP_DIR + PDK_BIN_PREFIX + cpu_conf
   pdk_bin_target_name = get_target_name_from_pdk_bin(pdk_bin_path)
   os.system("cp -a " + pdk_bin_path + "/raw_copy/host/* " + top_dir + "/out/host")
-  os.system("cp -a " + pdk_bin_path + "/raw_copy/target/common/* " + top_dir +
-            "/out/target/common")
+# no target/common yet
+#  os.system("cp -a " + pdk_bin_path + "/raw_copy/target/common/* " + top_dir +
+#            "/out/target/common")
   os.system("cp -a " + pdk_bin_path + "/raw_copy/target/product/" + pdk_bin_target_name + "/* "
             + top_dir + "/out/target/product/" + target_hw)
   os.system("touch " + top_dir + "/out/target/product/" + target_hw + "/PDK_BIN_COPIED")