Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
75 changes: 75 additions & 0 deletions makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
#usage
# make CFG=release

CPP = g++
CC = gcc
CPPFLAGS += -std=c++11 -Wall -Wextra -pedantic-errors
INCLUDE = -isystem lib/json-parser/ -Isrc

LIB = `pkg-config --libs sfml-all` lib/json-parser/json.a

ifeq ($(CFG),)
CFG=debug
endif

ifeq ($(CFG),debug)
CPPFLAGS += -ggdb -DDEBUG
else
CPPFLAGS += -O2
endif
CPPFLAGS += $(INCLUDE)


VPATH=src:src/board/:src/config/:src/graphics/:src/log/:src/util/
TARGET=chesscpp.bin

SRC = \
Queen.cpp \
Board.cpp \
Pawn.cpp \
Position.cpp \
Bishop.cpp \
King.cpp \
Rook.cpp \
Knight.cpp \
Piece.cpp \
Logger.cpp \
Main.cpp \
Graphics.cpp \
Application.cpp \
AppStateGame.cpp

OBJ = $(patsubst %.cpp, objs.$(CFG)/%.o, ${SRC})
DEP = $(patsubst %.cpp, deps.$(CFG)/%.d, ${SRC})

all: bin.$(CFG)/${TARGET}

bin.$(CFG)/${TARGET}: ${OBJ}
mkdir -p $(dir $@)
$(CPP) $^ $(LIBDIR) $(LIB) -o $@

test:
echo $(OBJ)
echo $(DEP)


deps.$(CFG)/%.d: %.cpp
mkdir -p $(dir $@)
$(CPP) -MM -MP $(CPPFLAGS) $< | perl -pe 's#^(.*\.o)#deps.$(CFG)/$$1 objs.$(CFG)/$$1#' > $@

objs.$(CFG)/%.o: %.cpp
mkdir -p $(dir $@)
$(CPP) -c $(CPPFLAGS) $< -o $@

.PHONY: clean deps

clean:
-rm -r objs.debug deps.debug bin.debug
-rm -r objs.release deps.release bin.release



# Unless "make clean" is called, include the dependency files
# which are auto-generated. Don't fail if they are missing
# (-include), since they will be missing in the first invocation!
-include ${DEP}
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion src/chesspp/AppStateGame.hpp → src/AppStateGame.hpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#ifndef _APPSTATEGAME_H
#define _APPSTATEGAME_H
#include "../SFML.hpp"
#include "SFML.hpp"
#include "TextureManager.hpp"
#include "graphics/Graphics.hpp"
#include "config/Configuration.hpp"
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion src/Main.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#include <iostream>

#include "chesspp/Application.hpp"
#include "Application.hpp"

int main()
{
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion src/chesspp/SFMLEvent.hpp → src/SFMLEvent.hpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#ifndef _EVENT_H
#define _EVENT_H

#include "../SFML.hpp"
#include "SFML.hpp"

namespace chesspp
{
Expand Down
2 changes: 1 addition & 1 deletion src/chesspp/TextureManager.hpp → src/TextureManager.hpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#ifndef _TEXTUREMANAGER_H
#define _TEXTUREMANAGER_H
#include "ResourceManager.hpp"
#include "../SFML.hpp"
#include "SFML.hpp"

#ifdef _DEBUG
#include <iostream>
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion src/chesspp/board/Piece.hpp → src/board/Piece.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
// textureX = givenValX
// textureY = givenValY + ( this->color == WHITE ? 0 : 80 )

#include "../log/Logger.hpp"
#include "log/Logger.hpp"

// The contigousness of this container does not matter
// It could be sorted for std::lower_bound? I don't think time is an issue
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@
#endif


#include "../Exception.hpp"
#include "../util/JsonReader.hpp"
#include "../log/logger.hpp"
#include "Exception.hpp"
#include "util/JsonReader.hpp"
#include "log/Logger.hpp"

namespace chesspp
{
Expand Down
File renamed without changes.
10 changes: 5 additions & 5 deletions src/chesspp/graphics/Graphics.hpp → src/graphics/Graphics.hpp
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
#ifndef _GRAPHICS_H
#define _GRAPHICS_H

#include "../../SFML.hpp"
#include "../TextureManager.hpp"
#include "../config/Configuration.hpp"
#include "../board/Piece.hpp"
#include "../log/Logger.hpp"
#include "SFML.hpp"
#include "TextureManager.hpp"
#include "config/Configuration.hpp"
#include "board/Piece.hpp"
#include "log/Logger.hpp"

#ifdef _DEBUG
#include <iostream>
Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
#include <json.h>
#include <cstdint>

#include "../Exception.hpp"
#include "Exception.hpp"

namespace chesspp
{
Expand Down