##
## THIS SOFTWARE IS SUBJECT TO COPYRIGHT PROTECTION AND IS OFFERED ONLY
## PURSUANT TO THE 3DFX GLIDE GENERAL PUBLIC LICENSE. THERE IS NO RIGHT
## TO USE THE GLIDE TRADEMARK WITHOUT PRIOR WRITTEN PERMISSION OF 3DFX
## INTERACTIVE, INC. A COPY OF THIS LICENSE MAY BE OBTAINED FROM THE 
## DISTRIBUTOR OR BY CONTACTING 3DFX INTERACTIVE INC(info@3dfx.com). 
## THIS PROGRAM IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER 
## EXPRESSED OR IMPLIED. SEE THE 3DFX GLIDE GENERAL PUBLIC LICENSE FOR A
## FULL TEXT OF THE NON-WARRANTY PROVISIONS.  
##
## USE, DUPLICATION OR DISCLOSURE BY THE GOVERNMENT IS SUBJECT TO
## RESTRICTIONS AS SET FORTH IN SUBDIVISION (C)(1)(II) OF THE RIGHTS IN
## TECHNICAL DATA AND COMPUTER SOFTWARE CLAUSE AT DFARS 252.227-7013,
## AND/OR IN SIMILAR OR SUCCESSOR CLAUSES IN THE FAR, DOD OR NASA FAR
## SUPPLEMENT. UNPUBLISHED RIGHTS RESERVED UNDER THE COPYRIGHT LAWS OF
## THE UNITED STATES.  
##
## COPYRIGHT 3DFX INTERACTIVE, INC. 1999, ALL RIGHTS RESERVED
##
## $Revision$
## $Date$
##
#
# First the variable definitions.
#
if HAL_HW
HAL_HW_VDEFS = -DGLIDE_BLIT_CLEAR=1 \
               -DWTF_P_COMDEX_RESET=1 \
               -DHAL_HW=1
endif

if GLIDE_DEBUG
DEBUG_VDEFS = -DGLIDE_DEBUG \
              -DGDBG_INFO_ON \
              -DGLIDE_SANITY_SIZE \
              -DGLIDE_SANITY_ASSERT
endif

if GL_AMD3D
GL_AMD3D_VDEFS = -DGL_AMD3D
endif

if FX_GLIDE_HW_CULL
FX_GLIDE_HW_VDEFS =
else
FX_GLIDE_HW_VDEFS = -DGLIDE_TRI_CULLING=1
endif

if FX_GLIDE_SW_SETUP
FX_GLIDE_SW_SETUP_VDEFS = -DGLIDE_HW_TRI_SETUP=0 \
                          -DGLIDE_TRI_CULLING=1
endif

if FX_GLIDE_CTRISETUP
FX_GLIDE_CTRISETUP_VDEFS = -DGLIDE_USE_C_TRISETUP 
else
FX_GLIDE_CTRISETUP_VDEFS = -DGLIDE_PACKED_RGB=0 \
                           -DGLIDE_TRI_CULLING=1
endif

if FX_GLIDE_VERTEX_TABLE
FX_GLIDE_VERTEX_TABLE_VDEFS = -DGLIDE_VERTEX_TABLE
endif

if FX_GLIDE_NO_PLUG
FX_GLIDE_NO_PLUG_VDEFS =
else
FX_GLIDE_NO_PLUG_VDEFS = -DGLIDE_PLUG
endif

if FX_GLIDE_NO_SPLASH
FX_GLIDE_NO_SPLASH_VDEFS =
else
FX_GLIDE_NO_SPLASH_VDEFS = -DGLIDE_SPLASH
endif

if FX_HOOPTI_TRI_SETUP_COMPARE
FX_HOOPTI_TRI_SETUP_COMPARE_VDEFS = -DGLIDE_FP_CLAMP=1 \
	                                -DGLIDE_FP_CLAMP_TEX=1 \
                                    -DHOOPTI_TRI_SETUP_COMPARE=1 \
                                    -DGLIDE_TRI_CULLING=1
