AI 145850: am: CL 145512 SDK add-on updates
  - rename the directory and zip file
  - make it build to the dist directory
  Original author: joeo
  Merged from: //branches/cupcake/...

Automated import of CL 145850
diff --git a/core/main.mk b/core/main.mk
index 04e9728..878e3f1 100644
--- a/core/main.mk
+++ b/core/main.mk
@@ -125,6 +125,15 @@
 ### between the build variants
 ###
 
+is_sdk_build :=
+ifneq ($(filter sdk,$(MAKECMDGOALS)),)
+is_sdk_build := true
+endif
+ifneq ($(filter sdk_addon,$(MAKECMDGOALS)),)
+is_sdk_build := true
+endif
+
+
 ## user/userdebug ##
 
 user_variant := $(filter userdebug user,$(TARGET_BUILD_VARIANT))
@@ -187,7 +196,7 @@
 
 ## sdk ##
 
-ifneq ($(filter sdk,$(MAKECMDGOALS)),)
+ifdef is_sdk_build
 ifneq ($(words $(filter-out $(INTERNAL_MODIFIER_TARGETS),$(MAKECMDGOALS))),1)
 $(error The 'sdk' target may not be specified with any other targets)
 endif
@@ -212,7 +221,7 @@
 # If we're on an eng or tests build, but not on the sdk, and we have
 # a better one, use that instead.
 ifneq ($(filter eng tests,$(TARGET_BUILD_VARIANT)),)
-  ifeq ($(filter sdk,$(MAKECMDGOALS)),)
+  ifdef is_sdk_build
     apns_to_use := $(wildcard vendor/google/etc/apns-conf.xml)
     ifneq ($(strip $(apns_to_use)),)
       PRODUCT_COPY_FILES := \
@@ -239,7 +248,7 @@
 $(if $(filter tests,$(1)),,true)
 endef
 
-ifneq (,$(filter sdk,$(MAKECMDGOALS)))
+ifdef is_sdk_build
 # For the sdk goal, anything with the "samples" tag should be
 # installed in /data even if that module also has "eng"/"debug"/"user".
 define should-install-to-system
@@ -534,7 +543,7 @@
 # Don't include any GNU targets in the SDK.  It's ok (and necessary)
 # to build the host tools, but nothing that's going to be installed
 # on the target (including static libraries).
-ifneq ($(filter sdk,$(MAKECMDGOALS)),)
+ifdef is_sdk_build
   target_gnu_MODULES := \
               $(filter \
                       $(TARGET_OUT_INTERMEDIATES)/% \