Don't use ALL_PREBUILT

Bug: 6294985
With ALL_PREBUILT it just installs the data files to all devices.
We switch to a config.mk, which will be included by module definition of
VoiceDialer.apk and set up the necessary dependency.
TODO: modulize the config files and have VoiceDialer.apk depend on them.

Change-Id: I25ecb9888960806acda808ef8f5e88fe9bcb48bb
diff --git a/config/en.us/Android.mk b/config/en.us/Android.mk
index 9af1f12..881c2ee 100644
--- a/config/en.us/Android.mk
+++ b/config/en.us/Android.mk
@@ -1,6 +1,6 @@
 
 LOCAL_PATH:= $(call my-dir)
-include $(CLEAR_VARS)
+########################################
 
 copy_from :=                     \
     baseline11k.par              \
@@ -23,7 +23,8 @@
 $(copy_to) : $(TARGET_OUT)/usr/srec/config/en.us/% : $(LOCAL_PATH)/% | $(ACP)
 	$(transform-prebuilt-to-target)
 
-ALL_PREBUILT += $(copy_to)
+# ALL_PREBUILT is deprecated. Moved to config.mk
+# ALL_PREBUILT += $(copy_to)
 
 
 # define paths to some grammar tools
@@ -45,9 +46,10 @@
 	$(G2G_INSTALL_PATH)/ipaq_commands.g2g \
 	$(G2G_INSTALL_PATH)/lookup.g2g \
 
-ALL_PREBUILT += $(G2G_INSTALL_PATH)/VoiceDialer.g2g \
-	$(G2G_INSTALL_PATH)/boolean.g2g \
-	$(G2G_INSTALL_PATH)/phone_type_choice.g2g
+# ALL_PREBUILT is deprecated. Moved to config.mk
+# ALL_PREBUILT += $(G2G_INSTALL_PATH)/VoiceDialer.g2g \
+#	$(G2G_INSTALL_PATH)/boolean.g2g \
+#	$(G2G_INSTALL_PATH)/phone_type_choice.g2g
 
 #---------------------------------------------------------------------------------
 # Explicit rules.
@@ -72,7 +74,6 @@
 	$(MAKE_G2G) -base $(G2G_INSTALL_PATH)/$*,addWords=0 -out $@
 	(cd $(G2G_INSTALL_PATH); rm -f $*.Grev2.det.txt $*.map $*.omap $*.P.txt $*.params $*.PCLG.txt $*.script)
 
-
 #-----------------------------------------------------------------
 # this rule generates cmu6plus.ok.zip, which is built manually and checked in.
 # the grxml compiler expects this (and other) data files to be here.
@@ -97,14 +98,12 @@
           echo -e "\n+++ advzip not installed; fell back to zip\n    cmu6plus.ok.zip (`du -h cmu6plus.ok.zip | cut -f 1`) could be ~10% smaller with advzip\n"))
 
 
-
 #-----------------------------------------------------------------
 # build cmu2nuance dictionary conversion program, to prevent bitrot
 #-----------------------------------------------------------------
-
-LOCAL_SRC_FILES:= dictionary/cmu2nuance.cpp
-
-LOCAL_MODULE:= cmu2nuance
+include $(CLEAR_VARS)
+LOCAL_SRC_FILES := dictionary/cmu2nuance.cpp
+LOCAL_MODULE := cmu2nuance
+LOCAL_MODULE_TAGS := optional
 
 include $(BUILD_HOST_EXECUTABLE)
-
diff --git a/config/en.us/config.mk b/config/en.us/config.mk
new file mode 100644
index 0000000..60d2b3c
--- /dev/null
+++ b/config/en.us/config.mk
@@ -0,0 +1,21 @@
+# Config files to be installed.
+SREC_CONFIG_TARGET_FILES := \
+    $(addprefix $(TARGET_OUT)/usr/srec/config/en.us/, \
+        baseline11k.par              \
+        baseline8k.par               \
+        baseline.par                 \
+        dictionary/basic.ok          \
+        dictionary/enroll.ok         \
+        dictionary/cmu6plus.ok.zip   \
+        g2p/en-US-ttp.data           \
+        models/generic.swiarb        \
+        models/generic11.lda         \
+        models/generic11_f.swimdl    \
+        models/generic11_m.swimdl    \
+        models/generic8.lda          \
+        models/generic8_f.swimdl     \
+        models/generic8_m.swimdl) \
+    $(addprefix $(TARGET_OUT)/usr/srec/config/en.us/grammars/, \
+        VoiceDialer.g2g \
+        boolean.g2g \
+        phone_type_choice.g2g)
diff --git a/srec_jni/Android.mk b/srec_jni/Android.mk
index 81035ed..d3ef8d9 100644
--- a/srec_jni/Android.mk
+++ b/srec_jni/Android.mk
@@ -71,5 +71,6 @@
 
 LOCAL_MODULE := libsrec_jni
 
-include $(BUILD_SHARED_LIBRARY)
+LOCAL_MODULE_TAGS := optional
 
+include $(BUILD_SHARED_LIBRARY)