www.pudn.com > ncdzsrc.rar > makefile.vc


#--------------------------------------------------------------------- 
# 
#       NEOGEO CDZ Emulator Makefile for Microsoft Visual C++ 
# 
#--------------------------------------------------------------------- 
 
#--------------------------------------------------------------------- 
# Programs 
#--------------------------------------------------------------------- 
 
AR = @lib 
CC = @cl 
LD = @link 
RC = @rc 
 
ASM = @nasmw 
ASMFLAGS = -f win32 
ifdef USE_VC6 
ASMDEFS = -DSCRBMP_ALIGNED=0 
else 
ASMDEFS = -DSCRBMP_ALIGNED=1 
endif 
 
RM = @del 
RMDIR = rd /S /Q 
MD = md 
PACKER = @upx 
 
#--------------------------------------------------------------------- 
# Executable File Extension 
#--------------------------------------------------------------------- 
 
EXE = .exe 
 
#--------------------------------------------------------------------- 
# Object File Output Directtory 
#--------------------------------------------------------------------- 
 
OBJ = obj 
 
#--------------------------------------------------------------------- 
# Target File Name 
#--------------------------------------------------------------------- 
 
EMULATOR = ncdz$(EXE) 
 
#--------------------------------------------------------------------- 
# If you have upx installed to compress executable. 
#--------------------------------------------------------------------- 
 
# COMPRESS = $(PACKER) -9 $(EMULATOR) 
 
#--------------------------------------------------------------------- 
# Optimize 
#--------------------------------------------------------------------- 
 
ifdef USE_VC8 
 
ARCH = 
 
ifdef ATHLON 
ARCH = /arch:SSE 
endif 
 
ifdef ATHLONXP 
ARCH = /arch:SSE2 
endif 
 
ifdef P3 
ARCH = /arch:SSE 
endif 
 
ifdef P4 
ARCH = /arch:SSE2 
endif 
 
ifdef PM 
ARCH = /arch:SSE2 
endif 
 
else 
 
ifdef USE_VC7 
 
ARCH = /G6 
 
ifdef ATHLON 
ARCH = /G7 /arch:SSE 
endif 
 
ifdef ATHLONXP 
ARCH = /G7 /arch:SSE2 
endif 
 
ifdef P3 
ARCH = /G6 /arch:SSE 
endif 
 
ifdef P4 
ARCH = /G7 /arch:SSE2 
endif 
 
ifdef PM 
ARCH = /G6 /arch:SSE2 
endif 
 
else 
 
ARCH = /G6 
 
endif 
endif 
 
#--------------------------------------------------------------------- 
# Compiler Flags 
#--------------------------------------------------------------------- 
 
CDEFS = \ 
	-DWINVER=0x0400 \ 
	-D_WIN32_WINNT=0x0500 \ 
	-DWIN32 \ 
	-D_WINDOWS \ 
	-DDIRECTSOUND_VERSION=0x0300 \ 
	-DDIRECTDRAW_VERSION=0x0300 \ 
	-DDIRECTINPUT_VERSION=0x0500 \ 
	-DINLINE='static __inline' \ 
	-Dinline=__inline \ 
	-D__inline__=__inline \ 
	-Isrc \ 
	-DNEOGEOCD 
 
ifdef USE_VC8 
 
ifdef DEBUG 
CFLAGS = /nologo /W3 /Od /RTCu /Zi /MTd 
else 
CFLAGS = /nologo /W3 $(ARCH) /Ox /GA /MT 
endif 
 
else 
 
ifdef DEBUG 
CFLAGS = -nologo /W3 /Od /G0 /MTd 
else 
CFLAGS = -nologo /W3 $(ARCH) /Ox /GA /GX /MT 
endif 
 
endif 
 
ifdef MEMORY_DEBUG 
CDEFS += -DMEMORY_DEBUG=1 
ASMDEFS += -DMEMORY_DEBUG=1 
else 
CDEFS += -DMEMORY_DEBUG=0 
ASMDEFS += -DMEMORY_DEBUG=0 
endif 
 
ifdef FAST_SPRITE 
CDEFS += -DFAST_SPRITE_DRAW=1 
else 
CDEFS += -DFAST_SPRITE_DRAW=0 
endif 
 
ifdef SYSTEM_CHECK 
CDEFS += -DENABLE_SYSTEM_CHECK=1 
else 
CDEFS += -DENABLE_SYSTEM_CHECK=0 
endif 
 
ifdef OUTPUT_CDDA_LOG 
CDEFS += -DOUTPUT_CDDA_LOG=1 
else 
CDEFS += -DOUTPUT_CDDA_LOG=0 
endif 
 
ifdef OUTPUT_MEMORY_LOG 
CDEFS += -DOUTPUT_MEMORY_LOG=1 
else 
CDEFS += -DOUTPUT_MEMORY_LOG=0 
endif 
 
ifdef M68K_DEBUG 
CDEFS += -DM68K_DEBUG=1 
ASMDEFS += -DM68K_DEBUG=1 
else 
CDEFS += -DM68K_DEBUG=0 
ASMDEFS += -DM68K_DEBUG=0 
endif 
 
