Changing license to GPL3 (and bumping version to 1.4.0).
[gnushogi.git] / gnushogi / Makefile.profile.in
blob61e53a949de4fac69607d3ebfe419cb9c30ed404
2 # Makefile for GNU Shogi
4 # Copyright (c) 2012 Free Software Foundation
6 # GNU Shogi is based on GNU Chess
8 # This file is part of GNU Shogi.
10 # GNU Shogi is free software; you can redistribute it and/or modify
11 # it under the terms of the GNU General Public License as published by
12 # the Free Software Foundation; either ../version 3 of the License, or (at your option)
13 # any later ../version.
15 # GNU Shogi is distributed in the hope that it will be useful,
16 # but WITHOUT ANY WARRANTY; without even the implied warranty of
17 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18 # GNU General Public License for more details.
20 # You should have received a copy of the GNU General Public License
21 # along with GNU Shogi; see the file COPYING.
22 # If not, see <http://www.gnu.org/licenses/>.
26 # gnushogi   is GNU shogi, for raw text, curses, or x output.
27 # pat2inc    converts pattern textfile to "pattern.inc" include file.
28 # sizetest   shows the memory usage of the main data structures.
31 SHELL           = /bin/sh
32 VERS            = 1.3
33 INSTALL         = @INSTALL@
34 INSTALL_DATA    = @INSTALL_DATA@
35 INSTALL_PROGRAM = @INSTALL_PROGRAM@
36 ROOT            = ..
39 # Installation directory.
40 prefix  =   @prefix@
42 # Where the binaries live.
43 BINDIR  =   $(prefix)/bin
45 # Where the language description, the book, and the 
46 # persistent hashtable live.
47 LIBDIR  =   $(prefix)/lib/gnushogi
49 # Where the man page goes.
50 MANDIR  = $(prefix)/man/man6
52 # Where the info file goes.
53 INFODIR = $(prefix)/info
55 # For _pow external 
56 LIBS    = -lm
58 # Display routines.
59 LCURSES =   -lcurses -ltermcap
63 # C compiler and compiler options.
66 CC          = @CC@
67 CWARNINGS   = @WARNINGS@
68 CEXTRAFLAGS = @CEXTRAFLAGS2@
69 CFLAGS      = -g $(CEXTRAFLAGS) $(CWARNINGS) -I..
72 # The hashfile is a record of positions seen. It is used by
73 # GNU Shogi to avoid making the same mistakes, a form of learning.
75 HASH       = -DHASHFILE=\"$(LIBDIR)/gnushogi.hsh\"
78 # The "book" is a record of the first few moves, for playing good
79 # moves easily and quickly, saving time, and irritating the human
80 # opponent.
82 TEXTBOOK   = -DBOOK=\"$(LIBDIR)/gnushogi.tbk\"
83 BINBOOK    = -DBINBOOK=\"$(LIBDIR)/gnushogi.bbk\"
86 # The language file describes capabilities of the program.  It may
87 # be useful for customizing gnushogi for non-English-speaking players.
89 LANGF      = -DLANGFILE=\"../misc/gnushogi.lng\"
92 # The pattern file contains various opening patterns. The program tries to
93 # obtain such a pattern in the opening stage. Sequences of opening
94 # patterns may be described in order to support the correct order of moves.
96 PATTERN    = -DPATTERNFILE=\"../misc/gnushogi.pat\"
99 all:
100         @echo No target specified.
104 # Source files.
107 COMMONFILES = \
108                 attacks.o      \
109                 book.o         \
110                 commondsp.o    \
111                 cursesdsp.o    \
112                 dspwrappers.o  \
113                 eval.o         \
114                 genmove.o      \
115                 globals.o      \
116                 init.o         \
117                 pattern.o      \
118                 rawdsp.o       \
119                 search.o       \
120                 sysdeps.o      \
121                 tcontrl.o      \
122                 util.o
124 GNUSHOGI_FILES  = $(COMMONFILES) main.o      
127 PAT2INCFILES    = $(COMMONFILES) makepattern.o pat2inc.o
131 # Primary targets.
134 gnushogi:
135         $(CC) $(CFLAGS) -o gnushogi $(GNUSHOGI_FILES) $(LCURSES) $(LIBS)
137 pat2inc:
138         $(CC) $(CFLAGS) -o pat2inc $(PAT2INCFILES) $(LCURSES) $(LIBS)
140 sizetest:
141         $(CC) $(CFLAGS) -o sizetest sizetest.o $(LIBS)
145 # Object files.
148 # Common files.
150 attacks.o:
151         $(CC) $(CFLAGS) -c attacks.c
153 book.o:
154         $(CC) $(CFLAGS) $(TEXTBOOK) $(BINBOOK) -c book.c 
156 commondsp.o:
157         $(CC) $(CFLAGS) -c commondsp.c 
159 cursesdsp.o:
160         $(CC) $(CFLAGS) -c cursesdsp.c
162 dspwrappers.o:
163         $(CC) $(CFLAGS) -c dspwrappers.c
165 genmove.o:
166         $(CC) $(CFLAGS) -c genmove.c
168 globals.o:
169         $(CC) $(CFLAGS) -c globals.c
171 eval.o:
172         $(CC) $(CFLAGS) -c eval.c
174 init.o:
175         $(CC)  $(CFLAGS) $(LANGF) -c init.c
177 main.o:
178         $(CC) $(CFLAGS) $(BINBOOK) -c main.c
180 # To create "pattern.inc" with "pat2inc", the external
181 # pattern textfile must be used.
183 makepattern.o:
184         $(CC) $(CFLAGS) $(PATTERN) -c makepattern.c
186 pattern.o:
187         $(CC)  $(CFLAGS) -c pattern.c
189 rawdsp.o:
190         $(CC) $(CFLAGS) -c rawdsp.c 
192 search.o:
193         $(CC) $(CFLAGS) -c search.c
195 sysdeps.o:
196         $(CC) $(CFLAGS) -c sysdeps.c 
198 tcontrl.o:
199         $(CC) $(CFLAGS) -c tcontrl.c
201 util.o:
202         $(CC) $(CFLAGS) -c util.c
205 # Files specific to particular targets.
207 pat2inc.o:
208         $(CC) $(CFLAGS) $(LANGF) $(BINBOOK) $(PATTERN) -c pat2inc.c
210 sizetest.o:
211         $(CC) $(CFLAGS) -c sizetest.c
215 # Other targets.
218 gnushogi.bbk: 
219         @if [ -f ./gnushogi.bbk ]; then rm ./gnushogi.bbk; fi
220         echo quit > test
221         cat ../misc/gnushogi.tbk > _tmp_t
222         cat test | ./gnushogi -R -b _tmp_t -B ./gnushogi.bbk -S 8000 -P 40 3 0
223         rm test _tmp_t
224         @echo
228 # Installation.
231 install: gnushogi
232         strip gnushogi
233         $(INSTALL_PROGRAM) -d $(BINDIR)
234         $(INSTALL_PROGRAM) -d $(LIBDIR)
235         $(INSTALL_PROGRAM) -d $(MANDIR)
236         $(INSTALL_PROGRAM) -d $(INFODIR)
237         $(INSTALL_PROGRAM) gnushogi $(BINDIR)
238         $(INSTALL_DATA)    $(ROOT)/doc/gnushogi.6     $(MANDIR)
239         $(INSTALL_DATA)    $(ROOT)/doc/gnushogi.info* $(INFODIR)
240         $(INSTALL_DATA)    gnushogi.bbk $(LIBDIR)/gnushogi.bbk
244 # Cleanup.
247 CLEANFILES = *.o gnushogi sizetest pat2inc CLp* *.bbk
249 clean: 
250         @for file in $(CLEANFILES); do \
251         if [ -f $$file ]; then rm $$file; fi; \
252         done
253         @-find . -name gmon.out  -exec rm {} \;
254         @-find . -name '*.bb'    -exec rm {} \;
255         @-find . -name '*.bbg'   -exec rm {} \;
256         @-find . -name '*.da'    -exec rm {} \;
257         @-find . -name '*.gcov'  -exec rm {} \;
261 # Dependencies.
264 gnushogi:   $(GNUSHOGI_FILES)
265 pat2inc:       $(PAT2INCFILES)
266 sizetest:      sizetest.o 
267 attacks.o:     attacks.c gnushogi.h ../version.h
268 book.o:        book.c gnushogi.h ../version.h 
269 commondsp.o:   commondsp.c gnushogi.h ../version.h
270 cursesdsp.o:   cursesdsp.c gnushogi.h ../version.h
271 dspwrappers.o: dspwrappers.c gnushogi.h ../version.h
272 genmove.o:     genmove.c gnushogi.h ../version.h
273 globals.o:     globals.c gnushogi.h ../version.h
274 eval.o:        eval.c eval.h gnushogi.h ../version.h pattern.h
275 init.o:        init.c gnushogi.h ../version.h pattern.h
276 main.o:        main.c gnushogi.h ../version.h
277 makepattern.o: pattern.c gnushogi.h pattern.h
278 pattern.o:     pattern.c gnushogi.h pattern.h pattern.inc
279 rawdsp.o:      rawdsp.c gnushogi.h ../version.h
280 search.o:      search.c gnushogi.h ../version.h 
281 sysdeps.o:     sysdeps.c gnushogi.h ../version.h
282 tcontrl.o:     tcontrl.c gnushogi.h ../version.h 
283 util.o:        util.c gnushogi.h ../version.h
284 pat2inc.o:     pat2inc.c pattern.h gnushogi.h 
285 sizetest.o:    sizetest.c gnushogi.h eval.h
286 gnushogi.bbk:  gnushogi