
ObjectFiles	=		\
			o.CheckHeap	\
			o.Compact	\
			o.Mem	\
			o.MidExtend	\
			o.MoveAnchor	\
			o.Size	\


LibName		=	Mem



# Template makefile to make all .o files
# and the SDLS Stubs file for DeskLib
# sublibraries.
# Julian Smith 16 Mar 1995.


# The macro $(ObjectFiles) should be set at the 
# start of this file, to be a space-separated
# list of object files.
# This is done by 'Makatic'.


# The macro $(LibName) should also be set at the 
# start of this file, to be the name of the 
# DeskLib sublibrary.
# This is done by 'Makatic'.

# Compiler and linker flags, These can be anything. 
# All flags required by Straylight (eg CC -zM and
# Link -rmf) are included in the macros $(CC) and
# $(LINK).
#
CCFlags		=	-fahi $(CCExtra) -depend !Depend -throwback -D_DeskLib_$(LibName) -I,C:
ASMFlags	=	-Stamp -NoCache -CloseExec -Quit $(ASMExtra)


# Macros for commands, including the Straylight
# tool 'cdll'. Note that DRLink doesn't seem to
# work with the SDLS.
#
CC		=	cc -c -zM -d_DLL -JC:DLLLib.,:mem $(CCFlags)
ASM		=	ObjAsm $(ASMFlags)
CDLL		=	cdll
LINK		=	link
AS		=	as -dde -throwback


# filename of DLL Stubs aof file. This is linked with client apps.
# 
DLL_Stubs	=	Stubs


# Filenames of intermediate files needed to make $(DLL_Lib) and $(DLL_Stubs).
#
# DLL_Def:		Standard definition file as per SDLS docs.
# DLL_OtherStubsSource	Assembler source to be partially linked into
#			the final stubs file. This will force linking
#			in of stubs from any other DLLs used by this
#			library when a client application is built.
# DLL_PlainStubs	The vanilla stubs file created by SDLS's cdll.
# DLL_OtherStubsObject	Assembled from DLL_OtherStubsSource. This
#			simply imports __DeskLib_SDLS_Stubs_<libname>'s
#			for all DeskLib DLLs used by this library, and
#			exports __DeskLib_SDLS_Stubs_<thislibname>.
#
DLL_Def			=	^.DLLDef
DLL_OtherStubsSource	=	^.OtherStubs

DLL_PlainStubs		=	PlainStubs
DLL_OtherStubsObject	=	OSObj

# -------------------------------------------------------
# Everything below here should probably not be changed...
# -------------------------------------------------------



# Now all the rules...


# Here's the two things we want to make...
#
All:	$(DLL_Stubs) $(ObjectFiles)

$(DLL_Stubs):	$(DLL_PlainStubs) $(DLL_OtherStubsObject)
	$(LINK) -aof -o $@ $(DLL_PlainStubs) $(DLL_OtherStubsObject)

$(DLL_PlainStubs):	$(DLL_Def)
	$(CDLL) -def $(DLL_Def) -stub $(DLL_PlainStubs)


#$(DLL_OtherStubsObject):	$(DLL_OtherStubsSource)
#	$(AS) -o $(DLL_OtherStubsObject) $(DLL_OtherStubsSource)

$(DLL_OtherStubsObject):	$(DLL_OtherStubsSource)
	$(ASM) $(ASMFlags) -from $(DLL_OtherStubsSource) -to $(DLL_OtherStubsObject) 


$(DLL_Def):	
	| Warning: No DLL definition file exists.
	| Creating a default DLL definition file: $(DLL_Def)
	| This will have to be altered by hand.
	$(CDLL) -def $(DLL_Def) -obj $(ObjectFiles)



# Rule for compiling C source code for a Straylight dynamically-linked library.

VPATH = @.^

.SUFFIXES:	.o .c .s

.c.o:
	$(CC) -o $@ $<

.s.o:
	$(ASM) $(ASMFlags) -from $< -to $@



# Dynamic dependencies:
o.CheckHeap:	^.c.CheckHeap
o.CheckHeap:	^.h.MemDefs
o.CheckHeap:	DeskLib:h.Mem
o.CheckHeap:	DeskLib:h.Core
o.CheckHeap:	C:h.stddef
o.CheckHeap:	C:DLLLib.h.dll
o.CheckHeap:	C:h.kernel
o.CheckHeap:	DeskLib:h.Error
o.Compact:	^.c.Compact
o.Compact:	^.h.MemDefs
o.Compact:	DeskLib:h.Mem
o.Compact:	DeskLib:h.Core
o.Compact:	C:h.stddef
o.Compact:	C:DLLLib.h.dll
o.Compact:	C:h.kernel
o.Mem:	^.c.Mem
o.Mem:	C:h.stdlib
o.Mem:	C:h.string
o.Mem:	C:h.kernel
o.Mem:	^.h.MemDefs
o.Mem:	DeskLib:h.Mem
o.Mem:	DeskLib:h.Core
o.Mem:	C:h.stddef
o.Mem:	C:DLLLib.h.dll
o.Mem:	DeskLib:h.WimpSWIs
o.Mem:	DeskLib:h.Wimp
o.Mem:	DeskLib:h.Error
o.MidExtend:	^.c.MidExtend
o.MidExtend:	Desklib:h.Error
o.MidExtend:	Desklib:h.Core
o.MidExtend:	C:h.stddef
o.MidExtend:	C:DLLLib.h.dll
o.MidExtend:	C:h.kernel
o.MidExtend:	^.h.MemDefs
o.MidExtend:	DeskLib:h.Mem
o.MidExtend:	C:h.string
o.MoveAnchor:	^.c.MoveAnchor
o.MoveAnchor:	^.h.MemDefs
o.MoveAnchor:	DeskLib:h.Mem
o.MoveAnchor:	DeskLib:h.Core
o.MoveAnchor:	C:h.stddef
o.MoveAnchor:	C:DLLLib.h.dll
o.MoveAnchor:	C:h.kernel
o.Size:	^.c.Size
o.Size:	^.h.MemDefs
o.Size:	DeskLib:h.Mem
o.Size:	DeskLib:h.Core
o.Size:	C:h.stddef
o.Size:	C:DLLLib.h.dll
o.Size:	C:h.kernel