ifdef DEBUG 
CDEFS += -DDEBUG=1 -DBUILD_CONSOLE=1 
ASMDEFS += -DDEBUG=1 
BUILD_CONSOLE = 1 
endif 
 
ifdef BUILD_CONSOLE 
CDEFS += -DBUILD_CONSOLE=1 
endif 
 
#--------------------------------------------------------------------- 
# Linker Flags 
#--------------------------------------------------------------------- 
 
ifdef BUILD_CONSOLE 
PROGRAM_TYPE = -subsystem:console 
else 
PROGRAM_TYPE = -subsystem:windows 
endif 
 
LDFLAGS = -nologo -machine:x86 $(PROGRAM_TYPE) 
 
ifdef DEBUG 
LDFLAGS += -debug:full -map:neogeocd.map 
else 
LDFLAGS += -release -incremental:no 
endif 
 
#--------------------------------------------------------------------- 
# Resource Compiler Flags 
#--------------------------------------------------------------------- 
 
#RCFLAGS = -l 0x409 -DNDEBUG -D_WIN32 
RCFLAGS = -l 0x411 -DNDEBUG -D_WIN32 
 
#--------------------------------------------------------------------- 
# Object files 
#--------------------------------------------------------------------- 
 
OBJDIRS = \ 
	$(OBJ) \ 
	$(OBJ)/cpu \ 
	$(OBJ)/cpu/m68000 \ 
	$(OBJ)/cpu/z80 \ 
	$(OBJ)/drivers \ 
	$(OBJ)/machine \ 
	$(OBJ)/sound \ 
	$(OBJ)/vidhrdw \ 
	$(OBJ)/win32 \ 
	$(OBJ)/zlib \ 
 
OBJS = \ 
	$(OBJ)/neogeocd.o \ 
	$(OBJ)/cpuintrf.o \ 
	$(OBJ)/config.o \ 
	$(OBJ)/input.o \ 
	$(OBJ)/memintrf.o \ 
	$(OBJ)/sndintrf.o \ 
	$(OBJ)/usrintrf.o \ 
	$(OBJ)/png.o \ 
	$(OBJ)/timer.o \ 
	$(OBJ)/video.o \ 
	$(OBJ)/drivers/driver.o \ 
	$(OBJ)/machine/machine.o \ 
	$(OBJ)/machine/cdda.o \ 
	$(OBJ)/machine/cdrom.o \ 
	$(OBJ)/machine/loadscr.o \ 
	$(OBJ)/machine/simbios.o \ 
	$(OBJ)/machine/i68k.o \ 
	$(OBJ)/machine/pd4990a.o \ 
	$(OBJ)/vidhrdw/vidhrdw.o \ 
	$(OBJ)/cpu/m68000/d68k.o \ 
	$(OBJ)/cpu/z80/z80.o \ 
	$(OBJ)/cpu/z80/z80intf.o \ 
	$(OBJ)/sound/2610intf.o \ 
	$(OBJ)/sound/ym2610.o \ 
	$(OBJ)/sound/streams.o \ 
 
 
OSOBJS = \ 
	$(OBJ)/win32/asmblt16.oa \ 
	$(OBJ)/win32/asmblt24.oa \ 
	$(OBJ)/win32/asmblt32.oa \ 
	$(OBJ)/win32/blit.o \ 
	$(OBJ)/win32/dbgcdrom.o \ 
	$(OBJ)/win32/DirectDraw.o \ 
	$(OBJ)/win32/DirectInput.o \ 
	$(OBJ)/win32/DirectSound.o \ 
	$(OBJ)/win32/fileio.o \ 
	$(OBJ)/win32/misc.oa \ 
	$(OBJ)/win32/osd_cdda.o \ 
	$(OBJ)/win32/osd_joy.o \ 
	$(OBJ)/win32/osd_key.o \ 
	$(OBJ)/win32/osd_sound.o \ 
	$(OBJ)/win32/osd_video.o \ 
	$(OBJ)/win32/ticker.o \ 
	$(OBJ)/win32/win32.o \ 
	$(OBJ)/win32/resource.res 
 
 
ifdef A68K0 
 
OBJS += $(OBJ)/cpu/m68000/68000.oa $(OBJ)/cpu/m68000/asmintf.o 
CDEFS += -DA68K0 
 
else 
 
M68000_GENERATED_OBJS = \ 
	$(OBJ)/cpu/m68000/m68kops.o $(OBJ)/cpu/m68000/m68kopac.o \ 
	$(OBJ)/cpu/m68000/m68kopdm.o $(OBJ)/cpu/m68000/m68kopnz.o 
OBJS += $(M68000_GENERATED_OBJS) $(OBJ)/cpu/m68000/m68kcpu.o $(OBJ)/cpu/m68000/m68kncdz.o 
CDEFS += /I$(OBJ)/cpu/m68000 /Isrc/cpu/m68000 
 
endif 
 
 
 
