#################################################################################
#
# Makefile for OS/2 Multimedia extensions
#
#   Generates
#         audiovdd.sys       - audio virtual device driver
#
# IBM Confidential
#
# Copyright (c) IBM Corporation 1992
# All Rights Reserved
#
# NOTE: The code in this component is shared - common between this
# component and the MMPM/2 toolkit virtual device driver sample.
# That is, this component is the sample.
# To confirm to the different build environments, the makefile's are different.
# This makefile is used to build the MMPM/2 product audiovdd.sys.
#
#################################################################################

.SUFFIXES:
.SUFFIXES: .exe .obj .asm .inc .def .lrf  \
           .lst .sym .map .c .h .lib .dlg .txt .cod  \
           .res .rc .l$(LANG) .dll

MODNAME=AVDD
NAMESYS=AUDIOVDD

#################################
# Compiler and Tools location
#################################
TOOLS=..\..\..\TOOLS
H=..\..\..\H
TOP=..\..\..\DDK
H386=..\..\..\H386
LIB=..\..\..\LIB
LIB386=..\..\..\LIB386
SHIP_LIB=..\..\LIB
SHIP_H=..\..\H
SHIP_INC=..\..\INC
COMMON=..\..\COMMON
INC=..\..\..\INC
MAP=mapsym $(NAMESYS)
MAK=..\..\SRC\H
SRC=$(TOP)\src
IBMC=$(TOP)\IBMC
MASM60=$(TOP)\MASM60
NLSPATH=$(TOP)\NLV\$(LANG)\$(MODNAME)
MAKEDIR=.

# C Set/2 Headers
IBMH=$(IBMC)\CINCLUDE
IBMHSYS=$(IBMC)\CINCLUDE\SYS



# MMPM/2 Private headers
COMMON=$(TOP)\COMMON


HPATH=.;$(H);$(SHIP_H);$(INC);$(SHIP_INC);$(COMMON);$(MAK);

COVCC=\VISTA
VISTA_LIB=\VISTA\VISTA

IBMLIB=$(IBMC)\CLIB
LIBPATH=$(LIB);$(LIB386);$(SHIP_LIB)

#
# Set the environmental variables for compiling
#
!if  [SET PATH=$(TOP)\TOOLS;$(TOP)\TOOLS\util;%PATH%]          || \
     [SET DPATH=$(TOP)\TOOLS;$(TOP)\TOOLS\util;%DPATH%] || \
     [SET LIB=$(LIBPATH);%LIB%]                                                               || \
     [SET INCLUDE=$(HPATH);%INCLUDE%]                                                           || \
     [SET HELP=$(IBMC)\CHELP;%HELP%]                                          || \
     [SET TZ=$(IBMC)\EST5EDT,0,0,0,0,0,0,0,0,0]                               || \
     [SET IPFC=$(TOOLS);$(IPFC)]
!endif

#
# Define macros for language. If the macro is NOT defined, the default
# value will be the US.
#
!ifndef LANG
LANG=us
!endif

#
# Set debugging and PTRACE on if environmental variables are set.
#  MMDEBUG
#  MMPTRACE
#
!IFDEF MMOPT
C_OPT=/O+
!ENDIF

!ifdef MMDEBUG
ASM_DEBUG=-DMMDEBUG
C_DEBUG=/Ti+ /O- /DMMDEBUG
#LNK_DEBUG=/CO
!endif


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

!ifdef MMRAS
ASM_RAS=-DMMRAS
C_RAS=/DMMRAS
!endif


#################################
# Definitions for IPFC
#################################
#IPF=ipfc

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

#################################
# Definitions for assembler
#################################
# Microsoft MASM 6.0
ASM     = ml
ASM_LST = -Fl
AFLAGS  = -c -Cx -Sn
# $(ASM_LST)
AINC= -I$(MASM60)\INCLUDE -I$(SRC)\INC

