- 5,178
- Worcester, MA
- skip0110
I need help in learning to use makefiles in Linux. Previously, I just compiled my code using a direct g++ command. I went to a lab on seperate compilation, and read several online resources, but I can't get the hang of it. The last assignment I handed in with just a shell script that compiles my code, but the teacher really wants me to use makefiles. I would greatly appreciate if someone could give me a link to a simple example of some C++ files and the associated makefile, or just show me how I would do it for the case I present here. I guess I learn best by example.
These are the dependencies for my project:
Right now, I can compile it just fine by doing
But I need the makefile to do this. Thanks a bunch.![Smile :) :)](/wp-content/themes/gtp16/images/smilies/smile.svg?v=3)
These are the dependencies for my project:
- mailinglist.cpp depends on courselist.h and personlist.h
- courselist.cpp depends on courselist.h and personlist.h
- courselist.h depends on personlist.h, and
- personlist.h has no dependencies.
Right now, I can compile it just fine by doing
Code:
g++ mailinglist.cpp courselist.cpp
But I need the makefile to do this. Thanks a bunch.