Fix android.mk

I fix android.mk to create android.mk automatically~

It can find any subdirs and .cpp that u add in “Classes”
<pre>
LOCAL_PATH := $
include $
LOCAL_MODULE := game_logic
dirs := $ ~~type d)
cppfilestemp1 := $~~type d)
cppfilestemp2 := $ -name
.cpp)
cppfilestemp3 := $(sort $(cppfilestemp2))
cppfiles := $(subst $(LOCAL_PATH)/,$(cppfilestemp3))

LOCAL_SRC_FILES := $(cppfiles)

LOCAL_C_INCLUDES := $(LOCAL_PATH)/…/…/cocos2dx $(LOCAL_PATH)/…/…/cocos2dx/platform $(LOCAL_PATH)/…/…/cocos2dx/include $(LOCAL_PATH)/…/…/CocosDenshion/include $(LOCAL_PATH)/…/…/cocos2dx/lua_support $(dirs)

it’s very useful,thank u for ur sharing

FoXx WeLl,

Help me to understand it right.

Let me take HellowWorld as a sample.

It has the following Android.mk files:

.mk
.mk
.mk

Which of them should I replace?

And what about

.mk ?

Do I let it alone?

Regards.


Please,

Hello~ u can replace

.mk

@FoXx WeLl, thanks for helping.

Regards.


Please,

Thank you very much :slight_smile: I’m trying it right now

You rock mate! Amazing idea! Just worried that must add all 20 files by hands and keep it updated in future.
Thanks!

hi, i m getting this error when i run my app on eclipse for android “make: * No rule to make target `jni_‘/testcpp/main.cpp’, needed by `obj/local/armeabi/objs-debug/testcpp_shared/testcpp/main.o’.”
what’s wrong with my mk file?
here is my mk file :

TOP_LOCAL_PATH :=$(call my-dir)
include $(call all-subdir-makefiles)
LOCAL_PATH := $(TOP_LOCAL_PATH)

include $(CLEAR_VARS)
LOCAL_LDLIBS:=-llog
LOCAL_MODULE := testcpp_shared
LOCAL_MODULE_FILENAME := libtestcpp
LOCAL_SRC_FILES := testcpp/main.cpp carTest.cpp test.cpp ScreenLayer.cpp track1.cpp GameOverScene.cpp MyContactListener.cpp story.cpp AdvanceSprite.cpp Hello.cpp
LOCAL_C_INCLUDES := $(LOCAL_PATH)/…/…/Classes

LOCAL_STATIC_LIBRARIES := curl_static_prebuilt

LOCAL_WHOLE_STATIC_LIBRARIES := cocos_testcpp_common
LOCAL_WHOLE_STATIC_LIBRARIES = cocos2dx_static
LOCAL_WHOLE_STATIC_LIBRARIES
= cocosdenshion_static
LOCAL_WHOLE_STATIC_LIBRARIES = box2d_static
LOCAL_WHOLE_STATIC_LIBRARIES
= chipmunk_static
LOCAL_WHOLE_STATIC_LIBRARIES += cocos_extension_static

include $(BUILD_SHARED_LIBRARY)

$(call import-module,samples/TestCpp)
$(call import-module,cocos2dx)
$(call import-module,cocos2dx/platform/third_party/android/prebuilt/libcurl)
$(call import-module,CocosDenshion/android)
$(call import-module,extensions)
$(call import-module,external/Box2D)
$(call import-module,external/chipmunk)