Search code examples
c++makefileseparator

Makefile: Foreach and eval's missing separators?


I have this in my Makefile:

# Build source files
define compile_rule
%.o : %.$1
        $$(COMPILE) $$(COMPILE_FLAGS) $$(CC_FLAGS) -o $$@ $$<
endef
$(foreach EXT, $(SRC_EXT), $(eval $(call compile_rule, $(EXT))))

However if I type make I get this error, why is this happening?

*** missing separator (did you mean TAB instead of 8 spaces?).  Stop.

Solution

  • You need to use a tab instead of 8 spaces in the line right above the endef.