06-12-2012 01:36 PM
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: *** No rule to make target `/Developer/SDKs/bbndk-2.0.1/target/qnx6/usr/inclu
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?
Solved! Go to Solution.
06-13-2012 09:50 AM
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
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.
06-13-2012 12:57 PM
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: Entering directory `/Users/dposluns/Documents/dev/ndk-2.0.0-workspace
/BuildTreeTest/common' /Developer/SDKs/bbndk-2.0.1/target/qnx6/usr/includ e/mk/os_nto.mk:41: /Developer/SDKs/bbndk-2.0.1/target/qnx6/usr/includ e/mk/nto_.mk: No such file or directory make: Leaving directory `/Users/dposluns/Documents/dev/ndk-2.0.0-workspace /BuildTreeTest/common' make: *** No rule to make target `/Developer/SDKs/bbndk-2.0.1/target/qnx6/usr/inclu de/mk/nto_.mk'. Stop. make: *** [all] Error 2
Please tell me what I have to do to make this work...
06-13-2012 01:55 PM
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
(note this goes into the common.mk not the makefile)
Select device-debug, clean and build.
05-04-2013 11:19 PM