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