Skip to content

Commit

Permalink
Update Makefile
Browse files Browse the repository at this point in the history
  • Loading branch information
Serianol authored and nodchip committed Aug 17, 2020
1 parent 2646080 commit 2fb3f76
Showing 1 changed file with 23 additions and 2 deletions.
25 changes: 23 additions & 2 deletions src/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ BINDIR = $(PREFIX)/bin

### Built-in benchmark for pgo-builds
PGOBENCH = ./$(EXE) bench
PGOGENSFEN = ./$(EXE) gensfen depth 3 loop 100000

### Source and object files
SRCS = benchmark.cpp bitbase.cpp bitboard.cpp endgame.cpp evaluate.cpp main.cpp \
Expand Down Expand Up @@ -270,9 +271,9 @@ endif
### ==========================================================================

### 3.1 Selecting compiler (default = gcc)
CXXFLAGS += -Wall -Wcast-qual -fno-exceptions -std=c++17 $(EXTRACXXFLAGS)
CXXFLAGS += -Wall -Wcast-qual -fno-exceptions -std=c++17 $(EXTRACXXFLAGS) $(LEARNCXXFLAGS)
DEPENDFLAGS += -std=c++17
LDFLAGS += $(EXTRALDFLAGS)
LDFLAGS += $(EXTRALDFLAGS) $(LEARNLDFLAGS)

ifeq ($(COMP),)
COMP=gcc
Expand Down Expand Up @@ -763,6 +764,26 @@ learn: config-sanity
EXTRACXXFLAGS=' -DEVAL_LEARN -DEVAL_NNUE -DENABLE_TEST_CMD -DUSE_BLAS -I/mingw64/include/OpenBLAS -fopenmp ' \
EXTRALDFLAGS=' -lopenblas -fopenmp -Wl,-s ' \
all

profile-learn: config-sanity objclean profileclean
@echo ""
@echo "Step 1/4. Building instrumented executable ..."
$(MAKE) ARCH=$(ARCH) COMP=$(COMP) $(profile_make) \
LEARNCXXFLAGS=' -DEVAL_LEARN -DEVAL_NNUE -DENABLE_TEST_CMD -DUSE_BLAS -I/mingw64/include/OpenBLAS -fopenmp ' \
LEARNLDFLAGS=' -lopenblas -fopenmp -Wl,-s '
@echo ""
@echo "Step 2/4. Running benchmark for pgo-build ..."
$(PGOGENSFEN)
@echo ""
@echo "Step 3/4. Building optimized executable ..."
$(MAKE) ARCH=$(ARCH) COMP=$(COMP) objclean
$(MAKE) ARCH=$(ARCH) COMP=$(COMP) $(profile_use) \
LEARNCXXFLAGS=' -DEVAL_LEARN -DEVAL_NNUE -DENABLE_TEST_CMD -DUSE_BLAS -I/mingw64/include/OpenBLAS -fopenmp ' \
LEARNLDFLAGS=' -lopenblas -fopenmp -Wl,-s '
@echo ""
@echo "Step 4/4. Deleting profile data ..."
$(MAKE) ARCH=$(ARCH) COMP=$(COMP) profileclean
rm generated_kifu.bin

.depend:
-@$(CXX) $(DEPENDFLAGS) -MM $(SRCS) > $@ 2> /dev/null
Expand Down

0 comments on commit 2fb3f76

Please sign in to comment.