83746482101636d9a460074f8da3a4c5ab476fe9
[gnushogi.git] / gnushogi / Makefile.profile.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 INSTALL         = @INSTALL@
35 INSTALL_DATA    = @INSTALL_DATA@
36 INSTALL_PROGRAM = @INSTALL_PROGRAM@
37 ROOT            = ..
38
39
40 # Installation directory.
41 prefix  =   @prefix@
42
43 # Where the binaries live.
44 BINDIR  =   $(prefix)/bin
45
46 # Where the language description, the book, and the 
47 # persistent hashtable live.
48 LIBDIR  =   $(prefix)/lib/gnushogi
49
50 # Where the man page goes.
51 MANDIR  = $(prefix)/man/man6
52
53 # Where the info file goes.
54 INFODIR = $(prefix)/info
55
56 # For _pow external 
57 LIBS    = -lm
58
59 # Display routines.
60 LCURSES =   -lcurses -ltermcap
61
62
63 #
64 # C compiler and compiler options.
65 #
66
67 CC          = @CC@
68 CWARNINGS   = @WARNINGS@
69 CEXTRAFLAGS = @CEXTRAFLAGS2@
70 CFLAGS      = -g $(CEXTRAFLAGS) $(CWARNINGS) -I..
71
72
73 # The hashfile is a record of positions seen. It is used by
74 # GNU Shogi to avoid making the same mistakes, a form of learning.
75
76 HASH       = -DHASHFILE=\"$(LIBDIR)/gnushogi.hsh\"
77
78
79 # The "book" is a record of the first few moves, for playing good
80 # moves easily and quickly, saving time, and irritating the human
81 # opponent.
82
83 TEXTBOOK   = -DBOOK=\"$(LIBDIR)/gnushogi.tbk\"
84 BINBOOK    = -DBINBOOK=\"$(LIBDIR)/gnushogi.bbk\"
85
86
87 # The language file describes capabilities of the program.  It may
88 # be useful for customizing gnushogi for non-English-speaking players.
89
90 LANGF      = -DLANGFILE=\"../misc/gnushogi.lng\"
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 PATTERN    = -DPATTERNFILE=\"../misc/gnushogi.pat\"
98
99
100 all:
101         @echo No target specified.
102
103
104 #
105 # Source files.
106 #
107
108 COMMONFILES = \
109                 attacks.o      \
110                 book.o         \
111                 commondsp.o    \
112                 cursesdsp.o    \
113                 dspwrappers.o  \
114                 eval.o         \
115                 genmove.o      \
116                 globals.o      \
117                 init.o         \
118                 pattern.o      \
119                 rawdsp.o       \
120                 search.o       \
121                 tcontrl.o      \
122                 util.o
123
124 GNUSHOGI_FILES  = $(COMMONFILES) main.o      
125
126
127 PAT2INCFILES    = $(COMMONFILES) makepattern.o pat2inc.o
128
129
130 #
131 # Primary targets.
132 #
133
134 gnushogi:
135         $(CC) $(CFLAGS) -o gnushogi $(GNUSHOGI_FILES) $(LCURSES) $(LIBS)
136
137 pat2inc:
138         $(CC) $(CFLAGS) -o pat2inc $(PAT2INCFILES) $(LCURSES) $(LIBS)
139
140 sizetest:
141         $(CC) $(CFLAGS) -o sizetest sizetest.o $(LIBS)
142
143
144 #
145 # Object files.
146 #
147
148 # Common files.
149
150 attacks.o:
151         $(CC) $(CFLAGS) -c attacks.c
152
153 book.o:
154         $(CC) $(CFLAGS) $(TEXTBOOK) $(BINBOOK) -c book.c 
155
156 commondsp.o:
157         $(CC) $(CFLAGS) -c commondsp.c 
158
159 cursesdsp.o:
160         $(CC) $(CFLAGS) -c cursesdsp.c
161
162 dspwrappers.o:
163         $(CC) $(CFLAGS) -c dspwrappers.c
164
165 genmove.o:
166         $(CC) $(CFLAGS) -c genmove.c
167
168 globals.o:
169         $(CC) $(CFLAGS) -c globals.c
170
171 eval.o:
172         $(CC) $(CFLAGS) -c eval.c
173
174 init.o:
175         $(CC)  $(CFLAGS) $(LANGF) -c init.c
176
177 main.o:
178         $(CC) $(CFLAGS) $(BINBOOK) -c main.c
179
180 # To create "pattern.inc" with "pat2inc", the external
181 # pattern textfile must be used.
182
183 makepattern.o:
184         $(CC) $(CFLAGS) $(PATTERN) -c makepattern.c
185
186 pattern.o:
187         $(CC)  $(CFLAGS) -c pattern.c
188
189 rawdsp.o:
190         $(CC) $(CFLAGS) -c rawdsp.c 
191
192 search.o:
193         $(CC) $(CFLAGS) -c search.c
194
195 tcontrl.o:
196         $(CC) $(CFLAGS) -c tcontrl.c
197
198 util.o:
199         $(CC) $(CFLAGS) -c util.c
200
201
202 # Files specific to particular targets.
203
204 pat2inc.o:
205         $(CC) $(CFLAGS) $(LANGF) $(BINBOOK) $(PATTERN) -c pat2inc.c
206
207 sizetest.o:
208         $(CC) $(CFLAGS) -c sizetest.c
209
210
211 #
212 # Other targets.
213 #
214
215 gnushogi.bbk: 
216         @if [ -f ./gnushogi.bbk ]; then rm ./gnushogi.bbk; fi
217         echo quit > test
218         cat ../misc/gnushogi.tbk > _tmp_t
219         cat test | ./gnushogi -R -b _tmp_t -B ./gnushogi.bbk -S 8000 -P 40 3 0
220         rm test _tmp_t
221         @echo
222
223
224 #
225 # Installation.
226 #
227
228 install: gnushogi
229         strip gnushogi
230         $(INSTALL_PROGRAM) -d $(BINDIR)
231         $(INSTALL_PROGRAM) -d $(LIBDIR)
232         $(INSTALL_PROGRAM) -d $(MANDIR)
233         $(INSTALL_PROGRAM) -d $(INFODIR)
234         $(INSTALL_PROGRAM) gnushogi $(BINDIR)
235         $(INSTALL_DATA)    $(ROOT)/doc/gnushogi.6     $(MANDIR)
236         $(INSTALL_DATA)    $(ROOT)/doc/gnushogi.info* $(INFODIR)
237         $(INSTALL_DATA)    gnushogi.bbk $(LIBDIR)/gnushogi.bbk
238
239
240 #
241 # Cleanup.
242 #
243
244 CLEANFILES = *.o gnushogi sizetest pat2inc CLp* *.bbk
245
246 clean: 
247         @for file in $(CLEANFILES); do \
248         if [ -f $$file ]; then rm $$file; fi; \
249         done
250         @-find . -name gmon.out  -exec rm {} \;
251         @-find . -name '*.bb'    -exec rm {} \;
252         @-find . -name '*.bbg'   -exec rm {} \;
253         @-find . -name '*.da'    -exec rm {} \;
254         @-find . -name '*.gcov'  -exec rm {} \;
255
256
257 #
258 # Dependencies.
259 #
260
261 gnushogi:   $(GNUSHOGI_FILES)
262 pat2inc:       $(PAT2INCFILES)
263 sizetest:      sizetest.o 
264 attacks.o:     attacks.c gnushogi.h ../version.h
265 book.o:        book.c gnushogi.h ../version.h 
266 commondsp.o:   commondsp.c gnushogi.h ../version.h
267 cursesdsp.o:   cursesdsp.c gnushogi.h ../version.h
268 dspwrappers.o: dspwrappers.c gnushogi.h ../version.h
269 genmove.o:     genmove.c gnushogi.h ../version.h
270 globals.o:     globals.c gnushogi.h ../version.h
271 eval.o:        eval.c eval.h gnushogi.h ../version.h pattern.h
272 init.o:        init.c gnushogi.h ../version.h pattern.h
273 main.o:        main.c gnushogi.h ../version.h
274 makepattern.o: pattern.c gnushogi.h pattern.h
275 pattern.o:     pattern.c gnushogi.h pattern.h pattern.inc
276 rawdsp.o:      rawdsp.c gnushogi.h ../version.h
277 search.o:      search.c gnushogi.h ../version.h 
278 tcontrl.o:     tcontrl.c gnushogi.h ../version.h 
279 util.o:        util.c gnushogi.h ../version.h
280 pat2inc.o:     pat2inc.c pattern.h gnushogi.h 
281 sizetest.o:    sizetest.c gnushogi.h eval.h
282 gnushogi.bbk:  gnushogi
283