Skip to content

Commit

Permalink
Fix syzygy dependencies (issue official-stockfish#2660)
Browse files Browse the repository at this point in the history
Changes:
- All .o object files now reside in the src directory itself.
- Instead of a single .depend file there now is a .dep directory
containing individual .d dependency files for every generated object
file.
- The src directory is added to the include path so source and header
files in subdirectories (like syzygy) can include header files in the
src directory directly (without the "../" prefix).

No functional change.
  • Loading branch information
gvreuls committed May 6, 2020
1 parent c527c3a commit 4daa279
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 18 deletions.
30 changes: 19 additions & 11 deletions src/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,14 @@ PGOBENCH = ./$(EXE) bench
### Object files
OBJS = benchmark.o bitbase.o bitboard.o endgame.o evaluate.o main.o \
material.o misc.o movegen.o movepick.o pawns.o position.o psqt.o \
search.o thread.o timeman.o tt.o uci.o ucioption.o tune.o syzygy/tbprobe.o
search.o thread.o timeman.o tt.o uci.o ucioption.o tune.o tbprobe.o

### Dependency directory and files
DEPDIR = .dep
DEPS = $(addprefix $(DEPDIR)/,$(OBJS:.o=.d))

### Virtual path
VPATH = syzygy

### Establish the operating system name
KERNEL = $(shell uname -s)
Expand Down Expand Up @@ -147,8 +154,7 @@ endif

### 3.1 Selecting compiler (default = gcc)

CXXFLAGS += -Wall -Wcast-qual -fno-exceptions -std=c++11 $(EXTRACXXFLAGS)
DEPENDFLAGS += -std=c++11
CXXFLAGS += -Wall -Wcast-qual -fno-exceptions -std=c++11 -I. $(EXTRACXXFLAGS)
LDFLAGS += $(EXTRALDFLAGS)

ifeq ($(COMP),)
Expand Down Expand Up @@ -307,7 +313,6 @@ endif
ifeq ($(prefetch),yes)
ifeq ($(sse),yes)
CXXFLAGS += -msse
DEPENDFLAGS += -msse
endif
else
CXXFLAGS += -DNO_PREFETCH
Expand Down Expand Up @@ -441,16 +446,16 @@ install:

#clean all
clean: objclean profileclean
@rm -f .depend *~ core
@rm -rf $(DEPDIR) *~ core

# clean binaries and objects
objclean:
@rm -f $(EXE) *.o ./syzygy/*.o
@rm -f $(EXE) *.o

# clean auxiliary profiling files
profileclean:
@rm -rf profdir
@rm -f bench.txt *.gcda ./syzygy/*.gcda *.gcno ./syzygy/*.gcno
@rm -f bench.txt *.gcda *.gcno
@rm -f stockfish.profdata *.profraw

default:
Expand All @@ -460,7 +465,7 @@ default:
### Section 5. Private targets
### ==========================================================================

all: $(EXE) .depend
all: $(EXE)

config-sanity:
@echo ""
Expand Down Expand Up @@ -535,8 +540,11 @@ icc-profile-use:
EXTRACXXFLAGS='-prof_use -prof_dir ./profdir' \
all

.depend:
-@$(CXX) $(DEPENDFLAGS) -MM $(OBJS:.o=.cpp) > $@ 2> /dev/null
%.o: %.cpp | $(DEPDIR)
$(CXX) $(CXXFLAGS) $(CPPFLAGS) -MMD -MF $(DEPDIR)/$(@:.o=.d) -c -o $@ $<

$(DEPDIR):
@mkdir -p $@

-include .depend
-include $(DEPS)

12 changes: 6 additions & 6 deletions src/syzygy/tbprobe.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,12 @@
#include <type_traits>
#include <mutex>

#include "../bitboard.h"
#include "../movegen.h"
#include "../position.h"
#include "../search.h"
#include "../types.h"
#include "../uci.h"
#include "bitboard.h"
#include "movegen.h"
#include "position.h"
#include "search.h"
#include "types.h"
#include "uci.h"

#include "tbprobe.h"

Expand Down
2 changes: 1 addition & 1 deletion src/syzygy/tbprobe.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

#include <ostream>

#include "../search.h"
#include "search.h"

namespace Tablebases {

Expand Down

0 comments on commit 4daa279

Please sign in to comment.