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 1, 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.  If not, write to
25# the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
26#
27
28ROOT        = @top_srcdir@
29BUILDROOT   = @top_builddir@
30GNUSHOGIDIR = $(BUILDROOT)/gnushogi
31
32PROGNAME = @PROGNAME@
33
34#
35# Default targets.
36#
37
38all : gnushogi_compile pat2inc bbk
39
40
41#
42# Primary targets.
43#
44
45gnushogi_compile:
46	-cd $(GNUSHOGIDIR) && $(MAKE) $(PROGNAME)
47
48pat2inc:
49	-cd $(GNUSHOGIDIR) && $(MAKE) pat2inc
50
51sizetest:
52	-cd $(GNUSHOGIDIR) && $(MAKE) sizetest
53
54bbk:
55	-cd $(GNUSHOGIDIR) && $(MAKE) $(PROGNAME).bbk
56
57
58#
59# Alien target architectures
60#
61
62win32/Makefile: misc/mkmakefile.mingw-on-cygwin
63	$<
64
65#
66# Installation.
67#
68
69install: gnushogi_install
70
71gnushogi_install:
72	-cd $(GNUSHOGIDIR) && $(MAKE) install
73
74
75
76#
77# Cleanup.
78#
79
80clean: gnushogi_clean doc_clean
81
82gnushogi_clean:
83	cd $(GNUSHOGIDIR) && $(MAKE) clean
84
85doc_clean:
86	cd $(BUILDROOT)/doc && $(MAKE) clean
87
88
89#
90# Building a distribution.
91#
92
93DISTNAME = @PACKAGE_TARNAME@-@PACKAGE_VERSION@
94
95dist:
96	$(MAKE) maintainerclean
97	rm -rf $(DISTNAME)
98	mkdir $(DISTNAME)
99	tar -cf - --exclude .git --exclude $(DISTNAME) $(ROOT) | (cd $(DISTNAME) && tar -xf -)
100	cd $(DISTNAME) && $(ROOT)/autogen.sh && $(ROOT)/configure
101	cd $(DISTNAME)/doc && $(MAKE) info
102	cd $(DISTNAME) && $(MAKE) win32/Makefile
103	cd $(DISTNAME) && $(MAKE) distclean
104	tar -zcf $(DISTNAME).tar.gz $(DISTNAME)
105
106#
107# Return to a pristine pre-configuration state.
108#
109
110DISTCLEANFILES = \
111	config.cache config.log config.status config.h Makefile \
112    $(GNUSHOGIDIR)/Makefile $(GNUSHOGIDIR)/Makefile.profile \
113    autom4te.cache
114
115distclean: clean
116	rm -rf $(DISTCLEANFILES)
117	find -name '*~' | xargs rm -f
118	cd $(BUILDROOT)/doc && $(MAKE) distclean
119
120#
121# Extra cleanup, for the maintainer only.
122#
123
124MAINTAINERCLEANFILES = configure config.h.in win32/Makefile
125
126maintainerclean: distclean
127	rm -f $(MAINTAINERCLEANFILES)
128	cd $(BUILDROOT)/doc && $(MAKE) maintainerclean
129