> I need to copy two files from one folder to another using Android.mk.
>
> Here is the Android.mk that I have written and doesn't work. I have
> tried replacing SHARED_LIBRARIES with other values, but still keep
> running into errors. It keeps looking for intermediate files.
Wouldn't it make more sense to treat the files as prebuilt, i.e. doing
include $(BUILD_PREBUILT)
instead of pretending they're shared libraries that we're building. For
the sake of the operation you want to do the files *are* prebuilt.
Perhaps $(BUILD_MULTI_PREBUILT) would be even better.
> Android.mk
> ==========
> ifeq ($(TARGET_BOARD_PLATFORM),mydevice)
>
> LOCAL_PATH := $(call my-dir)
>
> define local-transform-link-to-target
Is this macro relevant for the question? It's not anywhere else in the
code you pasted.
> @echo "$(if $(PRIVATE_IS_HOST_MODULE),host,target) Prebuilt:
> $(PRIVATE_MODULE) ($@)"
> $(hide) rm -f $@
> $(hide) ln -s `basename $<` $@
Perhaps cleaner:
$(hide) ln -s $(notdir $<) $@
You can probably skip the file deletion and use "ln -sf" instead.
> endef
>
> misc_files_from := \
> $(LOCAL_PATH)/file1.abc \
> $(LOCAL_PATH)/file2.abc
> misc_files_to := $(misc_files_from:$(LOCAL_PATH)/%=$(TARGET_OUT)/%)
>
> copy_files_to := \
> $(misc_files_to)
>
>
> $(misc_files_to): $(TARGET_OUT)/% : $(LOCAL_PATH)/% | $(ACP)
> $(transform-prebuilt-to-target)
>
> $(call add-prebuilt-files, EXECUTABLES, $(prebuilt_files))
>
> include $(CLEAR_VARS)
> LOCAL_MODULE := mymodule
> *LOCAL_MODULE_CLASS := SHARED_LIBRARIES*
> LOCAL_MODULE_TAGS := optional
>
> include $(BUILD_SYSTEM)/base_rules.mk
>
> $(LOCAL_BUILT_MODULE): $(copy_files_to)
>
> endif
Can't you just do something like this?
include $(CLEAR_VARS)
LOCAL_MODULE := file1.abc
LOCAL_MODULE_CLASS := SHARED_LIBRARIES
LOCAL_MODULE_PATH := $(TARGET_OUT)
include $(BUILD_PREBUILT)
> Debug Output
> =========
>
> Install: out/target/product/blaze/system/lib/mymodule
> acp: file
> 'out/target/product/blaze/obj/SHARED_LIBRARIES/mymodule_intermediates/
> mymodule' does not exist
> make: *** [out/target/product/blaze/system/lib/mymodule] Error 1
Indeed, because of how base_rules.mk is set up make expects there to be
a rule producing $(TARGET_OUT_INTERMEDIATES)/$(LOCAL_MODULE_CLASS)/
$(LOCAL_MODULE)/$(LOCAL_MODULE)$(LOCAL_MODULE_SUFFIX). Such a rule is
normally set up when you include a more specific makefile (in this case
shared_library.mk), but since you're including base_rules.mk directly
you'll have to deal with it yourself.
--
Magnus B�ck Opinions are my own and do not necessarily
SW Configuration Manager represent the ones of my employer, etc.
Sony Ericsson
Regards,
Srinivasu
--
Sent by an employee of the Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.
include $(BUILD_PREBUILT)
Perhaps cleaner:
--
Magnus Bäck Opinions are my own and do not necessarily
SW Configuration Manager represent the ones of my employer, etc.
Sony Ericsson
--
You received this message because you are subscribed to the "Android
Building" mailing list.
To post to this group, send email to android-...@googlegroups.com
To unsubscribe from this group, send email to
android-buildi...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-building?hl=en
> > Wouldn't it make more sense to treat the files as prebuilt, i.e.
> > doing
> >
> > include $(BUILD_PREBUILT)
> >
> > instead of pretending they're shared libraries that we're building.
> > For the sake of the operation you want to do the files *are*
> > prebuilt. Perhaps $(BUILD_MULTI_PREBUILT) would be even better.
>
> We can even use "PRODUCT_COPY_FILES += <PATH>/<file>:<PATH>/<file>".
Yes, but beware. If you use that in the Android.mk of the source module
you might end up making product configuration unless the file should be
installed for all configurations. You probably don't want
ifeq ($(TARGET_PRODUCT),fooproduct)
...
endif
spread throughout your source code. There are of course ways to avoid
this, if you realize the problem in time. If you instead place the same
lines in the product configuration (device/vendor/product etc) you'll
add a dependency between that git and the exact source code paths (and
the source module won't control the installation path). If you define
modules and list them in PRODUCT_PACKAGES the only dependency you'll
get is to the module name.
--
Magnus B�ck Opinions are my own and do not necessarily