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

Dhasneem
  • 4,037
  • 4
  • 33
  • 47
Coola
  • 479
  • 1
  • 8
  • 15
  • This is already solved. How can I flag this as solved? or closed this thread? Sorry, I'm new here. – Coola Apr 02 '12 at 11:45
  • 1
    possible duplicate of [Android.mk file - including all source files in different folders and subfolders](http://stackoverflow.com/questions/9970082/android-mk-file-including-all-source-files-in-different-folders-and-subfolders) – richq Apr 04 '12 at 08:01

2 Answers2

4

try :

LOCAL_SRC_FILES := $(wildcard $(LOCAL_PATH)/*/*.cpp)
medazzo
  • 99
  • 5
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
Community
  • 1
  • 1
Bill Hoo
  • 647
  • 5
  • 21