#******************************************************************************
#*
#* COPYRIGHT: Unless otherwise noted, all files are Copyright (c) 1992, 1993
#* Commodore-Amiga, Inc.  All rights reserved.
#*
#* DISCLAIMER: This software is provided "as is".  No representations or
#* warranties are made with respect to the accuracy, reliability, performance,
#* currentness, or operation of this software, and all use is at your own risk.
#* Neither commodore nor the authors assume any responsibility or liability
#* whatsoever with respect to your use of this software.
#*
#******************************************************************************

MODNAME	          = wav
VERSION		  = 39

TEMP		  = RAM:Temp
LOCAL		  = W:classes/datatypes/wav
REMOTE		  = V$(VERSION):src/workbench/classes/datatypes/wav

LD_FILE	          = $(MODNAME).ld
LD_STRIP          = $(MODNAME).ld.strip

C_COMPILER        = LC
C_COMPILER_OPTS   = -b0 -ms -v -me -rr -cfistqmcu -d4
#C_COMPILER_OPTS   = -b0 -ms -v -cfistq -d4

ASSEMBLER         = hx68 -a
ASSEMBLER_OPTS    = -csy -i include: -o

LINKER            = Blink
LINKER_OPTS	  = ADDSYM SC SD MAP $(MODNAME).map HLSXF PLAIN SWIDTH 16
LINKER_OPTS_STRIP = ND

C_SOURCES	  = classbase.c dispatch.c
ASM_SOURCES	  = classinit.asm endcode.asm

OBJECTS		  = classinit.o classbase.o dispatch.o endcode.o

STARTUP		  =
LIBS		  = LIB:debug.lib LIB:amiga.lib LIB:lcr.lib
LIBS		  = LIB:debug.lib LIB:amiga.lib LIB:lc.lib


##############################################################################
# Build the stripped load file...
#
$(LD_STRIP):	$(LD_FILE)
		$(LINKER) FROM $(LD_FILE) TO $(LD_STRIP) $(LINKER_OPTS_STRIP)

##############################################################################
# Build the load file...
#
$(LD_FILE):	$(OBJECTS) $(LIBS)

		$(LINKER) <with <
FROM $(STARTUP) $(OBJECTS) TO $(LD_FILE) LIB $(LIBS) $(LINKER_OPTS)
<


##############################################################################
# Default rules...
#
.c.o:
	$(C_COMPILER) $(C_COMPILER_OPTS) $*.c

.asm.o:
	$(ASSEMBLER) $*.asm $(ASSEMBLER_OPTS) $*.o


##############################################################################
# All dependencies...
#
classinit.o:	classinit.asm $(MODNAME)_rev.rev classbase.i
classbase.o:	classbase.c classbase.h
dispatch.o:	dispatch.c

##############################################################################
# Make protos
#
protos:
	mkproto $(C_SOURCES) to class_iprotos.h

##############################################################################
# Bump the version...
#
version:
	@BumpRev $(VERSION) $(MODNAME)_rev


##############################################################################
# Delete all object files
#
clean:
	-Delete $(OBJECTS)
        -Delete $(LD_FILE) $(MODNAME).map \#?.BAK


##############################################################################
# Build autodoc
#
$(MODNAME).doc:	autodocs.asm
	@Autodoc >$(MODNAME).doc autodocs.asm



##############################################################################
# Release the current build to the server...
#
internal:
	-Delete $(REMOTE)/((\#?.(c|h|asm|i|ld|rev|doc|class|datatype))|lmkfile)
	-protect ((\#?.(c|h|asm|i|ld|rev|doc))|lmkfile|$(LD_STRIP)) +r quiet
	-copy \#?.(strip|ld|doc|datatype) \#?_rev.\#? $(REMOTE)

##############################################################################
# Install the current build locally
#
install:
	-copy $(LD_STRIP) sys:classes/datatypes/$(MODNAME).datatype
	-delete sys:classes/datatypes/$(MODNAME).class
	-flushlibs

doc:
	@autodoc >$(MODNAME).datatype.doc classbase.c
	@copy $(MODNAME).datatype.doc V$(VERSION):doc
