
ObjectFiles	=		\
			o.Print	\


LibName		=	Print



# 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.Print:	^.c.Print
o.Print:	C:h.stdlib
o.Print:	C:h.stdio
o.Print:	DeskLib:h.Wimp
o.Print:	DeskLib:h.Core
o.Print:	C:h.stddef
o.Print:	C:DLLLib.h.dll
o.Print:	C:h.kernel
o.Print:	DeskLib:h.WimpSWIs
o.Print:	DeskLib:h.PDriver
o.Print:	DeskLib:h.Error
o.Print:	DeskLib:h.File
o.Print:	DeskLib:h.SWI
o.Print:	DeskLib:h.Event
o.Print:	DeskLib:h.Print
