##############################################################################
# SBUFP                                                                      #
#                                                                            #
# Build rules for mach64 Chapter 7 sample code                               #
#                                                                            #
# Copyright (c) 1994-1998 ATI Technologies Inc.  All rights reserved.        #
##############################################################################

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

Compiler = wcc386
Linker = wlink
System = dos4g

!ifdef DEBUG
%M64SDKDEBUG = 1
!endif

!ifdef %M64SDKDEBUG
Compiler_Options = -fo=$*.obj -d2
Linker_options = debug all
!else
Compiler_Options = -fo=$*.obj -zld
Linker_options =
NDEBUG = 1
!endif

Exe_file = sbufp.exe

Object_directory = obj

Object_files = $(Object_directory)\sbufp.obj

Library_file = ..\util\ch7util.lib

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

all: $(Exe_file)

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

$(Exe_file): $(Object_directory) $(Object_files) $(Library_file)
    *$(Linker) system $(System) $(Linker_Options) name $(Exe_file) &
    file {$(Object_files)} library {$(Library_file)}

$(Library_file):
    set M64SDKPATH = $(%cwd)
    cd ..
    wmake util
    cd $(%M64SDKPATH)

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

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