2 # Makefile for GNU Shogi
4 # Copyright (c) 1993, 1994 Matthias Mutz
5 # Copyright (c) 1998, 1999 Michael Vanier and the Free Software Foundation
7 # GNU Shogi is based on GNU Chess
8 # Copyright (c) 1992 Free Software Foundation
10 # This file is part of GNU Shogi.
12 # GNU Shogi is free software; you can redistribute it and/or modify
13 # it under the terms of the GNU General Public License as published by
14 # the Free Software Foundation; either version 3 of the License, or (at your option)
17 # GNU Shogi is distributed in the hope that it will be useful,
18 # but WITHOUT ANY WARRANTY; without even the implied warranty of
19 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 # GNU General Public License for more details.
22 # You should have received a copy of the GNU General Public License
23 # along with GNU Shogi; see the file COPYING.
24 # If not, see <http://www.gnu.org/licenses/>.
28 # gnushogi is GNU shogi, for raw text, curses, or x output.
29 # pat2inc converts pattern textfile to "pattern.inc" include file.
30 # sizetest shows the memory usage of the main data structures.
36 INSTALL_DATA = @INSTALL_DATA@
37 INSTALL_PROGRAM = @INSTALL_PROGRAM@
43 # Installation directory.
46 # Where the binaries live.
47 BINDIR = $(prefix)/bin
49 # Where the language description, the book, and the
50 # persistent hashtable live.
51 LIBDIR = $(prefix)/lib/gnushogi
53 # Where the man page goes.
54 MANDIR = $(prefix)/man/man6
56 # Where the info file goes.
57 INFODIR = $(prefix)/info
67 # C compiler and compiler options.
71 CWARNINGS = @WARNINGS@
72 CEXTRAFLAGS = @CEXTRAFLAGS@
73 CFLAGS = @CFLAGS@ $(CEXTRAFLAGS) $(CWARNINGS) -I$(ROOT) -I@top_builddir@
76 # The hashfile is a record of positions seen. It is used by
77 # GNU Shogi to avoid making the same mistakes, a form of learning.
79 HASH = -DHASHFILE=\"$(LIBDIR)/gnushogi.hsh\"
82 # The "book" is a record of the first few moves, for playing good
83 # moves easily and quickly, saving time, and irritating the human
86 TEXTBOOK = -DBOOK=\"$(LIBDIR)/gnushogi.tbk\"
87 BINBOOK = -DBINBOOK=\"$(LIBDIR)/gnushogi.bbk\"
90 # The pattern file contains various opening patterns. The program tries to
91 # obtain such a pattern in the opening stage. Sequences of opening
92 # patterns may be described in order to support the correct order of moves.
94 PATTERN = -DPATTERNFILE=\"$(ROOT)/misc/gnushogi.pat\"
98 @echo No target specified.
121 GNUSHOGI_FILES = $(COMMONFILES) main.o
124 PAT2INCFILES = $(COMMONFILES) makepattern.o pat2inc.o
132 $(CC) $(CFLAGS) -o gnushogi $(GNUSHOGI_FILES) $(LDFLAGS) $(LCURSES) $(LIBS)
135 $(CC) $(CFLAGS) -o pat2inc $(PAT2INCFILES) $(LDFLAGS) $(LCURSES) $(LIBS)
138 $(CC) $(CFLAGS) -o sizetest sizetest.o $(LDFLAGS) $(LIBS)
141 $(MAKE) -f Makefile.profile gnushogi
150 $(CC) $(CFLAGS) -c $<
153 $(CC) $(CFLAGS) $(TEXTBOOK) $(BINBOOK) -c $<
155 commondsp.o: commondsp.c
156 $(CC) $(CFLAGS) -c $<
158 cursesdsp.o: cursesdsp.c
159 $(CC) $(CFLAGS) -c $<
161 dspwrappers.o: dspwrappers.c
162 $(CC) $(CFLAGS) -c $<
165 $(CC) $(CFLAGS) -c $<
168 $(CC) $(CFLAGS) -c $<
171 $(CC) $(CFLAGS) -c $<
174 $(CC) $(CFLAGS) -c $<
177 $(CC) $(CFLAGS) $(BINBOOK) -c $<
179 # To create "pattern.inc" with "pat2inc", the external
180 # pattern textfile must be used.
182 makepattern.o: makepattern.c
183 $(CC) $(CFLAGS) $(PATTERN) -c $<
186 $(CC) $(CFLAGS) -c $<
189 $(CC) $(CFLAGS) -c $<
192 $(CC) $(CFLAGS) -c $<
195 $(CC) $(CFLAGS) -c $<
198 $(CC) $(CFLAGS) -c $<
201 # Files specific to particular targets.
204 $(CC) $(CFLAGS) $(BINBOOK) $(PATTERN) -c $<
206 sizetest.o: sizetest.c
207 $(CC) $(CFLAGS) -c $<
215 @if [ -f ./gnushogi.bbk ]; then rm ./gnushogi.bbk; fi
217 cat $(ROOT)/misc/gnushogi.tbk > _tmp_t
218 cat test | ./gnushogi -R -b _tmp_t -B ./gnushogi.bbk -S 8000 -P 40 3 0
229 $(INSTALL_PROGRAM) -d $(BINDIR)
230 $(INSTALL_PROGRAM) -d $(LIBDIR)
231 $(INSTALL_PROGRAM) -d $(MANDIR)
232 $(INSTALL_PROGRAM) -d $(INFODIR)
233 $(INSTALL_PROGRAM) gnushogi $(BINDIR)
234 $(INSTALL_DATA) $(ROOT)/doc/gnushogi.6 $(MANDIR)
235 $(INSTALL_DATA) $(ROOT)/doc/gnushogi.info* $(INFODIR)
236 $(INSTALL_DATA) gnushogi.bbk $(LIBDIR)/gnushogi.bbk
243 CLEANFILES = *.o gnushogi sizetest pat2inc CLp* *.bbk
246 @for file in $(CLEANFILES); do \
247 if [ -f $$file ]; then rm $$file; fi; \
255 gnushogi: $(GNUSHOGI_FILES)
256 pat2inc: $(PAT2INCFILES)
258 attacks.o: attacks.c gnushogi.h
259 book.o: book.c gnushogi.h
260 commondsp.o: commondsp.c gnushogi.h
261 cursesdsp.o: cursesdsp.c gnushogi.h
262 dspwrappers.o: dspwrappers.c gnushogi.h
263 genmove.o: genmove.c gnushogi.h
264 globals.o: globals.c gnushogi.h
265 eval.o: eval.c eval.h gnushogi.h $(SRCDIR)/pattern.h
266 init.o: init.c gnushogi.h $(SRCDIR)/pattern.h
267 main.o: main.c gnushogi.h
268 makepattern.o: pattern.c gnushogi.h $(SRCDIR)/pattern.h
269 pattern.o: pattern.c gnushogi.h $(SRCDIR)/pattern.h $(SRCDIR)/pattern.inc
270 rawdsp.o: rawdsp.c gnushogi.h
271 search.o: search.c gnushogi.h
272 tcontrl.o: tcontrl.c gnushogi.h
273 util.o: util.c gnushogi.h
274 pat2inc.o: pat2inc.c $(SRCDIR)/pattern.h $(SRCDIR)/gnushogi.h
275 sizetest.o: sizetest.c $(SRCDIR)/gnushogi.h $(SRCDIR)/eval.h
276 gnushogi.bbk: gnushogi