0

Trying to make a bin directory while also trying to compile .cpp files but not sure why I run into the following error above

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)
  • 2
    It's probably a missing tab. The commands of your targets have different indentation. – JFMR Feb 20 '18 at 15:30

1 Answers1

0

The line for each command for each rule (rshell, %.o, clean, all) MUST start with a tab character.

James McPherson
  • 2,476
  • 1
  • 12
  • 16