# Project:	Director:Utils


# Tool macros

asm_		= objasm
cc_		= cc
link		= link
squeeze_	= squeeze
text2basic	= <Prefix$Dir>.t2b.$@; BASIC
wipe		= X wipe


# Flag macros

# depend	= -depend !Depend
# throwback	= -throwback

asmflags	= $(throwback) $(depend) -i <OSLib$Dir>
ccflags		= -c $(depend) $(throwback) -IC: -IOSLib: -ffah -o $@
linkflags	= -o $@
squeezeflags	= $@
wipeflags	= ~CFRV


# Combined macros

asm		= $(asm_) $(asmflags)
cc		= $(cc_) $(ccflags)
link_app	= $(link) $(linkflags) -aif
link_mod	= $(link) $(linkflags) -bin
link_util	= $(link) $(linkflags) -bin
squeeze		= $(squeeze_) $(squeezeflags)


# Files to make

files 		= \
		AddRes \
		AppEnsure \
		Biggest \
		Click \
		CmndBASIC \
		DriveName \
		EveryWhere \
		ExpandMenu \
		IfCommand \
		IfModule \
		IfPodule \
		IfTask \
		IfThereIs \
		IfX \
		ModVersion \
		RMSave \
		RunFilerAc \
		SimClick \
		SwiModule \
		TestACS \
		TestAlt \
		TestCtrl \
		TestShift \
		X


# Final targets

all:		$(files) setup

setup:
		cdir @.o

clean:
		$(wipe) <Prefix$Dir>.o          $(wipeflags)

maintainerclean:
		$(wipe) <Prefix$Dir>.o          $(wipeflags)
		$(wipe) <Prefix$Dir>.AddRes     $(wipeflags)
		$(wipe) <Prefix$Dir>.AppEnsure  $(wipeflags)
		$(wipe) <Prefix$Dir>.Biggest    $(wipeflags)
		$(wipe) <Prefix$Dir>.Click      $(wipeflags)
		$(wipe) <Prefix$Dir>.CmndBASIC  $(wipeflags)
		$(wipe) <Prefix$Dir>.DriveName  $(wipeflags)
		$(wipe) <Prefix$Dir>.EveryWhere $(wipeflags)
		$(wipe) <Prefix$Dir>.ExpandMenu $(wipeflags)
		$(wipe) <Prefix$Dir>.IfCommand  $(wipeflags)
		$(wipe) <Prefix$Dir>.IfModule   $(wipeflags)
		$(wipe) <Prefix$Dir>.IfPodule   $(wipeflags)
		$(wipe) <Prefix$Dir>.IfTask     $(wipeflags)
		$(wipe) <Prefix$Dir>.IfThereis  $(wipeflags)
		$(wipe) <Prefix$Dir>.IfX        $(wipeflags)
		$(wipe) <Prefix$Dir>.ModVersion $(wipeflags)
		$(wipe) <Prefix$Dir>.RMSave     $(wipeflags)
		$(wipe) <Prefix$Dir>.RunFilerAc $(wipeflags)
		$(wipe) <Prefix$Dir>.SimClick   $(wipeflags)
		$(wipe) <Prefix$Dir>.SwiModule  $(wipeflags)
		$(wipe) <Prefix$Dir>.TestACS    $(wipeflags)
		$(wipe) <Prefix$Dir>.TestAlt    $(wipeflags)
		$(wipe) <Prefix$Dir>.TestCtrl   $(wipeflags)
		$(wipe) <Prefix$Dir>.TestShift  $(wipeflags)
		$(wipe) <Prefix$Dir>.X          $(wipeflags)

nosource:
		$(wipe) <Prefix$Dir>.CVS        $(wipeflags)
		$(wipe) <Prefix$Dir>.o          $(wipeflags)
		$(wipe) <Prefix$Dir>.c          $(wipeflags)
		$(wipe) <Prefix$Dir>.s          $(wipeflags)
		$(wipe) <Prefix$Dir>.bas        $(wipeflags)
		$(wipe) <Prefix$Dir>.t2b        $(wipeflags)
		$(wipe) <Prefix$Dir>.Makefile   $(wipeflags)


# Individual targets

AddRes:		@.o.AddRes @.o.AddResM
		$(link_app) @.o.AddRes @.o.AddResM oslib:o.oslib32 C:o.stubs
		$(squeeze)

AppEnsure:	@.bas.AppEnsure
		$(text2basic)

CmndBASIC:	o.CmndBASIC
		$(link_mod) @.o.CmndBASIC
		settype $@ Module

Biggest:	@.bas.Biggest
		$(text2basic)

Click:		@.bas.Click
		$(text2basic)

DriveName:	o.DriveName
		$(link_util) @.o.DriveName
		settype $@ Utility

EveryWhere:	o.EveryWhere
		$(link_util) @.o.EveryWhere
		settype $@ Utility

ExpandMenu:	@.bas.ExpandMenu
		$(text2basic)

IfCommand:	o.IfCommand
		$(link_util) @.o.IfCommand
		settype $@ Utility

IfModule:	o.IfModule
		$(link_util) @.o.IfModule
		settype $@ Utility

IfPodule:	o.IfPodule
		$(link_util) @.o.IfPodule
		settype $@ Utility

IfThereIs:	o.IfThereIs
		$(link_util) @.o.IfThereIs
		settype $@ Utility

IfTask:		o.IfTask
		$(link_util) @.o.IfTask
		settype $@ Utility

IfX:		o.IfX
		$(link_util) @.o.IfX
		settype $@ Utility

ModVersion:	@.bas.ModVersion
		$(text2basic)

RMSave:		o.RMSave
		$(link_util) @.o.RMSave
		settype $@ Utility

RunFilerAc:	@.bas.RunFilerAc
		$(text2basic)

SimClick:	@.bas.SimClick
		$(text2basic)

SwiModule:	o.SwiModule
		$(link_mod) @.o.SwiModule
		settype $@ Module

TestAlt:	o.TestAlt
		$(link_util) @.o.TestAlt
		settype $@ Utility

TestACS:	o.TestACS
		$(link_util) @.o.TestACS
		settype $@ Utility

TestCtrl:	o.TestCtrl
		$(link_util) @.o.TestCtrl
		settype $@ Utility

TestShift:	o.TestShift
		$(link_util) @.o.TestShift
		settype $@ Utility

X:		o.X
		$(link_util) @.o.X
		settype $@ Utility


# Rule Patterns

.SUFFIXES:	.o

.s.o:;		$(asm) $< $@ -PreDefine "SIGNATURE SETL {TRUE}"

.c.o:;		$(cc) -o $@ $*


# Static dependencies

o.AddRes: c.AddRes
o.AddResM: s.AddResM
o.CmndBASIC: s.CmndBASIC
o.DriveName: s.DriveName
o.EveryWhere: s.EveryWhere
o.IfCommand: s.IfCommand
o.IfModule: s.IfModule
o.IfPodule: s.IfPodule
o.IfTask: s.IfTask
o.IfThereIs: s.IfThereIs
o.IfX: s.IfX
o.RMSave: s.RMSave
o.SwiModule: s.SwiModule
o.TestACS: s.TestACS
o.TestAlt: s.TestAlt
o.TestCtrl: s.TestCtrl
o.TestShift: s.TestShift
o.X: s.X


