I'm trying to build an Android project using the ndk, but I have run into some troubles.
Here's the Android.mk file that works:
LOCAL_PATH:= $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE := mylib
LOCAL_CFLAGS := -Werror
LOCAL_SRC_FILES := main.cpp, Screen.cpp, ScreenManager.cpp
LOCAL_LDLIBS := -llog
include $(BUILD_SHARED_LIBRARY)
Is there a way that allows me to specify all the *.cpp files in the directory, without listing them manually under LOCAL_SRC_FILES?
So far I tried using LOCAL_SRC_FILES = $(wildcard *.cpp), but it did now work, it seems that no files get selected.
You could try something like this...
FILE_LIST := $(wildcard $(LOCAL_PATH)/[DIRECTORY]/*.cpp)
LOCAL_SRC_FILES := $(FILE_LIST:$(LOCAL_PATH)/%=%)
... Change [DIRECTORY]
to the actual directory of the files. If they are in the same directory as your .mk
file then remove that part. Create the FILE_LIST
variable to find all of the .cpp
files under the [DIRECTORY]
directory. Then use it in the file listing. The LOCAL_SRC_FILES
line will then remove the LOCAL_PATH
from the listing.