make: *** No rule to make target `main.c', needed by `main.o'. Stop make: *** No rule to make target `main.c', needed by `main.o'. Stop unix unix

make: *** No rule to make target `main.c', needed by `main.o'. Stop


When you run make it tries to make the first target in the file (exec), which depends on compile, which depends on main.o, which depends on main.c. There is no file main.c, only SRC/main.c. There is no rule to make a file called main.c, and there is no pre-existing main.c, so make has an error and exits.

You can fix this with VPATH or vpath:

VPATH = SRC INCLUDE 


Your main.c is in the subdirectory src, and make does not know to look there. There are many options, the easiest of which is to write "src/main.c" instead of "main.c" in the makefile. You could also move main.c up a level, or move the makefile to src/ and build there, or put a makefile in the toplevel that cds into src and calls that make (this is recursive make, which many consider "harmful", but is perfectly fine in many(most) cases.) You can also use a VPATH directive, but if you choose to do so, be aware that this will not work with all versions of make.