########################################################################### # # winui.mak # # winui (Mame32) makefile # # Copyright (c) 1996-2007, Nicola Salmoria and the MAME Team. # Visit http://mamedev.org for licensing and usage restrictions. # ########################################################################### ########################################################################### ################# BEGIN USER-CONFIGURABLE OPTIONS ##################### ########################################################################### #------------------------------------------------- # specify build options; see each option below # for details #------------------------------------------------- # uncomment next line to enable a build using Microsoft tools # MSVC_BUILD = 1 # uncomment next line to use cygwin compiler # CYGWIN_BUILD = 1 # uncomment next line to enable multi-monitor stubs on Windows 95/NT # you will need to find multimon.h and put it into your include # path in order to make this work # WIN95_MULTIMON = 1 # uncomment next line to enable a Unicode build # UNICODE = 1 ########################################################################### ################## END USER-CONFIGURABLE OPTIONS ###################### ########################################################################### #------------------------------------------------- # append "32" to the emulator name #------------------------------------------------- EMULATOR = $(FULLNAME)32$(EXE) #------------------------------------------------- # object and source roots #------------------------------------------------- WINSRC = $(SRC)/osd/windows WINOBJ = $(OBJ)/osd/windows OBJDIRS += $(WINOBJ) # add ui specific src/objs UISRC = $(SRC)/osd/$(OSD) UIOBJ = $(OBJ)/osd/$(OSD) OBJDIRS += $(UIOBJ) #------------------------------------------------- # configure the resource compiler #------------------------------------------------- RC = @windres --use-temp-file RCDEFS = -DNDEBUG -D_WIN32_IE=0x0400 # include UISRC direcotry RCFLAGS = -O coff -I $(UISRC) -I $(UIOBJ) #------------------------------------------------- # overrides for the CYGWIN compiler #------------------------------------------------- ifdef CYGWIN_BUILD CFLAGS += -mno-cygwin LDFLAGS += -mno-cygwin endif #------------------------------------------------- # overrides for the MSVC compiler #------------------------------------------------- ifdef MSVC_BUILD VCONV = $(WINOBJ)/vconv$(EXE) # replace the various compilers with vconv.exe prefixes CC = @$(VCONV) gcc -I. LD = @$(VCONV) ld /profile AR = @$(VCONV) ar RC = @$(VCONV) windres # make sure we use the multithreaded runtime CC += /MT # turn on link-time codegen if the MAXOPT flag is also set ifdef MAXOPT CC += /GL LD += /LTCG endif ifdef PTR64 CC += /wd4267 /wd4312 /Wp64 endif # add some VC++-specific defines DEFS += -D_CRT_SECURE_NO_DEPRECATE -DXML_STATIC -D__inline__=__inline -Dsnprintf=_snprintf -Dvsnprintf=_vsnprintf # make msvcprep into a pre-build step # OSPREBUILD = $(VCONV) # add VCONV to the build tools BUILD += $(VCONV) $(VCONV): $(WINOBJ)/vconv.o @echo Linking $@... ifdef PTR64 @link.exe /nologo $^ version.lib bufferoverflowu.lib /out:$@ else @link.exe /nologo $^ version.lib /out:$@ endif $(WINOBJ)/vconv.o: $(WINSRC)/vconv.c @echo Compiling $<... @cl.exe /nologo /O1 -D_CRT_SECURE_NO_DEPRECATE -c $< /Fo$@ endif #------------------------------------------------- # due to quirks of using /bin/sh, we need to # explicitly specify the current path #------------------------------------------------- CURPATH = ./ #------------------------------------------------- # Windows-specific debug objects and flags #------------------------------------------------- # define the x64 ABI to be Windows DEFS += -DX64_WINDOWS_ABI # debug build: enable guard pages on all memory allocations ifdef DEBUG DEFS += -DMALLOC_DEBUG LDFLAGS += -Wl,--allow-multiple-definition endif ifdef UNICODE DEFS += -DUNICODE -D_UNICODE endif #------------------------------------------------- # Windows-specific flags and libraries #------------------------------------------------- # add our prefix files to the mix, include WINSRC in UI build CFLAGS += -include $(WINSRC)/winprefix.h -I$(WINSRC) ifdef WIN95_MULTIMON CFLAGS += -DWIN95_MULTIMON endif # add the windows libaries, 3 additional libs at the end for UI LIBS += \ -luser32 \ -lgdi32 \ -lddraw \ -ldsound \ -ldinput \ -ldxguid \ -lwinmm \ -ladvapi32 \ -lcomctl32 \ -lshlwapi \ # add -mwindows for UI LDFLAGSEMULATOR += \ -mwindows \ -lkernel32 \ -lshell32 \ -lcomdlg32 \ ifdef PTR64 LIBS += -lbufferoverflowu endif #------------------------------------------------- # OSD core library #------------------------------------------------- # still not sure what to do about main. OSDCOREOBJS = \ $(WINOBJ)/strconv.o \ $(WINOBJ)/windir.o \ $(WINOBJ)/winfile.o \ $(WINOBJ)/winmisc.o \ $(WINOBJ)/winsync.o \ $(WINOBJ)/wintime.o \ $(WINOBJ)/winutf8.o \ $(WINOBJ)/winutil.o \ $(WINOBJ)/winwork.o \ # if malloc debugging is enabled, include the necessary code ifneq ($(findstring MALLOC_DEBUG,$(DEFS)),) OSDCOREOBJS += \ $(WINOBJ)/winalloc.o endif $(LIBOCORE): $(OSDCOREOBJS) #------------------------------------------------- # OSD Windows library #------------------------------------------------- OSDOBJS = \ $(WINOBJ)/d3d8intf.o \ $(WINOBJ)/d3d9intf.o \ $(WINOBJ)/drawd3d.o \ $(WINOBJ)/drawdd.o \ $(WINOBJ)/drawgdi.o \ $(WINOBJ)/drawnone.o \ $(WINOBJ)/input.o \ $(WINOBJ)/output.o \ $(WINOBJ)/sound.o \ $(WINOBJ)/video.o \ $(WINOBJ)/window.o \ $(WINOBJ)/winmain.o \ # add UI objs OSDOBJS += \ $(UIOBJ)/m32util.o \ $(UIOBJ)/directinput.o \ $(UIOBJ)/dijoystick.o \ $(UIOBJ)/directdraw.o \ $(UIOBJ)/directories.o \ $(UIOBJ)/audit32.o \ $(UIOBJ)/columnedit.o \ $(UIOBJ)/screenshot.o \ $(UIOBJ)/treeview.o \ $(UIOBJ)/splitters.o \ $(UIOBJ)/bitmask.o \ $(UIOBJ)/datamap.o \ $(UIOBJ)/dxdecode.o \ $(UIOBJ)/picker.o \ $(UIOBJ)/properties.o \ $(UIOBJ)/tabview.o \ $(UIOBJ)/help.o \ $(UIOBJ)/history.o \ $(UIOBJ)/dialogs.o \ $(UIOBJ)/m32opts.o \ $(UIOBJ)/layout.o \ $(UIOBJ)/datafile.o \ $(UIOBJ)/dirwatch.o \ $(UIOBJ)/win32ui.o \ $(UIOBJ)/helpids.o \ # extra dependencies $(WINOBJ)/drawdd.o : $(SRC)/emu/rendersw.c $(WINOBJ)/drawgdi.o : $(SRC)/emu/rendersw.c # add debug-specific files ifdef DEBUG OSDOBJS += \ $(WINOBJ)/debugwin.o endif # add our UI resources RESFILE += $(UIOBJ)/mame32.res $(LIBOSD): $(OSDOBJS) EMUMAIN = $(UIOBJ)/m32main.o #------------------------------------------------- # rule for making the ledutil sample # # Don't build for an MSVC_BUILD #------------------------------------------------- ledutil$(EXE): $(WINOBJ)/ledutil.o $(WINOBJ)/main.o $(LIBOCORE) @echo Linking $@... $(LD) $(LDFLAGS) $^ $(LIBS) -o $@ TOOLS += ledutil$(EXE) #------------------------------------------------- # rules for creating helpids.c #------------------------------------------------- $(UISRC)/helpids.c : $(UIOBJ)/mkhelp$(EXE) $(UISRC)/resource.h $(UISRC)/resource.hm $(UISRC)/mame32.rc $(UIOBJ)/mkhelp$(EXE) $(UISRC)/mame32.rc >$@ # rule to build the generator $(UIOBJ)/mkhelp$(EXE): $(UIOBJ)/mkhelp.o @echo Linking $@... $(LD) $(LDFLAGS) $(OSDBGLDFLAGS) $^ $(LIBS) -o $@ #------------------------------------------------- # rule for making the verinfo tool #------------------------------------------------- VERINFO = $(UIOBJ)/verinfo$(EXE) $(VERINFO): $(UIOBJ)/verinfo.o $(LIBOCORE) @echo Linking $@... $(LD) $(LDFLAGS) $^ $(LIBS) -o $@ BUILD += $(VERINFO) #------------------------------------------------- # Specific rele to compile verinfo util. #------------------------------------------------- $(UIOBJ)/verinfo.o : $(WINSRC)/verinfo.c @echo Compiling $<... $(CC) -DWINUI $(CDEFS) $(CFLAGS) -c $< -o $@ #------------------------------------------------- # generic rule for the resource compiler for UI #------------------------------------------------- $(UIOBJ)/mame32.res: $(UISRC)/mame32.rc $(UIOBJ)/mamevers.rc @echo Compiling mame32 resources $<... $(RC) $(RCDEFS) $(RCFLAGS) -o $@ -i $< #------------------------------------------------- # rules for resource file #------------------------------------------------- $(UIOBJ)/mame32.res: $(UISRC)/mame32.rc $(UIOBJ)/mamevers.rc $(UIOBJ)/mamevers.rc: $(VERINFO) $(SRC)/version.c @echo Emitting $@... @$(VERINFO) $(SRC)/version.c > $@ ##### End windui.mak ##############################################