##
##	$Id$
##
##	:ts=8
##

.c.o:
	sc $(CFLAGS) cpu=$(CPU) $*.c
	@ctags $*.c >tagfiles/$*.c
	@ci -l -m. -t-. $*.c

.c.oo:
	sc $(OPTIMIZE) $(CFLAGS) cpu=$(CPU) objname=$*.oo $*.c
	@ctags $*.c >tagfiles/$*.c
	@ci -l -m. -t-. $*.c

.c.ooo:
	sc $(OPTIMIZE) $(CFLAGS) cpu=any objname=$*.ooo $*.c
	@ctags $*.c >tagfiles/$*.c
	@ci -l -m. -t-. $*.c

.asm.o:
	asm -D -DCPU_$(CPU) -u $*.asm
	@ci -l -m. -t-. $*.asm

OPTIMIZE	= optimize optsize

CPU		= 68030
#CPU		= any

DEBUG		= debug=line

#C_UTILITY	= utillib
#L_UTILITY	= define __CXM33=__UCXM33 define __CXD33=__UCXD33 \
#		  define __CXM22=__UCXM22 define __CXD22=__UCXD22

CFLAGS		= streq strmerge nostkchk idlen=65 nover memsize=huge \
		  gst=gtlayout.gst gstimm nooptinlocal define=CPU_$(CPU) \
		  params=r $(DEBUG) $(C_UTILITY)
LFLAGS		= sc sd addsym noicons $(L_UTILITY)

LIBS		= lib:pools.lib lib:sc.lib lib:amiga.lib lib:debug.lib gtlayout_endtag.lib

all:		gtlayout.gst gtlayout_endtag.lib gtlayout.library

OBJS		= gtlayout_romtag.o gtlayout_data.oo gtlayout_lib.ooo \
		  LTP_AddGadgets.oo LTP_AddHistory.oo LTP_AdjustItemPosition.oo \
		  LTP_AdjustMenuPosition.oo LTP_Atol.oo LTP_BackFillRoutine.oo \
		  LTP_BlinkButton.oo LTP_Clone.oo LTP_ConvertNum.oo \
		  LTP_CorrectItemList.oo LTP_CreateGadgets.oo LTP_CreateIncrementer.oo \
		  LTP_CreateMenuTagList.oo LTP_CreateMenuTemplate.oo LTP_CreateObjectNode.oo \
		  LTP_CreatePicker.oo LTP_DefaultEditRoutine.oo LTP_DefaultHistoryHook.oo \
		  LTP_Delay.oo LTP_DeleteObjectNode.oo LTP_DetermineSize.oo \
		  LTP_Draw.oo LTP_DrawBackFore.oo LTP_DrawBox.oo \
		  LTP_DrawGauge.oo LTP_DrawGroup.oo LTP_DrawIncrementer.oo \
		  LTP_DrawPalette.oo LTP_DrawPicker.oo LTP_DrawPrevNext.oo \
		  LTP_DrawTapeButton.oo LTP_FillMenu.oo LTP_Find.oo \
		  LTP_FixExtraLabel.oo LTP_FracEditRoutine.oo LTP_GetCommandWidth.oo \
		  LTP_GetDisplayClip.oo LTP_GlyphSetup.oo LTP_HandleHistory.oo \
		  LTP_HexEditRoutine.oo LTP_ImageClass.oo LTP_InitIText.oo \
		  LTP_LayoutGadgets.oo LTP_LayoutGroup.o LTP_LayoutMenu.oo \
		  LTP_LevelGadget.oo LTP_LevelImage.oo LTP_MakeItem.oo \
		  LTP_MakeMenu.oo LTP_Memory.oo LTP_MoveToWindow.oo \
		  LTP_NewMenu.oo LTP_PasswordEditRoutine.oo LTP_PlaceGroups.oo \
		  LTP_PopupClass.oo LTP_PrintBoxLine.oo LTP_PrintLabel.oo LTP_RenderArrow.oo \
		  LTP_RenderCircle.oo LTP_Rescale.o LTP_ResetGroups.oo \
		  LTP_RPortAttrs.oo LTP_SearchKeys.oo LTP_SelectKeys.oo \
		  LTP_ShrinkMenu.oo LTP_SizeDimensions.oo LTP_Spread.oo \
		  LTP_SPrintf.oo LTP_Storage.oo LTP_TabClass.oo \
		  LT_Activate.oo LT_Build.oo LT_CreateHandle.oo \
		  LT_DeleteHandle.oo LT_DisposeMenu.oo LT_FindMenuCommand.oo \
		  LT_Fixed.oo LT_GetAttributes.oo LT_GetCode.oo \
		  LT_GetMenuItem.oo LT_HandleInput.oo LT_IMsg.oo \
		  LT_InitExit.oo LT_LabelWidth.oo LT_LayoutMenus.oo \
		  LT_LevelWidth.oo LT_LockWindow.oo LT_MenuControlTagList.oo \
		  LT_New.oo LT_NewMenuTagList.oo LT_NewMenuTemplate.o \
		  LT_PressButton.oo LT_Rebuild.oo LT_Refresh.oo \
		  LT_SetAttributes.oo LT_ShowWindow.oo LT_UpdateStrings.oo

gtlayout_endtag.lib:	gtlayout_endtag.o
			oml $@ r gtlayout_endtag.o

gtlayout.library:	$(OBJS)
			slink with t:gtlayout.with <<!(t:gtlayout.with)
				from $(OBJS)
				to $@.debug
				lib $(LIBS)
				$(LFLAGS)
			<
			slink from $@.debug to $@ nd noicons
			protect $@ -e
			copy $@ Libs:
			-remlib $@
			@type tagfiles/\#?.c >t:tags
			@copy t:tags tags
			@delete quiet t:tags

gtlayout_romtag.oo:	gtlayout_romtag.asm gtlayout.library_rev.i

gtlayout.gst:		gtlayout_preinclude.c gtlayout_includes.h gtlayout_global.h \
			gtlayout_defines.h gtlayout_data.h gtlayout_libprotos.h
			gst $@ unload
			sc params=r noobjname makegst=$@ gtlayout_preinclude.c
			gst $@

bumprev:
			bumprev 24 gtlayout.library

clean:
			-delete gtlayout.gst gtlayout_endtag.lib \#?.o\#o

mkid:
			mkid -v \#?.(c|h|asm)

update:
			mkid -u -v
