#
# Makefile for GNU Shogi and xshogi
#
# Copyright (c) 1993, 1994 Matthias Mutz
# Copyright (c) 1998, 1999 Michael Vanier and the Free Software Foundation
#
# GNU Shogi is based on GNU Chess
# Copyright (c) 1992 Free Software Foundation
#
# This file is part of GNU Shogi.
#
# GNU Shogi is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 1, or (at your option)
# any later version.
#
# GNU Shogi is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with GNU Shogi; see the file COPYING.  If not, write to
# the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
#

GNUSHOGIDIR = ./gnushogi
XSHOGIDIR   = ./xshogi

#
# Default targets.
#

all : gnushogi_compile pat2inc gnushogi.bbk @XSHOGI@ 


#
# Primary targets.
#

gnushogi_compile:
	-cd $(GNUSHOGIDIR); $(MAKE) gnushogi

pat2inc:
	-cd $(GNUSHOGIDIR); $(MAKE) pat2inc

sizetest:
	-cd $(GNUSHOGIDIR); $(MAKE) sizetest

xshogi_compile:
	-cd $(XSHOGIDIR); $(MAKE)

gnushogi.bbk:
	-cd $(GNUSHOGIDIR); $(MAKE) gnushogi.bbk


#
# Installation.
#

install: gnushogi_install @XSHOGIINSTALL@

gnushogi_install:
	-cd $(GNUSHOGIDIR); $(MAKE) install

xshogi_install: $(XSHOGIDIR)/xshogi
	-cd $(XSHOGIDIR); $(MAKE) install



#
# Cleanup.
#

clean: gnushogi_clean @XSHOGICLEAN@

gnushogi_clean:
	cd $(GNUSHOGIDIR); $(MAKE) clean

xshogi_clean:
	cd $(XSHOGIDIR); $(MAKE) clean


#
# Return to a pristine pre-configuration state.
#

DISTCLEANFILES = \
	config.cache config.log config.status config.h \
	Makefile $(GNUSHOGIDIR)/Makefile $(XSHOGIDIR)/Makefile

distclean: clean
	for file in $(DISTCLEANFILES); do \
        if [ -f $$file ]; then rm $$file; fi; \
        done


#
# Extra cleanup, for the maintainer only :-)
#

MAINTAINERCLEANFILES = configure config.h.in doc/gnushogi.info

maintainerclean: distclean
	for file in $(MAINTAINERCLEANFILES); do \
        if [ -f $$file ]; then rm $$file; fi; \
        done

