Monthly Archives: April 2016

c-compiling and make

Make is a very useful tool and makes compiling very easy. Let’s take classical Hello World as an example. You can save the following file as hello.c

Now you can compile the code in linux box with a command

and then run it with

You can also make a simple makefile. For example you can give compiler flags to compiler with a following makefile. Save it as makefile to your programming directory

It means that the make gives the flags to c compiler. -g adds debug symbols (if you are using a debugger),  -Wall gives all warnings, -std=gnu11 uses c11 standard which is the latest c-standard and -o3 optimizes for speed.