#*******************************************************************************
#           Copyright (C) 2000 Texas Instruments Incorporated.
#                           All Rights Reserved
#-------------------------------------------------------------------------------
# FILENAME...... makefile
# DATE CREATED.. 06/15/2000
# LAST MODIFIED. 06/16/2000
#
#*******************************************************************************

# base directories
TIDIR   = c:\ti
BASEDIR = c:\bsl\bsl20

# file locations
MAKEDIR = $(BASEDIR)\make
SRCDIR  = $(BASEDIR)\source
LIBDIR  = $(BASEDIR)\lib
INCDIR  = $(BASEDIR)\include
OBJDIR  = $(MAKEDIR)\objs\bsl$(BOARD)

# code-gen tools
AR   = @$(TIDIR)\c6000\cgtools\bin\ar6x.exe
CL   = @$(TIDIR)\c6000\cgtools\bin\cl6x.exe
LN   = @$(TIDIR)\c6000\cgtools\bin\lnk6x.exe
ASM  = @$(TIDIR)\c6000\cgtools\bin\asm6x.exe

# system tools
MAKE = @nmake /NOLOGO
CP   = @xcopy /v
CAT  = @type
ECHO = @echo
CD   = @cd

# build options
OPTS = -mo -al -k -qq -o3 -ml3 -dBOARD_$(BOARD) -i$(SRCDIR) -im:\include -dCHIP_$(CHIP) $(OPT)

#-------------------------------------------------------------------------------

default: bsl6711dsk

all: \
  bsl6711dsk \

clean:
   @del /s $(MAKEDIR)\*.obj

bsl6711dsk: 
    $(MAKE) BOARD=6711DSK CHIP=6711 OPT="-mv6711" $(LIBDIR)\bsl6711dsk.lib

#-------------------------------------------------------------------------------
LIB_DEP = \
  board \
  bsl \
  ad535 \
  dip \
  flash \
  led \

SRCFILES = \
  $(SRCDIR)\*.c \
  $(SRCDIR)\*.h 

$(LIBDIR)\bsl6711dsk.lib:  display $(LIB_DEP)
#    @if exist $(LIBDIR)\bsl.src del $(LIBDIR)\bsl.src
#    @if exist $(LIBDIR)\bsl$(LIB).lib del $(LIBDIR)\bsl.src
#   $(AR) -rq $(LIBDIR)\bsl.src $(SRCDIR)\*.*
    $(AR) -rq $(LIBDIR)\bsl.src $(SRCFILES)
    $(AR) -rq $(LIBDIR)\bsl6711dsk.lib $(MAKEDIR)\objs\bsl$(BOARD)\*.obj

display:
    $(ECHO).
    $(ECHO) BUILDING LIBRARY bsl6711dsk.lib
	$(ECHO) OPTIONS: $(OPTS)
    $(ECHO). 

dir:
#   @if not exist $(MAKEDIR)\objs\bsl$(BOARD) md $(MAKEDIR)\objs\bsl$(BOARD)

#-------------------------------------------------------------------------------
# BOARD
#-------------------------------------------------------------------------------

# the module depends on these
BOARD_DEP = \
  $(OBJDIR)\bsl_board.obj \
  $(INCDIR)\bsl_board.h \

# the obj file depends on these
BOARD_OBJ_DEP = \
  $(SRCDIR)\bsl_board.h \
  $(SRCDIR)\bsl_board.c \

# module target
board: $(BOARD_DEP)

# obj target
$(OBJDIR)\bsl_board.obj: $(BOARD_OBJ_DEP)
    $(CD) $(OBJDIR)
    $(ECHO) $(*B).c
    $(CL) $(OPTS) $(SRCDIR)\$(*B).c
    $(CD) $(MAKEDIR)

# copy related include files into the release include directory
$(INCDIR)\bsl_board.h: $(SRCDIR)\bsl_board.h
    $(CAT) $(SRCDIR)\$(*B).h > $(INCDIR)\$(*B).h

#-------------------------------------------------------------------------------
# BSL
#-------------------------------------------------------------------------------

# the module depends on these
BSL_DEP = \
  $(OBJDIR)\bsl.obj \
  $(INCDIR)\bsl.h \

# the obj file depends on these
BSL_OBJ_DEP = \
  $(SRCDIR)\bsl_board.h \
  $(SRCDIR)\bsl.h \
  $(SRCDIR)\bsl.c \

# module target
bsl: $(BSL_DEP)

# obj target
$(OBJDIR)\bsl.obj: $(BSL_OBJ_DEP)
    $(CD) $(OBJDIR)
    $(ECHO) $(*B).c
    $(CL) $(OPTS) $(SRCDIR)\$(*B).c
    $(CD) $(MAKEDIR)

