------------------------------------------
Main configuration file projectconfig. mk in mtk6573
-----------------------------------------
============================== Start ========================== ============================
Main configuration file projectconfig. mk in mtk6573
The main variables are:
Auto_add_global_define_by_name
Auto_add_global_define_by_value
Auto_add_global_define_by_name_value
The three variable functions are parsed as follows:
======================================
Assign the content in the variable auto_add_global_define_by_name to the Array Based on the space index.
If the value of the array variable is not null or no, the macro definition in C language is generated (the macro is an array variable)
======================================
Foreach ($ ENV {auto_add_global_define_by_name })
{
My @ defarray = Split (/\ s + /);
Foreach my $ def (@ defarray)
{
$ Flags. = "-d $ Def" if ($ ENV {$ def} ne "" and $ ENV {$ def} ne "no ");
}
}
==================================
Assign the content in the variable auto_add_global_define_by_value to the Array Based on the space index.
If the value of the array variable is not empty or no, the macro definition in C language is generated (the macro is the value of the array variable)
That's why
Custom_kernel_lcm = ili94820.dpi
Written in this variable to define ili94820.dpi
==================================
Foreach ($ ENV {auto_add_global_define_by_value })
{
My @ defarray = Split (/\ s + /);
Foreach my $ def (@ defarray)
{
$ Flags. = "-d $ ENV {$ def}" if ($ ENV {$ def} ne "" and $ ENV {$ def} ne "no ");
}
}
==================================
Assign the content in the variable auto_add_global_define_by_value to the Array Based on the space index.
And judge if the value of the array variable is not empty or no, generate the macro definition in C Language (macro is the macro of the defined value)
==================================
Foreach ($ ENV {auto_add_global_define_by_name_value })
{
My @ defarray = Split (/\ s + /);
Foreach my $ def (@ defarray)
{
$ Flags. = "-d $ def = \" $ ENV {$ def} \ "" if ($ ENV {$ def} ne "" and $ ENV {$ def} ne "no" );
}
}
============================== End ========================= ==============================
============================ Add start ============================ ============================
Define. If-CFG-on
$ (If $ (filter-out no, $ (Strip $ (1), $ (2), $(3 ))
Endef
Define MTK. Custom. Generate-macros
$ (Strip $ (foreach T, $ (auto_add_global_define_by_name), $ (call. if-CFG-on, $ (t),-d $ (call UC, $ (t ))))
$ (Foreach T, $ (auto_add_global_define_by_value), $ (call. if-CFG-on, $ (t), $ (foreach V, $ (call UC, $ (t),-d $ (V ))))
$ (Foreach T, $ (auto_add_global_define_by_name_value), $ (call. if-CFG-on, $ (t),-d $ (call UC, $ (t) = \ "$ (t ))\")))
Endef
If (non-null is true) conditions are true. use variable 1 as the household variable 2.
Filter-out: filters the first variable in the second variable.
Strip removes several spaces and changes them to one space.
Split variables by spaces in a foreach Loop
Call to call a function. Replace the following variables with $ (1) $ (2) $ (3) in the function)
Now, you can understand the above functions.
MTK. Custom. Generate-macros!
Continue to view other files.
./Android/config. mk: 190: mtk_cdefs :=$ (call MTK. Custom. Generate-macros)
./Kernel/makefile: 53: kbuild_cflags + = $ (call MTK. Custom. Generate-macros)
To sum up
MTK. Custom. Generate-macros
Is split
Auto_add_global_define_by_name
Auto_add_global_define_by_value
Auto_add_global_define_by_name_value
The content of these three variables, where the content of the variables is null or no, is discarded, the remaining variable content is defined using mtk_cdefs, and kbuild_cflags compilation is added to the kernel!
I just don't know which function UC represents. I haven't found it yet!
======================================== Add end ==================== ======================================