5

I have a structure like this:

folder1

      |--subfolder1

          |--.cpp files .h files

      |--other .cpp files

folder1 contains cpp files and 1 subfolder which also contains cpp files and head files

How will I write my Android.mk file so that all the source files, including those inside subfolder1 will be included during compilation?

i tried

LOCAL_SRC_FILES := $(wildcard $(LOCAL_PATH)/\*/\*.*) $(wildcard *.*) 

but it does not work, it didnt include the source files which are inside the subdirectories

2

2 Answers 2

4

try :

LOCAL_SRC_FILES := $(wildcard $(LOCAL_PATH)/*/*.cpp)
Sign up to request clarification or add additional context in comments.

2 Comments

give a reason why, not just an answer.
$(wildcard $(LOCAL_PATH)/*/*.cpp) will put all files that ends will .cpp and found in folders : $(LOCAL_PATH)/*/ ;
4

this may help. quote:

If you want to define Android.mk files in sub-directories, you should include them explicitly in your top-level Android.mk. There is even a helper function to do that, i.e. use:

include $(call all-subdir-makefiles)

This will include all Android.mk files in sub-directories of the current build file's path.

copied from android-ndk-r8d doc.

that means you should write a Android.mk file to describe your .cpp in each of your subdir, and write a top-level Android.mk to include them by "include $(call all-subdir-makefiles)"

now it may like this:

|-jni

|----Android.mk (top level one)

|--------subfolder1

|------------Android.mk (to describe your a.cpp)

|------------a.cpp/a.h

|----other .cpp/.h files

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.