diff --git a/glide2x/h3/glide/src/Makefile.win32 b/glide2x/h3/glide/src/Makefile.win32 new file mode 100644 index 0000000..2f7a2cd --- /dev/null +++ b/glide2x/h3/glide/src/Makefile.win32 @@ -0,0 +1,261 @@ +# Win32 makefile for Glide2/H3 +# This makefile MUST be processed by GNU make!!! +# +# Copyright (c) 2003 - Daniel Borca +# Email : dborca@users.sourceforge.net +# Web : http://www.geocities.com/dborca +# +# Copyright (c) 2006 - Guillem Jover +# + +# +# Available options: +# +# Environment variables: +# CPU optimize for the given processor. +# default = 6 (PentiumPro) +# DEBUG=1 enable debugging checks and messages +# default = no +# H4=1 High speed Avenger. +# default = no +# USE_X86=1 use assembler triangle specializations! +# default = no +# USE_3DNOW=1 allow 3DNow! specializations. However, the true CPU +# capabilities are still checked at run-time to avoid +# crashes. +# default = no +# +# Targets: +# all: build everything +# glide2x: build Glide2x lib +# clean: remove object files +# realclean: remove all generated files +# + +.PHONY: all glide2x clean realclean +.INTERMEDIATE: fxgasm.exe +.SUFFIXES: .c .obj .rc .res + +############################################################################### +# general defines (user settable?) +############################################################################### + +GLIDE_RES = glide.res +GLIDE_DLL = glide2x.dll +GLIDE_IMP = glide2x.lib + +FX_GLIDE_SW = ../../../swlibs +GLIDE_LIBDIR = ../../lib + +############################################################################### +# tools +############################################################################### + +CC = cl +AS = nasm +LD = link +RC = rc + +ifeq ($(wildcard $(addsuffix /rm.exe,$(subst ;, ,$(PATH)))),) +UNLINK = del $(subst /,\,$(1)) +else +UNLINK = $(RM) $(1) +endif + +############################################################################### +# defines +############################################################################### + +# platform +CDEFS = -D__WIN32__ -DFX_DLL_ENABLE -DHWC_ACCESS_DDRAW=1 -DHWC_EXT_INIT=1 + +# general +CDEFS += -DGLIDE_HW_TRI_SETUP=1 -DGLIDE_INIT_HWC -DGLIDE_PACKED_RGB=0 -DGLIDE_TRI_CULLING=1 +CDEFS += -DGLIDE_LIB -DHAL_HW=1 + +# subsystem +CDEFS += -DH3 +ifdef H4 +CDEFS += -DH4 +endif + +# debug +ifdef DEBUG +CDEFS += -DGDBG_INFO_ON -DGLIDE_DEBUG -DGLIDE_SANITY_ASSERT -DGLIDE_SANITY_SIZE +endif + +override USE_FIFO = 1 +#override USE_X86 = 1 + +ifeq ($(USE_X86),1) +CDEFS += -DGLIDE_DISPATCH_SETUP=1 +override USE_FIFO = 1 +CDEFS += -DHAVE_XDRAWTRI_ASM=1 +override USE_DRAWTRI_ASM = 1 +else +CDEFS += -DGLIDE_USE_C_TRISETUP=1 +endif + +# fifo +ifeq ($(USE_FIFO),1) +CDEFS += -DUSE_PACKET_FIFO=1 -DGLIDE_PACKET3_TRI_SETUP=1 +endif + +# other +CDEFS += -DGLIDE_PLUG -DGLIDE_SPLASH + +# obsolete options +# -DDIAG_BUILD + +############################################################################### +# flags +############################################################################### + +# linker +LDFLAGS = -nologo -dll -opt:WIN98 -machine:IX86 -nodefaultlib + +# assembler +ASFLAGS = -O2 -fwin32 -D__WIN32__ --prefix _ +ASFLAGS += $(CDEFS) + +# compiler +CFLAGS = -nologo -W3 -WX -D__MSC__=1 +CFLAGS += -I. -I../../incsrc -I../../minihwc +CFLAGS += -I$(FX_GLIDE_SW)/fxmisc -I$(FX_GLIDE_SW)/newpci/pcilib -I$(FX_GLIDE_SW)/fxmemmap +CFLAGS += $(CDEFS) + +LDLIBS = user32.lib kernel32.lib ddraw.lib gdi32.lib dxguid.lib advapi32.lib +ifdef DEBUG +CFLAGS += -Od -MTd -Zi +LDFLAGS += -debugtype:both -debug +LDLIBS += LIBCMTD.lib +else +CPU ?= 6 +CFLAGS += -DNDEBUG -G$(CPU) -O2 -MT +LDLIBS += LIBCMT.lib +endif + +ifeq ($(USE_3DNOW),1) +CFLAGS += -DGL_AMD3D +override USE_X86 = 1 +endif + +############################################################################### +# objects +############################################################################### + +GLIDE_OBJECTS = \ + fifo.obj \ + gsplash.obj \ + g3df.obj \ + gu.obj \ + guclip.obj \ + gpci.obj \ + gump.obj \ + diglide.obj \ + disst.obj \ + ditex.obj \ + gbanner.obj \ + gerror.obj \ + gmovie.obj \ + digutex.obj \ + ddgump.obj \ + gaa.obj \ + gdraw.obj \ + gglide.obj \ + glfb.obj \ + gsst.obj \ + gtex.obj \ + gtexdl.obj \ + gutex.obj \ + cpuid.obj \ + xtexdl_def.obj + +ifeq ($(USE_DRAWTRI_ASM),1) +GLIDE_OBJECTS += xdrawtri.obj +endif +ifeq ($(USE_X86),1) +GLIDE_OBJECTS += \ + xdraw2_def.obj +ifeq ($(USE_3DNOW),1) +GLIDE_OBJECTS += \ + xdraw2_3dnow.obj \ + xtexdl_3dnow.obj +endif +else +GLIDE_OBJECTS += \ + gxdraw.obj +endif + +GLIDE_OBJECTS += \ + ../../minihwc/hwcio.obj \ + ../../minihwc/gdebug.obj \ + ../../minihwc/minihwc.obj \ + ../../minihwc/win_mode.obj +# so that we don't need win9x ddk: +GLIDE_OBJECTS += \ + ../../minihwc/win9x.obj + +############################################################################### +# rules +############################################################################### + +.c.obj: + $(CC) -Fo$@ $(CFLAGS) -c $< +.rc.res: + $(RC) -Fo$@ $(CDEFS) -I$(FX_GLIDE_SW)/fxmisc $< + +############################################################################### +# main +############################################################################### +all: glide2x + +glide2x: $(GLIDE_LIBDIR)/$(GLIDE_DLL) + +$(GLIDE_LIBDIR)/$(GLIDE_DLL): $(GLIDE_OBJECTS) $(GLIDE_RES) + $(LD) -out:$@ $(LDFLAGS) $(GLIDE_OBJECTS) $(LDLIBS) $(GLIDE_RES) + +############################################################################### +# rules(2) +############################################################################### + +cpuid.obj: cpudtect.asm + $(AS) -o $@ $(ASFLAGS) $< +xdraw2_def.obj: xdraw2.asm + $(AS) -o $@ $(ASFLAGS) $< +xdraw2_3dnow.obj: xdraw2.asm + $(AS) -o $@ $(ASFLAGS) -DGL_AMD3D=1 $< +xtexdl_3dnow.obj: xtexdl.asm + $(AS) -o $@ $(ASFLAGS) -DGL_AMD3D=1 $< +xdrawtri.obj: xdrawtri.asm + $(AS) -o $@ $(ASFLAGS) $< + +../../minihwc/win9x.obj: ../../minihwc/win9x.asm + $(AS) -o $@ -O2 -fwin32 $< + +$(GLIDE_OBJECTS): fxinline.h fxgasm.h + +fxinline.h: fxgasm.exe + $< -inline > $@ + +fxgasm.h: fxgasm.exe + $< -hex > $@ + +fxgasm.exe: fxgasm.c + $(CC) -o $@ $(CFLAGS) $< + +############################################################################### +# clean, realclean +############################################################################### + +clean: + -$(call UNLINK,*.res) + -$(call UNLINK,*.obj) + -$(call UNLINK,../../minihwc/*.obj) + -$(call UNLINK,fxinline.h) + -$(call UNLINK,fxgasm.h) + +realclean: clean + -$(call UNLINK,$(GLIDE_LIBDIR)/glide2x.exp) + -$(call UNLINK,$(GLIDE_LIBDIR)/$(GLIDE_DLL)) + -$(call UNLINK,$(GLIDE_LIBDIR)/$(GLIDE_IMP))