# copy related include files into the release include directory
$(INCDIR)\bsl.h: $(SRCDIR)\bsl.h
    $(CAT) $(SRCDIR)\$(*B).h > $(INCDIR)\$(*B).h

#-------------------------------------------------------------------------------
# AD535
#-------------------------------------------------------------------------------

# the module depends on these
AD535_DEP = \
  $(OBJDIR)\bsl_ad535.obj \
  $(INCDIR)\bsl_ad535.h \

# the obj file depends on these
AD535_OBJ_DEP = \
  $(SRCDIR)\bsl_board.h \
  $(SRCDIR)\bsl_ad535.h \
  $(SRCDIR)\bsl_ad535.c \

# module target, put the obj file into the library
ad535: $(AD535_DEP)

# obj target
$(OBJDIR)\bsl_ad535.obj: $(AD535_OBJ_DEP)
    $(CD) $(OBJDIR)
    $(ECHO) $(*B).c
    $(CL) $(OPTS) $(SRCDIR)\$(*B).c
    $(CD) $(MAKEDIR)

# copy related include files into the release include directory
$(INCDIR)\bsl_ad535.h: $(SRCDIR)\bsl_ad535.h
    $(CAT) $(SRCDIR)\$(*B).h > $(INCDIR)\$(*B).h

#-------------------------------------------------------------------------------
# DIP
#-------------------------------------------------------------------------------

# the module depends on these
DIP_DEP = \
  $(OBJDIR)\bsl_dip.obj \
  $(INCDIR)\bsl_dip.h \

# the obj file depends on these
DIP_OBJ_DEP = \
  $(SRCDIR)\bsl_board.h \
  $(SRCDIR)\bsl_dip.h \
  $(SRCDIR)\bsl_dip.c \

# module target, put the obj file into the library
dip: $(DIP_DEP)

# obj target
$(OBJDIR)\bsl_dip.obj: $(DIP_OBJ_DEP)
    $(CD) $(OBJDIR)
    $(ECHO) $(*B).c
    $(CL) $(OPTS) $(SRCDIR)\$(*B).c
    $(CD) $(MAKEDIR)

# copy related include files into the release include directory
$(INCDIR)\bsl_dip.h: $(SRCDIR)\bsl_dip.h
    $(CAT) $(SRCDIR)\$(*B).h > $(INCDIR)\$(*B).h

#-------------------------------------------------------------------------------
# FLASH
#-------------------------------------------------------------------------------

# the module depends on these
FLASH_DEP = \
  $(OBJDIR)\bsl_flash.obj \
  $(INCDIR)\bsl_flash.h \

# the obj file depends on these
FLASH_OBJ_DEP = \
  $(SRCDIR)\bsl_board.h \
  $(SRCDIR)\bsl_flash.h \
  $(SRCDIR)\bsl_flash.c \

# module target, put the obj file into the library
flash: $(FLASH_DEP)

# obj target
$(OBJDIR)\bsl_flash.obj: $(FLASH_OBJ_DEP)
    $(CD) $(OBJDIR)
    $(ECHO) $(*B).c
    $(CL) $(OPTS) $(SRCDIR)\$(*B).c
    $(CD) $(MAKEDIR)

# copy related include files into the release include directory
$(INCDIR)\bsl_flash.h: $(SRCDIR)\bsl_flash.h
    $(CAT) $(SRCDIR)\$(*B).h > $(INCDIR)\$(*B).h

#-------------------------------------------------------------------------------
# LED 
#-------------------------------------------------------------------------------

# the module depends on these
LED_DEP = \
  $(OBJDIR)\bsl_led.obj \
  $(INCDIR)\bsl_led.h \

# the obj file depends on these
LED_OBJ_DEP = \
  $(SRCDIR)\bsl_board.h \
  $(SRCDIR)\bsl_led.h \
  $(SRCDIR)\bsl_led.c \

# module target, put the obj file into the library
led: $(LED_DEP)

# obj target
$(OBJDIR)\bsl_led.obj: $(LED_OBJ_DEP)
    $(CD) $(OBJDIR)
    $(ECHO) $(*B).c
    $(CL) $(OPTS) $(SRCDIR)\$(*B).c
    $(CD) $(MAKEDIR)

# copy related include files into the release include directory
$(INCDIR)\bsl_led.h: $(SRCDIR)\bsl_led.h
    $(CAT) $(SRCDIR)\$(*B).h > $(INCDIR)\$(*B).h

#-------------------------------------------------------------------------------

#*******************************************************************************
# End of makefile
#*******************************************************************************