Skip to content

Commit

Permalink
Merge pull request #2 from sezero/master
Browse files Browse the repository at this point in the history
sage updates
  • Loading branch information
dborca committed Feb 22, 2018
2 parents 8109ef7 + a3d4d3a commit a69f74b
Show file tree
Hide file tree
Showing 63 changed files with 2,846 additions and 1,678 deletions.
1,212 changes: 0 additions & 1,212 deletions Doxyfile

This file was deleted.

38 changes: 21 additions & 17 deletions Makefile
Expand Up @@ -7,24 +7,22 @@ DRIVER ?= glide
all: lib/libGL.so.1.1

CC = gcc
CFLAGS = -Wall -W -pedantic
HOST_CC = gcc
CFLAGS = -Wall
CFLAGS += -Wno-unused
CFLAGS += -O2
# CFLAGS += -ffast-math -DFAST_MATH
# in case of problems disable -DNDEBUG to enable assertions
CFLAGS += -DNDEBUG
#CFLAGS += -g
#CFLAGS += -ffast-math -DFAST_MATH
CFLAGS += -I. -Iinclude -Idrivers
CFLAGS += -g -Wno-unused
LD = gcc
# disable software scaledown of hardware-unsupported large textures
#CFLAGS += -DFX_RESCALEHACK=0
LD = $(CC)
LDFLAGS =
LDLIBS = -lm
LDLIBS = -lX11 -ldl -lm
AS = nasm
ASFLAGS = -O6 -felf -D__linux__ -Ix86/ -Imain/

# MSS begin
ifeq ($(MSS),1)
CFLAGS += -DMSS=1 -include mss.h
LDFLAGS += -Llib
LDLIBS += -lmss
endif
# MSS end
ASFLAGS = -O2 -felf -D__linux__ -Ix86/ -Imain/

CORE_SOURCES = \
util/cfg.c \
Expand Down Expand Up @@ -83,6 +81,8 @@ X86_SOURCES = \
x86/sse_mat.asm \
x86/sse_clip.asm \
x86/sse_misc.asm

x86/x86.o: x86/x86chk.h
endif

include drivers/$(DRIVER)/config
Expand All @@ -94,7 +94,7 @@ SOURCES = $(CORE_SOURCES) $(TNL_SOURCES) $(X86_SOURCES) $(DRIVER_SOURCES)
OBJECTS = $(addsuffix .o,$(basename $(SOURCES)))

.c.o:
$(CC) -o $@ $(CFLAGS) -c $<
$(CC) -o $@ $(CFLAGS) -fPIC -DPIC -c $<
.asm.o:
$(AS) -o $@ $(ASFLAGS) $<

Expand All @@ -106,13 +106,17 @@ $(X86_SOURCES:.asm=.o): x86/x86.inc
x86/x86.inc: x86/x86gen.exe
$< -o $@

x86/x86chk.h: x86/x86gen.exe
$< -c -o $@

x86/x86gen.exe: x86/x86gen.c glinternal.h main/context.h main/matrix.h tnl/tnl.h x86/cpu.h
$(CC) -o $@ $(CFLAGS) $(LDFLAGS) $<
$(HOST_CC) -o $@ $(CFLAGS) $<

clean::
-$(RM) $(OBJECTS)
-$(RM) x86/*.o
-$(RM) x86/x86chk.h
-$(RM) x86/x86.inc

realclean:: clean
-$(RM) x86/x86.inc
-$(RM) lib/libGL.so.1.1
53 changes: 36 additions & 17 deletions Makefile.DJ
Expand Up @@ -2,32 +2,40 @@
.SUFFIXES: .asm .o
.INTERMEDIATE: x86/x86gen.exe

LIBNAME = "SAGE_GL 0.9.x"
DRIVER ?= glide

all: lib/libGL.a
all: lib/libgl.a lib/gl.dxe

CC = gcc
CFLAGS = -Wall -W -pedantic
HOST_CC = gcc
CFLAGS = -Wall
CFLAGS += -Wno-unused
CFLAGS += -O2
# CFLAGS += -ffast-math -DFAST_MATH
# in case of problems disable -DNDEBUG to enable assertions
CFLAGS += -DNDEBUG
#CFLAGS += -g
#CFLAGS += -ffast-math -DFAST_MATH
CFLAGS += -I. -Iinclude -Idrivers
CFLAGS += -g -Wno-unused
CFLAGS += -D__DOS__
LD = gcc
# disable software scaledown of hardware-unsupported large textures
CFLAGS += -DFX_RESCALEHACK=0
#CFLAGS += -DUSE_EXTERNAL_DXTN_LIB=1
LD = $(CC)
LDFLAGS =
LDLIBS = -lm
AS = nasm
ASFLAGS = -O6 -fcoff -D__DJGPP__ -Ix86/ -Imain/ --prefix _
ASFLAGS = -O2 -fcoff -D__DJGPP__ -Ix86/ -Imain/ --prefix _
# workaround the sse issue in DXE builds: note that this
# is only needed for DXE, but not for the static library.
ASFLAGS+= -DBROKEN_MOVAPS
AR = ar
ARFLAGS = crus

# MSS begin
ifeq ($(MSS),1)
CFLAGS += -DMSS=1 -include mss.h
LDFLAGS += -Llib
LDLIBS += -lmss
DXE3GEN = dxe3gen
DXE3FLAGS = -E _sage_ -E _gl -X _gl_
ifeq ($(DRIVER),glide)
DXE3FLAGS+= -P glide3x.dxe
endif
# MSS end

CORE_SOURCES = \
util/cfg.c \
Expand Down Expand Up @@ -86,6 +94,8 @@ X86_SOURCES = \
x86/sse_mat.asm \
x86/sse_clip.asm \
x86/sse_misc.asm

x86/x86.o: x86/x86chk.h
endif

include drivers/$(DRIVER)/config
Expand All @@ -99,21 +109,30 @@ OBJECTS = $(addsuffix .o,$(basename $(SOURCES)))
.asm.o:
$(AS) -o $@ $(ASFLAGS) $<

lib/libGL.a: $(OBJECTS)
lib/libgl.a: $(OBJECTS)
$(AR) $(ARFLAGS) $@ $^

lib/gl.dxe: $(OBJECTS)
-$(DXE3GEN) -o $@ -Y lib/libigl.a -D $(LIBNAME) $(DXE3FLAGS) -U $(OBJECTS)

$(X86_SOURCES:.asm=.o): x86/x86.inc

x86/x86.inc: x86/x86gen.exe
$< -o $@

x86/x86chk.h: x86/x86gen.exe
$< -c -o $@

x86/x86gen.exe: x86/x86gen.c glinternal.h main/context.h main/matrix.h tnl/tnl.h x86/cpu.h
$(CC) -o $@ $(CFLAGS) $(LDFLAGS) $<
$(HOST_CC) -o $@ $(CFLAGS) $<

clean::
-$(RM) $(OBJECTS)
-$(RM) x86/*.o
-$(RM) x86/x86chk.h
-$(RM) x86/x86.inc

realclean:: clean
-$(RM) x86/x86.inc
-$(RM) lib/libGL.a
-$(RM) lib/libgl.a
-$(RM) lib/gl.dxe
-$(RM) lib/libigl.a
38 changes: 21 additions & 17 deletions Makefile.icc
Expand Up @@ -6,25 +6,23 @@ DRIVER ?= glide

all: lib/libGL.so.1.1

CC = /opt/intel/cc/9.0/bin/icc
CFLAGS = -Wall
#CC = /opt/intel/cc/9.0/bin/icc
CC = icc
HOST_CC = icc
CFLAGS = -Wall
CFLAGS += -O2 -ip
# CFLAGS += -rcd -xK -DFAST_MATH
# in case of problems disable -DNDEBUG to enable assertions
CFLAGS += -DNDEBUG
#CFLAGS += -g
#CFLAGS += -rcd -xK -DFAST_MATH
CFLAGS += -I. -Iinclude -Idrivers
# CFLAGS += -g
LD = /opt/intel/cc/9.0/bin/icc
# disable software scaledown of hardware-unsupported large textures
#CFLAGS += -DFX_RESCALEHACK=0
LD = $(CC)
LDFLAGS = -i-static
LDLIBS = -lm
LDLIBS = -lX11 -ldl -lm
AS = nasm
ASFLAGS = -O6 -felf -D__linux__ -Ix86/ -Imain/

# MSS begin
ifeq ($(MSS),1)
CFLAGS += -DMSS=1 -include mss.h
LDFLAGS += -Llib
LDLIBS += -lmss
endif
# MSS end
ASFLAGS = -O2 -felf -D__linux__ -Ix86/ -Imain/

CORE_SOURCES = \
util/cfg.c \
Expand Down Expand Up @@ -83,6 +81,8 @@ X86_SOURCES = \
x86/sse_mat.asm \
x86/sse_clip.asm \
x86/sse_misc.asm

x86/x86.o: x86/x86chk.h
endif

include drivers/$(DRIVER)/config
Expand All @@ -106,13 +106,17 @@ $(X86_SOURCES:.asm=.o): x86/x86.inc
x86/x86.inc: x86/x86gen.exe
$< -o $@

x86/x86chk.h: x86/x86gen.exe
$< -c -o $@

x86/x86gen.exe: x86/x86gen.c glinternal.h main/context.h main/matrix.h tnl/tnl.h x86/cpu.h
$(CC) -o $@ $(CFLAGS) $(LDFLAGS) $<
$(HOST_CC) -o $@ $(CFLAGS) $<

clean::
-$(RM) $(OBJECTS)
-$(RM) x86/*.o
-$(RM) x86/x86chk.h
-$(RM) x86/x86.inc

realclean:: clean
-$(RM) x86/x86.inc
-$(RM) lib/libGL.so.1.1
50 changes: 27 additions & 23 deletions Makefile.mgw
Expand Up @@ -6,27 +6,26 @@ DRIVER ?= glide

all: lib/opengl32.dll lib/libopengl32.a

CC = mingw32-gcc
CFLAGS = -Wall -W -pedantic
CC = gcc
HOST_CC = gcc
CFLAGS = -m32 -Wall
CFLAGS += -Wno-unused
CFLAGS += -O2
# in case of problems disable -DNDEBUG to enable assertions
CFLAGS += -DNDEBUG
#CFLAGS += -g
CFLAGS += -ffast-math -DFAST_MATH
CFLAGS += -I. -Iinclude -Idrivers
CFLAGS += -g -Wno-unused
LD = mingw32-gcc
LDFLAGS =
# disable software scaledown of hardware-unsupported large textures
#CFLAGS += -DFX_RESCALEHACK=0
LD = $(CC)
LDFLAGS = -m32 -Wl,--enable-auto-image-base -Wl,--no-undefined -Wl,-k
LDLIBS = -lm
AS = nasmw
ASFLAGS = -O6 -fwin32 -D__WIN32__ -Ix86/ -Imain/ --prefix _
AS = nasm
ASFLAGS = -O2 -fwin32 -D__WIN32__ -Ix86/ -Imain/ --prefix _
RC = windres
RCFLAGS = -O coff

# MSS begin
ifeq ($(MSS),1)
CFLAGS += -DMSS=1 -include mss.h
LDFLAGS += -Llib
LDLIBS += -lmss
endif
# MSS end
RCFLAGS = --output-format=coff --target=pe-i386
DLLTOOL = dlltool

CORE_SOURCES = \
util/cfg.c \
Expand Down Expand Up @@ -85,6 +84,8 @@ X86_SOURCES = \
x86/sse_mat.asm \
x86/sse_clip.asm \
x86/sse_misc.asm

x86/x86.o: x86/x86chk.h
endif

include drivers/$(DRIVER)/config
Expand All @@ -102,27 +103,30 @@ OBJECTS = $(addsuffix .o,$(basename $(SOURCES)))
.rc.res:
$(RC) -o $@ $(RCFLAGS) $<

lib/opengl32.dll: $(OBJECTS) drivers/$(DRIVER)/opengl.res
$(LD) -o $@ -shared $(LDFLAGS) $^ $(LDLIBS) -Wl,-k
# $(LD) -o $@ -shared $(LDFLAGS) $^ $(LDLIBS)

lib/libopengl32.a:
dlltool --dllname opengl32.dll --def drivers/opengl32.def --output-lib $@ -k
$(DLLTOOL) --as-flags=--32 -m i386 --dllname opengl32.dll --input-def drivers/opengl32.def --output-lib $@ -k

lib/opengl32.dll: $(OBJECTS) drivers/$(DRIVER)/opengl.res drivers/opengl32.def
$(LD) -shared -o $@ $^ $(LDFLAGS) $(LDLIBS)

$(X86_SOURCES:.asm=.o): x86/x86.inc

x86/x86.inc: x86/x86gen.exe
$< -o $@

x86/x86chk.h: x86/x86gen.exe
$< -c -o $@

x86/x86gen.exe: x86/x86gen.c glinternal.h main/context.h main/matrix.h tnl/tnl.h x86/cpu.h
$(CC) -o $@ $(CFLAGS) $(LDFLAGS) $<
$(HOST_CC) -o $@ $(CFLAGS) $<

clean::
-$(RM) $(OBJECTS)
-$(RM) drivers/$(DRIVER)/opengl.res
-$(RM) x86/*.o
-$(RM) x86/x86chk.h
-$(RM) x86/x86.inc

realclean:: clean
-$(RM) x86/x86.inc
-$(RM) lib/opengl32.dll
-$(RM) lib/libopengl32.a
2 changes: 1 addition & 1 deletion doc/conform/Makefile.mgw
Expand Up @@ -30,7 +30,7 @@ CC = mingw32-gcc
CFLAGS = -Wall -W -pedantic
CFLAGS += -O2 -ffast-math
CFLAGS += -I. -I../include
LD = mingw32-gcc
LD = $(CC)
LDFLAGS = -s
LDFLAGS = -L../lib
LDLIBS = -lglut32 -lglu32 -lopengl32 -lglide3x -lm
Expand Down
13 changes: 7 additions & 6 deletions doc/conform/extgl.c
Expand Up @@ -37,7 +37,7 @@
GLAPI void GLAPIENTRY
myBlendColorEXT (GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha)
{
#ifdef __WIN32__
#ifdef _WIN32
static PFNGLBLENDCOLOREXTPROC BlendColorEXT = NULL;
if (BlendColorEXT == NULL) {
BlendColorEXT = (PFNGLBLENDCOLOREXTPROC)wglGetProcAddress("glBlendColorEXT");
Expand All @@ -54,7 +54,7 @@ myBlendColorEXT (GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha)
GLAPI void GLAPIENTRY
myBlendFuncSeparateEXT (GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha)
{
#ifdef __WIN32__
#ifdef _WIN32
static PFNGLBLENDFUNCSEPARATEEXTPROC BlendFuncSeparateEXT = NULL;
if (BlendFuncSeparateEXT == NULL) {
BlendFuncSeparateEXT = (PFNGLBLENDFUNCSEPARATEEXTPROC)wglGetProcAddress("glBlendFuncSeparateEXT");
Expand All @@ -71,7 +71,7 @@ myBlendFuncSeparateEXT (GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlph
GLAPI void GLAPIENTRY
myBlendEquationEXT (GLenum mode)
{
#ifdef __WIN32__
#ifdef _WIN32
static PFNGLBLENDEQUATIONEXTPROC BlendEquationEXT = NULL;
if (BlendEquationEXT == NULL) {
BlendEquationEXT = (PFNGLBLENDEQUATIONEXTPROC)wglGetProcAddress("glBlendEquationEXT");
Expand All @@ -88,7 +88,7 @@ myBlendEquationEXT (GLenum mode)
GLAPI void GLAPIENTRY
myBlendEquationSeparateEXT (GLenum modeRGB, GLenum modeAlpha)
{
#ifdef __WIN32__
#ifdef _WIN32
static PFNGLBLENDEQUATIONSEPARATEEXTPROC BlendEquationSeparateEXT;
if (BlendEquationSeparateEXT == NULL) {
BlendEquationSeparateEXT = (PFNGLBLENDEQUATIONSEPARATEEXTPROC)wglGetProcAddress("glBlendEquationSeparateEXT");
Expand All @@ -105,7 +105,7 @@ myBlendEquationSeparateEXT (GLenum modeRGB, GLenum modeAlpha)
GLAPI void APIENTRY
myActiveTextureARB (GLenum texture)
{
#ifdef __WIN32__
#ifdef _WIN32
static PFNGLACTIVETEXTUREARBPROC ActiveTextureARB;
if (ActiveTextureARB == NULL) {
ActiveTextureARB = (PFNGLACTIVETEXTUREARBPROC)wglGetProcAddress("glActiveTextureARB");
Expand All @@ -122,7 +122,7 @@ myActiveTextureARB (GLenum texture)
GLAPI void APIENTRY
myMultiTexCoord2fARB (GLenum target, GLfloat s, GLfloat t)
{
#ifdef __WIN32__
#ifdef _WIN32
static PFNGLMULTITEXCOORD2FARBPROC MultiTexCoord2fARB = NULL;
if (MultiTexCoord2fARB == NULL) {
MultiTexCoord2fARB = (PFNGLMULTITEXCOORD2FARBPROC)wglGetProcAddress("glMultiTexCoord2fARB");
Expand All @@ -134,3 +134,4 @@ myMultiTexCoord2fARB (GLenum target, GLfloat s, GLfloat t)
glMultiTexCoord2fARB(target, s, t);
#endif
}

0 comments on commit a69f74b

Please sign in to comment.