Subversion Repositories Games.Chess Giants

Rev

Rev 169 | Rev 183 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 169 Rev 182
Line 20... Line 20...
20
### ==========================================================================
20
### ==========================================================================
21
### Section 1. General Configuration
21
### Section 1. General Configuration
22
### ==========================================================================
22
### ==========================================================================
23
 
23
 
24
### Establish the operating system name
24
### Establish the operating system name
-
 
25
# Pierre-Marie Baty -- Windows doesn't know uname
-
 
26
ifeq ($(OS),Windows_NT)
-
 
27
	KERNEL = Windows
-
 
28
else
25
KERNEL = $(shell uname -s)
29
	KERNEL = $(shell uname -s)
26
ifeq ($(KERNEL),Linux)
30
	ifeq ($(KERNEL),Linux)
27
	OS = $(shell uname -o)
31
		OS = $(shell uname -o)
-
 
32
	endif
28
endif
33
endif
29
 
34
 
30
### Executable name
35
### Executable name
-
 
36
# Pierre-Marie Baty -- on Windows, add the .exe extension
-
 
37
ifeq ($(OS),Windows_NT)
-
 
38
	EXE = stockfish.exe
-
 
39
else
31
EXE = stockfish
40
	EXE = stockfish
-
 
41
endif
32
 
42
 
33
### Installation dir definitions
43
### Installation dir definitions
34
PREFIX = /usr/local
44
PREFIX = /usr/local
35
BINDIR = $(PREFIX)/bin
45
BINDIR = $(PREFIX)/bin
36
 
46
 
Line 139... Line 149...
139
### Section 3. Low-level configuration
149
### Section 3. Low-level configuration
140
### ==========================================================================
150
### ==========================================================================
141
 
151
 
142
### 3.1 Selecting compiler (default = gcc)
152
### 3.1 Selecting compiler (default = gcc)
143
 
153
 
-
 
154
ifeq ($(OS),Windows_NT)
-
 
155
# Pierre-Marie Baty -- we need two extra flags AND the C++14 standard when building with Clang against the Visual Studio 2015 SDK
-
 
156
CXXFLAGS += -Xclang -flto-visibility-public-std -Wall -Wcast-qual -fno-exceptions -std=c++14 $(EXTRACXXFLAGS)
-
 
157
DEPENDFLAGS += -std=c++14
-
 
158
else
144
CXXFLAGS += -Wall -Wcast-qual -fno-exceptions -std=c++11 $(EXTRACXXFLAGS)
159
CXXFLAGS += -Wall -Wcast-qual -fno-exceptions -std=c++11 $(EXTRACXXFLAGS)
145
DEPENDFLAGS += -std=c++11
160
DEPENDFLAGS += -std=c++11
-
 
161
endif
146
LDFLAGS += $(EXTRALDFLAGS)
162
LDFLAGS += $(EXTRALDFLAGS)
147
 
163
 
148
ifeq ($(COMP),)
164
#ifeq ($(COMP),)
149
	COMP=gcc
165
#	COMP=gcc
150
endif
166
#endif
-
 
167
COMP=clang
151
 
168
 
152
ifeq ($(COMP),gcc)
169
ifeq ($(COMP),gcc)
153
	comp=gcc
170
	comp=gcc
154
	CXX=g++
171
	CXX=g++
155
	CXXFLAGS += -pedantic -Wextra -Wshadow
172
	CXXFLAGS += -pedantic -Wextra -Wshadow
Line 202... Line 219...
202
 
219
 
203
ifeq ($(COMP),clang)
220
ifeq ($(COMP),clang)
204
	comp=clang
221
	comp=clang
205
	CXX=clang++
222
	CXX=clang++
206
	CXXFLAGS += -pedantic -Wextra -Wshadow
223
	CXXFLAGS += -pedantic -Wextra -Wshadow
-
 
224
# Pierre-Marie Baty -- also add the test case for Windows
-
 
225
ifneq ($(OS),Windows_NT)
207
ifneq ($(KERNEL),Darwin)
226
ifneq ($(KERNEL),Darwin)
208
ifneq ($(KERNEL),OpenBSD)
227
ifneq ($(KERNEL),OpenBSD)
209
	LDFLAGS += -latomic
228
	LDFLAGS += -latomic
-
 
229
endif
210
endif
230
endif
211
endif
231
endif
212
 
232
 
213
	ifeq ($(ARCH),armv7)
233
	ifeq ($(ARCH),armv7)
214
		ifeq ($(OS),Android)
234
		ifeq ($(OS),Android)
Line 247... Line 267...
247
### Allow overwriting CXX from command line
267
### Allow overwriting CXX from command line
248
ifdef COMPCXX
268
ifdef COMPCXX
249
	CXX=$(COMPCXX)
269
	CXX=$(COMPCXX)
250
endif
270
endif
251
 
271
 
-
 
272
# Pierre-Marie Baty -- also add the test case for Windows
-
 
273
ifneq ($(OS),Windows_NT)
252
### On mingw use Windows threads, otherwise POSIX
274
	### On mingw use Windows threads, otherwise POSIX
253
ifneq ($(comp),mingw)
275
	ifneq ($(comp),mingw)
254
	# On Android Bionic's C library comes with its own pthread implementation bundled in
276
		# On Android Bionic's C library comes with its own pthread implementation bundled in
255
	ifneq ($(OS),Android)
277
		ifneq ($(OS),Android)
256
		# Haiku has pthreads in its libroot, so only link it in on other platforms
