Makefile question regarding Simple Library
DavidZemon
Posts: 2,973
I would like to give PropWare the ability to hook into the Simple Library. However, the header files in Simple Library contain relative path includes instead of system includes. For instance, simpletools.h has a line:
One (ugly) option is to repackage the entire Learn folder with PropWare and modify the source files to work as expected. I'm not a big fan of this option. If I were to do it though, I would probably just refactor the entire Learn folder and incorporate it into PropWare 100% (move folders around and build all of it into the already existing PropWare library). This is no good though, and only a last-ditch resort.
Does anyone else know of a way to make this work?
(I've just pushed an Example project to release-2.0-nightly branch that has my current work)
#include "simpletext.h"This is something I don't know how to deal with. Obviously, simpletext.h is not in the folder that Make expects it to be.
One (ugly) option is to repackage the entire Learn folder with PropWare and modify the source files to work as expected. I'm not a big fan of this option. If I were to do it though, I would probably just refactor the entire Learn folder and incorporate it into PropWare 100% (move folders around and build all of it into the already existing PropWare library). This is no good though, and only a last-ditch resort.
Does anyone else know of a way to make this work?
(I've just pushed an Example project to release-2.0-nightly branch that has my current work)
Comments
Simple Libraries are not designed for "simple" Makefiles.
You will need to use some $(shell blah) commands to get what you want.
Consider this which can be optimized, but is a starting point:
The Makefile needs some additional targets for building all those libraries of course ....
It would be wonderful if you could contribute that
2. I'm thinking of writing a script for my local machine that downloads the latest Simple Library, copies all source files into my local PropWare directory and renames them appropriately in a directory hierarchy that matches the current setup. This isn't ideal... but I'm very afraid of how long it's going to take to compile this seemingly small library with a script like the above once I take into account cross-platform compatibility
I can think of some other ways to make it work, but they would add extra requisite knowledge for using PropWare or make existing projects that utilize Simple Library incompatible, which I don't want to do.
The current plan should result is line-for-line compatibility with existing projects using Simple Library. All header files will exist in the the PropWare root and all source files will exist in <propware_root>/simple_source. Tomorrow's work revolves around creating a libSimple_<mem_model>.a for each memory model and dropping it in <propware_root>/<mem_model>, right next to libPropWare_<mem_model>.a.
I am open to other ideas if they're out there.
Any existing Simple IDE projects making use of the Simple Library should be 98% code compatible with this build system - just write yourself a quick Makefile based on the I2C example or any other and you'll be good to go.
One change I had to make that I am not entirely comfortable with is setting the 32-bit doubles option (it's required by at least one file in the Simple Library). I'm guessing the answer is no, but is it possible to compile Simple with 32-bit doubles and everything else with either 32- or 64-bit doubles and have it all linked into a single executable, or does everything need to match?
Now, to go import some more Simple Library demo projects into PropWare and verify that they work.
Everything needs to match. Simple Libraries are designed mostly for small size and use within the education environment. While the print() function is bigger than printf() for simple parameters, it never grows beyond 6KB like printf does (30KB with 64bit doubles and -lm) and does not need the math library for doing floating-point (not that we really needs that, but it is an education requirement). The 32-bit doubles requirement was selected for smaller size.
Then perhaps the best way to handle it (and other non-obvious oddities) within PropWare is to create a section in the docs for "Quirks and Oddities" that lists noteworthy items like the doubles, header file dependency, and others. Thanks.