-
Notifications
You must be signed in to change notification settings - Fork 2
Make
When the program that you're trying to run is Hello, World, it doesn't take much to compile, just:
gcc helloworld.c
will do. But, when you have a project like Runtime, the compilation commands can get really, really long. For example, here's the command to compile net_handler
:
gcc net_util.c net_handler.c udp_conn.c tcp_conn.c ../logger/logger.c ../shm_wrapper/shm_wrapper.c ../runtime_util/runtime_util.c pbc_gen/*.c -o net_handler -Wall -L/usr/local/lib -lprotobuf-c
Nobody wants to type out that entire command by hand every time they compile net_handler
. That's where Make
comes in.
GNU Make
is a tool that basically allows you to compile things without having to type out an entire long compilation command. That really long example I gave would be replaced by the command make net_handler
. Much easier!
Make
uses a file called a Makefile
to organize rule for making certain targets. In this case, our target is net_handler
and the rule for it contains what files it depends on and what the command to compile it is.
At this point, we'll defer you to this great, simple Makefile
tutorial to learn more about some of the common idioms people use when writing Makefiles
.
If you really want to know everything there is to know about Makefiles
, see the GNU Make
manual which will tell you more than you'd ever want to know about the tool.
- Important
- Advanced/Specific