Skip to content
Snippets Groups Projects
Commit 557ced61 authored by Bariatti Francesco's avatar Bariatti Francesco
Browse files

New version of Makefile: changed name of the output, added comments and improved rules

parent b0752b27
No related branches found
No related tags found
No related merge requests found
# Compiler
CC=g++ CC=g++
# Output directory
BIN=bin BIN=bin
INCLUDE=-I src/game -I src/util -I src/monte_carlo -I src/mcts -I src/minmax -I src/json # Name of the executable
CFLAGS=-g -O3 -ffast-math -fopenmp -c -Wall -std=c++11 $(INCLUDE) EXECUTABLE=$(BIN)/penguin
# Directories with .h files
INCLUDE=-I src/game -I src/util -I src/monte_carlo -I src/mcts -I src/json
# Directories in which make will search for files
vpath %.cpp src/game src/main src/util src/monte_carlo src/mcts src/gdl
# Flags passed to the compiler
CFLAGS=-g -O3 -ffast-math -fopenmp -Wall -std=c++11
# Flags passed to the linker
LDFLAGS=-fopenmp -std=c++11 #-lprofiler -Wl,-no_pie LDFLAGS=-fopenmp -std=c++11 #-lprofiler -Wl,-no_pie
SOURCES=omp_util.cpp fast_log.cpp display_node.cpp penguin.cpp connect4.cpp morpion.cpp test_two_players_game.cpp test_connect4.cpp monte_carlo.cpp test_monte_carlo.cpp test_fast_log.cpp\ # Cpp source files
statistics.cpp node.cpp allocator.cpp test_allocator.cpp openings.cpp mcts_two_players.cpp test_mcts_two_players.cpp test_minmax.cpp\ SOURCES=omp_util.cpp fast_log.cpp display_node.cpp penguin.cpp test_two_players_game.cpp monte_carlo.cpp \
bits.cpp test_bits.cpp main.cpp test_fast_log.cpp statistics.cpp node.cpp allocator.cpp test_allocator.cpp openings.cpp mcts_two_players.cpp \
test_mcts_two_players.cpp bits.cpp test_bits.cpp main.cpp
# Generating .o files' names
OBJECTS=$(addprefix $(BIN)/, $(SOURCES:.cpp=.o)) OBJECTS=$(addprefix $(BIN)/, $(SOURCES:.cpp=.o))
EXECUTABLE=$(BIN)/theturk
vpath %.cpp src/game:src/main:src/util:src/monte_carlo:src/mcts:src/gdl:src/minmax
all: $(EXECUTABLE) # ========= RULES ============
# Creates the output directory and the executable
all: bindir $(EXECUTABLE)
# Creates the output directory if it doesn't exist
bindir:
mkdir -p $(BIN)
$(EXECUTABLE): $(OBJECTS) $(EXECUTABLE): $(OBJECTS)
$(CC) $(LDFLAGS) $(OBJECTS) -o $@ $(CC) $(LDFLAGS) $(OBJECTS) -o $@
-include $(BIN)/$(OBJECTS:.o=.d) # Creates .o files with automatic generation of dependencies (.d) files
$(BIN)/%.o: %.cpp $(BIN)/%.o: %.cpp
$(CC) -c $(CFLAGS) $< -o $(BIN)/$*.o $(CC) -c $(CFLAGS) $(INCLUDE) -MD -MP $< -o $@
$(CC) -MM $(CFLAGS) $< > $(BIN)/$*.d # Include the dependency files into the makefile
@mv -f $(BIN)/$*.d $(BIN)/$*.d.tmp -include $(OBJECTS:.o=.d)
@sed -e 's|.*:|$(BIN)/$*.o:|' < $(BIN)/$*.d.tmp > $(BIN)/$*.d
@sed -e 's/.*://' -e 's/\\$$//' < $(BIN)/$*.d.tmp | fmt -1 | \
sed -e 's/^ *//' -e 's/$$/:/' >> $(BIN)/$*.d
@rm -f $(BIN)/$*.d.tmp
# Deletes .o, .d and the executable
clean: clean:
rm -f $(BIN)/*.o $(BIN)/*.d $(EXECUTABLE) rm -f $(BIN)/*.o $(BIN)/*.d $(EXECUTABLE)
...@@ -30,7 +30,7 @@ import java.util.ResourceBundle; ...@@ -30,7 +30,7 @@ import java.util.ResourceBundle;
public class Controller implements Initializable public class Controller implements Initializable
{ {
private static final String iaProgramPath = "../bin/theturk"; private static final String iaProgramPath = "../bin/penguin";
private static final String introMusicFile = "./resource/pingu_theme.wav"; private static final String introMusicFile = "./resource/pingu_theme.wav";
private static final String clickSoundFile = "./resource/clic.wav"; private static final String clickSoundFile = "./resource/clic.wav";
private static final int max1Fish = 30, max2Fish = 20, max3Fish = 10; private static final int max1Fish = 30, max2Fish = 20, max3Fish = 10;
......
#include "test_connect4.hpp"
#include "connect4.hpp"
#include "morpion.hpp"
#include "penguin.hpp" #include "penguin.hpp"
#include "test_two_players_game.hpp" #include "test_two_players_game.hpp"
#include "test_monte_carlo.hpp"
#include "test_fast_log.hpp" #include "test_fast_log.hpp"
#include "test_allocator.hpp" #include "test_allocator.hpp"
#include "test_mcts_two_players.hpp" #include "test_mcts_two_players.hpp"
#include "test_minmax.hpp"
#include "test_bits.hpp" #include "test_bits.hpp"
#include "learning.hpp" #include "learning.hpp"
...@@ -17,23 +12,13 @@ using namespace std; ...@@ -17,23 +12,13 @@ using namespace std;
int main(int argc, char *argv[]) int main(int argc, char *argv[])
{ {
// game::test_connect4();
// util::test_fast_log(100000000); // util::test_fast_log(100000000);
// mcts::test_allocator(10, 2); // mcts::test_allocator(10, 2);
// omp_set_num_threads(8); // omp_set_num_threads(8);
// game::run_test_two_players_game(game::connect4());
//mcts::run_test_mcts_two_players(game::connect4());
//game::run_test_two_players_game(game::morpion());
//mcts::run_test_mcts_two_players(game::morpion());
//game::run_test_two_players_game(game::penguin()); //game::run_test_two_players_game(game::penguin());
mcts::run_test_mcts_two_players(game::penguin()); mcts::run_test_mcts_two_players(game::penguin());
// minmax::test_minmax();
//util::test_bits(200000000); //util::test_bits(200000000);
//game::connect4 c4;
// util::learning::display_file(c4, "learning_examples.txt");
return 0; return 0;
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment