glide2x: added experimental MinGW makefiles.

This commit is contained in:
sezero
2018-08-20 10:23:10 +03:00
parent e9133561f1
commit 9ba0795fc7
3 changed files with 919 additions and 0 deletions

View File

@@ -0,0 +1,320 @@
# Win32 makefile for Glide2/CVG
# This makefile MUST be processed by GNU make!!!
#
# Copyright (c) 2004
#
# Daniel Borca
# Email : dborca@users.sourceforge.net
# Web : http://www.geocities.com/dborca
#
# Hiroshi Morii
# Email : koolsmoky@users.sourceforge.net
# Web : http://www.3dfxzone.it/koolsmoky
#
#
# Available options:
#
# Environment variables:
# CPU optimize for the given processor.
# default = -mtune=pentium
# DEBUG=1 disable optimizations and build for debug.
# default = no
# USE_X86=1 use assembler triangle specializations; req by CVG
# default = yes
# USE_3DNOW=1 allow 3DNow! specializations. However, the true CPU
# capabilities are still checked at run-time to avoid
# crashes.
# default = no
# USE_MMX=1 allow MMX specializations.
# default = no
# FXOEM2X=1 build fxoem2x.dll
# 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_DEF = glide2x.def
GLIDE_IMP = libglide2x.dll.a
FX_GLIDE_SW = ../../../swlibs
GLIDE_LIBDIR = ../../lib
###############################################################################
# tools
###############################################################################
CC = gcc
AS = nasm
LD = $(CC)
RC = windres
DLLTOOL = dlltool
#for cross-builds
HOST_CC = gcc
UNLINK = $(RM) $(1)
###############################################################################
# defines
###############################################################################
# platform
CDEFS = -D__WIN32__ -DDIRECTX -DFX_DLL_ENABLE -D__3Dfx_PCI_CFG__
# MSVC doesn't define WINNT, but MinGW does. The Glide
# source uses WINNT for its own purposes, so undefine it.
CDEFS += -UWINNT
# general
CDEFS += -DGLIDE_HW_TRI_SETUP=1 -DGLIDE_PACKED_RGB=1 -DGLIDE_TRI_CULLING=1 -DGLIDE_DEFAULT_GAMMA=1.3f -DGLIDE_LIB=1
#CDEFS += -DGLIDE3 -DGLIDE3_ALPHA -DGLIDE3_SCALER
# special sli buffer clears
CDEFS += -DGLIDE_BLIT_CLEAR=1
# workaround for CVGs with broken tsus which cannot send commands to multiple
# tmus using chipfield. chipfield will always be set to 0xf
CDEFS += -DGLIDE_CHIP_BROADCAST=1
# subsystem
CDEFS += -DCVG
# 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 -DGLIDE_DISPATCH_DOWNLOAD=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
# shameless plug and splash screen
CDEFS += -DGLIDE_PLUG -DGLIDE_SPLASH
###############################################################################
# flags
###############################################################################
# linker
LDFLAGS = -shared -m32 -Wl,--enable-auto-image-base -Wl,--no-undefined
# -Xlinker --output-def -Xlinker $(GLIDE_LIBDIR)/$(GLIDE_DEF)
# -Xlinker --out-implib -Xlinker $(GLIDE_LIBDIR)/$(GLIDE_IMP)
DLLTOOL_FLAGS = --as-flags=--32 -m i386 -U
#DLLTOOL_FLAGS+= -k
# assembler
ASFLAGS = -O2 -fwin32 -D__WIN32__ --prefix _
ASFLAGS += $(CDEFS)
# resource compiler
RCFLAGS = --output-format=coff --target=pe-i386
# compiler
CFLAGS = -m32 -Wall
LDLIBS = -luser32 -lkernel32 -ladvapi32
ifdef DEBUG
CFLAGS += -g
else
CPU ?= -mtune=pentium
CFLAGS += -DNDEBUG -O2 -ffast-math $(CPU)
endif
CFLAGS += -I. -I../../incsrc -I../../init
CFLAGS += -I$(FX_GLIDE_SW)/fxmisc -I$(FX_GLIDE_SW)/newpci/pcilib -I$(FX_GLIDE_SW)/fxmemmap
CFLAGS += $(CDEFS)
# cpu optimized triangle
ifeq ($(USE_MMX),1)
CFLAGS += -DGL_MMX
override USE_X86 = 1
endif
ifeq ($(USE_3DNOW),1)
CFLAGS += -DGL_AMD3D
override USE_X86 = 1
endif
# for cross-builds
HOST_CFLAGS=$(filter-out -mcpu=% -mtune=% -DFX_DLL_ENABLE -march=%,$(CFLAGS))
###############################################################################
# objects
###############################################################################
GLIDE_OBJECTS = \
fifo.o \
gsplash.o \
g3df.o \
gu.o \
guclip.o \
gpci.o \
gump.o \
diglide.o \
disst.o \
ditex.o \
gbanner.o \
gerror.o \
gmovie.o \
digutex.o \
ddgump.o \
gaa.o \
gdraw.o \
gglide.o \
glfb.o \
gsst.o \
gtex.o \
gtexdl.o \
gutex.o \
cpuid.o \
fpu.o \
xtexdl_def.o
ifeq ($(USE_DRAWTRI_ASM),1)
GLIDE_OBJECTS += xdrawtri.o
endif
ifeq ($(USE_X86),1)
GLIDE_OBJECTS += \
xdraw2_def.o
ifeq ($(USE_MMX),1)
GLIDE_OBJECTS += \
xtexdl_mmx.o
endif
ifeq ($(USE_3DNOW),1)
GLIDE_OBJECTS += \
xdraw2_3dnow.o \
xtexdl_3dnow.o
endif
else
GLIDE_OBJECTS += \
gxdraw.o
endif
GLIDE_OBJECTS += \
$(FX_GLIDE_SW)/newpci/pcilib/fxpci.o \
$(FX_GLIDE_SW)/newpci/pcilib/fxw32.o \
$(FX_GLIDE_SW)/newpci/pcilib/fxvxd.o \
$(FX_GLIDE_SW)/newpci/pcilib/fxnt.o \
$(FX_GLIDE_SW)/newpci/pcilib/fxmsr.o \
../../init/canopus.o \
../../init/dac.o \
../../init/gamma.o \
../../init/gdebug.o \
../../init/info.o \
../../init/parse.o \
../../init/print.o \
../../init/sli.o \
../../init/sst1init.o \
../../init/util.o \
../../init/video.o \
../../init/fxremap.o
###############################################################################
# rules
###############################################################################
.c.o:
$(CC) -o $@ $(CFLAGS) -c $<
.rc.res:
$(RC) -o $@ $(RCFLAGS) $(CDEFS) -I$(FX_GLIDE_SW)/fxmisc $<
###############################################################################
# main
###############################################################################
all: glide2x fxoem2x
glide2x: $(GLIDE_LIBDIR)/$(GLIDE_DLL) $(GLIDE_LIBDIR)/$(GLIDE_IMP)
$(GLIDE_LIBDIR)/$(GLIDE_DEF): $(GLIDE_LIBDIR)/$(GLIDE_DLL)
$(GLIDE_LIBDIR)/$(GLIDE_DLL): $(GLIDE_OBJECTS) $(GLIDE_RES)
$(LD) -o $@ $(LDFLAGS) -Xlinker --output-def -Xlinker $(GLIDE_LIBDIR)/$(GLIDE_DEF) \
$(GLIDE_OBJECTS) $(LDLIBS) $(GLIDE_RES)
$(GLIDE_LIBDIR)/$(GLIDE_IMP): $(GLIDE_LIBDIR)/$(GLIDE_DLL)
$(DLLTOOL) $(DLLTOOL_FLAGS) --dllname $(GLIDE_DLL) --input-def $(GLIDE_LIBDIR)/$(GLIDE_DEF) --output-lib $@
fxoem2x: $(GLIDE_LIBDIR)/fxoem2x.dll
ifeq ($(FXOEM2X),1)
$(GLIDE_LIBDIR)/fxoem2x.dll: ../oem/oeminit.o ../oem/oeminit.res
# $(LD) -o $@ $(LDFLAGS) ../oem/oeminit.o $(LDLIBS) ../oem/oeminit.res
else
$(GLIDE_LIBDIR)/fxoem2x.dll:
# $(warning FxOem2x not enabled... Skipping fxoem2x.dll)
endif
###############################################################################
# rules(2)
###############################################################################
#cpuid.o: cpudtect.asm
# $(AS) -o $@ $(ASFLAGS) $<
xdraw2_def.o: xdraw2.asm
$(AS) -o $@ $(ASFLAGS) $<
xtexdl_def.o: xtexdl.c
$(CC) -o $@ $(CFLAGS) -c $<
xtexdl_mmx.o: xtexdl.asm
$(AS) -o $@ $(ASFLAGS) -DGL_MMX=1 $<
xdraw2_3dnow.o: xdraw2.asm
$(AS) -o $@ $(ASFLAGS) -DGL_AMD3D=1 $<
xtexdl_3dnow.o: xtexdl.asm
$(AS) -o $@ $(ASFLAGS) -DGL_AMD3D=1 $<
xdrawtri.o: xdrawtri.asm
$(AS) -o $@ $(ASFLAGS) -D__MINGW32__ $<
$(GLIDE_OBJECTS): fxinline.h fxgasm.h
fxinline.h: fxgasm.exe
./$< -inline > $@
fxgasm.h: fxgasm.exe
./$< -hex > $@
fxgasm.exe: fxgasm.c
$(HOST_CC) -o $@ $(HOST_CFLAGS) $<
###############################################################################
# clean, realclean
###############################################################################
clean:
-$(call UNLINK,*.res)
-$(call UNLINK,*.o)
-$(call UNLINK,../../init/*.o)
-$(call UNLINK,$(FX_GLIDE_SW)/newpci/pcilib/*.o)
-$(call UNLINK,fxinline.h)
-$(call UNLINK,fxgasm.h)
-$(call UNLINK,../oem/oeminit.o)
-$(call UNLINK,../oem/oeminit.res)
realclean: clean
-$(call UNLINK,$(GLIDE_LIBDIR)/$(GLIDE_DLL))
-$(call UNLINK,$(GLIDE_LIBDIR)/$(GLIDE_IMP))
-$(call UNLINK,$(GLIDE_LIBDIR)/$(GLIDE_DEF))
-$(call UNLINK,$(GLIDE_LIBDIR)/fxoem2x.dll)

View File

@@ -0,0 +1,295 @@
# 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 <guillem@hadrons.org>
#
#
# Available options:
#
# Environment variables:
# H4=1 High speed Avenger.
# default = no
# OPTFLAGS pass given optimization flags to compiler
# default = -O2 -ffast-math
# DEBUG=1 enable debugging checks and messages
# 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_DEF = glide2x.def
GLIDE_IMP = libglide2x.dll.a
FX_GLIDE_SW = ../../../swlibs
GLIDE_LIBDIR = ../../lib
###############################################################################
# tools
###############################################################################
CC = gcc
AS = nasm
LD = $(CC)
RC = windres
DLLTOOL = dlltool
#for cross-builds
HOST_CC = gcc
UNLINK = $(RM) $(1)
###############################################################################
# defines
###############################################################################
# platform
CDEFS = -D__WIN32__ -DFX_DLL_ENABLE -DHWC_ACCESS_DDRAW=1 -DHWC_EXT_INIT=1
# MSVC doesn't define WINNT, but MinGW does. The Glide
# source uses WINNT for its own purposes, so undefine it.
CDEFS += -UWINNT
# 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 = -shared -m32 -Wl,--enable-auto-image-base -Wl,--no-undefined
# -Xlinker --output-def -Xlinker $(GLIDE_LIBDIR)/$(GLIDE_DEF)
# -Xlinker --out-implib -Xlinker $(GLIDE_LIBDIR)/$(GLIDE_IMP)
DLLTOOL_FLAGS = --as-flags=--32 -m i386 -U
#DLLTOOL_FLAGS+= -k
# assembler
ASFLAGS = -O2 -fwin32 -D__WIN32__ --prefix _
ASFLAGS += $(CDEFS)
# resource compiler
RCFLAGS = --output-format=coff --target=pe-i386
# compiler
CFLAGS = -m32 -Wall
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 = -luser32 -lkernel32 -lddraw -lgdi32 -ldxguid -ladvapi32
ifdef DEBUG
CFLAGS += -g
else
CPU ?= -mtune=pentium
CFLAGS += -DNDEBUG -O2 -ffast-math $(CPU)
endif
ifeq ($(USE_3DNOW),1)
CFLAGS += -DGL_AMD3D
override USE_X86 = 1
endif
ifeq ($(USE_X86),1)
CFLAGS += -DGL_X86
endif
# for cross-builds
# note that with this, fxgasm outputs wrong (20 bytes shorter) SIZEOF_GC and SIZEOF_GrState
# values in fxgasm.h - everything else is the same (compared to fxgasm.h generated by MSVC 6).
# those two are not used by the asm sources, so we are good.
HOST_CFLAGS=$(filter-out -mcpu=% -mtune=% -DFX_DLL_ENABLE -DHWC_EXT_INIT=% -march=%,$(CFLAGS))
###############################################################################
# objects
###############################################################################
GLIDE_OBJECTS = \
fifo.o \
gsplash.o \
g3df.o \
gu.o \
guclip.o \
gpci.o \
gump.o \
diglide.o \
disst.o \
ditex.o \
gbanner.o \
gerror.o \
gmovie.o \
digutex.o \
ddgump.o \
gaa.o \
gdraw.o \
gglide.o \
glfb.o \
gsst.o \
gtex.o \
gtexdl.o \
gutex.o \
cpuid.o \
xtexdl_def.o
ifeq ($(USE_DRAWTRI_ASM),1)
GLIDE_OBJECTS += xdrawtri.o
endif
ifeq ($(USE_X86),1)
GLIDE_OBJECTS += \
xdraw2_def.o
ifeq ($(USE_3DNOW),1)
GLIDE_OBJECTS += \
xdraw2_3dnow.o \
xtexdl_3dnow.o
endif
else
GLIDE_OBJECTS += \
gxdraw.o
endif
GLIDE_OBJECTS += \
../../minihwc/hwcio.o \
../../minihwc/gdebug.o \
../../minihwc/minihwc.o \
../../minihwc/win_mode.o
# so that we don't need win9x ddk:
GLIDE_OBJECTS += \
../../minihwc/win9x.o
###############################################################################
# rules
###############################################################################
.c.o:
$(CC) -o $@ $(CFLAGS) -c $<
.S.o:
$(CC) -o $@ $(CDEFS) -x assembler-with-cpp -c $<
.rc.res:
$(RC) -o $@ $(RCFLAGS) $(CDEFS) -I$(FX_GLIDE_SW)/fxmisc $<
###############################################################################
# main
###############################################################################
all: glide2x
glide2x: $(GLIDE_LIBDIR)/$(GLIDE_DLL) $(GLIDE_LIBDIR)/$(GLIDE_IMP)
$(GLIDE_LIBDIR)/$(GLIDE_DEF): $(GLIDE_LIBDIR)/$(GLIDE_DLL)
$(GLIDE_LIBDIR)/$(GLIDE_DLL): $(GLIDE_OBJECTS) $(GLIDE_RES)
$(LD) -o $@ $(LDFLAGS) -Xlinker --output-def -Xlinker $(GLIDE_LIBDIR)/$(GLIDE_DEF) \
$(GLIDE_OBJECTS) $(LDLIBS) $(GLIDE_RES)
$(GLIDE_LIBDIR)/$(GLIDE_IMP): $(GLIDE_LIBDIR)/$(GLIDE_DLL)
$(DLLTOOL) $(DLLTOOL_FLAGS) --dllname $(GLIDE_DLL) --input-def $(GLIDE_LIBDIR)/$(GLIDE_DEF) --output-lib $@
###############################################################################
# rules(2)
###############################################################################
#cpuid.o: cpudtect.S
# $(CC) -o $@ -xassembler-with-cpp -c $(CDEFS) $<
#xdraw2_def.o: xdraw2.S
# $(CC) -o $@ -xassembler-with-cpp -c $(CDEFS) $<
#xdraw2_3dnow.o: xdraw2.S
# $(CC) -o $@ -xassembler-with-cpp -c $(CDEFS) -DGL_AMD3D=1 $<
#xtexdl_3dnow.o: xtexdl.S
# $(CC) -o $@ -xassembler-with-cpp -c $(CDEFS) -DGL_AMD3D=1 $<
#xdrawtri.o: xdrawtri.S
# $(CC) -o $@ -xassembler-with-cpp -c $(CDEFS) $<
cpuid.o: cpudtect.asm
$(AS) -o $@ $(ASFLAGS) $<
xdraw2_def.o: xdraw2.asm
$(AS) -o $@ $(ASFLAGS) $<
xdraw2_3dnow.o: xdraw2.asm
$(AS) -o $@ $(ASFLAGS) -DGL_AMD3D=1 $<
xtexdl_3dnow.o: xtexdl.asm
$(AS) -o $@ $(ASFLAGS) -DGL_AMD3D=1 $<
xdrawtri.o: xdrawtri.asm
$(AS) -o $@ $(ASFLAGS) -D__MINGW32__ $<
../../minihwc/win9x.o: ../../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
$(HOST_CC) -o $@ $(HOST_CFLAGS) $<
###############################################################################
# clean, realclean
###############################################################################
clean:
-$(call UNLINK,*.res)
-$(call UNLINK,*.o)
-$(call UNLINK,../../minihwc/*.o)
-$(call UNLINK,fxinline.h)
-$(call UNLINK,fxgasm.h)
realclean: clean
-$(call UNLINK,$(GLIDE_LIBDIR)/$(GLIDE_DLL))
-$(call UNLINK,$(GLIDE_LIBDIR)/$(GLIDE_IMP))
-$(call UNLINK,$(GLIDE_LIBDIR)/$(GLIDE_DEF))

View File

@@ -0,0 +1,304 @@
# Win32 makefile for Glide2/SST1
# This makefile MUST be processed by GNU make!!!
#
# Copyright (c) 2004
#
# Daniel Borca
# Email : dborca@users.sourceforge.net
# Web : http://www.geocities.com/dborca
#
# Hiroshi Morii
# Email : koolsmoky@users.sourceforge.net
# Web : http://www.3dfxzone.it/koolsmoky
#
#
# Available options:
#
# Environment variables:
# FX_GLIDE_HW build for the given ASIC (either sst1, or sst96).
# default = sst1
# CPU optimize for the given processor.
# default = -mtune=pentium
# DEBUG=1 disable optimizations and build for debug.
# default = no
# USE_X86=1 use assembler triangle specializations!
# 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_DEF = glide2x.def
GLIDE_IMP = libglide2x.dll.a
FX_GLIDE_HW ?= sst1
FX_GLIDE_SW = ../../../swlibs
GLIDE_LIBDIR = ../../lib
###############################################################################
# tools
###############################################################################
CC = gcc
AS = nasm
LD = $(CC)
RC = windres
DLLTOOL = dlltool
#for cross-builds
HOST_CC = gcc
UNLINK = $(RM) $(1)
###############################################################################
# defines
###############################################################################
# platform
CDEFS = -D__WIN32__ -DDIRECTX -DFX_DLL_ENABLE -DINIT_ACCESS_DDRAW
# MSVC doesn't define WINNT, but MinGW does. The Glide
# source uses WINNT for its own purposes, so undefine it.
CDEFS += -UWINNT
# general
CDEFS += -DGLIDE_HARDWARE -DGLIDE_DEFAULT_GAMMA=1.3f -DGLIDE_LIB=1
# subsystem
ifeq ($(FX_GLIDE_HW),sst1)
CDEFS += -DSST1
else
ifeq ($(FX_GLIDE_HW),sst96)
CDEFS += -DSST96
CDEFS += -DSST96_FIFO
#CDEFS += -DSST96_ALT_FIFO_WRAP
#CDEFS += -DINIT96VGASWAP
#CDEFS += -DINIT_ACCESS_DIRECT
CDEFS += -DGLIDE_USE_ALT_REGMAP
else
$(error Invalid FX_GLIDE_HW setting)
endif
endif
# debug
ifdef DEBUG
CDEFS += -DGDBG_INFO_ON -DGLIDE_DEBUG -DGLIDE_SANITY_ASSERT -DGLIDE_SANITY_SIZE
endif
# shameless plug and splash screen
CDEFS += -DGLIDE_PLUG -DGLIDE_SPLASH
###############################################################################
# flags
###############################################################################
# linker
LDFLAGS = -shared -m32 -Wl,--enable-auto-image-base -Wl,--no-undefined
# -Xlinker --output-def -Xlinker $(GLIDE_LIBDIR)/$(GLIDE_DEF)
# -Xlinker --out-implib -Xlinker $(GLIDE_LIBDIR)/$(GLIDE_IMP)
DLLTOOL_FLAGS = --as-flags=--32 -m i386 -U
#DLLTOOL_FLAGS+= -k
# assembler
ASFLAGS = -O2 -fwin32 -D__WIN32__ --prefix _
ASFLAGS += $(CDEFS)
# resource compiler
RCFLAGS = --output-format=coff --target=pe-i386
# compiler
CFLAGS = -m32 -Wall
LDLIBS = -luser32 -lkernel32
ifeq ($(FX_GLIDE_HW),sst96)
LDLIBS += -lgdi32 -lddraw -ldxguid
endif
ifdef DEBUG
CFLAGS += -g
else
CPU ?= -mtune=pentium
CFLAGS += -DNDEBUG -O2 -ffast-math $(CPU)
endif
CFLAGS += -I. -I../../incsrc -I../../init -I../../init/initvg -I../../init/init96
CFLAGS += -I$(FX_GLIDE_SW)/fxmisc -I$(FX_GLIDE_SW)/newpci/pcilib -I$(FX_GLIDE_SW)/fxmemmap
CFLAGS += $(CDEFS)
ifneq ($(USE_X86),1)
CFLAGS += -DGLIDE_USE_C_TRISETUP
endif
# for cross-builds
HOST_CFLAGS=$(filter-out -mcpu=% -mtune=% -DFX_DLL_ENABLE -march=%,$(CFLAGS))
###############################################################################
# objects
###############################################################################
GLIDE_OBJECTS = \
gsplash.o \
g3df.o \
gu.o \
guclip.o \
gpci.o \
gump.o \
diglide.o \
disst.o \
ditex.o \
gbanner.o \
gerror.o \
gmovie.o \
digutex.o \
ddgump.o \
gaa.o \
gdraw.o \
gglide.o \
glfb.o \
gsst.o \
gtex.o \
gtexdl.o \
gutex.o \
gxdraw.o
GLIDE_OBJECTS += \
cpuid.o
ifeq ($(USE_X86),1)
ifeq ($(FX_GLIDE_HW),sst1)
GLIDE_OBJECTS += \
xdraw.o
else
GLIDE_OBJECTS += \
xdraw96.o
endif
endif
ifeq ($(FX_GLIDE_HW),sst96)
GLIDE_OBJECTS += \
sst96.o \
../../init/init96/init96.o \
../../init/init96/dxdrvr.o \
../../init/init96/initat3d.o \
../../init/init96/initmcrx.o
endif
GLIDE_OBJECTS += \
../../init/init.o \
../../init/vgdrvr.o \
../../init/vg96drvr.o \
../../init/initvg/gamma.o \
../../init/initvg/dac.o \
../../init/initvg/video.o \
../../init/initvg/parse.o \
../../init/initvg/sli.o \
../../init/initvg/util.o \
../../init/initvg/info.o \
../../init/initvg/print.o \
../../init/initvg/gdebug.o \
../../init/initvg/sst1init.o \
$(FX_GLIDE_SW)/newpci/pcilib/sst1_pci.o \
$(FX_GLIDE_SW)/newpci/pcilib/fxmsr.o \
$(FX_GLIDE_SW)/newpci/pcilib/fxpci.o \
$(FX_GLIDE_SW)/newpci/pcilib/fxw32.o \
$(FX_GLIDE_SW)/newpci/pcilib/fxvxd.o \
$(FX_GLIDE_SW)/newpci/pcilib/fxnt.o
###############################################################################
# rules
###############################################################################
.c.o:
$(CC) -o $@ $(CFLAGS) -c $<
.rc.res:
$(RC) -o $@ $(RCFLAGS) $(CDEFS) -I$(FX_GLIDE_SW)/fxmisc $<
###############################################################################
# main
###############################################################################
all: glide2x
glide2x: $(GLIDE_LIBDIR)/$(GLIDE_DLL) $(GLIDE_LIBDIR)/$(GLIDE_IMP)
$(GLIDE_LIBDIR)/$(GLIDE_DEF): $(GLIDE_LIBDIR)/$(GLIDE_DLL)
$(GLIDE_LIBDIR)/$(GLIDE_DLL): $(GLIDE_OBJECTS) $(GLIDE_RES)
$(LD) -o $@ $(LDFLAGS) -Xlinker --output-def -Xlinker $(GLIDE_LIBDIR)/$(GLIDE_DEF) \
$(GLIDE_OBJECTS) $(LDLIBS) $(GLIDE_RES)
$(GLIDE_LIBDIR)/$(GLIDE_IMP): $(GLIDE_LIBDIR)/$(GLIDE_DLL)
$(DLLTOOL) $(DLLTOOL_FLAGS) --dllname $(GLIDE_DLL) --input-def $(GLIDE_LIBDIR)/$(GLIDE_DEF) --output-lib $@
###############################################################################
# rules(2)
###############################################################################
cpuid.o: cpudtect.asm
$(AS) -o $@ $(ASFLAGS) $<
xdraw.o: xdraw.asm
$(AS) -o $@ $(ASFLAGS) -D__MINGW32__ $<
xdraw96.o: xdraw96.asm
$(AS) -o $@ $(ASFLAGS) -D__MINGW32__ $<
ifeq ($(FX_GLIDE_HW),sst96)
../../init/initvg/gamma.o: ../../init/initvg/gamma.c
$(CC) -o $@ $(CFLAGS) -USST96 -c $<
../../init/initvg/dac.o: ../../init/initvg/dac.c
$(CC) -o $@ $(CFLAGS) -USST96 -c $<
../../init/initvg/video.o: ../../init/initvg/video.c
$(CC) -o $@ $(CFLAGS) -USST96 -c $<
../../init/initvg/parse.o: ../../init/initvg/parse.c
$(CC) -o $@ $(CFLAGS) -USST96 -c $<
../../init/initvg/sli.o: ../../init/initvg/sli.c
$(CC) -o $@ $(CFLAGS) -USST96 -c $<
../../init/initvg/util.o: ../../init/initvg/util.c
$(CC) -o $@ $(CFLAGS) -USST96 -c $<
../../init/initvg/info.o: ../../init/initvg/info.c
$(CC) -o $@ $(CFLAGS) -USST96 -c $<
../../init/initvg/print.o: ../../init/initvg/print.c
$(CC) -o $@ $(CFLAGS) -USST96 -c $<
../../init/initvg/gdebug.o: ../../init/initvg/gdebug.c
$(CC) -o $@ $(CFLAGS) -USST96 -c $<
../../init/initvg/sst1init.o: ../../init/initvg/sst1init.c
$(CC) -o $@ $(CFLAGS) -USST96 -c $<
endif
$(GLIDE_OBJECTS): fxinline.h fxgasm.h
fxinline.h: fxgasm.exe
./$< -inline > $@
fxgasm.h: fxgasm.exe
./$< -hex > $@
fxgasm.exe: fxgasm.c
$(HOST_CC) -o $@ $(HOST_CFLAGS) $<
###############################################################################
# clean, realclean
###############################################################################
clean:
-$(call UNLINK,*.res)
-$(call UNLINK,*.o)
-$(call UNLINK,../../init/*.o)
-$(call UNLINK,../../init/initvg/*.o)
-$(call UNLINK,../../init/init96/*.o)
-$(call UNLINK,$(FX_GLIDE_SW)/newpci/pcilib/*.o)
-$(call UNLINK,fxinline.h)
-$(call UNLINK,fxgasm.h)
realclean: clean
-$(call UNLINK,$(GLIDE_LIBDIR)/$(GLIDE_DLL))
-$(call UNLINK,$(GLIDE_LIBDIR)/$(GLIDE_IMP))
-$(call UNLINK,$(GLIDE_LIBDIR)/$(GLIDE_DEF))