Here is the structure of my directories:
../Projects/Common
../Projects/SES
The common project has its own Makefile which builds an object file common.o.
The ses project uses classes from common and builds an executable, its Makefile below.
I have two questions:
1) Is it the right way to include common.o?
2) If I change common.*, how can I re-compile common.o from ses Makefile? Right now I have to go to ../Common directory and run its Makefile.
It may be easier to make Common a static library. That way it can be treated as a self contained unit with little overhead. Remember, a Unix static library is just a buch of object files that are compiled in exactly the same way a program's object files are compiled.
@kbw, thank you for replying. I am using static lib for my other shared library I can as well do it for common. I used to have all the files of respective projects in the same directory but as the number of projects grow that came the time to put them into their own directories. I have to say besides ses I have multiple other projects using classes from common.
That means I have to call a third makefile from the parent directory to make sure common is built before ses. I usually work from the ses directory, can I call Common Makefile from the ses Makefile?
Quick question, I noticed that even when I haven't changed the source files and run the make file the date on object files and executable files is updated. So it's not really doing re-compiling and re-building but just updating the date, right?
Edit: also in your code, how do you set DEBUG variable?
Edit: so DEBUG is a env. var. If I do not want to read env. var. how can I do such conditional?