auto import from //depot/cupcake/@135843
diff --git a/core/executable.mk b/core/executable.mk
new file mode 100644
index 0000000..623c766
--- /dev/null
+++ b/core/executable.mk
@@ -0,0 +1,28 @@
+###########################################################
+## Standard rules for building an executable file.
+##
+## Additional inputs from base_rules.make:
+## None.
+###########################################################
+
+ifeq ($(strip $(LOCAL_MODULE_CLASS)),)
+LOCAL_MODULE_CLASS := EXECUTABLES
+endif
+ifeq ($(strip $(LOCAL_MODULE_SUFFIX)),)
+LOCAL_MODULE_SUFFIX := $(TARGET_EXECUTABLE_SUFFIX)
+endif
+
+# Executables are not prelinked.  If we decide to start prelinking
+# them, the LOCAL_PRELINK_MODULE definitions should be moved from
+# here and shared_library.make and consolidated in dynamic_binary.make.
+LOCAL_PRELINK_MODULE := false
+
+include $(BUILD_SYSTEM)/dynamic_binary.mk
+
+ifeq ($(LOCAL_FORCE_STATIC_EXECUTABLE),true)
+$(linked_module): $(TARGET_CRTBEGIN_STATIC_O) $(all_objects) $(all_libraries) $(TARGET_CRTEND_O)
+	$(transform-o-to-static-executable)
+else	
+$(linked_module): $(TARGET_CRTBEGIN_DYNAMIC_O) $(all_objects) $(all_libraries) $(TARGET_CRTEND_O)
+	$(transform-o-to-executable)
+endif