Add support for building gnushogi and xshogi out of source tree.
[gnushogi.git] / xshogi / Makefile.in
1 #
2 # Makefile for XShogi, part of GNU shogi.
3 #
4 # Copyright (c) 1993 Matthias Mutz
5 # Copyright (c) 1998, 1999 Michael C. Vanier and the Free Software Foundation
6 #
7 # XShogi 1.1 is based on XBoard 2.0
8 # Copyright (c) 1992 Free Software Foundation
9 #
10 # This file is part of XShogi.
11 #
12 # XShogi 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 1, or (at your option)
15 # any later version.
16 #
17 # XShogi 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 XShogi; see the file COPYING.  If not, write to
24 # the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
25 #
26
27 #
28 # xshogi is the X Windows-based user interface for GNU Shogi.
29 #
30
31 SHELL           = /bin/sh
32 VERS            = 1.3
33 INSTALL         = @INSTALL@
34 INSTALL_DATA    = @INSTALL_DATA@
35 INSTALL_PROGRAM = @INSTALL_PROGRAM@
36 ROOT            = @top_srcdir@
37 SRCDIR          = @srcdir@
38
39 VPATH=$(SRCDIR)
40
41
42 #
43 # Installation directories.
44 #
45
46 prefix  = @prefix@
47 BINDIR  = $(prefix)/bin
48 MANDIR  = $(prefix)/man/man6
49
50
51 #
52 # Parser generator.
53 #
54
55 LEX    =   @LEX@
56 YACC   =   @YACC@
57
58
59 #
60 # C compiler and compiler options.
61 #
62
63 CC          = @CC@
64 XINCLUDES   = @X_CFLAGS@
65 CWARNINGS   = @WARNINGS@
66 CEXTRAFLAGS = @CEXTRAFLAGS@
67 CFLAGS      = @CFLAGS@ $(CEXTRAFLAGS) $(XINCLUDES) -I$(ROOT) -I@top_builddir@
68 LIBS        =
69 XLIBS       = @X_LIBS@ -lXaw -lXmu -lXt -lXext -lX11
70 LDFLAGS     = $(XLIBS) $(LIBS)
71
72
73 OPT                   = @OPT@
74 FIRST_SHOGI_PROGRAM   = -DFIRST_SHOGI_PROGRAM=\"@FIRST_SHOGI_PROGRAM@\"
75 SECOND_SHOGI_PROGRAM  = -DSECOND_SHOGI_PROGRAM=\"@SECOND_SHOGI_PROGRAM@\"
76 FIRST_HOST            = -DFIRST_HOST=\"@FIRST_HOST@\"
77 SECOND_HOST           = -DSECOND_HOST=\"@SECOND_HOST@\"
78
79
80 #
81 # Targets.
82 #
83
84 all: xshogi
85
86 xshogi: 
87         $(CC) -o xshogi xshogi.o parser.o $(CFLAGS) $(LDFLAGS) 
88
89 xshogi.o: xshogi.c
90         $(CC) -c $< $(CWARNINGS) $(CFLAGS) \
91         $(OPT) $(FIRST_SHOGI_PROGRAM) $(SECOND_SHOGI_PROGRAM) \
92         $(FIRST_HOST) $(SECOND_HOST) 
93
94
95 #
96 # Regenerate the parser.  NOTE: scanner.c is never compiled; it
97 # is #included into parser.y.
98 #
99
100 parser.o: parser.c
101         $(CC) $(CFLAGS) -I$(SRCDIR) -c $<
102
103 parser.c: parser.y
104         $(YACC) $<
105         mv y.tab.c parser.c
106
107 scanner.c: scanner.l
108         $(LEX) $<
109         mv lex.yy.c scanner.c
110
111
112 #
113 # Sources.
114 #
115
116 SOURCES = xshogi.c 
117
118
119 #
120 # Installation.
121 #
122
123 install: xshogi
124         strip xshogi
125         $(INSTALL_PROGRAM) -d $(BINDIR)
126         $(INSTALL_PROGRAM) -d $(MANDIR)
127         $(INSTALL_PROGRAM) xshogi $(BINDIR)
128         $(INSTALL_DATA)    $(ROOT)/doc/xshogi.6 $(MANDIR)
129
130
131 #
132 # Cleanup.
133 #
134
135 CLEANFILES = xshogi *.o parser.c y.tab.c scanner.c lex.yy.c
136
137 clean:
138         for file in $(CLEANFILES); do \
139     if [ -f $$file ]; then rm $$file; fi; \
140         done
141
142
143 #
144 # Dependencies.
145 #
146
147 xshogi:     xshogi.o parser.o
148 xshogi.o:   xshogi.c $(SRCDIR)/sysdeps.h $(SRCDIR)/xshogi.h $(SRCDIR)/bitmaps.h $(ROOT)/version.h ../config.h
149 parser.o:   parser.c $(SRCDIR)/xshogi.h
150 parser.c:   parser.y scanner.c
151 scanner.c:  scanner.l
152