endif

if FX_GLIDE_DEBUG_FIFO
FX_GLIDE_DEBUG_FIFO_VDEFS = -DGLIDE_USE_DEBUG_FIFO=1 \
                            -DFIFO_ASSERT_FULL=1 
endif

include_HEADERS         = glide.h
lib_LTLIBRARIES         = libglide3.la
libglide3_la_SOURCES    = gsplash.c g3df.c  gu.c gpci.c \
                          diglide.c disst.c ditex.c gbanner.c gerror.c\
                          digutex.c gaa.c gdraw.c\
                          gglide.c glfb.c gsst.c gtex.c gtexdl.c\
                          fifo.c gstrip.c distrip.c distate.c diget.c \
                          xtexdl.c cpudtect.s

#
# Special rules for assembly files.
#
PREPROCESSOR=/lib/cpp -$$ -I.
xdraw2_def.o xdraw2_def.lo: xdraw2.s xdraw2.inc.s fxgasm.h
	$(PREPROCESSOR) $< > $*.tmp.s
	$(CC) $(AFLAGS) -c -o $*.o $*.tmp.s
	$(CP) $*.o $*.lo
	$(RM) -f $*.tmp.s

xdraw2_3dnow.o xdraw2_3dnow.lo: xdraw2.s xdraw2.inc.s fxgasm.h
	$(PREPROCESSOR) -DGL_AMD3D -DUSE_PACKET_FIFO=1 $< > $*.tmp.s
	$(CC) $(AFLAGS) -c -o $*.o $*.tmp.s
	$(CP) $*.o $*.lo
	$(RM) -f $*.tmp.s

xdraw3_def.o xdraw3_def.lo: xdraw3.s fxgasm.h
	$(PREPROCESSOR) $< > $*.tmp.s
	$(CC) $(AFLAGS) -c -o $*.o $*.tmp.s
	$(CP) $*.o $*.lo
	$(RM) -f $*.tmp.s

xdraw3_3dnow.o xdraw3_3dnow.lo: xdraw3.s fxgasm.h
	$(PREPROCESSOR) -DGL_AMD3D -DUSE_PACKET_FIFO=1 $< > $*.tmp.s
	$(CC) $(AFLAGS) -c -o $*.o $*.tmp.s
	$(CP) $*.o $*.lo
	$(RM) -f $*.tmp.s

xtexdl_3dnow.o xtexdl_3dnow.lo: xtexdl.s fxgasm.h 
	$(PREPROCESSOR) -DGL_AMD3D -DUSE_PACKET_FIFO=1 $< > $*.tmp.s
	$(CC) $(AFLAGS) -c -o $*.o $*.tmp.s
	$(CP) $*.o $*.lo
	$(RM) -f $*.tmp.s

cpudtect.o cpudtect.lo: cpudtect.s
	$(PREPROCESSOR) -DUSE_PACKET_FIFO=1 $< > $*.tmp.s
	$(CC) $(AFLAGS) -c -o $*.o $*.tmp.s
	$(CP) $*.o $*.lo
	$(RM) -f $*.tmp.s

#--------------------------------------------------------------------------#
# special rules for making fxgasm.h, fxinclude.h
#
fxgasm.h: fxgasm
	./fxgasm -hex > fxgasm.h
fxinline.h: fxgasm
	./fxgasm -inline > fxinline.h

#--------------------------------------------------------------------------#
# special rules for using fxgasm.h, fxinclude.h
#
diget.o diget.lo gdraw.o gdraw.lo gglide.o gglide.lo gu.o gu.lo: fxinline.h
xdraw2_def.o    xdraw3_def.o    xtexdl_def.o:    fxinline.h
xdraw2_def.lo   xdraw3_def.lo   xtexdl_def.lo:   fxinline.h
xdraw2_3dnow.o  xdraw3_3dnow.o  xtexdl_3dnow.o:  fxgasm.h
xdraw2_3dnow.lo xdraw3_3dnow.lo xtexdl_3dnow.lo: fxgasm.h
