Skip to main content

Simple Make file

I kind of hate make files...

But let's start it from scratch ....
I'll use gcc for the compilation on windows using cygwin ...

File name: main.c

#include <stdio.h> int main(int argc,char *argv[]) { printf("You see, u see this... I'm running"); return 0; }

$ gcc main.c -o mobi.exe

$ ./mobi.exe
You see, u see this... I'm running

Great ... Let's make a make file for this. Sounds funny .

So, What essentially does a make file do ?
It compiles. cool... but helps to keep configuration and order once and for all.

file: mobi.mk

all:
    gcc main.c -o mobi.exe


NOTE: Use  notepad for make file... Try not using Notepad++ or u may waste sometime to figure out why.

Let use make file:

$ make -f ./mobi.mk
gcc main.c -o mobi.exe


 So for so good...

Comments