summaryrefslogtreecommitdiff
path: root/Makefile
blob: c4913e7f89a5ea4259a26984cb979f10bd49b747 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
CXX = g++
CXXFLAGS = -Wall -Wextra -std=c++17 -O2 -g
LDFLAGS =
TARGET = tri

OBJDIR = obj

.PHONY: all clean

all: $(TARGET)

clean:
	@echo "Cleaning"
	@rm -f $(TARGET)
	@rm -rf $(OBJDIR)


$(OBJDIR)/%.o: %.cpp $(wildcard *.h) | $(OBJDIR)
	@echo "CXX $<"
	@$(CXX) $(CXXFLAGS) -c -o $@ $<

$(TARGET): $(patsubst %.cpp,$(OBJDIR)/%.o,$(wildcard *.cpp)) | $(OBJDIR)
	@echo "LD -o $@"
	@$(CXX) -o $@ $^ $(LDFLAGS)

$(OBJDIR):
	@mkdir -p $(OBJDIR)