# SCCSID = @(#)makefile 13.3 92/04/30
#         SCCSID = @(#)makefile 13.3 92/04/30
# **************************************************************************
# *
# * Make file for SVIA - Jovian SVIA (Video Capture Adapter) Device Driver
# *
# *  Generates:
# *       VIDSV.sys - Video Super VIA adapter Device Driver
# *
# * IBM Confidential
# *
# * Copyright (c) IBM Corporation  1987, 1991
# * All Rights Reserved
# KLL  9/30/92       New Make file (base from ACPA's makefile)
# KLL  4/11/94       Toolkit Should exclude CARDSPEC.ASM as some of the
#                    information in this file may not be OK with for us to
#                    ship in a toolkit (Developers Connection).
# **************************************************************************

.SUFFIXES:
.SUFFIXES:     .com .sys .exe .obj .mbj .asm .inc .def .lrf .crf .ref \
               .lst .sym .map .c .h .lib .msg .pro .txt

######################################################################
## The line below turn off including of a file to the toolkit       ##
######################################################################
TOOLKITBLD=1
!ifdef TOOLKITBLD
ASM_TOOLKIT=-DTOOLKIT
!endif

NAMESYS   = VIDVBC


###############################################################
# This is what the build tree looks like
#  \me11
#   \me11\dd\vblaster           - Video Blaster source code
#   \me11\dd\ship_h             - mme includes
#   \me11\dd\common             - mme common files across components
#
#   \me11\src\h                 - cruiser h files
#   \me11\src\h386              - cruiser h386 files
#   \me11\src\inc               - cruiser inc files
#   \me11\src\lib               - cruiser h386 files
#   \me11\src\lib386            - cruiser h386 files
#
#   \me11\tools                - various bld tools
###############################################################
TOOLS=..\..\..\TOOLS            # DDK Tools Directory
H=..\..\..\H                    # DDK Header Files
H386=..\..\..\H386              # DDK Header Files
LIB=..\..\..\LIB                # DDK Libraries
LIB386=..\..\LIB386             # DDK Libraries
MMTKLIB=..\..\LIB                  # DDK MM Toolkit Libraries
MMTKH=..\..\H                      # DDK MM Toolkit Header Files
MMTKINC=..\..\INC                  # DDK MM Toolkit Include Files
VCADINC=..\VCADDT                  # DDK MM Toolkit Specific Include File
INC=..\..\..\INC                # DDK Include Files
MAP=mapsym $(NAMESYS)

#
# Set the environmental variables for compiling
#
!if [set INCLUDE=$(H386);$(H386)\SYS;$(H);$(H)\SYS;$(INC)] ||           \
    [set LIB=$(LIB386);$(LIB)] ||                                       \
    [set PATH=$(TOOLS);$(TOOLS)\UTIL] ||                                \
    [set DPATH=$(TOOLS);$(TOOLS)\UTIL] ||                               \
    [set IPFC=$(TOOLS)]
!endif

!ifdef MMDEBUG
ASM_DEBUG=-Zi
ASM_LST=-L
C_DEBUG=/Zi /Od
C_LST= /Fc$(<B).cod
LNK_DEBUG=/CO
CVK=debstrip -o $(NAMESYS).cvk $(NAMESYS).sys
!endif

!ifdef MMPTRACE
ASM_PTRACE=-DPTRACE
C_PTRACE=/DPTRACE
!endif


##################################
# Environment variables
#
# set ASM_DEBUG = -DDEBUG -Zi
# set ASM_LST   = ,$(<B).lst
# set C_LST     = /Fc$(<B).cod
# set C_DEBUG   = /Zip /O
# set LNK_DEBUG = /CO
# set CVK = debstrip -o $(NAMESYS).cvk $(NAMESYS).sys
##################################

##################################
# Definitions for assembler
##################################
ASM=masm
AFLAGS=-Mx -T -N -D@AVC103 -DTWO_TRACKS $(ASM_DEBUG) $(ASM_PTRACE) $(ASM_TOOLKIT)
AINC=-I. -I$(INC) -I$(MMTKINC) -I$(VCADINC)

