# Makefile for MS Visual C

R=..\..\..\ 

CFLAGS=/nologo /W2 /O2 /D "_CRT_SECURE_NO_WARNINGS" -I. -I$(R) -I$(R)zlib\

LDFLAGS=/nologo /machine:I386 /opt:nowin98 /out:PicoDrive.exe

CFLAGS=$(CFLAGS) /DEMU_F68K

CFLAGS=$(CFLAGS) /D_USE_CZ80

# debug
#CFLAGS=$(CFLAGS) /Gi

#LDFLAGS=$(LDFLAGS) /DEBUG

# emu
OBJ = Emu.obj Input.obj Main.obj Direct.obj DSound.obj Loop.obj

# TexScreen.obj

# common
#OBJS += platform\common\emu.obj platform\common\menu.obj platform\common\fonts.obj 
#		platform\common\mp3_helix.obj
OBJ = $(OBJ) $(R)platform\common\readpng.obj $(R)platform\common\config.obj

# Pico
OBJ = $(OBJ) $(R)Pico\Area.obj $(R)Pico\Cart.obj $(R)Pico\Memory.obj $(R)Pico\Misc.obj $(R)Pico\Pico.obj $(R)Pico\Sek.obj \
		$(R)Pico\VideoPort.obj $(R)Pico\Draw2.obj $(R)Pico\Draw.obj $(R)Pico\Patch.obj
# Pico - CD
OBJ = $(OBJ) $(R)Pico\cd\Pico.obj $(R)Pico\cd\Memory.obj $(R)Pico\cd\Sek.obj $(R)Pico\cd\LC89510.obj \
		$(R)Pico\cd\cd_sys.obj $(R)Pico\cd\cd_file.obj $(R)Pico\cd\gfx_cd.obj \
		$(R)Pico\cd\Area.obj $(R)Pico\cd\Misc.obj $(R)Pico\cd\pcm.obj $(R)Pico\cd\buffering.obj \
		$(R)Pico\cd\cue.obj
# Pico - Pico
OBJ = $(OBJ) $(R)Pico\Pico\Pico.obj $(R)Pico\Pico\Memory.obj $(R)Pico\Pico\xpcm.obj
# Pico - sound
OBJ = $(OBJ) $(R)Pico\sound\sound.obj $(R)Pico\sound\sn76496.obj $(R)Pico\sound\ym2612.obj $(R)Pico\sound\mix.obj
# Pico - carthw
OBJ = $(OBJ) $(R)Pico\carthw\carthw.obj $(R)Pico\carthw\svp\svp.obj $(R)Pico\carthw\svp\Memory.obj \
		$(R)Pico\carthw\svp\ssp16.obj $(R)Pico\carthw\svp\compiler.obj
# zlib
OBJ = $(OBJ) $(R)zlib\gzio.obj $(R)zlib\inffast.obj $(R)zlib\inflate.obj $(R)zlib\inftrees.obj $(R)zlib\trees.obj \
	$(R)zlib\deflate.obj $(R)zlib\crc32.obj $(R)zlib\adler32.obj $(R)zlib\zutil.obj $(R)zlib\compress.obj $(R)zlib\uncompr.obj
# unzip
OBJ = $(OBJ) $(R)unzip\unzip.obj $(R)unzip\unzip_stream.obj
# CPU cores
OBJ = $(OBJ) $(R)cpu\fame\famec.obj
# z80
OBJ = $(OBJ) $(R)cpu\cz80\cz80.obj


.c.obj:
	cl $(CFLAGS) /c $< /Fo$@

.cpp.obj:
	cl $(CFLAGS) /c $< /Fo$@


ALL : PicoDrive.exe

PicoDrive.exe : $(OBJ)
	link.exe $(LDFLAGS) $(OBJ) libpng.lib gdi32.lib user32.lib advapi32.lib dsound.lib comdlg32.lib ddraw.lib dxguid.lib

# d3d8.lib d3dx8.lib 

clean:
	-del $(OBJ) PicoDrive.exe


test.exe : test.cpp
	cl $(CFLAGS) test.cpp user32.lib d3dx8.lib d3d8.lib

dxtut1.exe : dxtut1.cpp
	cl $(CFLAGS) dxtut1.cpp user32.lib d3d8.lib

# d3dx8.lib

