#/*****************************************************************************
# * Copyright (c) 1997 - 1999 PLX Technology, Inc.
# * 
# * PLX Technology Inc. licenses this software under specific terms and
# * conditions.  Use of any of the software or derviatives thereof in any
# * product without a PLX Technology chip is strictly prohibited. 
# * 
# * PLX Technology, Inc. provides this software AS IS, WITHOUT ANY WARRANTY,
# * EXPRESS OR IMPLIED, INCLUDING, WITHOUT LIMITATION, ANY WARRANTY OF
# * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  PLX makes no guarantee
# * or representations regarding the use of, or the results of the use of,
# * the software and documentation in terms of correctness, accuracy,
# * reliability, currentness, or otherwise; and you rely on the software,
# * documentation and results solely at your own risk.
# * 
# * IN NO EVENT SHALL PLX BE LIABLE FOR ANY LOSS OF USE, LOSS OF BUSINESS,
# * LOSS OF PROFITS, INDIRECT, INCIDENTAL, SPECIAL OR CONSEQUENTIAL DAMAGES
# * OF ANY KIND.  IN NO EVENT SHALL PLX'S TOTAL LIABILITY EXCEED THE SUM
# * PAID TO PLX FOR THE PRODUCT LICENSED HEREUNDER.
# * 
# ****************************************************************************/

#/***************************************************************************
# * File Name   :   Makerom.860
# *
# * Module Name :   IOP BSP (ROM version)
# *
# * Description :   Create IOP BSP (RAM version) library file for Motorola MPC860.
# *
# *                 To nmake:
# *
# *                 1. For Windows 95/Windows98: (Set860.bat needs modifying).
# *                      Command /k SDK_INSTALL_PATH\bin\set860.bat
# *                    Or for Windows NT:
# *                      Cmd /k  SDK_INSTALL_PATH\bin\set860.bat
# *
# *                    This step will set up some environment variables
# *                    and compiler path.
# *                     
# *                 2. To make a ROM version BSP, type 
# *                    nmake /f MakeRom.860
# *
# * Note        :   This nmake file assumes the following directory structure.
# *
# *                 +---IOP
# *                 |   +---BSP
# *                 |   |   +---CPCI9054RDK-860
# *                 |   +---Lib
# *                 |       +---CPCI9054RDK-860
# *                 |           +---DIAB-COFF
# *                 |           +---DIAB-ELF
# *                 +---Inc
# *                 +---bin
# * 
# * Revision:
# *     09-03-99 : PCI SDK v3.00 Release  
# *
# ***************************************************************************/

# -------------- Suffix rules --------------------------
.SUFFIXES: .s .c .as

# ----- C files to Object files, consult a book on nmake and compiler
# documentation for more information.
.c.o:
#    $(CC) $(CFLAGS) -S $*.c
    @Echo Source file: $*.c
    $(CC) -@<<
    $(CFLAGS)
    -c $*.c
    -o $*.o
<<

# Assembly file to object files, consult a book on nmake and compiler
# documentation for more information.
.s.o:
    @Echo Source file: $*.s
    $(AS) -@<<
    $(AFLAGS) $*.s
<<

# Assembly file to object files, consult a book on nmake and compiler
# documentation for more information.
.as.o:
    @Echo Source file: $*.as
    $(AS) -@<<
    $(AFLAGS) $*.as
<<

# Define compilers and linker and others
# das.exe is assembly compiler, dcc.exe is C compiler, dld.exe is linker,
# ddump.exe is a file conversion utility, dar.exe is an archiver or library
# program, as to del, is delete command.
AS      =   das.exe
CC      =   dcc.exe
LD      =   dld.exe
ROM     =   ddump.exe
AR      =   dar.exe
RM      =   del
CLS     =   cls
TYPE    =   type

# Include directories, M860_INC is an environment variable
# Modify the path to the include directory
INCLUDE = -I%M860_INC% -I..\..\..\INC

# -DMPC860             CPU type, optional flag for SDK
# -DIOP_CODE           IOP codes, a MUST_HAVE flag for SDK
# -DCPCI9054           PLX chip type, a MUST_HAVE flag for CompactPCI9054RDKs
# -DBIG_ENDIAN         endianness type, a MUST_HAVE for SDK
# -DIOP_ROM            ROM version, either IOP_ROM or IOP_RAM must exist
# -tPPC860DN:simple    Target: MPC860, PowerPC COFF BackEnd, No Floating Point
#                      Only Char IO
DEFINE = -DMPC860 -DIOP_CODE -DCPCI9054 -DBIG_ENDIAN -DIOP_ROM -tPPC860DN:simple

# Output file, change if necessary
OUTPUT = BspRom.a

# RDK constant, change this directory if necessary
RDK = cPCI9054RDK-860

# CPCI9054 library directory, links to BSP and LIB directories
LIB_DIR = ..\..\lib\$(RDK)\DIAB-COFF

# Define Assembler or C Compiler flags etc 
AFLAGS = $(DEFINE) $(INCLUDE)
CFLAGS = $(DEFINE) -D__DIAB $(INCLUDE)

# Required object files, add if necessary
OBJS =  ROMEntry.o      \
        sysrom.o        \
        mainrom.o       \
        Flash.o         \
        isr9054.o       \
        IO860.o         \
        InitDma.o       \
        TestMem.o       \
        BspSup.o        \
        Uart.o          \
        PPCintr.o       \
        Idma.o          \
        mmu.o           \
        SeriDwld.o      \
        BemSup.o        \
        BspAll.o

#  This will be the target, all temporary files will be deleted.
#  Remove "Clean" if you want intermediate compiling.
all: $(OUTPUT) Clean

$(OUTPUT): $(OBJS)
    @if exist $(OUTPUT) erase $(OUTPUT)
    @$(AR) -rv $(OUTPUT) $(OBJS)
    @copy $(OUTPUT) $(LIB_DIR)
    @Echo $(RDK) IOP BSP $(OUTPUT) library created.

Clean:
   @if exist *.o erase *.o
   @if exist *.a erase *.a
   @Echo Finished cleaning up