#--------------------------------------------------------------------- 
# Library files 
#--------------------------------------------------------------------- 
 
LIBS = \ 
	kernel32.lib \ 
	user32.lib \ 
	gdi32.lib \ 
	shell32.lib \ 
	dxguid.lib \ 
	ddraw.lib \ 
	dinput.lib \ 
	dsound.lib \ 
	winmm.lib 
 
#--------------------------------------------------------------------- 
# Make rules 
#--------------------------------------------------------------------- 
 
all: maketree $(EMULATOR) 
 
include src/zlib/zlib.mak 
 
$(EMULATOR): $(OBJS) $(OSOBJS) 
	@echo Linking $@... 
	$(LD) $(LDFLAGS) $(OBJS) $(OSOBJS) $(LIBS) -out:$@ 
	$(COMPRESS) 
 
#--------------------------------------------------------------------- 
# A68K - ASM MC68000 core 
#--------------------------------------------------------------------- 
 
# generate ASM source files for the 68000 emulator 
$(OBJ)/cpu/m68000/68000.asm: src/cpu/m68000/make68k.c 
	@echo make68k make $<... 
	$(CC) $(CDEFS) $(CFLAGS) -Fe$(OBJ)/cpu/m68000/make68k$(EXE) -Fo$(OBJ)/cpu/m68000/make68k.o $< 
	@echo Generating M68K source files... 
	$(OBJ)/cpu/m68000/make68k$(EXE) $@ $(OBJ)/cpu/m68000/68000tab.asm 00 ppro 
 
# compile generated ASM files for the 68000 emulator 
$(OBJ)/cpu/m68000/68000.oa: $(OBJ)/cpu/m68000/68000.asm 
	@echo Compiling A68K0... 
	$(ASM) -o $@ $(ASMFLAGS) $(subst -D,-d,$(ASMDEFS)) $< 
 
#--------------------------------------------------------------------- 
# MUSASHI - C MC68000 core 
#--------------------------------------------------------------------- 
 
# compile generated C files for the 68000 emulator 
$(M68000_GENERATED_OBJS): $(OBJ)/cpu/m68000/m68kmake$(EXE) 
	@echo Compiling $(subst .o,.c,$@)... 
	$(CC) $(CDEFS) $(CFLAGS) -c $*.c -Fo$@ 
 
# additional rule, because m68kcpu.c includes the generated m68kops.h :-/ 
$(OBJ)/cpu/m68000/m68kcpu.o: $(OBJ)/cpu/m68000/m68kmake$(EXE) 
 
# generate C source files for the 68000 emulator 
$(OBJ)/cpu/m68000/m68kmake$(EXE): src/cpu/m68000/m68kmake.c 
	@echo M68K make $<... 
	$(CC) $(CDEFS) $(CFLAGS) -o $(OBJ)/cpu/m68000/m68kmake$(EXE) $< 
	$(RM) m68kmake.obj 
	@echo Generating M68K source files... 
	$(OBJ)/cpu/m68000/m68kmake$(EXE) $(OBJ)/cpu/m68000 src/cpu/m68000/m68k_in.c 
 
#--------------------------------------------------------------------- 
# RAZE - Z80 core 
#--------------------------------------------------------------------- 
 
RAZEASMFLAGS = -w+orphan-labels 
 
# This pre-processes the .ASM file 
$(OBJ)/cpu/z80/z80.asm: src/cpu/z80/raze.asm src/cpu/z80/raze.inc src/cpu/z80/raze.reg 
	$(ASM) $(RAZEASMFLAGS) -e $< -o $@ 
 
# This assembles the file, once it's been pre-processed 
$(OBJ)/cpu/z80/z80.o: $(OBJ)/cpu/z80/z80.asm 
	$(ASM) $(RAZEASMFLAGS) -f win32 $< -o $@ -psrc/cpu/z80/raze.reg 
 
 
#--------------------------------------------------------------------- 
# C file 
#--------------------------------------------------------------------- 
 
$(OBJ)/%.o: src/%.c 
	@echo Compiling $<... 
	$(CC) $(CDEFS) $(INCLUDES) $(DEBUGDEF) $(CFLAGS) -c $< -Fo$@ 
 
$(OBJ)/%.oa: src/%.asm 
	@echo Assembling $@... 
	$(ASM) -o $@ $(ASMFLAGS) $(subst -D,-d,$(ASMDEFS)) $< 
 
$(OBJ)/%.a: 
	@echo Archiving $@... 
	$(AR) -out:$@ $^ 
 
$(OBJ)/%.res: src/%.rc 
	@echo Compiling Resource $@... 
	$(RC) $(RCFLAGS) -Fo$@ $< 
 
#--------------------------------------------------------------------- 
# Rules to manage files 
#--------------------------------------------------------------------- 
 
mkdir: 
	@echo make mkdir is no longer necessary, just type make 
 
$(sort $(OBJDIRS)): 
	$(MD) $(subst /,\,$@) 
 
maketree2: 
	@echo Making object tree... 
 
maketree: maketree2 $(sort $(OBJDIRS))