Merge branch 'maint'
[gnushogi.git] / gnushogi / Makefile.in
blob176454c3af12dea931d669a3990553fe2b9a3519
2 # Makefile for GNU Shogi
4 # Copyright (c) 1993, 1994 Matthias Mutz
5 # Copyright (c) 1998, 1999 Michael Vanier and the Free Software Foundation
6 # Copyright (c) 2008, 2013, 2014 Yann Dirson and the Free Software Foundation
8 # GNU Shogi is based on GNU Chess
9 # Copyright (c) 1992 Free Software Foundation
11 # This file is part of GNU Shogi.
13 # GNU Shogi is free software; you can redistribute it and/or modify
14 # it under the terms of the GNU General Public License as published by
15 # the Free Software Foundation; either version 3 of the License, or (at your option)
16 # any later version.
18 # GNU Shogi is distributed in the hope that it will be useful,
19 # but WITHOUT ANY WARRANTY; without even the implied warranty of
20 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 # GNU General Public License for more details.
23 # You should have received a copy of the GNU General Public License
24 # along with GNU Shogi; see the file COPYING.
25 # If not, see <http://www.gnu.org/licenses/>.
29 # gnushogi is GNU shogi, for raw text, curses, or x output.
30 # gnuminishogi is GNU minishogi, for raw text, curses, or x output.
31 # pat2inc converts pattern textfile to "pattern.inc" include file.
32 # sizetest shows the memory usage of the main data structures.
35 SHELL = /bin/sh
36 INSTALL = @INSTALL@
37 INSTALL_DATA = @INSTALL_DATA@
38 INSTALL_PROGRAM = @INSTALL_PROGRAM@
39 ROOT = @top_srcdir@
40 SRCDIR = @srcdir@
42 VPATH=$(SRCDIR)
44 PROGNAME=@PROGNAME@
46 # Installation directory.
47 prefix = @prefix@
49 # Where the binaries live.
50 BINDIR = $(prefix)/bin
52 # Where the language description, the book, and the
53 # persistent hashtable live.
54 LIBDIR = $(prefix)/lib/$(PROGNAME)
56 # Where the man page goes.
57 MANDIR = $(prefix)/man/man6
59 # Where the info file goes.
60 INFODIR = $(prefix)/info
62 # For _pow external
63 LIBS = -lm
65 # Display routines.
66 LCURSES = @LIBCURSES@
70 # C compiler and compiler options.
73 CC = @CC@
74 CWARNINGS = @WARNINGS@
75 CEXTRAFLAGS = @CEXTRAFLAGS@
76 CFLAGS = @CFLAGS@ $(HASH) $(CEXTRAFLAGS) $(CWARNINGS) -I. -I@top_builddir@ -I$(ROOT)
77 LDFLAGS = @LDFLAGS@
79 # The hashfile is a record of positions seen. It is used by
80 # GNU Shogi to avoid making the same mistakes, a form of learning.
82 HASH = -DHASHFILE=\"$(LIBDIR)/$(PROGNAME).hsh\"
85 # The "book" is a record of the first few moves, for playing good
86 # moves easily and quickly, saving time, and irritating the human
87 # opponent.
89 TEXTBOOK = -DBOOK=\"$(LIBDIR)/$(PROGNAME).tbk\"
90 BINBOOK = -DBINBOOK=\"$(LIBDIR)/$(PROGNAME).bbk\"
93 # The pattern file contains various opening patterns. The program tries to
94 # obtain such a pattern in the opening stage. Sequences of opening
95 # patterns may be described in order to support the correct order of moves.
97 PATTERNFILE=$(ROOT)/misc/$(PROGNAME).pat
100 all:
101 @echo No target specified.
105 # Source files.
108 COMMONFILES = \
109 globals.o \
110 init-common.o \
111 pattern-common.o
113 NOTCOMMONFILES = \
114 attacks.o \
115 book.o \
116 commondsp.o \
117 @CURSESDSP@ \
118 eval.o \
119 genmove.o \
120 init.o \
121 pattern.o \
122 rawdsp.o \
123 search.o \
124 tcontrl.o \
125 util.o
127 GNUSHOGI_FILES = $(COMMONFILES) $(NOTCOMMONFILES) main.o
130 PAT2INCFILES = $(COMMONFILES) makepattern.o pat2inc.o
134 # Primary targets.
137 $(PROGNAME):
138 $(CC) $(CFLAGS) -o $(PROGNAME) $(GNUSHOGI_FILES) $(LDFLAGS) $(LCURSES) $(LIBS)
140 pat2inc:
141 $(CC) $(CFLAGS) -o pat2inc $(PAT2INCFILES) $(LDFLAGS) $(LCURSES) $(LIBS)
143 sizetest:
144 $(CC) $(CFLAGS) -o sizetest sizetest.o $(LDFLAGS) $(LIBS)
146 profile:
147 $(MAKE) -f Makefile.profile gnushogi
150 # Object files.
153 # Common files.
155 attacks.o: attacks.c
156 $(CC) $(CFLAGS) -c $<
158 book.o: book.c
159 $(CC) $(CFLAGS) $(TEXTBOOK) $(BINBOOK) -c $<
161 commondsp.o: commondsp.c
162 $(CC) $(CFLAGS) -c $<
164 cursesdsp.o: cursesdsp.c
165 $(CC) $(CFLAGS) -c $<
167 genmove.o: genmove.c
168 $(CC) $(CFLAGS) -c $<
170 globals.o: globals.c
171 $(CC) $(CFLAGS) -c $<
173 eval.o: eval.c
174 $(CC) $(CFLAGS) -c $<
176 init.o: init.c
177 $(CC) $(CFLAGS) -c $<
179 init-common.o: init-common.c
180 $(CC) $(CFLAGS) $(LANGF) -c $<
182 main.o: main.c
183 $(CC) $(CFLAGS) $(BINBOOK) -c $<
185 # To create "pattern.inc" with "pat2inc", the external
186 # pattern textfile must be used.
188 makepattern.o: makepattern.c
189 $(CC) $(CFLAGS) -c $<
191 pattern.o: pattern.c
192 $(CC) $(CFLAGS) -c $<
194 pattern-common.o: pattern-common.c
195 $(CC) $(CFLAGS) -c $<
197 rawdsp.o: rawdsp.c
198 $(CC) $(CFLAGS) -c $<
200 search.o: search.c
201 $(CC) $(CFLAGS) -c $<
203 tcontrl.o: tcontrl.c
204 $(CC) $(CFLAGS) -c $<
206 util.o: util.c
207 $(CC) $(CFLAGS) -c $<
210 # Files specific to particular targets.
212 pat2inc.o: pat2inc.c
213 $(CC) $(CFLAGS) -c $<
215 sizetest.o: sizetest.c
216 $(CC) $(CFLAGS) -c $<
218 pattern.inc: $(PATTERNFILE) pat2inc
219 ./pat2inc $< $@
222 # Other targets.
225 $(PROGNAME).bbk:
226 @if [ -f ./$(PROGNAME).bbk ]; then rm ./$(PROGNAME).bbk; fi
227 echo quit > test
228 cat $(ROOT)/misc/$(PROGNAME).tbk > _tmp_t
229 cat test | ./$(PROGNAME) -R -b _tmp_t -B ./$(PROGNAME).bbk -S 8000 -P 40 3 0
230 rm test _tmp_t
231 @echo
235 # Installation.
238 install: $(PROGNAME)
239 strip $(PROGNAME)
240 $(INSTALL_PROGRAM) -d $(BINDIR)
241 $(INSTALL_PROGRAM) -d $(LIBDIR)
242 $(INSTALL_PROGRAM) -d $(MANDIR)
243 $(INSTALL_PROGRAM) -d $(INFODIR)
244 $(INSTALL_PROGRAM) $(PROGNAME) $(BINDIR)
245 $(INSTALL_DATA) $(ROOT)/doc/gnushogi.6 $(MANDIR)
246 $(INSTALL_DATA) $(ROOT)/doc/gnushogi.info* $(INFODIR)
247 $(INSTALL_DATA) $(PROGNAME).bbk $(LIBDIR)/$(PROGNAME).bbk
251 # Cleanup.
254 CLEANFILES = *.o gnushogi gnuminishogi sizetest pat2inc CLp* *.bbk
256 clean:
257 @for file in $(CLEANFILES); do \
258 if [ -f $$file ]; then rm $$file; fi; \
259 done
263 # Dependencies.
266 $(PROGNAME): $(GNUSHOGI_FILES)
267 pat2inc: $(PAT2INCFILES)
268 sizetest: sizetest.o
269 attacks.o: attacks.c gnushogi.h
270 book.o: book.c gnushogi.h
271 commondsp.o: commondsp.c gnushogi.h
272 cursesdsp.o: cursesdsp.c gnushogi.h
273 genmove.o: genmove.c gnushogi.h
274 globals.o: globals.c gnushogi.h
275 eval.o: eval.c eval.h gnushogi.h $(SRCDIR)/pattern.h
276 init.o: init.c gnushogi.h $(SRCDIR)/pattern.h
277 init-common.o: init-common.c gnushogi.h
278 main.o: main.c gnushogi.h
279 makepattern.o: pattern.c gnushogi.h $(SRCDIR)/pattern.h
280 pattern.o: pattern.c gnushogi.h $(SRCDIR)/pattern.h pattern.inc
281 rawdsp.o: rawdsp.c gnushogi.h
282 search.o: search.c gnushogi.h
283 tcontrl.o: tcontrl.c gnushogi.h
284 util.o: util.c gnushogi.h
285 pat2inc.o: pat2inc.c $(SRCDIR)/pattern.h $(SRCDIR)/gnushogi.h
286 sizetest.o: sizetest.c $(SRCDIR)/gnushogi.h $(SRCDIR)/eval.h
287 $(PROGNAME).bbk: $(PROGNAME)