278
			# Haiku has pthreads in its libroot, so only link it in on other platforms
257
		ifneq ($(KERNEL),Haiku)
279
			ifneq ($(KERNEL),Haiku)
258
			LDFLAGS += -lpthread
280
				LDFLAGS += -lpthread
-
 
281
			endif
259
		endif
282
		endif
260
	endif
283
	endif
261
endif
284
endif
262
 
285
 
263
### 3.2.1 Debugging
286
### 3.2.1 Debugging
Line 457... Line 480...
457
	-cp $(EXE) $(BINDIR)
480
	-cp $(EXE) $(BINDIR)
458
	-strip $(BINDIR)/$(EXE)
481
	-strip $(BINDIR)/$(EXE)
459
 
482
 
460
#clean all
483
#clean all
461
clean: objclean profileclean
484
clean: objclean profileclean
-
 
485
ifneq ($(OS),Windows_NT)
462
	@rm -f .depend *~ core
486
	@rm -f .depend *~ core
-
 
487
else
-
 
488
	@del /f .depend *~ core > nul 2>&1
-
 
489
endif
463
 
490
 
464
# clean binaries and objects
491
# clean binaries and objects
465
objclean:
492
objclean:
-
 
493
ifneq ($(OS),Windows_NT)
466
	@rm -f $(EXE) $(EXE).exe *.o ./syzygy/*.o
494
	@rm -f $(EXE) $(EXE).exe *.o ./syzygy/*.o
-
 
495
else
-
 
496
	@del /f $(EXE) $(EXE).exe *.o .\syzygy\*.o > nul 2>&1
-
 
497
endif
467
 
498
 
468
# clean auxiliary profiling files
499
# clean auxiliary profiling files
469
profileclean:
500
profileclean:
-
 
501
ifneq ($(OS),Windows_NT)
470
	@rm -rf profdir
502
	@rm -rf profdir
471
	@rm -f bench.txt *.gcda ./syzygy/*.gcda *.gcno ./syzygy/*.gcno
503
	@rm -f bench.txt *.gcda ./syzygy/*.gcda *.gcno ./syzygy/*.gcno
472
	@rm -f stockfish.profdata *.profraw
504
	@rm -f stockfish.profdata *.profraw
-
 
505
else
-
 
506
	@del /f /s /q profdir > nul 2>&1
-
 
507
	@del /f bench.txt *.gcda .\syzygy\*.gcda *.gcno .\syzygy\*.gcno > nul 2>&1
-
 
508
	@del /f stockfish.profdata *.profraw > nul 2>&1
-
 
509
endif
473
 
510
 
474
default:
511
default:
475
	help
512
	help
476
 
513
 
477
### ==========================================================================
514
### ==========================================================================
Line 498... Line 535...
498
	@echo "Flags:"
535
	@echo "Flags:"
499
	@echo "CXX: $(CXX)"
536
	@echo "CXX: $(CXX)"
500
	@echo "CXXFLAGS: $(CXXFLAGS)"
537
	@echo "CXXFLAGS: $(CXXFLAGS)"
501
	@echo "LDFLAGS: $(LDFLAGS)"
538
	@echo "LDFLAGS: $(LDFLAGS)"
502
	@echo ""
539
	@echo ""
-
 
540
# Pierre-Marie Baty -- "test" doesn't exist on Windows, so just skip that
-
 
541
ifneq ($(OS),Windows_NT)
503
	@echo "Testing config sanity. If this fails, try 'make help' ..."
542
	@echo "Testing config sanity. If this fails, try 'make help' ..."
504
	@echo ""
543
	@echo ""
505
	@test "$(debug)" = "yes" || test "$(debug)" = "no"
544
	@test "$(debug)" = "yes" || test "$(debug)" = "no"
506
	@test "$(sanitize)" = "undefined" || test "$(sanitize)" = "thread" || test "$(sanitize)" = "no"
545
	@test "$(sanitize)" = "undefined" || test "$(sanitize)" = "thread" || test "$(sanitize)" = "no"
507
	@test "$(optimize)" = "yes" || test "$(optimize)" = "no"
546
	@test "$(optimize)" = "yes" || test "$(optimize)" = "no"
Line 511... Line 550...
511
	@test "$(prefetch)" = "yes" || test "$(prefetch)" = "no"
550
	@test "$(prefetch)" = "yes" || test "$(prefetch)" = "no"
512
	@test "$(popcnt)" = "yes" || test "$(popcnt)" = "no"
551
	@test "$(popcnt)" = "yes" || test "$(popcnt)" = "no"
513
	@test "$(sse)" = "yes" || test "$(sse)" = "no"
552
	@test "$(sse)" = "yes" || test "$(sse)" = "no"
514
	@test "$(pext)" = "yes" || test "$(pext)" = "no"
553
	@test "$(pext)" = "yes" || test "$(pext)" = "no"
515
	@test "$(comp)" = "gcc" || test "$(comp)" = "icc" || test "$(comp)" = "mingw" || test "$(comp)" = "clang"
554
	@test "$(comp)" = "gcc" || test "$(comp)" = "icc" || test "$(comp)" = "mingw" || test "$(comp)" = "clang"
-
 
555
endif
516
 
556
 
517
$(EXE): $(OBJS)
557
$(EXE): $(OBJS)
518
	$(CXX) -o $@ $(OBJS) $(LDFLAGS)
558
	$(CXX) -o $@ $(OBJS) $(LDFLAGS)
519
 
559
 
520
clang-profile-make:
560
clang-profile-make: