Xshogi: build scanner separately from parser.
[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 INSTALL         = @INSTALL@
33 INSTALL_DATA    = @INSTALL_DATA@
34 INSTALL_PROGRAM = @INSTALL_PROGRAM@
35 ROOT            = @top_srcdir@
36 SRCDIR          = @srcdir@
37
38 VPATH=$(SRCDIR)
39
40
41 #
42 # Installation directories.
43 #
44
45 prefix  = @prefix@
46 BINDIR  = $(prefix)/bin
47 MANDIR  = $(prefix)/man/man6
48
49
50 #
51 # Parser generator.
52 #
53
54 LEX    =   @LEX@
55 YACC   =   @YACC@
56
57
58 #
59 # C compiler and compiler options.
60 #
61
62 CC          = @CC@
63 XINCLUDES   = @X_CFLAGS@
64 CWARNINGS   = @WARNINGS@
65 CEXTRAFLAGS = @CEXTRAFLAGS@
66 CFLAGS      = @CFLAGS@ $(CEXTRAFLAGS) $(XINCLUDES) -I$(ROOT) -I@top_builddir@
67 LIBS        =
68 XLIBS       = @X_LIBS@ -lXaw -lXmu -lXt -lXext -lX11
69 LDFLAGS     = @LDFLAGS@ $(XLIBS) $(LIBS)
70
71
72 OPT                   = @OPT@
73 FIRST_SHOGI_PROGRAM   = -DFIRST_SHOGI_PROGRAM=\"@FIRST_SHOGI_PROGRAM@\"
74 SECOND_SHOGI_PROGRAM  = -DSECOND_SHOGI_PROGRAM=\"@SECOND_SHOGI_PROGRAM@\"
75 FIRST_HOST            = -DFIRST_HOST=\"@FIRST_HOST@\"
76 SECOND_HOST           = -DSECOND_HOST=\"@SECOND_HOST@\"
77
78
79 #
80 # Targets.
81 #
82
83 all: xshogi
84
85 xshogi: 
86         $(CC) -o xshogi xshogi.o parser.o scanner.o $(CFLAGS) $(LDFLAGS) 
87
88 xshogi.o: xshogi.c
89         $(CC) -c $< $(CWARNINGS) $(CFLAGS) \
90         $(OPT) $(FIRST_SHOGI_PROGRAM) $(SECOND_SHOGI_PROGRAM) \
91         $(FIRST_HOST) $(SECOND_HOST) 
92
93
94 #
95 # Regenerate the parser.  NOTE: scanner.c is never compiled; it
96 # is #included into parser.y.
97 #
98
99 parser.o: parser.c
100         $(CC) $(CFLAGS) -I$(SRCDIR) -c $<
101 scanner.o: scanner.c parser.h
102         $(CC) $(CFLAGS) -I$(SRCDIR) -c $<
103
104 parser.c parser.h: parser.y
105         $(YACC) -d $<
106         mv y.tab.c parser.c
107         mv y.tab.h parser.h
108
109 scanner.c: scanner.l
110         $(LEX) $<
111         mv lex.yy.c scanner.c
112
113
114 #
115 # Sources.
116 #
117
118 SOURCES = xshogi.c 
119
120
121 #
122 # Installation.
123 #
124
125 install: xshogi
126         strip xshogi
127         $(INSTALL_PROGRAM) -d $(BINDIR)
128         $(INSTALL_PROGRAM) -d $(MANDIR)
129         $(INSTALL_PROGRAM) xshogi $(BINDIR)
130         $(INSTALL_DATA)    $(ROOT)/doc/xshogi.6 $(MANDIR)
131
132
133 #
134 # Cleanup.
135 #
136
137 CLEANFILES = xshogi *.o parser.c y.tab.c scanner.c lex.yy.c
138
139 clean:
140         for file in $(CLEANFILES); do \
141     if [ -f $$file ]; then rm $$file; fi; \
142         done
143
144
145 #
146 # Dependencies.
147 #
148
149 xshogi:     xshogi.o parser.o scanner.o
150 xshogi.o:   xshogi.c $(SRCDIR)/sysdeps.h $(SRCDIR)/xshogi.h $(SRCDIR)/bitmaps.h ../config.h
151 parser.o:   parser.c $(SRCDIR)/xshogi.h
152 parser.c:   parser.y scanner.c
153 scanner.c:  scanner.l
154