Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Native Development

Reply
Contributor
dposluns
Posts: 23
Registered: ‎06-06-2012
My Device: Simulator
My Carrier: n/a
Accepted Solution

Makefiles when porting a development tree

I've been trying to follow the guidelines for porting a Makefile project, but finding it exceedingly difficult to handle a directory hierarchy when porting.

 

My code is all vanilla C++, so I don't want it targetted to any specific OS or CPU.

 

When I create an empty project in the IDE, the root directory has a makefile with LIST=CPU and the only option seems to be to put the entire source tree in that directory (removing the entire directory structure of the project), which is unfeasable and unacceptable.

 

So I try moving the "arm" and "x86" folders into a "cpu" subdirectory, copy the main Makefile there, create a "common" subdirectory, and remove the LIST=CPU line from the root makefile. Now things look like this:

root
    common.mk    <- unchanged
    bar-descriptor.xml    <- unchanged
    Makefile    <- removed LIST=CPU
    cpu
        Makefile <- has LIST=CPU
        arm
        x86
    common
        <my project's directory tree goes here, with Makefiles added at each level>

 

 

Well, it doesn't work. When I build I get:

make[2]: *** No rule to make target `/Developer/SDKs/bbndk-2.0.1/target/qnx6/usr/include/mk/nto_.mk'.  Stop.

 

Googling this, it seems to be breaking on my project subdirectories because a CPU hasn't been set. But the contents of my project are CPU independent. How do I go about building a directory tree in this environment?

 

Thanks,


Dan.

Please use plain text.
BlackBerry Development Advisor (Retired)
selom
Posts: 60
Registered: ‎05-10-2012
My Device: Blackberry 10 Alpha
My Carrier: none

Re: Makefiles when porting a development tree

Hello Dan,

 

I created a simple project with the directory structure you outlined but did not encounter the error in your post. The only additional change I made was add

 


EXTRA_SRCVPATH+=$(current_dir)/common

 

in the common.mk file. Without this line, the project fails, as expected with an  "undefined reference to main" error.

 

Can you try using a simple test project to confirm that the problem isn't elsewhere. I suspect it may be related to an incorrect or missing lib setting.

Please use plain text.
Contributor
dposluns
Posts: 23
Registered: ‎06-06-2012
My Device: Simulator
My Carrier: n/a

Re: Makefiles when porting a development tree

Hi selom,

 

I tried this again, with the test OpenGL 1.1 C project that you can create in the IDE. Didn't add any of my own code, just attempted to reshuffle the project hierarchy.

 

1. I moved the x86 and arm directories into a "cpu" subdirectory, along with the root Makefile.

2. I modified cpu/arm/o.le-v7/Makefile to point an extra directory up to reach common.mk.

3. I created a "common" directory in the project root and put main.c, bbutil.c and bbutil.h into it.

4. I put a Makefile in the "common" directory which just includes ../common.mk

5. I recreated the Makefile in the project root, removed LIST=CPU and added EXTRA_SRCVPATH+=$(current_dir)/common

 

Sure enough, I get the error when I try to build:

 

make all 
make -j 1 -Ccommon -fMakefile all 
make[1]: Entering directory `/Users/dposluns/Documents/dev/ndk-2.0.0-workspace/BuildTreeTest/common'
/Developer/SDKs/bbndk-2.0.1/target/qnx6/usr/include/mk/os_nto.mk:41: /Developer/SDKs/bbndk-2.0.1/target/qnx6/usr/include/mk/nto_.mk: No such file or directory
make[1]: Leaving directory `/Users/dposluns/Documents/dev/ndk-2.0.0-workspace/BuildTreeTest/common'
make[1]: *** No rule to make target `/Developer/SDKs/bbndk-2.0.1/target/qnx6/usr/include/mk/nto_.mk'.  Stop.
make: *** [all] Error 2

Please tell me what I have to do to make this work...

 

Thanks,


Dan.

 

Please use plain text.
BlackBerry Development Advisor (Retired)
selom
Posts: 60
Registered: ‎05-10-2012
My Device: Blackberry 10 Alpha
My Carrier: none

Re: Makefiles when porting a development tree

Hello again Dan, thanks for the clarification, I am also able to reproduce the error you are getting. Here is how to get it compiling..

 

1. Remove the Makefile in the "common" directory. This is what is causing your error.

2. In the "common.mk" file in the root directory add the line

 

EXTRA_SRCVPATH+=$(current_dir)/common 

 

(note this goes into the common.mk not the makefile)

 

Select device-debug, clean and build.

 

Cheers

Selom

 

Please use plain text.
Contributor
dposluns
Posts: 23
Registered: ‎06-06-2012
My Device: Simulator
My Carrier: n/a

Re: Makefiles when porting a development tree

Ah, perfect. This works like a charm and I don't even need to add makefiles to my source hierarchy to use it. Thanks!

Dan.
Please use plain text.
New Member
HecaWorld
Posts: 1
Registered: ‎05-04-2013
My Device: Q10
My Carrier: Rogers

Re: Makefiles when porting a development tree

I am simply trying to build a sample project - Camera; but it keeps giving me this error: "make[2]: *** No rule to make target `C:/bbndk/target_10_1_0_1020/qnx6/usr/include/mk/nto_.mk'. Stop."

When I build the hellocamera app, I don't get this error. What should I do to fix it?
Please use plain text.