43fb4fe0c993cd768616bc5d34e39bd5e31fa2db
[xboard.git] / winboard / makefile.gcc
1 # WinBoard makefile using gcc\r
2 \r
3 \r
4 PROJ=winboard\r
5 \r
6 \r
7 OBJS=backend.o book.o gamelist.o lists.o moves.o pgntags.o uci.o zippy.o\\r
8  parser.o wbres.o wclipbrd.o wedittags.o wengineo.o wevalgraph.o\\r
9  wgamelist.o whistory.o winboard.o wlayout.o woptions.o wsnap.o\\r
10  wsockerr.o help.o\r
11 \r
12 \r
13 # make compiling less spammy\r
14 compile = @echo "$1"; $(CC) $(CFLAGS) $1\r
15 \r
16 \r
17 # Debugging?\r
18 USE_DEBUG=0\r
19 \r
20 \r
21 # JAWS support?\r
22 JAWS=0\r
23 \r
24 \r
25 # set this to 1 unless you don't mind linking with cygwin1.dll\r
26 USE_MINGW=1\r
27 \r
28 \r
29 # set up for cygwin or not\r
30 ifeq ($(USE_MINGW),1)\r
31 CFCYG = -mno-cygwin\r
32 LFCYG = -mno-cygwin -lmsvcrt\r
33 endif\r
34 \r
35 CC = gcc\r
36 FLEX = "flex.exe" # we need version 2.5.4 or later, cygwin's is 2.5.35\r
37 #      "c:/mingw/mingw32/bin/flex.exe"\r
38 HC="C:/Program Files/Help Workshop/hcrtf" -xn\r
39 DEFS = -D_WIN32_IE=0x0300 -DWIN32\r
40 WARN = -Wall -Wno-char-subscripts -Wno-parentheses\r
41 ARCH =\r
42 ifeq ($(USE_DEBUG),0)\r
43   CFDEBUG = -DNDEBUG\r
44   OPTS = -Os -frename-registers -funit-at-a-time -fstrict-aliasing -fstrength-reduce\r
45 else\r
46   CFDEBUG = -D_DEBUG -DDEBUG -g\r
47 endif\r
48 CF = -c $(WARN) -pipe $(CFDEBUG) $(DEFS) -I. -I..\r
49 CFLAGS = $(CF) $(ARCH) $(OPTS) $(CFCYG)\r
50 LFLAGS = $(LFCYG) $(CFDEBUG) -fpic -s -mwindows -lwsock32 -lwinmm -lcomctl32\r
51 \r
52 # set up for JAWS\r
53 RESDEPS = $(PROJ).rc $(PROJ).h resource.h\r
54 ifeq ($(JAWS),1)\r
55   RESDEPS = jaws.rc resource.h jaws.h\r
56   DEFS += -DJAWS\r
57 endif\r
58 \r
59 \r
60 all: $(PROJ).exe\r
61 \r
62 \r
63 clean:\r
64         rm -f *~ $(PROJ).exe $(PROJ).err $(PROJ).rbj $(PROJ).RES $(PROJ).res\\r
65         *.sbr *.bsc *.o *.obj *.plg *.opt *.ncb *.debug *.bak *.gid *.GID\\r
66         *.map *.pdb *.tmp $(PROJ).ini\r
67 \r
68 \r
69 # Update the help file if necessary\r
70 $(PROJ).hlp : $(PROJ).rtf\r
71         $(HC) $(PROJ).hpj\r
72         @cat $(PROJ).err\r
73         @mv $(PROJ).hlp tmp.hlp\r
74         @mv tmp.hlp $(PROJ).hlp # these moves to get the case right\r
75 \r
76 \r
77 # Update the resource if necessary\r
78 wbres.o: $(RESDEPS)\r
79         windres $(DEFS) --use-temp-file --include-dir .. $< -O coff -o $@\r
80 \r
81 \r
82 # note: cygwin flex needs m4 package.  cygwin-setup forgets this dependency\r
83 # note2: use mingw flex instead... although I got cygwin's flex working (with m4),\r
84 #        it didn't produce a useable parser.c (1000's of errors)\r
85 parser.c: ../parser.l\r
86         $(FLEX) -oparser.c -L ../parser.l\r
87 \r
88 \r
89 $(PROJ).exe: $(OBJS) $(PROJ).hlp\r
90         $(CC) $(guiflags) $(OBJS) $(LFLAGS) -o $(PROJ).exe\r
91 \r
92 \r
93 winboard.o: winboard.c config.h winboard.h ../common.h ../frontend.h ../backend.h \\r
94         ../moves.h wgamelist.h defaults.h resource.h wclipbrd.h \\r
95         wedittags.h wsockerr.h woptions.h wsnap.h ../lists.h help.h\r
96         $(call compile, $<)\r
97 \r
98 backend.o: ../backend.c config.h ../common.h ../frontend.h ../backend.h \\r
99         ../parser.h ../moves.h ../zippy.h ../backendz.h ../gettext.h ../lists.h\r
100         $(call compile, $<)\r
101 \r
102 parser.o: parser.c config.h ../common.h ../backend.h ../parser.h \\r
103         ../frontend.h ../moves.h ../lists.h\r
104         $(call compile, $<)\r
105 \r
106 moves.o: ../moves.c config.h ../backend.h ../common.h ../parser.h \\r
107         ../moves.h ../lists.h\r
108         $(call compile, $<)\r
109 \r
110 lists.o: ../lists.c config.h ../lists.h ../common.h\r
111         $(call compile, $<)\r
112 \r
113 gamelist.o: ../gamelist.c config.h ../lists.h ../common.h ../frontend.h \\r
114         ../backend.h ../parser.h\r
115         $(call compile, $<)\r
116 \r
117 wclipbrd.o: wclipbrd.c config.h ../common.h ../frontend.h ../backend.h \\r
118         winboard.h resource.h wclipbrd.h ../lists.h\r
119         $(call compile, $<)\r
120 \r
121 wedittags.o: wedittags.c config.h ../common.h winboard.h resource.h ../frontend.h \\r
122         ../backend.h ../lists.h wedittags.h\r
123         $(call compile, $<)\r
124 \r
125 wgamelist.o: wgamelist.c config.h. ../common.h winboard.h resource.h ../frontend.h \\r
126         ../backend.h wgamelist.h ../lists.h\r
127         $(call compile, $<)\r
128 \r
129 woptions.o: woptions.c config.h ../common.h ../frontend.h ../backend.h ../lists.h \\r
130         defaults.h winboard.h resource.h\r
131         $(call compile, $<)\r
132 \r
133 wengineo.o: wengineo.c config.h ../common.h ../frontend.h ../backend.h \\r
134         ../lists.h winboard.h resource.h wsnap.h\r
135         $(call compile, $<)\r
136 \r
137 whistory.o: whistory.c config.h ../common.h ../frontend.h ../backend.h \\r
138         ../lists.h winboard.h resource.h wsnap.h\r
139         $(call compile, $<)\r
140 \r
141 wevalgraph.o: wevalgraph.c config.h ../common.h ../frontend.h ../backend.h \\r
142         ../lists.h winboard.h resource.h wsnap.h\r
143         $(call compile, $<)\r
144 \r
145 wlayout.o: wlayout.c config.h ../common.h winboard.h resource.h\r
146         $(call compile, $<)\r
147 \r
148 wsockerr.o: wsockerr.c wsockerr.h\r
149         $(call compile, $<)\r
150 \r
151 help.o: help.c help.h\r
152         $(call compile, $<)\r
153 \r
154 wsnap.o: wsnap.c wsnap.h\r
155         $(call compile, $<)\r
156 \r
157 pgntags.o: ../pgntags.c config.h ../common.h ../frontend.h ../backend.h \\r
158         ../parser.h ../lists.h\r
159         $(call compile, $<)\r
160 \r
161 zippy.o: ../zippy.c config.h ../common.h ../zippy.h ../frontend.h \\r
162         ../backend.h ../backendz.h ../lists.h\r
163         $(call compile, $<)\r
164 \r
165 book.o: ../book.c ../common.h ../backend.h ../lists.h\r
166         $(call compile, $<)\r
167 \r
168 uci.o: ../uci.c ..//common.h ../backend.h ../frontend.h ../lists.h\r
169         $(call compile, $<)\r
170 \r
171 %.o: %.c\r
172         $(call compile, $<)\r