Make recipe rule

Make allows one to define recipes to make common intermediate files

%.o: %.c* $(CC) $(CFLAGS) -c $< -o $@

The % is a wild card that make knows how to replace - so if has to make main.o the % will be replaced with “main”. The * at the end of c means we can match both C++ .cpp and .c files. Quite helpful.

After the : we see the dependencies - which is main.cpp if we dealing with main

The $< variable is replaced with the first input - in this case main.cpp.

$@ variable is replaced with the output - which is main.o.

$^ - replaced with the list of pre-requisites.

Make is very sensitive about using tabs. There has to be tab character between the : and the dependency list. Each line after the rule needs to start with a tab.

Seehttps://www.gnu.org/software/make/manual/html_node/Automatic-Variables.html