DJGPP Makefile updates with some (ugly) cross-build workarounds.

This commit is contained in:
sezero
2018-08-03 19:55:02 +03:00
parent 35be4ad445
commit 720d0b125e
8 changed files with 122 additions and 102 deletions

View File

@@ -19,7 +19,7 @@
# default = no # default = no
# OPTFLAGS pass given optimization flags to compiler # OPTFLAGS pass given optimization flags to compiler
# target = sst1, sst96, cvg, h3, h5 # target = sst1, sst96, cvg, h3, h5
# default = -O2 -ffast-math # default = -O2 -ffast-math (+ -mcpu=pentium if USE_X86=1)
# DEBUG=1 enable debugging checks and messages # DEBUG=1 enable debugging checks and messages
# target = sst1, sst96, cvg, h3, h5 # target = sst1, sst96, cvg, h3, h5
# default = no # default = no

View File

@@ -12,7 +12,7 @@
# FX_GLIDE_HW build for the given ASIC (cvg). # FX_GLIDE_HW build for the given ASIC (cvg).
# default = cvg # default = cvg
# OPTFLAGS pass given optimization flags to compiler # OPTFLAGS pass given optimization flags to compiler
# default = -O2 -ffast-math # default = -O2 -ffast-math (+ -mtune=pentium if USE_X86=1)
# DEBUG=1 enable debugging checks and messages # DEBUG=1 enable debugging checks and messages
# default = no # default = no
# USE_X86=1 use assembler triangle specializations; req by CVG # USE_X86=1 use assembler triangle specializations; req by CVG
@@ -43,9 +43,9 @@
# general defines (user settable?) # general defines (user settable?)
############################################################################### ###############################################################################
GLIDE_LIB = libgld3x.a GLIDE_LIB = libglide3x.a
GLIDE_DXE = glide3x.dxe GLIDE_DXE = glide3x.dxe
GLIDE_IMP = libgld3i.a GLIDE_IMP = libglide3i.a
TEXUS_EXE = texus2.exe TEXUS_EXE = texus2.exe
FX_GLIDE_HW ?= cvg FX_GLIDE_HW ?= cvg
@@ -58,16 +58,11 @@ TEXUS_EXEDIR = $(FX_GLIDE_SW)/bin
############################################################################### ###############################################################################
CC = gcc CC = gcc
HOST_CC = gcc
AS = nasm AS = nasm
AR = ar AR = ar
HAVEDXE3 = $(wildcard $(DJDIR)/bin/dxe3gen.exe) UNLINK = rm -f $(1)
ifeq ($(wildcard $(addsuffix /rm.exe,$(subst ;, ,$(PATH)))),)
UNLINK = del $(subst /,\,$(1))
else
UNLINK = $(RM) $(1)
endif
############################################################################### ###############################################################################
# defines # defines
@@ -110,11 +105,11 @@ endif
ARFLAGS = rus ARFLAGS = rus
# assembler # assembler
ASFLAGS = -O6 -fcoff -D__DJGPP__ --prefix _ ASFLAGS = -O2 -fcoff -D__DJGPP__ --prefix _
ASFLAGS += $(CDEFS) ASFLAGS += $(CDEFS)
# compiler # compiler
CFLAGS = -Wall -W CFLAGS = -Wall
CFLAGS += -I. -I../../incsrc -I../../init CFLAGS += -I. -I../../incsrc -I../../init
CFLAGS += -I$(FX_GLIDE_SW)/fxmisc -I$(FX_GLIDE_SW)/newpci/pcilib -I$(FX_GLIDE_SW)/fxmemmap CFLAGS += -I$(FX_GLIDE_SW)/fxmisc -I$(FX_GLIDE_SW)/newpci/pcilib -I$(FX_GLIDE_SW)/fxmemmap
CFLAGS += -I$(FX_GLIDE_SW)/texus2/lib CFLAGS += -I$(FX_GLIDE_SW)/texus2/lib
@@ -132,14 +127,15 @@ endif
ifeq ($(USE_X86),1) ifeq ($(USE_X86),1)
CFLAGS += -DGL_X86 CFLAGS += -DGL_X86
OPTFLAGS ?= -O2 -ffast-math OPTFLAGS ?= -O1 -ffast-math -mtune=pentium
else else
CFLAGS += -DGLIDE_USE_C_TRISETUP CFLAGS += -DGLIDE_USE_C_TRISETUP
OPTFLAGS ?= -O2 -ffast-math OPTFLAGS ?= -O1 -ffast-math
endif endif
# optflags # optflags
CFLAGS += $(OPTFLAGS) CFLAGS += $(OPTFLAGS)
HOST_CFLAGS=$(filter-out -mcpu=% -mtune=% -march=%,$(CFLAGS))
############################################################################### ###############################################################################
# objects # objects
@@ -176,7 +172,7 @@ GLIDE_OBJECTS += \
xdraw3_def.o xdraw3_def.o
ifeq ($(USE_MMX),1) ifeq ($(USE_MMX),1)
GLIDE_OBJECTS += \ GLIDE_OBJECTS += \
xtexdl_mmx.obj xtexdl_mmx.o
endif endif
ifeq ($(USE_3DNOW),1) ifeq ($(USE_3DNOW),1)
GLIDE_OBJECTS += \ GLIDE_OBJECTS += \
@@ -254,15 +250,11 @@ $(GLIDE_LIBDIR)/$(GLIDE_LIB): $(GLIDE_OBJECTS)
$(AR) $(ARFLAGS) $@ $^ $(AR) $(ARFLAGS) $@ $^
$(GLIDE_LIBDIR)/$(GLIDE_DXE) $(GLIDE_LIBDIR)/$(GLIDE_IMP): $(GLIDE_OBJECTS) $(GLIDE_LIBDIR)/$(GLIDE_DXE) $(GLIDE_LIBDIR)/$(GLIDE_IMP): $(GLIDE_OBJECTS)
ifeq ($(HAVEDXE3),)
$(warning Missing DXE3 package... Skipping $(GLIDE_DXE))
else
-dxe3gen -o $(GLIDE_LIBDIR)/$(GLIDE_DXE) -Y $(GLIDE_LIBDIR)/$(GLIDE_IMP) -D "Glide3(cvg) DJGPP" -E _gr -E _gu -E _tx -U $^ -dxe3gen -o $(GLIDE_LIBDIR)/$(GLIDE_DXE) -Y $(GLIDE_LIBDIR)/$(GLIDE_IMP) -D "Glide3(cvg) DJGPP" -E _gr -E _gu -E _tx -U $^
endif
$(TEXUS_EXEDIR)/$(TEXUS_EXE): $(FX_GLIDE_SW)/texus2/cmd/cmd.c $(GLIDE_LIBDIR)/$(GLIDE_LIB) $(TEXUS_EXEDIR)/$(TEXUS_EXE): $(FX_GLIDE_SW)/texus2/cmd/cmd.c $(GLIDE_LIBDIR)/$(GLIDE_LIB)
ifeq ($(TEXUS2),1) ifeq ($(TEXUS2),1)
$(CC) -o $@ -s $(CFLAGS) -L$(GLIDE_LIBDIR) $< -lgld3x $(CC) -o $@ -s $(CFLAGS) -L$(GLIDE_LIBDIR) $< -lglide3x
else else
$(warning Texus2 not enabled... Skipping $(TEXUS_EXE)) $(warning Texus2 not enabled... Skipping $(TEXUS_EXE))
endif endif
@@ -279,7 +271,7 @@ xdraw3_def.o: xdraw3.asm
$(AS) -o $@ $(ASFLAGS) $< $(AS) -o $@ $(ASFLAGS) $<
xtexdl_def.o: xtexdl.c xtexdl_def.o: xtexdl.c
$(CC) -o $@ $(CFLAGS) -c $< $(CC) -o $@ $(CFLAGS) -c $<
xtexdl_mmx.obj: xtexdl.asm xtexdl_mmx.o: xtexdl.asm
$(AS) -o $@ $(ASFLAGS) -DGL_MMX=1 $< $(AS) -o $@ $(ASFLAGS) -DGL_MMX=1 $<
xdraw2_3dnow.o: xdraw2.asm xdraw2_3dnow.o: xdraw2.asm
$(AS) -o $@ $(ASFLAGS) -DGL_AMD3D=1 $< $(AS) -o $@ $(ASFLAGS) -DGL_AMD3D=1 $<
@@ -290,14 +282,21 @@ xtexdl_3dnow.o: xtexdl.asm
$(GLIDE_OBJECTS): fxinline.h fxgasm.h $(GLIDE_OBJECTS): fxinline.h fxgasm.h
# cross-compile workaround:
ifneq ($(COMSPEC),)
RUN_FXGASM=fxgasm.exe
else
RUN_FXGASM=./fxgasm.exe
endif
fxinline.h: fxgasm.exe fxinline.h: fxgasm.exe
$< -inline > $@ $(RUN_FXGASM) -inline > $@
fxgasm.h: fxgasm.exe fxgasm.h: fxgasm.exe
$< -hex > $@ $(RUN_FXGASM) -hex > $@
fxgasm.exe: fxgasm.c fxgasm.exe: fxgasm.c
$(CC) -o $@ $(CFLAGS) $< $(HOST_CC) -o $@ $(HOST_CFLAGS) $<
############################################################################### ###############################################################################
# clean, realclean # clean, realclean

View File

@@ -27,8 +27,10 @@ FX_GLIDE_HW = cvg
TOP = ../../.. TOP = ../../..
CPU ?= pentium CPU ?= pentium
UNLINK = rm -f $(1)
CC = gcc CC = gcc
CFLAGS = -Wall -O2 -ffast-math -mcpu=$(CPU) CFLAGS = -Wall -O2 -ffast-math -mtune=$(CPU)
CFLAGS += -I$(TOP)/$(FX_GLIDE_HW)/glide3/src -I$(TOP)/$(FX_GLIDE_HW)/incsrc CFLAGS += -I$(TOP)/$(FX_GLIDE_HW)/glide3/src -I$(TOP)/$(FX_GLIDE_HW)/incsrc
CFLAGS += -I$(TOP)/swlibs/fxmisc CFLAGS += -I$(TOP)/swlibs/fxmisc
CFLAGS += -D__DOS__ -DCVG CFLAGS += -D__DOS__ -DCVG
@@ -37,9 +39,9 @@ CFLAGS += -D__DOS32__
LDFLAGS = -s -L$(TOP)/$(FX_GLIDE_HW)/lib LDFLAGS = -s -L$(TOP)/$(FX_GLIDE_HW)/lib
ifdef DXE ifdef DXE
LDLIBS = -lgld3i LDLIBS = -lglide3i
else else
LDLIBS = -lgld3x LDLIBS = -lglide3x
endif endif
.c.o: .c.o:
@@ -49,3 +51,7 @@ endif
all: all:
$(error Must specify <filename.exe> to build) $(error Must specify <filename.exe> to build)
clean:
-$(call UNLINK,*.o)
-$(call UNLINK,*.exe)

View File

@@ -41,9 +41,9 @@
# general defines (user settable?) # general defines (user settable?)
############################################################################### ###############################################################################
GLIDE_LIB = libgld3x.a GLIDE_LIB = libglide3x.a
GLIDE_DXE = glide3x.dxe GLIDE_DXE = glide3x.dxe
GLIDE_IMP = libgld3i.a GLIDE_IMP = libglide3i.a
TEXUS_EXE = texus2.exe TEXUS_EXE = texus2.exe
FX_GLIDE_HW ?= h3 FX_GLIDE_HW ?= h3
@@ -56,16 +56,11 @@ TEXUS_EXEDIR = $(FX_GLIDE_SW)/bin
############################################################################### ###############################################################################
CC = gcc CC = gcc
HOST_CC = gcc
AS = nasm AS = nasm
AR = ar AR = ar
HAVEDXE3 = $(wildcard $(DJDIR)/bin/dxe3gen.exe) UNLINK = rm -f $(1)
ifeq ($(wildcard $(addsuffix /rm.exe,$(subst ;, ,$(PATH)))),)
UNLINK = del $(subst /,\,$(1))
else
UNLINK = $(RM) $(1)
endif
############################################################################### ###############################################################################
# defines # defines
@@ -104,11 +99,11 @@ endif
ARFLAGS = rus ARFLAGS = rus
# assembler # assembler
ASFLAGS = -O6 -fcoff -D__DJGPP__ --prefix _ ASFLAGS = -O2 -fcoff -D__DJGPP__ --prefix _
ASFLAGS += $(CDEFS) ASFLAGS += $(CDEFS)
# compiler # compiler
CFLAGS = -Wall -W CFLAGS = -Wall
CFLAGS += -I. -I../../incsrc -I../../minihwc -I../../cinit CFLAGS += -I. -I../../incsrc -I../../minihwc -I../../cinit
CFLAGS += -I$(FX_GLIDE_SW)/fxmisc -I$(FX_GLIDE_SW)/newpci/pcilib -I$(FX_GLIDE_SW)/fxmemmap CFLAGS += -I$(FX_GLIDE_SW)/fxmisc -I$(FX_GLIDE_SW)/newpci/pcilib -I$(FX_GLIDE_SW)/fxmemmap
CFLAGS += -I$(FX_GLIDE_SW)/texus2/lib CFLAGS += -I$(FX_GLIDE_SW)/texus2/lib
@@ -121,14 +116,15 @@ endif
ifeq ($(USE_X86),1) ifeq ($(USE_X86),1)
CFLAGS += -DGL_X86 CFLAGS += -DGL_X86
OPTFLAGS ?= -O2 -ffast-math OPTFLAGS ?= -O1 -ffast-math
else else
CFLAGS += -DGLIDE_USE_C_TRISETUP CFLAGS += -DGLIDE_USE_C_TRISETUP
OPTFLAGS ?= -O2 -ffast-math OPTFLAGS ?= -O1 -ffast-math
endif endif
# optflags # optflags
CFLAGS += $(OPTFLAGS) CFLAGS += $(OPTFLAGS)
HOST_CFLAGS=$(filter-out -mcpu=% -mtune=% -march=%,$(CFLAGS))
############################################################################### ###############################################################################
# objects # objects
@@ -235,15 +231,11 @@ $(GLIDE_LIBDIR)/$(GLIDE_LIB): $(GLIDE_OBJECTS)
$(AR) $(ARFLAGS) $@ $^ $(AR) $(ARFLAGS) $@ $^
$(GLIDE_LIBDIR)/$(GLIDE_DXE) $(GLIDE_LIBDIR)/$(GLIDE_IMP): $(GLIDE_OBJECTS) $(GLIDE_LIBDIR)/$(GLIDE_DXE) $(GLIDE_LIBDIR)/$(GLIDE_IMP): $(GLIDE_OBJECTS)
ifeq ($(HAVEDXE3),)
$(warning Missing DXE3 package... Skipping $(GLIDE_DXE))
else
-dxe3gen -o $(GLIDE_LIBDIR)/$(GLIDE_DXE) -Y $(GLIDE_LIBDIR)/$(GLIDE_IMP) -D "Glide3(h3) DJGPP" -E _gr -E _gu -E _tx -U $^ -dxe3gen -o $(GLIDE_LIBDIR)/$(GLIDE_DXE) -Y $(GLIDE_LIBDIR)/$(GLIDE_IMP) -D "Glide3(h3) DJGPP" -E _gr -E _gu -E _tx -U $^
endif
$(TEXUS_EXEDIR)/$(TEXUS_EXE): $(FX_GLIDE_SW)/texus2/cmd/cmd.c $(GLIDE_LIBDIR)/$(GLIDE_LIB) $(TEXUS_EXEDIR)/$(TEXUS_EXE): $(FX_GLIDE_SW)/texus2/cmd/cmd.c $(GLIDE_LIBDIR)/$(GLIDE_LIB)
ifeq ($(TEXUS2),1) ifeq ($(TEXUS2),1)
$(CC) -o $@ -s $(CFLAGS) -L$(GLIDE_LIBDIR) $< -lgld3x $(CC) -o $@ -s $(CFLAGS) -L$(GLIDE_LIBDIR) $< -lglide3x
else else
$(warning Texus2 not enabled... Skipping $(TEXUS_EXE)) $(warning Texus2 not enabled... Skipping $(TEXUS_EXE))
endif endif
@@ -267,14 +259,21 @@ xtexdl_3dnow.o: xtexdl.asm
$(GLIDE_OBJECTS): fxinline.h fxgasm.h $(GLIDE_OBJECTS): fxinline.h fxgasm.h
# cross-compile workaround:
ifneq ($(COMSPEC),)
RUN_FXGASM=fxgasm.exe
else
RUN_FXGASM=./fxgasm.exe
endif
fxinline.h: fxgasm.exe fxinline.h: fxgasm.exe
$< -inline > $@ $(RUN_FXGASM) -inline > $@
fxgasm.h: fxgasm.exe fxgasm.h: fxgasm.exe
$< -hex > $@ $(RUN_FXGASM) -hex > $@
fxgasm.exe: fxgasm.c fxgasm.exe: fxgasm.c
$(CC) -o $@ $(CFLAGS) $< $(HOST_CC) -o $@ $(HOST_CFLAGS) $<
############################################################################### ###############################################################################
# clean, realclean # clean, realclean

View File

@@ -14,7 +14,8 @@
# H4=1 High speed Avenger/Napalm. # H4=1 High speed Avenger/Napalm.
# default = no # default = no
# OPTFLAGS pass given optimization flags to compiler # OPTFLAGS pass given optimization flags to compiler
# default = -O2 -ffast-math # default = -O1 -ffast-math
# -O2 has problems in SLI configurations and GCC3
# DEBUG=1 enable debugging checks and messages # DEBUG=1 enable debugging checks and messages
# default = no # default = no
# USE_X86=1 use assembler triangle specializations! # USE_X86=1 use assembler triangle specializations!
@@ -46,9 +47,9 @@
# general defines (user settable?) # general defines (user settable?)
############################################################################### ###############################################################################
GLIDE_LIB = libgld3x.a GLIDE_LIB = libglide3x.a
GLIDE_DXE = glide3x.dxe GLIDE_DXE = glide3x.dxe
GLIDE_IMP = libgld3i.a GLIDE_IMP = libglide3i.a
TEXUS_EXE = texus2.exe TEXUS_EXE = texus2.exe
FX_GLIDE_HW ?= h5 FX_GLIDE_HW ?= h5
@@ -61,16 +62,11 @@ TEXUS_EXEDIR = $(FX_GLIDE_SW)/bin
############################################################################### ###############################################################################
CC = gcc CC = gcc
HOST_CC = gcc
AS = nasm AS = nasm
AR = ar AR = ar
HAVEDXE3 = $(wildcard $(DJDIR)/bin/dxe3gen.exe) UNLINK = rm -f $(1)
ifeq ($(wildcard $(addsuffix /rm.exe,$(subst ;, ,$(PATH)))),)
UNLINK = del $(subst /,\,$(1))
else
UNLINK = $(RM) $(1)
endif
############################################################################### ###############################################################################
# defines # defines
@@ -110,11 +106,11 @@ endif
ARFLAGS = rus ARFLAGS = rus
# assembler # assembler
ASFLAGS = -O6 -fcoff -D__DJGPP__ --prefix _ ASFLAGS = -O2 -fcoff -D__DJGPP__ --prefix _
ASFLAGS += $(CDEFS) ASFLAGS += $(CDEFS)
# compiler # compiler
CFLAGS = -Wall -W CFLAGS = -Wall -fno-strict-aliasing
CFLAGS += -I. -I../../incsrc -I../../minihwc -I../../cinit CFLAGS += -I. -I../../incsrc -I../../minihwc -I../../cinit
CFLAGS += -I$(FX_GLIDE_SW)/fxmisc -I$(FX_GLIDE_SW)/newpci/pcilib -I$(FX_GLIDE_SW)/fxmemmap CFLAGS += -I$(FX_GLIDE_SW)/fxmisc -I$(FX_GLIDE_SW)/newpci/pcilib -I$(FX_GLIDE_SW)/fxmemmap
CFLAGS += -I$(FX_GLIDE_SW)/texus2/lib CFLAGS += -I$(FX_GLIDE_SW)/texus2/lib
@@ -139,14 +135,15 @@ endif
ifeq ($(USE_X86),1) ifeq ($(USE_X86),1)
CFLAGS += -DGL_X86 CFLAGS += -DGL_X86
OPTFLAGS ?= -O2 -ffast-math OPTFLAGS ?= -O1 -ffast-math
else else
CFLAGS += -DGLIDE_USE_C_TRISETUP CFLAGS += -DGLIDE_USE_C_TRISETUP
OPTFLAGS ?= -O2 -ffast-math OPTFLAGS ?= -O1 -ffast-math
endif endif
# optflags # optflags
CFLAGS += $(OPTFLAGS) CFLAGS += $(OPTFLAGS)
HOST_CFLAGS=$(filter-out -mcpu=% -mtune=% -march=%,$(CFLAGS))
############################################################################### ###############################################################################
# objects # objects
@@ -263,15 +260,11 @@ $(GLIDE_LIBDIR)/$(GLIDE_LIB): $(GLIDE_OBJECTS)
$(AR) $(ARFLAGS) $@ $^ $(AR) $(ARFLAGS) $@ $^
$(GLIDE_LIBDIR)/$(GLIDE_DXE) $(GLIDE_LIBDIR)/$(GLIDE_IMP): $(GLIDE_OBJECTS) $(GLIDE_LIBDIR)/$(GLIDE_DXE) $(GLIDE_LIBDIR)/$(GLIDE_IMP): $(GLIDE_OBJECTS)
ifeq ($(HAVEDXE3),)
$(warning Missing DXE3 package... Skipping $(GLIDE_DXE))
else
-dxe3gen -o $(GLIDE_LIBDIR)/$(GLIDE_DXE) -Y $(GLIDE_LIBDIR)/$(GLIDE_IMP) -D "Glide3(h5) DJGPP" -E _gr -E _gu -E _tx -U $^ -dxe3gen -o $(GLIDE_LIBDIR)/$(GLIDE_DXE) -Y $(GLIDE_LIBDIR)/$(GLIDE_IMP) -D "Glide3(h5) DJGPP" -E _gr -E _gu -E _tx -U $^
endif
$(TEXUS_EXEDIR)/$(TEXUS_EXE): $(FX_GLIDE_SW)/texus2/cmd/cmd.c $(GLIDE_LIBDIR)/$(GLIDE_LIB) $(TEXUS_EXEDIR)/$(TEXUS_EXE): $(FX_GLIDE_SW)/texus2/cmd/cmd.c $(GLIDE_LIBDIR)/$(GLIDE_LIB)
ifeq ($(TEXUS2),1) ifeq ($(TEXUS2),1)
$(CC) -o $@ -s $(CFLAGS) -L$(GLIDE_LIBDIR) $< -lgld3x $(CC) -o $@ -s $(CFLAGS) -L$(GLIDE_LIBDIR) $< -lglide3x
else else
$(warning Texus2 not enabled... Skipping $(TEXUS_EXE)) $(warning Texus2 not enabled... Skipping $(TEXUS_EXE))
endif endif
@@ -301,26 +294,37 @@ xtexdl_sse2.o: xtexdl.asm
$(GLIDE_OBJECTS): fxinline.h fxgasm.h fxbldno.h $(GLIDE_OBJECTS): fxinline.h fxgasm.h fxbldno.h
# cross-compile workaround:
ifneq ($(COMSPEC),)
RUN_FXGASM=fxgasm.exe
RUN_FXBLDNO=fxbldno.exe
RUN_GENDATE=gendate.exe
else
RUN_FXGASM=./fxgasm.exe
RUN_FXBLDNO=./fxbldno.exe
RUN_GENDATE=./gendate.exe
endif
fxinline.h: fxgasm.exe fxinline.h: fxgasm.exe
$< -inline > $@ $(RUN_FXGASM) -inline > $@
fxgasm.h: fxgasm.exe fxgasm.h: fxgasm.exe
$< -hex > $@ $(RUN_FXGASM) -hex > $@
fxgasm.exe: fxgasm.c ../../incsrc/gendate.h fxgasm.exe: fxgasm.c ../../incsrc/gendate.h
$(CC) -o $@ $(CFLAGS) $< $(HOST_CC) -o $@ $(HOST_CFLAGS) $<
../../incsrc/gendate.h: gendate.exe ../../incsrc/gendate.h: gendate.exe
$< > $@ $(RUN_GENDATE) > $@
fxbldno.h: fxbldno.exe fxbldno.h: fxbldno.exe
$< > $@ $(RUN_FXBLDNO) > $@
gendate.exe: ../../incsrc/gendate.c gendate.exe: ../../incsrc/gendate.c
$(CC) -o $@ $(CFLAGS) $< $(HOST_CC) -o $@ $(HOST_CFLAGS) $<
fxbldno.exe: fxbldno.c fxbldno.exe: fxbldno.c
$(CC) -o $@ $(CFLAGS) $< $(HOST_CC) -o $@ $(HOST_CFLAGS) $<
############################################################################### ###############################################################################
# clean, realclean # clean, realclean

View File

@@ -27,8 +27,10 @@ FX_GLIDE_HW = h5
TOP = ../../.. TOP = ../../..
CPU ?= pentium CPU ?= pentium
UNLINK = rm -f $(1)
CC = gcc CC = gcc
CFLAGS = -Wall -O2 -ffast-math -mcpu=$(CPU) CFLAGS = -Wall -O2 -ffast-math -mtune=$(CPU)
CFLAGS += -I$(TOP)/$(FX_GLIDE_HW)/glide3/src -I$(TOP)/$(FX_GLIDE_HW)/incsrc CFLAGS += -I$(TOP)/$(FX_GLIDE_HW)/glide3/src -I$(TOP)/$(FX_GLIDE_HW)/incsrc
CFLAGS += -I$(TOP)/swlibs/fxmisc CFLAGS += -I$(TOP)/swlibs/fxmisc
CFLAGS += -D__DOS__ -DH3 CFLAGS += -D__DOS__ -DH3
@@ -38,9 +40,9 @@ CFLAGS += -DFX_GLIDE_NAPALM=1
LDFLAGS = -s -L$(TOP)/$(FX_GLIDE_HW)/lib LDFLAGS = -s -L$(TOP)/$(FX_GLIDE_HW)/lib
ifdef DXE ifdef DXE
LDLIBS = -lgld3i LDLIBS = -lglide3i
else else
LDLIBS = -lgld3x LDLIBS = -lglide3x
endif endif
.c.o: .c.o:
@@ -50,3 +52,7 @@ endif
all: all:
$(error Must specify <filename.exe> to build) $(error Must specify <filename.exe> to build)
clean:
-$(call UNLINK,*.o)
-$(call UNLINK,*.exe)

View File

@@ -12,7 +12,7 @@
# FX_GLIDE_HW build for the given ASIC (sst1, sst96). # FX_GLIDE_HW build for the given ASIC (sst1, sst96).
# default = sst1 # default = sst1
# OPTFLAGS pass given optimization flags to compiler # OPTFLAGS pass given optimization flags to compiler
# default = -O1 -ffast-math # default = -O1 -ffast-math (+ -mtune=pentium if USE_X86=1)
# DEBUG=1 enable debugging checks and messages # DEBUG=1 enable debugging checks and messages
# default = no # default = no
# USE_X86=1 use assembler triangle specializations! # USE_X86=1 use assembler triangle specializations!
@@ -34,9 +34,9 @@
# general defines (user settable?) # general defines (user settable?)
############################################################################### ###############################################################################
GLIDE_LIB = libgld3x.a GLIDE_LIB = libglide3x.a
GLIDE_DXE = glide3x.dxe GLIDE_DXE = glide3x.dxe
GLIDE_IMP = libgld3i.a GLIDE_IMP = libglide3i.a
TEXUS_EXE = texus2.exe TEXUS_EXE = texus2.exe
FX_GLIDE_HW ?= sst1 FX_GLIDE_HW ?= sst1
@@ -49,16 +49,11 @@ TEXUS_EXEDIR = $(FX_GLIDE_SW)/bin
############################################################################### ###############################################################################
CC = gcc CC = gcc
HOST_CC = gcc
AS = nasm AS = nasm
AR = ar AR = ar
HAVEDXE3 = $(wildcard $(DJDIR)/bin/dxe3gen.exe) UNLINK = rm -f $(1)
ifeq ($(wildcard $(addsuffix /rm.exe,$(subst ;, ,$(PATH)))),)
UNLINK = del $(subst /,\,$(1))
else
UNLINK = $(RM) $(1)
endif
############################################################################### ###############################################################################
# defines # defines
@@ -80,6 +75,7 @@ CDEFS += -DSST96_FIFO
#CDEFS += -DSST96_ALT_FIFO_WRAP #CDEFS += -DSST96_ALT_FIFO_WRAP
#CDEFS += -DINIT96VGASWAP -DINIT_ACCESS_DIRECT #CDEFS += -DINIT96VGASWAP -DINIT_ACCESS_DIRECT
CDEFS += -DGLIDE_USE_ALT_REGMAP CDEFS += -DGLIDE_USE_ALT_REGMAP
GLIDE_LIBDIR = ../../lib/sst96
endif endif
endif endif
@@ -103,11 +99,11 @@ endif
ARFLAGS = rus ARFLAGS = rus
# assembler # assembler
ASFLAGS = -O6 -fcoff -D__DJGPP__ --prefix _ ASFLAGS = -O2 -fcoff -D__DJGPP__ --prefix _
ASFLAGS += $(CDEFS) ASFLAGS += $(CDEFS)
# compiler # compiler
CFLAGS = -Wall -W CFLAGS = -Wall
CFLAGS += -I. -I../../incsrc -I../../init -I../../init/initvg -I../../init/init96 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 += -I$(FX_GLIDE_SW)/fxmisc -I$(FX_GLIDE_SW)/newpci/pcilib -I$(FX_GLIDE_SW)/fxmemmap
CFLAGS += -I$(FX_GLIDE_SW)/texus2/lib CFLAGS += -I$(FX_GLIDE_SW)/texus2/lib
@@ -115,7 +111,7 @@ CFLAGS += $(CDEFS)
ifeq ($(USE_X86),1) ifeq ($(USE_X86),1)
CFLAGS += -DGL_X86 CFLAGS += -DGL_X86
OPTFLAGS ?= -O1 -ffast-math OPTFLAGS ?= -O1 -ffast-math -mtune=pentium
else else
CFLAGS += -DGLIDE_USE_C_TRISETUP CFLAGS += -DGLIDE_USE_C_TRISETUP
OPTFLAGS ?= -O1 -ffast-math OPTFLAGS ?= -O1 -ffast-math
@@ -123,6 +119,7 @@ endif
# optflags # optflags
CFLAGS += $(OPTFLAGS) CFLAGS += $(OPTFLAGS)
HOST_CFLAGS=$(filter-out -mcpu=% -mtune=% -march=%,$(CFLAGS))
############################################################################### ###############################################################################
# objects # objects
@@ -238,15 +235,11 @@ $(GLIDE_LIBDIR)/$(GLIDE_LIB): $(GLIDE_OBJECTS)
$(AR) $(ARFLAGS) $@ $^ $(AR) $(ARFLAGS) $@ $^
$(GLIDE_LIBDIR)/$(GLIDE_DXE) $(GLIDE_LIBDIR)/$(GLIDE_IMP): $(GLIDE_OBJECTS) $(GLIDE_LIBDIR)/$(GLIDE_DXE) $(GLIDE_LIBDIR)/$(GLIDE_IMP): $(GLIDE_OBJECTS)
ifeq ($(HAVEDXE3),)
$(warning Missing DXE3 package... Skipping $(GLIDE_DXE))
else
-dxe3gen -o $(GLIDE_LIBDIR)/$(GLIDE_DXE) -Y $(GLIDE_LIBDIR)/$(GLIDE_IMP) -D "Glide3($(FX_GLIDE_HW)) DJGPP" -E _gr -E _gu -E _tx -U $^ -dxe3gen -o $(GLIDE_LIBDIR)/$(GLIDE_DXE) -Y $(GLIDE_LIBDIR)/$(GLIDE_IMP) -D "Glide3($(FX_GLIDE_HW)) DJGPP" -E _gr -E _gu -E _tx -U $^
endif
$(TEXUS_EXEDIR)/$(TEXUS_EXE): $(FX_GLIDE_SW)/texus2/cmd/cmd.c $(GLIDE_LIBDIR)/$(GLIDE_LIB) $(TEXUS_EXEDIR)/$(TEXUS_EXE): $(FX_GLIDE_SW)/texus2/cmd/cmd.c $(GLIDE_LIBDIR)/$(GLIDE_LIB)
ifeq ($(TEXUS2),1) ifeq ($(TEXUS2),1)
$(CC) -o $@ -s $(CFLAGS) -L$(GLIDE_LIBDIR) $< -lgld3x $(CC) -o $@ -s $(CFLAGS) -L$(GLIDE_LIBDIR) $< -lglide3x
else else
$(warning Texus2 not enabled... Skipping $(TEXUS_EXE)) $(warning Texus2 not enabled... Skipping $(TEXUS_EXE))
endif endif
@@ -287,14 +280,21 @@ endif
$(GLIDE_OBJECTS): fxinline.h fxgasm.h $(GLIDE_OBJECTS): fxinline.h fxgasm.h
# cross-compile workaround:
ifneq ($(COMSPEC),)
RUN_FXGASM=fxgasm.exe
else
RUN_FXGASM=./fxgasm.exe
endif
fxinline.h: fxgasm.exe fxinline.h: fxgasm.exe
$< -inline > $@ $(RUN_FXGASM) -inline > $@
fxgasm.h: fxgasm.exe fxgasm.h: fxgasm.exe
$< -hex > $@ $(RUN_FXGASM) -hex > $@
fxgasm.exe: fxgasm.c fxgasm.exe: fxgasm.c
$(CC) -o $@ $(CFLAGS) $< $(HOST_CC) -o $@ $(HOST_CFLAGS) $<
############################################################################### ###############################################################################
# clean, realclean # clean, realclean

View File

@@ -38,8 +38,10 @@ override FX_GLIDE_HW = sst1
TOP = ../../.. TOP = ../../..
CPU ?= pentium CPU ?= pentium
UNLINK = rm -f $(1)
CC = gcc CC = gcc
CFLAGS = -Wall -O2 -ffast-math -mcpu=$(CPU) CFLAGS = -Wall -O2 -ffast-math -mtune=$(CPU)
CFLAGS += -I$(TOP)/$(FX_GLIDE_HW)/glide3/src -I$(TOP)/$(FX_GLIDE_HW)/incsrc -I$(TOP)/$(FX_GLIDE_HW)/init CFLAGS += -I$(TOP)/$(FX_GLIDE_HW)/glide3/src -I$(TOP)/$(FX_GLIDE_HW)/incsrc -I$(TOP)/$(FX_GLIDE_HW)/init
CFLAGS += -I$(TOP)/swlibs/fxmisc CFLAGS += -I$(TOP)/swlibs/fxmisc
CFLAGS += -D__DOS__ $(HWDEF) CFLAGS += -D__DOS__ $(HWDEF)
@@ -48,9 +50,9 @@ CFLAGS += -D__DOS32__
LDFLAGS = -s -L$(TOP)/$(FX_GLIDE_HW)/lib LDFLAGS = -s -L$(TOP)/$(FX_GLIDE_HW)/lib
ifdef DXE ifdef DXE
LDLIBS = -lgld3i LDLIBS = -lglide3i
else else
LDLIBS = -lgld3x LDLIBS = -lglide3x
endif endif
.c.o: .c.o:
@@ -60,3 +62,7 @@ endif
all: all:
$(error Must specify <filename.exe> to build) $(error Must specify <filename.exe> to build)
clean:
-$(call UNLINK,*.o)
-$(call UNLINK,*.exe)