Makefile and directory structure
Stem rules:

Spelling out compilation rule for each object file is tedious and error prone.

$(TEMPDIR)/%.o: $(SRC)/%.c
    $(CXX) $(CFLAGS) -c $&lt; -o $@


takes care about all of them.
Autodependencies:

Spelling out dependencies for each object file is tedious and error prone. gcc can do it for you:

$(TEMPDIR)/main.d: $(SRC)/main.c
    $(CXX) $(CFLAGS) -MM -MT $&lt; -o $@

-include $(TEMPDIR)/main.d


Of course you we don't want to spell it out for each source file, which naturally leads us to the next step.
Use macros. Shall you add more source files, only FILES needs to be modified.

FILES = main.c terminal.c
SOURCES = $(patsubst %,$(SRC)/%,$(FILES))
OBJECTS = $(patsubst %.c,$(TEMPDIR)/%.o,$(FILES))
DEPS    = $(patsubst %.c.$(TEMPDIR)/%.d,$(FILES))

$(TEMPDIR)/%.o: $(SRC)/%.c
    $(CXX) $(CFLAGS) -c $&lt; -o $@

$(TEMPDIR)/%.d: $(SRC)/%.c
    $(CXX) $(CFLAGS) -MM -MT $&lt; -o $@

-include $(DEPS)

$(TARGET): $(OBJECTS)
    $(CXX) $(LDFLAGS) $(OBJECTS) -o $(TARGET)