Makefile: Missing separator

Okay, a technical blog post after a long time. I got this error today, so am sharing the solution. I'll try to keep these coming.

Summary: if you see this error, it mostly means that a line in Makefile is split in multiple lines. Or when the 'action' line doesn't start with a tab character.

If you're new to Makefiles, here's a short intro:
Makefiles ease compilations of projects. Generally. But you can use it for any purpose where you need to specify some dependency and an action. Like commit code into a cvs tree. Or delete stale files from a directory if newer files exist.

The syntax of a Makefile goes like this:

<newline>
target:<space> dep <space> ...
<tab> action
     .
     .
     .

Okay, so if you want to achieve target, deps are the dependencies which must be fulfilled before the action is carried out to get the desired result. deps can themselves be targets, or they can be files on disk.

The advantage of using Makefiles is that if target already exists, the action isn't carried out. Unless the deps are newer than the target.

So if you use this to compile a program and mention a header (.h) file as on of the dependencies, the .c file will be compiled even if the .c wasn't changed (since it depends on the .h).

This is a very simplistic intro to make and Makefiles. For more information, refer to the info pages or the GNU make manual.

I have used a tool (either standalone or from within emacs) to create Makefiles. Can't recollect. Will update later when I do.