summaryrefslogtreecommitdiff
path: root/Makefile
blob: 04267f92c218f9918408d8556347dccb34270de4 (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
CXX = g++
CXXFLAGS = -Wall -Wextra -std=c++14 -O2 -fwrapv
TARGET = chess

OBJDIR = obj

.PHONY: all clean

.SUFFIXES:

all: $(TARGET)

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


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

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