Have any of you guys checked out mbolivars example project stuff
https://github.com/mbolivar/example-libmaple-project I have been using a derivative of it with xcode happily for a while now.
Seriously though, how really to make our own Makefiles for larger projects?
(44 posts) (12 voices)-
Posted 2 years ago #
-
Got it working, sort of. I copied Makefile from ~/libmaple to my project directory and edited it as per billw's instructions from a year ago. I had to keep my old build-targets.mk to get it to work.
So, it's now finding all of my project files like it should. Only problem is it recompiles all of libmaple every time. Can anyone shed some light on a fix for this?
Posted 2 years ago # -
Use ccache to speed things up as described here: http://leaflabs.com/2012/08/2549
Posted 2 years ago # -
Thank you, that is certainly worth investigating, but what I have is a broken makefile, pure and simple. Before I did the libmaple upgrade as stated a few posts back, it would compile all of the libmaple stuff once the first time, then after that it wold only compile any files that had changed (usually just my project files), at least until I did a make clean. This is how makefiles are supposed to work.
Post upgrade, once I finally got the Makefile to compile all of my files and not just main.cpp, it compiles all of libmaple every time.
Posted 2 years ago # -
Obviously libmaples directory tree and build system has changed somewhere in between and those 1year old fixes don't apply anymore...
I also use mbolivars example project (in conjunction with ccache), I think this does exactly what you're looking after.
Posted 2 years ago # -
Thank you for the suggestion. It works, but no differently than the previous Makefile and built-targets.mk that I had. It still recompiles all of libmaple et al every time.
I don't see why ccache should be necessary. It seems to me that it just treats a symptom.
Posted 2 years ago # -
@tdc218, ccache is useful if you do a 'make clean' alot (e.g. when building for different targets).
In my case, make recompiles only the changed sources, so works as intended. However, all object files have to be linked in every time, maybe it's that what you're referring to?
Maybe it'd help if you'd post the console outputs of your build process somewhere to shed some light on what where make may go wrong on your side. (or a link to your project if it should be open source...)
make clean
make
-> console output 1
-> change a file
make
-> console output 2
Posted 2 years ago # -
Here are the results of the test: http://pastebin.com/1TmzEU4c
The maple stuff is located at ~/libmaple
My project is at ~/maple/et218
There are 10 .cpp and 10 .h files.Per above I did:
make clean
make >make_output_1 # contents of make_output_1 at the pastebin link above
then I edited loop.cpp
make >make_output_2I didn't bother to post the contents of make_output_2 because it was identical with make_output_1 (confirmed with diff).
In case anyone wonders why the output isn't complete, the compile fails on an error I introduced while making some changes that I haven't gotten back to fixing yet. For the purposes of fixing the makefile, it doesn't matter - even when the program compiles properly it still recompiles all of libmaple et al every time.
The whole project is not posted anywhere public. I would have no objection to doing so if necessary. It's highly specialized and would probably not be of much interest to anyone unless you happen to be building a large scale miniature locomotive with a Sevcon traction controller in it.
Posted 2 years ago # -
I'd take the following approach to debug:
Start from a clean clone of https://github.com/mbolivar/example-libmaple-project (check whether this works as intended to exclude the possibility of a damaged make).
Strip everything in the example project tree that you don't need (check again...)
Add your project files one at a time (check again...)Posted 2 years ago # -
Sigh. No joy. I downloaded the example project - it compiles fine. I changed one file and it did the right thing - compiled just that one file, linked, and was happy.
So I copy Makefile and rules.mk to my project directory, make the minimal changes needed to get it to work and everything compiles fine, but:
make[1]: *** No rule to make target
build/main.o', needed by `build/maple_mini.elf'. Stop.
make[1]: Leaving directory `/home/tdc/maple/et218'
make: *** [sketch] Error 2`And also, if I run make again it compiles everything again. *smiley of head beating against a brick wall*
I think at this point my next step is to blow away the whole install and reload it all.
Posted 2 years ago # -
Ok, reloaded all of libmaple, ran make on the example project - it failed with
make[1]: *** No rule to make target
/home/tdc/libmaple/main.cpp', needed by `build/main.o'. Stop.
make[1]: Leaving directory `/home/tdc/maple/test'
make: *** [sketch] Error 2Same result in my own project.
Blew away those makefiles, copied Makefile and build-target.mk from ~/libmaple, edited it as billw described a year ago. This fails with
make: *** No rule to make target
build/main.o', needed by `build/maple_mini.elf'. Stop.This really shouldn't be this hard.
Posted 2 years ago # -
This sounds like you miss the empty main.cpp as stated in the README.txt
https://github.com/mbolivar/example-libmaple-projectPosted 2 years ago # -
Nailed it. Sort of. I did know about that and I did copy the blank main.cpp from the example test into ~/libmaple and I thought I'd double checked it. I think what happened was a permissions mismatch, the copy failed, and I missed it. Now that is corrected the example project will compile and so will mine using makefiles derived from said example project.
However, it still compiles everything every time.
Posted 2 years ago # -
Got it! My Makefile and rules.mk are here for anyone who wants them for reference: http://pastebin.com/bQndR95C
Thanks for all of the assistance.
Posted 2 years ago #
Reply
You must log in to post.