为什么我收到此错误:Makefile:12:***缺少分隔符。停止

时间:2018-02-20 15:29:02

标签: makefile

在尝试编译.cpp文件的同时尝试创建bin目录但不确定为什么我遇到上面的以下错误

CC = g++
CC_FLAGS = -Wall -pendantic -std=c++11 -03

EXECUTABLE = test_commands
SOURCEDIR = src
BUILDRDIR = bin

SOURCES = $(wildcard $(SOURCEDIR)/*.cpp)
OBJECTS = $(SOURCES:.cpp=.o)

all: $(OBJECTS)
      mkdir -p $(BUILDDIR)
      $(CC) $(OBJECTS) -o $(BUILDDIR)/$(EXECUTABLE)

rshell: $(OBJECTS)
        mkdir -p $(BUILDDIR)
        $(CC) $(OBJECTS) -o $(BUILDDIR)/$(EXECUTABLE)

%.o: %.cpp
    $(CC) -c $(CC_FLAGS) $< -o $@

clean:
      rm -f $(EXECUTABLE) $(OBJECTS)
      rm -rf  $(BUILDDIR)

1 个答案:

答案 0 :(得分:0)

每个规则(rshell,%。o,clean,all)的每个命令的行必须以制表符开头。