all-makefiles-under v.s. first-makefiles-under

5,331 views
Skip to first unread message

Hylon

unread,
Jan 10, 2012, 3:51:54 AM1/10/12
to Android Building
Hi JBQ,

A title, any recommended using scenarios for below two functions? and
how about the pros and cons of them? thanks very much in advance. :)

all-makefiles-under v.s. first-makefiles-under

Jean-Baptiste Queru

unread,
Jan 10, 2012, 11:07:46 AM1/10/12
to android-...@googlegroups.com
I don't know. I didn't even know there was a "first-makefiles-under" function...

Ying, does this ring a bell?

JBQ

> --
> 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

--
Jean-Baptiste M. "JBQ" Queru
Software Engineer, Android Open-Source Project, Google.

Questions sent directly to me that have no reason for being private
will likely get ignored or forwarded to a public forum with no further
warning.

Ying Wang

unread,
Jan 10, 2012, 1:55:46 PM1/10/12
to android-...@googlegroups.com
all-makefiles-under is defined as $(wildcard $(1)/*/Android.mk).
The builtin wildcard is quite efficient. So we should use $(call all-makefiles-under, $(LOCAL_PATH)) as you can.

 first-makefiles-under calls the script build/tools/findleaves.py to find Android.mks in the given directory.
If it finds an Android.mk in a directory, it just stops searching the subdirs.
It's not efficient, especially in case you have deep complex directory structure that does not have Android.mk in the top dirs.
We should use it as little as possible.

If your Android.mk's only purpose is to include all first-level sub-directory Android.mks, use:
include $(call all-subdir-makefiles)

If you want to include Android.mks in a specific set of first-level sub-directories:
include $(call all-named-subdir-makefiles, <subdirs>)

Those function names are really confusing.
Before using them please check their definitions in 
build/core/definitions.mk

Ying Wang

unread,
Jan 10, 2012, 1:58:31 PM1/10/12
to android-...@googlegroups.com
Both all-subdir-makefiles and all-named-subdir-makefiles use $(my-dir), which uses makefile's builtin MAKEFILE_LIST to get the current include chain of makefiles.
So they must be the called before any "include" statement in your makefile.

Hylon

unread,
Jan 12, 2012, 12:23:43 PM1/12/12
to Android Building
Hi Ying & JBQ,
Thanks very much for your explanation.:)
Reply all
Reply to author
Forward
0 new messages