##################################
# Definitions for C compiler
##################################
CCOMP=cl
CFLAGS= /c /Zp /Zl /G2s /Asnw /W3 /O /DIS_OS2=1 /DIS_ACPA=1 /DIS_AVC103=1 /DNUM_TRACKS=2 $(C_DEBUG) $(C_PTRACE)
CINC=-I. -I$(H) -I$(MMTKH)

##################################
# Definitions for linker
##################################
LINK=link
LINK386=link386
LFLAGS= $(LNK_DEBUG) /B
#LIBS286=DOSCALLS+SLIBC7P+os2286
LIBSSYS=os2286p+doscalls


##################################
# Inference rules
##################################
#.c.obj:
#     $(CCOMP) $(CFLAGS) $(CINC) /Fo$(<B).obj $(C_LST) $(<B).c

.asm.obj:
     $(ASM) $(AFLAGS) $(AINC) $(<B).asm,$(<B).obj $(ASM_LST);

#.txt.msg:
#     mkmsgf $(<B).txt $*.msg /P437 /P850


##################################
# Object file list
##################################

SYSOBJS=VBCL.obj      \
        VBCLIDC.obj   \
        VIDIDC.obj    \
        PCVIDEO2.obj  \
!ifndef TOOLKITBLD
        TUNER.OBJ     \
        CARDSPEC.OBJ  \
!endif
        VBCLCAPT.obj  \
        VBCLINIT.obj

##################################
# Target descriptions
##################################

#!include        "$(H)\common.mak"
!include       "$(H)\version.mak"


#################################
# Definitions for h2inc
#################################
HFLAGS=-c -f -g -t
HLOOK =-s $(H)\os2def.h -s $(MMTKH)\os2medef.h -s $(H)\bsedos.h
ILOOK =

all:sys


########################################
# Video Blaster .sys Target descriptions
########################################

sys: $(NAMESYS).sys

$(NAMESYS).sys:     vidvci.inc $(SYSOBJS) makefile $(NAMESYS).lrf  \
                    $(NAMESYS).def
                    $(LINK) $(LFLAGS) @$(NAMESYS).lrf
                    $(MAP)
                    copy $(NAMESYS).sys $(SHIP_LIB)\$(NAMESYS).sys

################################
# Explicit h2inc rules
################################
VIDVCI.inc:  $(MMTKH)\VIDVCI.h $(H)\os2def.h  $(MMTKH)\os2medef.h  $(H)\bsedos.h makefile
                h2inc $(HFLAGS) $(HLOOK) $(ILOOK) $(MMTKH)\VIDVCI.h -o VIDVCI.inc


$(NAMESYS).def: makefile
        @echo Creating file <<$(@B).def
LIBRARY $(NAMESYS)
DESCRIPTION '$(FILEVER) OS/2 SVIA (Video Capture Adapter) Device Driver'
PROTMODE
SEGMENTS
   DSEG     CLASS 'DATA'
   CSEG     CLASS 'CODE'
   INITDSEG CLASS 'INITDATA'
   INITCSEG CLASS 'INITCODE'
<<keep

#CODE    PRELOAD
#DATA    PRELOAD
$(NAMESYS).lrf:  makefile
        @echo Creating file <<$(@B).lrf
$(SYSOBJS)
$(NAMESYS).sys
$(NAMESYS).map /map /nod
$(LIBSSYS)
$(NAMESYS).def;
<<keep

#$(LIBS286)

clean:
#       if exist *.lrf  del *.lrf
#       if exist *.def  del *.def
#       if exist *.obj  del *.obj
#       if exist *.map  del *.map
#       if exist *.old  del *.old
#       if exist *.lst  del *.lst
#       if exist *.cod  del *.cod
#       if exist *.sys  del *.sys
#       if exist *.sym  del *.sym
#       if exist *.msg  del *.msg


depend.mak: dephold
        touch depchk
#        nsync $(COMMON) . VIDIDC.ASM
        includes -e -l $(AINC)     *.asm  >$@
#        includes -e -l $(CINC)     *.c   >>$@
        -del depchk

dephold:
        touch $@

#!include depend.mak
