I can’t understand how I can produce a makefile for C code
I have the following .c file which normally I execute in the following manner:
gcc server.c -o server.out -lpthread
Once compiled, I run the .out file like this:
./server.out 4000
EDITED
I only need the make files to compile the program rather than running it too..
If naming your executable file
serverwill do for you, then justin a file called
Makefilewill do. The you can just typeto build it.
Ortherwise your
Makefileshould contain:Except that it is a tabulation, not spaces before the text “
gcc”.