#############################################################################
#
#                   Copyright (C) 1994 SciTech Software
#                           All rights reserved.
#
# Descripton:   Generic makefile for the Quick3D library. Requires
#               the SciTech Software makefile definitions package to be
#               installed.
#
#               Creates a number of different libraries depending on the
#               options used to create them with the following format:
#
#                   q3d<db>_<flt>.lib
#
#               where <db> is either empty or 'd' for the debugging versions
#               of the library compiled with DEBUG=2. You should set DEBUG=1
#               or DEBUG=2 in your own code to add the debugging stuff in
#               the header files. <flt> is the type of real numbers the
#               library is compiled for and will be one of the following:
#
#                   fix - 16.16 fixed point
#                   fl  - IEEE float's
#                   fl7 - IEEE float's for 80387+
#                   db  - IEEE double's
#                   db7 - IEEE double's for 80387+
#
#               The standard fl and db libraries use the default compiler
#               supplied floating point options, so work on all machines
#               with or without and FPU. The fl7 and db7 libraries are
#               compiled with the FPU387=1 flag and contain direct
#               co-processor support for 80387+ FPU's.
#
# $Date:   26 Jun 1996 01:33:36  $ $Author:   KendallB  $
#
#############################################################################

# DOS Extender dependant flags

CFLAGS          += $(DX_CFLAGS)

# Name of library and object files required to build it

.IMPORT .IGNORE : FX_FLOAT FX_DOUBLE FX_FIXED CHECKS

# Turn on the debugging version if desired

.IF $(CHECKS)
CFLAGS          += -DDEBUG=2
LIBSTART        = q3dd
VECSTART        = vecd
TECHLIB         = techd$L
.ELSE
.IF $(STKCALL)
LIBSTART        = sq3d
VECSTART        = svec
TECHLIB         = stech$L
.ELSE
LIBSTART        = q3d
VECSTART        = vec
TECHLIB         = tech$L
.ENDIF
.ENDIF

# Object files required to build the libraries

OBJECTS         = quick3d$O line3d$O poly3d$O render$O depthsrt$O		\
				  bsptree$O bsppoly$O lighting$O circle3d$O text3d$O

# Set up to use 80387 assembler routines if specified

.IF $(FPU)
LIBEND          = 7
.ENDIF

.IF $(FX_DOUBLE)   # Type of real numbers to use
CFLAGS          += -DFX_DOUBLE
ASFLAGS         += -DFX_DOUBLE
LIBFILE         = $(LIBSTART)_db$(LIBEND)$L
VECLIB          = $(VECSTART)_db$(LIBEND)$L
.ELIF $(FX_FIXED)
CFLAGS          += -DFX_FIXED -DFIXED386
ASFLAGS         += -DFIXED386
LIBFILE         = $(LIBSTART)_fix$L
VECLIB          = $(VECSTART)_fix$(LIBEND)$L
.ELSE
CFLAGS          += -DFX_FLOAT
ASFLAGS         += -DFX_FLOAT
LIBFILE         = $(LIBSTART)_fl$(LIBEND)$L
VECLIB          = $(VECSTART)_fl$(LIBEND)$L
.ENDIF

EXELIBS         = mgldos$L mglcpp$L $(TECHLIB) $(VECLIB)
LIBCLEAN        = q3d*.lib q3d*.a sq3d*.lib

# Define the list of object files to create dependency information for

DEPEND_OBJ      = $(OBJECTS) test3d$O

tests:  test3d$E

test3d$E: test3d$O getopt$O $(LIBFILE)

.INCLUDE: "$(SCITECH)\makedefs\common.mk"

# Target to build all DOS 32-bit libraries

.SWAP .PHONY mkdos32:
	@+build wc10-d32 install -u OPT=1 NO_PCH=1
	@+build wc11-d32 install -u OPT=1 NO_PCH=1
	@+build bc45-d32 install -u OPT=1
	@+build dj20-d32 install -u OPT=1

# Target to build all DOS libraries

.PHONY mkdos: mkdos32 cleanexe

# Target to build all win 32-bit libraries

.SWAP .PHONY mkwin32:
	@+build wc10-w32 install -u OPT=1 NO_PCH=1
	@+build wc11-w32 install -u OPT=1 NO_PCH=1
	@+build bc45-w32 install -u OPT=1
	@+build bc50-w32 install -u OPT=1
	@+build vc40-w32 install -u OPT=1
	@+build vc50-w32 install -u OPT=1

# Target to build all Windows libraries

.PHONY mkwin: mkwin32 cleanexe

# Target to build all libraries

.PHONY mkall: mkdos32 mkwin32 cleanexe

