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