Reputation:
I'm looking through the Android Open Source Project makefiles, and I'm seeing what appears to be two different ways of including another makefile. For example, master/build/target/product/aosp_arm64.mk
has these lines:
PRODUCT_COPY_FILES += frameworks/native/data/etc/android.hardware.ethernet.xml:system/etc/permissions/android.hardware.ethernet.xml
$(call inherit-product, $(SRC_TARGET_DIR)/product/core_64_bit.mk)
$(call inherit-product, $(SRC_TARGET_DIR)/product/aosp_base_telephony.mk)
$(call inherit-product, $(SRC_TARGET_DIR)/board/generic_arm64/device.mk)
include $(SRC_TARGET_DIR)/product/emulator.mk
PRODUCT_NAME := aosp_arm64
PRODUCT_DEVICE := generic_arm64
PRODUCT_BRAND := Android
PRODUCT_MODEL := AOSP on ARM arm64 Emulator
What is the difference(s) between the $(call inherit-product ...)
line and the include ...
line?
Upvotes: 19
Views: 9741
Reputation: 306
Let's say you have PRODUCT_VAR := a
in A.mk, PRODUCT_VAR := b
in B.mk.
If you include B.mk in A.mk, you will get PRODUCT_VAR := b
at last.
But if you inherit-product
B.mk in A.mk, you will get PRODUCT_VAR := a b
.
And inherit-product
makes sure that you won't include a makefile twice because it Records that we've visited this node, in ALL_PRODUCTS
.
Upvotes: 6
Reputation: 490
include
just includes the file. inherit-product
does that and three more things accordig to file in link below:
See line 113 in this file for details core/product.mk
Upvotes: 14