<commit_before>CLIENT_SOURCE:=$(wildcard client/*.cpp)
SERVER_SOURCE:=$(wildcard server/*.cpp)

# TODO maybe try out pendantic/strict ANSI?
CXXFLAGS=-std=c++11
BOOST_PO=boost_program_options

ifdef RELEASE
CXXFLAGS+=-O2
else
CXXFLAGS+=-Wall -Wextra -Wfatal-errors -ggdb -pg
endif

ifdef WINDOWS
CXX=x86_64-w64-mingw32-g++
CXXFLAGS+=-static
BOOST_PO:=$(BOOST_PO)-mt
SUFFIX=.exe
endif

all: bananagrams$(SUFFIX) dedicated_server$(SUFFIX)

bananagrams$(SUFFIX): $(patsubst %.cpp,%.o,$(CLIENT_SOURCE))
	$(CXX) $(CXXFLAGS) -o bananagrams$(SUFFIX) $+ -lyaml-cpp -lsfml-audio -lsfml-graphics -lsfml-window -lsfml-network -lsfml-system

client/client.hpp: client/*.hpp common.hpp
	touch client/client.hpp

client/%.o: client/%.cpp client/client.hpp
	$(CXX) $(CXXFLAGS) -c $< -o $@

dedicated_server$(SUFFIX): $(patsubst %.cpp,%.o,$(SERVER_SOURCE))
	$(CXX) $(CXXFLAGS) -o dedicated_server$(SUFFIX) $+ -l$(BOOST_PO) -lsfml-network -lsfml-system

server/server.hpp: server/*.hpp common.hpp
	touch server/server.hpp

server/%.o: server/%.cpp server/server.hpp
	$(CXX) $(CXXFLAGS) -c $< -o $@

clean:
	rm -f client/*.o server/*.o bananagrams bananagrams.exe dedicated_server dedicated_server.exe<commit_msg>Refactor makefile. Use vars more<commit_after>CLIENT=bananagrams
SERVER=dedicated_server
CLIENT_SOURCE:=$(wildcard client/*.cpp)
SERVER_SOURCE:=$(wildcard server/*.cpp)
BINS=$(CLIENT) $(SERVER)

# TODO maybe try out pendantic/strict ANSI?
CXXFLAGS=-std=c++11
BOOST_PO=boost_program_options

ifdef RELEASE
CXXFLAGS+=-O2
else
CXXFLAGS+=-Wall -Wextra -Wfatal-errors -ggdb -pg
endif

ifdef WINDOWS
CXX=x86_64-w64-mingw32-g++
CXXFLAGS+=-static
BOOST_PO:=$(BOOST_PO)-mt
CLIENT:=$(CLIENT).exe
SERVER:=$(SERVER).exe
PKG=bananagrams.zip
endif

all: $(BINS)

$(CLIENT): $(patsubst %.cpp,%.o,$(CLIENT_SOURCE))
	$(CXX) $(CXXFLAGS) -o $(CLIENT) $+ -lyaml-cpp -lsfml-audio -lsfml-graphics -lsfml-window -lsfml-network -lsfml-system

client/client.hpp: client/*.hpp common.hpp
	touch client/client.hpp

client/%.o: client/%.cpp client/client.hpp
	$(CXX) $(CXXFLAGS) -c $< -o $@

$(SERVER): $(patsubst %.cpp,%.o,$(SERVER_SOURCE))
	$(CXX) $(CXXFLAGS) -o $(SERVER) $+ -l$(BOOST_PO) -lsfml-network -lsfml-system

server/server.hpp: server/*.hpp common.hpp
	touch server/server.hpp

server/%.o: server/%.cpp server/server.hpp
	$(CXX) $(CXXFLAGS) -c $< -o $@

clean:
	rm -f client/*.o server/*.o $(BINS) $(PKG)
{'fraction_non_alphanumeric': 0.18506084767100295, 'fraction_numerical': 0.009232060428031893, 'mean_word_length': 5.0971867007672635, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1899400', 'n_tokens_mistral': 997, 'n_tokens_neox': 938, 'n_words': 182}