##############################################################################
# CH5UTIL                                                                    #
#                                                                            #
# Build rules for R128 Chapter 5 sample code utility library                 #
#                                                                            #
# Copyright (c) 1999 ATI Technologies Inc.  All rights reserved.             #
##############################################################################

########################
# User settable macros #
########################

Compiler = wcc386
Assembler = wasm
Librarian = wlib

!ifdef DEBUG
%R128SDKDEBUG = 1
!endif

!ifdef %R128SDKDEBUG
Compiler_Options = -fo=$*.obj -d2 -w3 -zq
Assembler_Options = -fo=$*.obj -3pr -mf -w3 -zq
Library_options = -b -l -n -q
!else
Compiler_Options = -fo=$*.obj -zld -zq
Assembler_Options = -fo=$*.obj -3pr -mf -zq
Library_options = -b -l -n -q -t
NDEBUG = 1
!endif

Library_name = ch5util
Library_file = $(Library_name).lib

Additional_libraries = ..\..\chap4\util\ch4util.lib

Object_directory = obj

Object_files =  $(Object_directory)\agplib.obj &
                $(Object_directory)\gart.obj &
                $(Object_directory)\l2p.obj &
                $(Object_directory)\l2pll.obj &
                $(Object_directory)\flush.obj &
                $(Object_directory)\cceutil.obj

##################
# Makefile rules #
##################

all: $(Library_file)

clean: .SYMBOLIC
    for %i in ($(Object_files)) do if exist %i del %i
    if exist $(Library_file) del $(Library_file)
    if exist $(Library_name).lst del $(Library_name).lst
    if exist $(Object_directory) rmdir $(Object_directory)

$(Library_file): $(Object_directory) $(Object_files) $(Additional_libraries)
    *$(Librarian) $(Library_Options) $(Library_file) &
          $(Object_files) $(Additional_libraries)

$(Object_directory):
    if not exist $(Object_directory)\nul mkdir $(Object_directory)

.c.obj:
    *$(Compiler) $(Compiler_Options) $<

.asm.obj:
    *$(Assembler) $(Assembler_Options) $<
