Habba
Habba

Reputation: 1199

GNU make - finding sources from parent directories with wildcard

I'm re-asking this question, with a twist:

How do I specify the wildcard pattern when the files are in parent directory of LOCAL_PATH?

say, files would be ../../src/foo.cpp and ../../src/bar.cpp.

code LOCAL_SRC_FILES := $(wildcard ../../src/*.cpp) assigns an empty string.

Upvotes: 4

Views: 1336

Answers (1)

Habba
Habba

Reputation: 1199

I found the solution, but I'm not quite sure what was the problem.

Old script:

LOCAL_PATH := $(call my-dir)
LOCAL_SRC_FILES := $(wildcard ../../src/*.cpp)

The new script that works:

LOCAL_PATH := $(call my-dir)/..
LOCAL_SRC_FILES := $(wildcard ../src/*.cpp)

I guess my-dir and wildcard do not refer to same working directory.

Android ndk toolchain expects to find the make file (android.mk) in /jni folder. $(call my-dir) seems to return /jni directory (because that's where the make file is). However $(wildcard ) seems to look from the current directory.

I'm not quite sure if I'm right here, but effectively it seems to be so.

EDIT: And here's the working script that I used before this attempt with wildcard (just to explain you why I initially did what I did)

LOCAL_PATH := $(call my-dir)
LOCAL_SRC_FILES := ../../src/foo.cpp \
../../src/bar.cpp

Upvotes: 2

Related Questions