forked from mcclure/snes9x-coop
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile.in
405 lines (335 loc) · 9.58 KB
/
Makefile.in
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
@ZSNESFX@
@ZSNESC4@
@ASMCPU@
@SPC700ASM@
@NETPLAY@
UNZIP=1
@JMA@
@GLIDE@
@OPENGL@
@AIDO@
#GUI=0
@THREAD_SOUND@
@ASMKREED@
@SDD1_DECOMP@
@CORRECT_VRAM_READS@
@DREAMCAST@
CHEATS=1
2XSAI=1
#Fairly good and special-char-safe descriptor of the os being built on.
OS=`uname -s -r -m|sed \"s/ /-/g\"|tr \"[A-Z]\" \"[a-z]\"|tr \"/()\" \"___\"`
# "
BUILDDIR=.
#BUILDDIR=build/$(OS)
ifdef DREAMCAST
CPU=sh
ASMCPU=1
CHEATS=0
2XSAI=0
else
CPU=i386
endif
ifdef ZSNESFX
FXOBJ=$(CPU)/fxemu2b.o $(CPU)/fxemu2.o $(CPU)/fxemu2c.o $(CPU)/fxtable.o $(CPU)/sfxproc.o $(CPU)/ZSNES.O
FXDEFINES=-DZSNES_FX -DEXECUTE_SUPERFX_PER_LINE
FXDEPENDS=zsnes_fx
FXNO_DEPENDS=c_fx
else
FXOBJ=fxinst.o fxemu.o fxdbg.o
FXDEFINES=
FXDEPENDS=c_fx
FXNO_DEPENDS=zsnes_fx
endif
ifdef ZSNESC4
C4OBJ=$(CPU)/C4.O $(CPU)/zsnesc4.o c4.o
C4DEFINES=-DZSNES_C4
C4DEPENDS=zsnes_c4
C4NO_DEPENDS=c_c4
else
C4OBJ=c4.o c4emu.o
C4DEFINES=
C4DEPENDS=c_c4
C4NO_DEPENDS=zsnes_c4
endif
SOUNDOBJ=spc700.o soundux.o apu.o @I386SPC@
SOUNDDEFINES=-DSPC700_C
ifdef ASMCPU
CPUOBJ=$(CPU)/cpuops.o $(CPU)/cpuexec.o $(CPU)/sa1ops.o
else
CPUOBJ=cpuops.o cpuexec.o sa1cpu.o
endif
ifdef DREAMCAST
PLATFORMOBJ=dc/input.o dc/display.o dc/sound.o \
dc/dc.o dc/menu.o dc/trace.o dc/lcd.o \
dc/lain_blanker.o dc/td.o dc/md5.o
else
PLATFORMOBJ=unix/unix.o
endif
ifdef CHEATS
CHEATOBJ=cheats.o cheats2.o
endif
ifndef DREAMCAST
SNAPOBJ = snaporig.o snapshot.o
SCREENSHOTOBJ = screenshot.o
MOVIEOBJ = movie.o
endif
ifdef 2XSAI
ifdef ASMKREED
KREEDOBJ=$(CPU)/2XSAIMMX.O $(CPU)/bilinear.o 2xsai.o
KREEDDEFINES=-DMMX
else
KREEDOBJ=2xsai.o
endif
endif
ifdef SDD1_DECOMP
SDD1OBJ=sdd1emu.o
ifdef SDD1_VERIFY
SDD1DEFINES=-DSDD1_DECOMP -DSDD1_VERIFY
else
SDD1DEFINES=-DSDD1_DECOMP
endif
endif
ifdef CORRECT_VRAM_READS
CORRVRAMDEFINES=-DCORRECT_VRAM_READS
endif
SPC7110OBJ=spc7110.o
OBC1OBJ=obc1.o
SETAOBJ=seta.o seta010.o seta011.o seta018.o
OBJECTS=$(CPUOBJ) $(SOUNDOBJ) apudebug.o $(FXOBJ) $(C4OBJ) \
controls.o crosshairs.o cpu.o sa1.o debug.o sdd1.o tile.o srtc.o gfx.o \
memmap.o clip.o dsp1.o ppu.o dma.o snes9x.o data.o globals.o reader.o \
conffile.o bsx.o logger.o \
$(SPC7110OBJ) $(OBC1OBJ) $(SETAOBJ) $(KREEDOBJ) $(SDD1OBJ) \
$(CHEATOBJ) $(PLATFORMOBJ) $(SNAPOBJ) $(SCREENSHOTOBJ) $(MOVIEOBJ) \
lua-engine.o luasav.o
ifdef NETPLAY
OBJECTS += netplay.o server.o
NETPLAYDEFINES=-DNETPLAY_SUPPORT
SERVER_OBJECTS=server.o unix/server_main.o globals.o netplay.o
endif
ifdef UNZIP
OBJECTS += loadzip.o unzip/unzip.o unzip/explode.o unzip/unreduce.o unzip/unshrink.o unzip/ioapi.o
UNZIPDEFINES=-DUNZIP_SUPPORT
endif
ifdef JMA
OBJECTS += jma/s9x-jma.o jma/7zlzma.o jma/crc32.o jma/iiostrm.o jma/inbyte.o jma/jma.o jma/lzma.o jma/lzmadec.o jma/winout.o
JMADEFINES = -DJMA_SUPPORT
endif
ifdef THREAD_SOUND
CPUDEFINES += -DUSE_THREADS
EXTRALIBS += -lpthread
endif
ifdef GLIDE
GLIDEOBJS = unix/glide.o
GLIDEDEFINES = -DUSE_GLIDE -I/usr/include/glide
GLIDELIBS = -lglide2x
endif
ifdef OPENGL
OPENGLOBJS = unix/opengl.o
OPENGLDEFINES = -DUSE_OPENGL
OPENGLLIBS = -lGL -lGLU -ldl
endif
ifdef AIDO
AIDOOBJS = unix/aido.o
AIDODEFINES = -DUSE_AIDO
endif
JOYDEFINES = @JOYDEFINES@
ifdef DREAMCAST
CCC = sh-elf-c++ -fno-rtti
CC = sh-elf-gcc
NASM = fail
GASM = fail
else
CCC = @CXX@ @RTTIFLAG@
CC = @CC@
NASM = @NASM@
GASM = @CXX@
endif
#INCLUDES = -I../zlib @X_INCLUDES@
ifdef DREAMCAST
INCLUDES = -Idc
DEFS = -DDC
else
INCLUDES = @X_INCLUDES@
DEFS = -DMITSHM
endif
INCLUDES += -I. -Iunzip @CPUINC@ -Ilua/src
ifdef DREAMCAST
OPTIMISE=-O4 -ffreestanding -ffast-math -fschedule-insns2 -fomit-frame-pointer -fno-inline-functions -fno-defer-pop -fforce-addr -fstrict-aliasing -funroll-loops -fdelete-null-pointer-checks -fno-exceptions
CPUFLAGS=-ml -m4-single-only
else
OPTIMISE = @OPTIMIZE@
endif
DEFS += \
-DCPU_SHUTDOWN \
-DSPC700_SHUTDOWN \
$(FXDEFINES) \
$(C4DEFINES) \
$(CPUDEFINES) \
$(SOUNDDEFINES) \
$(NETPLAYDEFINES) \
$(UNZIPDEFINES) \
$(JMADEFINES) \
$(GLIDEDEFINES) \
$(OPENGLDEFINES) \
$(AIDODEFINES) \
$(KREEDDEFINES) \
$(SDD1DEFINES) \
$(CORRVRAMDEFINES) \
$(JOYDEFINES) \
@SYSDEFINES@
CCFLAGS = $(OPTIMISE) $(CPUFLAGS) $(INCLUDES) $(DEFS)
CFLAGS=$(CCFLAGS)
.SUFFIXES: .o .cpp .c .cc .h .m .i .S .asm .obj .O .CPP .C .ASM
#FIXME: Why is this set statically?
#LDLIBS = -L/usr/X11R6/lib
# -L../zlib
ifdef GLIDE
all: Makefile configure gsnes9x
else
ifdef OPENGL
all: Makefile configure osnes9x
else
all: Makefile configure snes9x
endif
endif
Makefile: configure Makefile.in
@echo "Makefile is older than configure or in-file. Run configure or touch Makefile."
exit 1
configure: configure.in
@echo "configure is older than in-file. Run autoconf or touch configure."
exit 1
#ggisnes9x
#xf86snes9x
ifdef ASMCPU
OFFSET=offsets
else
OFFSET=
endif
offsets: offsets.o
$(CCC) $(INCLUDES) -o $@ offsets.o
./offsets >$(CPU)/offsets.h
#../zlib/libz.a:
# cd ../zlib && sh ./configure && make
snes9x: $(OBJECTS) unix/x11.o $(AIDOOBJS) $(OFFSET)
$(CCC) $(INCLUDES) -o $@ $(OBJECTS) $(AIDOOBJS) $(GLIDEOBJS) $(OPENGLOBJS) unix/x11.o $(LDLIBS) $(GLIDELIBS) $(OPENGLLIBS) @SYSLIBS@ -lXext -lX11 $(EXTRALIBS) -lm -llua
unix/svga_keynames.h: unix/svga_get_keynames.pl
unix/svga_get_keynames.pl /usr/include/vgakeyboard.h > unix/svga_keynames.h
unix/svga.o: unix/svga_keynames.h
ssnes9x: $(OBJECTS) unix/svga.o
$(CCC) $(INCLUDES) -o $@ $(OBJECTS) $(GLIDEOBJS) unix/svga.o $(LDLIBS) $(GLIDELIBS) @SYSLIBS@ -lvga -lvgagl $(EXTRALIBS) -lm
gsnes9x: $(OBJECTS) $(GLIDEOBJS)
$(CCC) $(INCLUDES) -o $@ $(OBJECTS) $(GLIDEOBJS) $(LDLIBS) @SYSLIBS@ -lglide $(EXTRALIBS) -lm
ggisnes9x: $(OBJECTS) unix/ggi.o
$(CCC) $(INCLUDES) -o $@ $(OBJECTS) unix/ggi.o $(LDLIBS) @SYSLIBS@ -lggi $(EXTRALIBS) -lm
osnes9x: $(OBJECTS) unix/x11.o $(OPENGLOBJS)
$(CCC) $(INCLUDES) -o $@ $(OBJECTS) unix/x11.o $(OPENGLOBJS) $(LDLIBS) $(OPENGLLIBS) @SYSLIBS@ -lXext -lX11 $(EXTRALIBS) -lm -llua
s9xserver: $(SERVER_OBJECTS)
$(CCC) $(INCLUDES) -o $@ $(SERVER_OBJECTS)
jma/s9x-jma.o: jma/s9x-jma.cpp
$(CCC) $(INCLUDES) -c $(CCFLAGS) -fexceptions $*.cpp -o $@
jma/7zlzma.o: jma/7zlzma.cpp
$(CCC) $(INCLUDES) -c $(CCFLAGS) -fexceptions $*.cpp -o $@
jma/crc32.o: jma/crc32.cpp
$(CCC) $(INCLUDES) -c $(CCFLAGS) -fexceptions $*.cpp -o $@
jma/iiostrm.o: jma/iiostrm.cpp
$(CCC) $(INCLUDES) -c $(CCFLAGS) -fexceptions $*.cpp -o $@
jma/inbyte.o: jma/inbyte.cpp
$(CCC) $(INCLUDES) -c $(CCFLAGS) -fexceptions $*.cpp -o $@
jma/jma.o: jma/jma.cpp
$(CCC) $(INCLUDES) -c $(CCFLAGS) -fexceptions $*.cpp -o $@
jma/lzma.o: jma/lzma.cpp
$(CCC) $(INCLUDES) -c $(CCFLAGS) -fexceptions $*.cpp -o $@
jma/lzmadec.o: jma/lzmadec.cpp
$(CCC) $(INCLUDES) -c $(CCFLAGS) -fexceptions $*.cpp -o $@
jma/winout.o: jma/winout.cpp
$(CCC) $(INCLUDES) -c $(CCFLAGS) -fexceptions $*.cpp -o $@
.cpp.o:
$(CCC) $(INCLUDES) -c $(CCFLAGS) $*.cpp -o $@
.c.o:
$(CC) $(INCLUDES) -c $(CCFLAGS) $*.c -o $@
.cpp.S:
$(GASM) $(INCLUDES) -S $(CCFLAGS) $*.cpp -o $@
.cpp.i:
$(GASM) $(INCLUDES) -E $(CCFLAGS) $*.cpp -o $@
.S.o:
$(GASM) $(INCLUDES) -c $(CCFLAGS) $*.S -o $@
.S.i:
$(GASM) $(INCLUDES) -c -E $(CCFLAGS) $*.S -o $@
.s.o:
@echo Compiling $*.s
sh-elf-as -little $*.s -o $@
.asm.o:
$(NASM) -f elf -DELF $(FXDEFINES) -i. -ii386 -o $@ $*.asm
.obj.o:
cp $*.obj $*.o
.CPP.O:
$(CCC) $(INCLUDES) -c $(CCFLAGS) -x c++ $*.CPP -o $@
.C.O:
$(CC) $(INCLUDES) -c $(CCFLAGS) $*.C -o $@
.ASM.O:
$(NASM) -f elf -DELF $(FXDEFINES) -i . -i i386 $*.ASM -o $@
unix/moc_snes9x_gui.cpp: unix/snes9x_gui.h
$(MOC) unix/snes9x_gui.h -o $@
clean:
rm -f $(OBJECTS) offsets.o unix/svga.o unix/aido.o unix/x11.o unix/ggi.o unix/xf86.o unix/glide.o
#release: CCFLAGS += -DNO_DEBUGGER
_bin-package:
RELNR=`grep "#define VERSION" snes9x.h | sed -e 's/"//g' | awk '{ print $$3 }'` && \
echo $$RELNR && \
RELNAME=snes9x-$${RELNR} && export RELNAME && \
test \! -f $${RELNAME}.tar.gz && \
DISTDIR=disttmp/$${RELNAME}/ && \
rm -rf disttmp && \
mkdir disttmp && \
mkdir $${DISTDIR} && \
cp snes9x $${DISTDIR} && \
cp config.info hardware.txt problems.txt changes.txt ../faqs.txt ../readme.txt ../readme.unix $${DISTDIR} && \
(cd disttmp && tar cvf - $${RELNAME}) | gzip -c > $${RELNAME}.tar.gz &&\
rm -rf disttmp
#FIXME: Should possibly have clean, but not in xenofarm build
bin-release: snes9x _bin-package
#FIXME: Intelligent messages when bailing out.
#FIXME: See those ls:s? Don't look to closely at the statements...
_src-package:
RELNR=`grep "#define VERSION" snes9x.h | sed -e 's/"//g' | awk '{ print $$3 }'` && \
echo $$RELNR && \
RELNAME=snes9x-$${RELNR}-src && \
test \! -f $${RELNAME}.tar.gz && \
test \! `ls *~` && \
test \! `ls *.o` && \
test \! -f snes9x && \
export RELNR && export RELNAME && \
(cd .. && PWD=`pwd` && SNESDIR=`basename $$PWD` && cd .. && \
DISTDIR=disttmp/$${RELNAME} && \
rm -rf disttmp && \
mkdir disttmp && \
cp -r $${SNESDIR} $${DISTDIR} && \
rm -f $${DISTDIR}/snes9x/config.* 2>/dev/null && \
rm -f $${DISTDIR}/snes9x/conftezt.out.* 2>/dev/null && \
rm -rf $${DISTDIR}/snes9x/autom4te.cache 2>/dev/null && \
rm $${DISTDIR}/snes9x/Makefile && \
find disttmp -name CVS -type f -exec rm "{}" \; && \
find disttmp -name CVS -type d -exec rm "{}" \; && \
(cd disttmp && tar cvf - $${RELNAME}) | gzip -c > $${RELNAME}.tar.gz && \
mv $${RELNAME}.tar.gz $${SNESDIR}/snes9x/ ) && \
rm -rf disttmp
#Requires:
# 1. Prestine checkout
# 2. `autoconf`
# 3. `./configure`
src-release: depend _src-package
xenofarm:
./xenofarm.sh
cd build/xenofarm && tar cf - . > ../../../xenofarm_result.tar
gzip -f9 ../xenofarm_result.tar
# And now for the impressive testsuite:
verify: snes9x
./snes9x --selftest
#FIXME: Make a auto-self-reference.
depend:
$(CC) $(CFLAGS) -MM -MG \
`find . '(' -name '*.c' -o -name '*.cpp' -o -name '*.S' ')' -print -o -name msdos -prune` \
| sed -e 's@^[^ :]*: *\([^ ]*/\)[^ /]*@\1&@' \
>dependencies
include dependencies