Embedding build systems into one another is a very complicated issue, and requires deep knowledge of both build systems in order to keep all the functionality of both systems. Given that the Android build attempts to provide safe, fast incremental builds that work on any machine, it gets very difficult to preserve those features while calling out to another build system. If the scripts are simpler (bash/python script that reads a known set of inputs and writes to a know set of outputs, and doesn't use any other tools), then this doesn't get too difficult. But keep in mind that you do need to declare all inputs and outputs, and most tools you use need to be referenced by paths (and also be inputs), not in $PATH. Android.bp has the `genrule` concept that makes this easier.
<this where i need to run the script so that bins will be generated for > Android build to pickup> > Keep in mind that we're not linearly executing Android.mk files -- that only happens in the first minute or two of the build to generate commands for what comes later. So you shouldn't actually be running the script there, but defining some Make logic to run your script later. You may be able to find references to Android.mk files using base_rules.mk and defining rules to build $(LOCAL_BUILT_MODULE), but you could also look into writing Android.bp files with genrules, which makes this simpler and adds some checks for common issues. > Have you tried using $(shell) ? > RESULT:= $(shell ($(LOCAL_PATH)/yourscript.sh)) > Definitely don't do this, it will slow down every build as we serially execute every one of these every time (even if there's nothing to build). - Dan On Mon, Dec 13, 2021 at 2:49 PM Paulo Maia <[email protected]> wrote: > Have you tried using $(shell) ? > RESULT:= $(shell ($(LOCAL_PATH)/yourscript.sh)) > > Also you I think you could put in buiod/core/app_prebuilt_internal.mk if > this is going to be repetitive. > > BR, > Paulo > > On Monday, November 8, 2021 at 2:14:48 PM UTC-8 [email protected] wrote: > >> Hi, >> >> I need to run a shell script so that the libs and bins will be generated >> beofre Android can pick them up. >> >> A structure of the makefile i am trying to comeup is below, not sure if >> this is really possible.. any inputs are appreciated. >> >> LOCAL_PATH := $(call my-dir) >> >> <this where i need to run the script so that bins will be generated for >> Android build to pickup> >> >> include $(CLEAR_VARS) >> LOCAL_MODULE := my_modules >> LOCAL_MODULE_OWNER := Me >> LOCAL_MODULE_TAGS := optional >> LOCAL_SRC_FILES := ./my_bin_001 >> LOCAL_MODULE_PATH := $(PRODUCT_OUT)/system/bin >> include $(BUILD_PREBUILT) >> >> i am not sure how can i add my build script which generates the my_bin_001 >> there are several bins its generating and i cant really convert the shell >> script in to a Makefile for practical reasons. >> >> reagrds, >> abhay >> > -- > -- > You received this message because you are subscribed to the "Android > Building" mailing list. > To post to this group, send email to [email protected] > To unsubscribe from this group, send email to > [email protected] > For more options, visit this group at > http://groups.google.com/group/android-building?hl=en > > --- > You received this message because you are subscribed to the Google Groups > "Android Building" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To view this discussion on the web visit > https://groups.google.com/d/msgid/android-building/2824e7a8-3745-45b7-9037-fc5c1eaf8930n%40googlegroups.com > <https://groups.google.com/d/msgid/android-building/2824e7a8-3745-45b7-9037-fc5c1eaf8930n%40googlegroups.com?utm_medium=email&utm_source=footer> > . > -- -- You received this message because you are subscribed to the "Android Building" mailing list. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/android-building?hl=en --- You received this message because you are subscribed to the Google Groups "Android Building" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/android-building/CALQgHdmuC3RcAfmF6GvmQVEqGyemMHW-7K0ovbP1RkZkZam-fA%40mail.gmail.com.
