1 # Makefile (for typhoon/GNU-style make). Recognized gmake variables:
3 # DEBUG=1: make debug version (includes asserts and sanity checks)
4 # TEST=1: include self-test code in the binary produced
5 # ASM=1: create assembly code, does not link final binary
6 # EVAL_DUMP=1: make a version that can dump eval breakdowns
7 # EVAL_HASH=1: hash eval scores
8 # EVAL_TIME=1: make a version that counts cycles spent in eval
9 # PERF_COUNTERS=1: make version with perf counters enabled
10 # BOUNDS_CHECKING=1: make version with bounds checking enabled
11 # MP=1: make version for multi-processor machine
12 # DUMP_TREE=1: internal tree dumping version
13 # SEE_HEAPS=1: use minheaps in the SEE code
14 # OSX=1: build for an Intel-based Apple Mac (omit this for FreeBSD/Linux)
15 # USE_READLINE=1: link against the GNU readline library
16 # SIXTYFOUR=1: make an X64 binary
17 # CROUTINES=1: use the C versions of the asm routines [slower]
18 # EVERYTHING=1: everything everything everything everything
26 LIBRARIES = -pthread -lc
28 $(warning you will need to use yasm for now to get x64 on OSX)
29 NASMFLAGS = -f macho64 -dOSX -d_X64_
31 NASMFLAGS = -f macho -dOSX
34 LIBRARIES = -pthread -lc -lstdc++
36 NASMFLAGS = -f elf64 -d__GNUC__
38 NASMFLAGS = -f elf -d__GNUC__
44 # Setup commandline based on make defines
48 PROFILE = -S -fverbose-asm -std=gnu99 -D_X64_
50 PROFILE = -S -fverbose-asm -std=gnu99 -D_X86_
54 PROFILE = -std=gnu99 -D_X64_
56 PROFILE = -std=gnu99 -D_X86_
69 PROFILE += -g -O2 -DDEBUG
72 PROFILE += -g -O3 -fexpensive-optimizations -ffast-math -finline-functions
77 LIBRARIES += -lreadline
78 PROFILE += -DUSE_READLINE
90 PROFILE += -DCROUTINES
94 PROFILE += -DEVAL_DUMP -DEVAL_HASH -DEVAL_TIME -DPERF_COUNTERS -DMP -DSMP -DTEST_NULL -DDUMP_TREE -fbounds-checking
97 PROFILE += -DEVAL_DUMP
100 PROFILE += -DEVAL_HASH
103 PROFILE += -DEVAL_TIME
106 PROFILE += -DPERF_COUNTERS
108 ifdef BOUNDS_CHECKING
109 PROFILE += -fbounds-checking
112 PROFILE += -DMP -DSMP
115 PROFILE += -DTEST_NULL
118 PROFILE += -DDUMP_TREE
122 CFLAGS = -DPROFILE="\"$(PROFILE)\"" $(PROFILE) -Wall
123 HEADERS = chess.h compiler.h
126 # ---> .o, not .c! <---
128 OBJS = main.o root.o search.o searchsup.o draw.o dynamic.o \
129 hash.o eval.o evalhash.o x86.o pawnhash.o bitboard.o \
130 generate.o see.o move.o movesup.o command.o script.o \
131 input.o vars.o util.o unix.o gamelist.o mersenne.o \
132 sig.o piece.o ics.o san.o fen.o book.o bench.o board.o \
133 data.o probe.o egtb.o recogn.o poshash.o list.o x64.o
136 # ---> .o, not .c! <---
138 OBJS += testdraw.o testmove.o testfen.o testgenerate.o \
139 testsan.o testics.o testeval.o testbitboard.o \
140 testhash.o testsee.o testsearch.o testsup.o
144 OBJS += testeval.o testsup.o
162 $(CXX) $(PROFILE) -o $(BINARY) -Wall $(LIBRARIES) \
166 $(CC) $(CFLAGS) -c $< -o $@
168 %.o: %.cpp $(HEADERS)
169 $(CXX) $(CFLAGS) -c -w $< -o $@
171 %.o: %.asm $(HEADERS)
172 $(NASM) $(NASMFLAGS) -o $@ $<
176 $(RM) -f *.o *.core *~ *.gmon \#*\# typhoon _typhoon