Makefiles, building source from another folder with obj files > subfolder of current?
I've been stuck on this one for a while now so really hoping someone can help! I have an array of folders of C/C++ source that are common code to several projects, and some more folders (by the side of the others) that contain projects themselves.
When I build a project, I want to be able to include a sources.mk from an external folder, and have the objects for those included sources go into a subfolder of the project directory so as not to clutter the common folder up with project-specific objects (each project can have different flags, optimisations etc.)
As an example, here's a folder structure:
The Makefile in projects/thing will include common/stuff/sources.mk to get a list of the sources in that folder (appended to the list of sources already in Makefile). Sources in sources.mk are prepended with the relative path between Makefile and sources.mk as follows:
cd projects/thing; make
I make a list of object files and strip the ../ out of the relative path as follows:
Any help greatly appreciated!
I use something similar to the following when I develop C++ projects:
|All times are GMT -5. The time now is 11:28 AM.|