# Source dependency setup
INCLUDE = Rchess/inst/include/SchachHoernchen
SRC = $(notdir $(wildcard $(INCLUDE)/*.cpp))
OBJ = $(SRC:.cpp=.o)

# Compiler config
CC = g++
FLAGS = -I$(INCLUDE) -Wall -Wextra -Wpedantic -pedantic -pthread -O3 -march=native -mtune=native
CPPFLAGS = $(FLAGS) -std=c++17
LDFLAGS = $(FLAGS)

.PHONY: all clean

%.o: $(INCLUDE)/%.cpp
	$(CC) $(CPPFLAGS) -c $< -o $(notdir $@)

pgn2fen.o: pgn2fen.cpp
	$(CC) $(CPPFLAGS) -c $< -o $@

pgn2fen: pgn2fen.o $(OBJ)
	$(CC) $(LDFLAGS) -o $@ $^

all: pgn2fen

clean:
	rm -f *.out *.o *.h.gch pgn2fen