#
# Definitions for linker
#
LINK    = LINK386
LFLAGS  = /NOE /NOD /M /BATCH
LIBS    = \
!ifdef COVERAGE
       $(VISTA_LIB)\COV3.LIB \
!endif
       vdh.lib

!ifdef COVERAGE
CC=\vista\covcc -xCSthmia --
!else
CC=icc
!endif

CINC=-I$(SHIP_H) -I$(COMMON) -I$(IBMH) -I$(IBMH)\SYS -I$(H) -I$(H)\SYS
CFLAGS=/C /Q+ /Kp+ /Ss+ /Sn+ /Ge- /Gm+ /Gn+ \
-DLINT_ARGS $(C_DEBUG) $(C_PTRACE) $(C_OPT)
# /Ls+ /Fa$*.cod

MAPSYM=mapsym


#########################################
# Definitions for RESOURCE compiler
#########################################
RC   = rc
RCINC= -i $(H) -i $(SHIP_H) -i $(COMMON)

#################################
# Object file lists
#################################
OBJS = audiovdd.obj audioreq.obj audioeoi.obj vddinit.obj \
       globdata.obj instdata.obj

#################################
# Inference Rules
#################################
.c.obj:
        $(CC) $(CFLAGS) $(CINC) /Fo$*.obj $*.c

.asm.obj:
        $(ASM) $(AFLAGS) $(AINC) -Fo$*.obj $*.asm $(ASM_LST)

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

#
# Include a makefile with all the information about NLS Language (L=...),
# Codepage (P=...) and Country (C=...) for the ipfc compiler.
#
!include "$(H)\preipfc.mak"

# Modified makefile to not build JHN 17-Feb-93
# OS/2 include files (me11\src\inc) don't work with MASM 6.0.
# Many headers have changed and are no longer compatible.
# Need to chase with OS/2 toolkit group.
all: $(NAMESYS).s$(LANG)
#all: disable

#################################
# Target Descriptions
#################################
disable: makefile
        @echo *** Makefile disabled pending MASM 6.0 compatible
        @echo *** headers.  Binaries deltaed to fulfill build.
        @echo *** OS/2 2.0 GA headers work with small modifications.
        @echo *** 2.1 level headers have many incompatibilities.
        @echo *** JHN 17-Feb-93

$(NAMESYS).s$(LANG): $(OBJS) AUDIOVDD.l$(LANG) AUDIOVDD.def
        $(LINK) $(LFLAGS) @AUDIOVDD.l$(LANG)
        if "$(LANG)" == "us" $(MAPSYM) $(NAMESYS)

#
# Make link response file
#
$(NAMESYS).l$(LANG): makefile
        @echo Creating file <<$(@B).l$(LANG)
$(OBJS)
$(@B).s$(LANG)
$(@B).map
$(LIBS)
$(@B).def;
<<keep

#
# Make DEF file
#
$(NAMESYS).def: makefile
        @echo Creating file <<$(@B).def
VIRTUAL DEVICE
DESCRIPTION '$(FILEVER)'
PROTMODE

STUB           'OS2STUB.EXE'    ; DOS program that gets executed if user
                                ; tries to run the .sys under DOS
                                ; Program is embedded into .sys file.
SEGMENTS
    _TEXT        CLASS 'CODE'      SHARED    NONDISCARDABLE  RESIDENT
    CINIT_TEXT   CLASS 'CODE'      SHARED    DISCARDABLE     RESIDENT
    CSWAP_TEXT   CLASS 'CODE'      SHARED    NONDISCARDABLE
    CINIT_DATA   CLASS 'CINITDATA' SHARED    DISCARDABLE     RESIDENT
    CSWAP_DATA   CLASS 'CSWAPDATA' SHARED    NONDISCARDABLE
    MVDMINSTDATA CLASS 'MIDATA'    NONSHARED NONDISCARDABLE  RESIDENT
    SWAPINSTDATA CLASS 'SIDATA'    NONSHARED NONDISCARDABLE
    _DATA        CLASS 'DATA'      SHARED    NONDISCARDABLE  RESIDENT
<<keep

