Update copyright info for 2008 (minishogi patches) and recent developments.
[gnushogi.git] / gnushogi / Makefile.in
1 #
2 # Makefile for GNU Shogi
3 #
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
7 #
8 # GNU Shogi is based on GNU Chess
9 # Copyright (c) 1992 Free Software Foundation
10 #
11 # This file is part of GNU Shogi.
12 #
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.
17 #
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.
22 #
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/>.
26 #
27
28 #
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.
33 #
34
35 SHELL           = /bin/sh
36 INSTALL         = @INSTALL@
37 INSTALL_DATA    = @INSTALL_DATA@
38 INSTALL_PROGRAM = @INSTALL_PROGRAM@
39 ROOT            = @top_srcdir@
40 SRCDIR          = @srcdir@
41
42 VPATH=$(SRCDIR)
43
44 PROGNAME=@PROGNAME@
45
46 # Installation directory.
47 prefix  =   @prefix@
48
49 # Where the binaries live.
50 BINDIR  =   $(prefix)/bin
51
52 # Where the language description, the book, and the 
53 # persistent hashtable live.
54 LIBDIR  =   $(prefix)/lib/$(PROGNAME)
55
56 # Where the man page goes.
57 MANDIR  = $(prefix)/man/man6
58
59 # Where the info file goes.
60 INFODIR = $(prefix)/info
61
62 # For _pow external 
63 LIBS    = -lm
64
65 # Display routines.
66 LCURSES = @LIBCURSES@
67
68
69 #
70 # C compiler and compiler options.
71 #
72
73 CC          = @CC@
74 CWARNINGS   = @WARNINGS@
75 CEXTRAFLAGS = @CEXTRAFLAGS@
76 CFLAGS      = @CFLAGS@ $(HASH) $(CEXTRAFLAGS) $(CWARNINGS) -I. -I@top_builddir@ -I$(ROOT)
77 LDFLAGS     = @LDFLAGS@
78
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.
81
82 HASH       = -DHASHFILE=\"$(LIBDIR)/$(PROGNAME).hsh\"
83
84
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.
88
89 TEXTBOOK   = -DBOOK=\"$(LIBDIR)/$(PROGNAME).tbk\"
90 BINBOOK    = -DBINBOOK=\"$(LIBDIR)/$(PROGNAME).bbk\"
91
92
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.
96
97 PATTERNFILE=$(ROOT)/misc/$(PROGNAME).pat
98 PATTERN    = -DPATTERNFILE=\"$(PATTERNFILE)\"
99
100
101 all:
102         @echo No target specified.
103
104
105 #
106 # Source files.
107 #
108
109 COMMONFILES = \
110                 globals.o      \
111                 init-common.o    \
112                 pattern-common.o
113
114 NOTCOMMONFILES = \
115                 attacks.o      \
116                 book.o         \
117                 commondsp.o    \
118                 @CURSESDSP@    \
119                 dspwrappers.o  \
120                 eval.o         \
121                 genmove.o      \
122                 init.o         \
123                 pattern.o      \
124                 rawdsp.o       \
125                 search.o       \
126                 tcontrl.o      \
127                 util.o
128
129 GNUSHOGI_FILES  = $(COMMONFILES) $(NOTCOMMONFILES) main.o
130
131
132 PAT2INCFILES    = $(COMMONFILES) makepattern.o pat2inc.o
133
134
135 #
136 # Primary targets.
137 #
138
139 $(PROGNAME):
140         $(CC) $(CFLAGS) -o $(PROGNAME) $(GNUSHOGI_FILES) $(LDFLAGS) $(LCURSES) $(LIBS)
141
142 pat2inc:
143         $(CC) $(CFLAGS) -o pat2inc $(PAT2INCFILES) $(LDFLAGS) $(LCURSES) $(LIBS)
144
145 sizetest:
146         $(CC) $(CFLAGS) -o sizetest sizetest.o $(LDFLAGS) $(LIBS)
147
148 profile:
149         $(MAKE) -f Makefile.profile gnushogi
150
151 #
152 # Object files.
153 #
154
155 # Common files.
156
157 attacks.o: attacks.c
158         $(CC) $(CFLAGS) -c $<
159
160 book.o: book.c
161         $(CC) $(CFLAGS) $(TEXTBOOK) $(BINBOOK) -c $<
162
163 commondsp.o: commondsp.c
164         $(CC) $(CFLAGS) -c $<
165
166 cursesdsp.o: cursesdsp.c
167         $(CC) $(CFLAGS) -c $<
168
169 dspwrappers.o: dspwrappers.c
170         $(CC) $(CFLAGS) -c $<
171
172 genmove.o: genmove.c
173         $(CC) $(CFLAGS) -c $<
174
175 globals.o: globals.c
176         $(CC) $(CFLAGS) -c $<
177
178 eval.o: eval.c
179         $(CC) $(CFLAGS) -c $<
180
181 init.o: init.c
182         $(CC)  $(CFLAGS) -c $<
183
184 init-common.o: init-common.c
185         $(CC)  $(CFLAGS) $(LANGF) -c $<
186
187 main.o: main.c
188         $(CC) $(CFLAGS) $(BINBOOK) -c $<
189
190 # To create "pattern.inc" with "pat2inc", the external
191 # pattern textfile must be used.
192
193 makepattern.o: makepattern.c
194         $(CC) $(CFLAGS) $(PATTERN) -c $<
195
196 pattern.o: pattern.c
197         $(CC)  $(CFLAGS) -c $<
198
199 pattern-common.o: pattern-common.c
200         $(CC)  $(CFLAGS) -c $<
201
202 rawdsp.o: rawdsp.c
203         $(CC) $(CFLAGS) -c $<
204
205 search.o: search.c
206         $(CC) $(CFLAGS) -c $<
207
208 tcontrl.o: tcontrl.c
209         $(CC) $(CFLAGS) -c $<
210
211 util.o: util.c
212         $(CC) $(CFLAGS) -c $<
213
214
215 # Files specific to particular targets.
216
217 pat2inc.o: pat2inc.c
218         $(CC) $(CFLAGS) -c $<
219
220 sizetest.o: sizetest.c
221         $(CC) $(CFLAGS) -c $<
222
223 pattern.inc: $(PATTERNFILE) pat2inc
224         ./pat2inc
225
226 #
227 # Other targets.
228 #
229
230 $(PROGNAME).bbk:
231         @if [ -f ./$(PROGNAME).bbk ]; then rm ./$(PROGNAME).bbk; fi
232         echo quit > test
233         cat $(ROOT)/misc/$(PROGNAME).tbk > _tmp_t
234         cat test | ./$(PROGNAME) -R -b _tmp_t -B ./$(PROGNAME).bbk -S 8000 -P 40 3 0
235         rm test _tmp_t
236         @echo
237
238
239 #
240 # Installation.
241 #
242
243 install: $(PROGNAME)
244         strip $(PROGNAME)
245         $(INSTALL_PROGRAM) -d $(BINDIR)
246         $(INSTALL_PROGRAM) -d $(LIBDIR)
247         $(INSTALL_PROGRAM) -d $(MANDIR)
248         $(INSTALL_PROGRAM) -d $(INFODIR)
249         $(INSTALL_PROGRAM) $(PROGNAME) $(BINDIR)
250         $(INSTALL_DATA)    $(ROOT)/doc/gnushogi.6     $(MANDIR)
251         $(INSTALL_DATA)    $(ROOT)/doc/gnushogi.info* $(INFODIR)
252         $(INSTALL_DATA)    $(PROGNAME).bbk $(LIBDIR)/$(PROGNAME).bbk
253
254
255 #
256 # Cleanup.
257 #
258
259 CLEANFILES = *.o gnushogi gnuminishogi sizetest pat2inc CLp* *.bbk
260
261 clean: 
262         @for file in $(CLEANFILES); do \
263         if [ -f $$file ]; then rm $$file; fi; \
264         done
265
266
267 #
268 # Dependencies.
269 #
270
271 $(PROGNAME):   $(GNUSHOGI_FILES)
272 pat2inc:       $(PAT2INCFILES)
273 sizetest:      sizetest.o 
274 attacks.o:     attacks.c gnushogi.h
275 book.o:        book.c gnushogi.h
276 commondsp.o:   commondsp.c gnushogi.h
277 cursesdsp.o:   cursesdsp.c gnushogi.h
278 dspwrappers.o: dspwrappers.c gnushogi.h
279 genmove.o:     genmove.c gnushogi.h
280 globals.o:     globals.c gnushogi.h
281 eval.o:        eval.c eval.h gnushogi.h $(SRCDIR)/pattern.h
282 init.o:        init.c gnushogi.h $(SRCDIR)/pattern.h
283 main.o:        main.c gnushogi.h
284 makepattern.o: pattern.c gnushogi.h $(SRCDIR)/pattern.h
285 pattern.o:     pattern.c gnushogi.h $(SRCDIR)/pattern.h pattern.inc
286 rawdsp.o:      rawdsp.c gnushogi.h
287 search.o:      search.c gnushogi.h
288 tcontrl.o:     tcontrl.c gnushogi.h
289 util.o:        util.c gnushogi.h
290 pat2inc.o:     pat2inc.c $(SRCDIR)/pattern.h $(SRCDIR)/gnushogi.h
291 sizetest.o:    sizetest.c $(SRCDIR)/gnushogi.h $(SRCDIR)/eval.h
292 $(PROGNAME).bbk:  $(PROGNAME)
293