##############################################################################
#
# reqtoolsppc makefile
#

ROOTPATH=../../../
include $(ROOTPATH)Makefile.global

RM      := rm
CFLAGS  := -noixemul -O2 -mcpu=604e -Wall -D__MORPHOS__ -DPUBLIC_ONLY -D_AROS -U__varargs68k__ -DUSE_INLINE_STDARG -I./
LDFLAGS := -nostartfiles -noixemul
LIBFILE := reqtools.library
CFILES := reqtoolsami_init \
	reqtools_init \
	filereqalloc \
	mem \
	filereqextra \
	req \
	misc \
	rtlocale \
	general \
	filereq \
	boopsigads \
	filereqsetup \
	filereqmain \
	boopsi \
	palettereq \
	rtfuncs \
	rtallocrequesta \
	rtchangereqattra \
	rtclosewindowsafely \
	rtezrequesta \
	rtfilerequesta \
	rtfontrequesta \
	rtfreefilelist \
	rtfreereqbuffer \
	rtfreerequest \
	rtfuncs \
	rtgetlonga \
	rtgetstringa \
	rtgetvscreensize \
	rtinternalenterpassword \
	rtinternalgetpassword \
	rtlocale \
	rtlockprefs \
	rtlockwindow \
	rtpaletterequesta \
	rtreqhandlera \
	rtscreenmoderequesta \
	rtscreentofrontsafely \
	rtsetreqposition \
	rtsetwaitpointer \
	rtspread \
	rtunlockprefs \
	rtunlockwindow \
	mempool \
	mos_wrappers

COBJS   := $(foreach f, $(CFILES), $(f).o)
LIBDIR  := /gg/ppc-morphos/lib/

##############################################################################
#
# target rules
#
.PHONY: all clean install

all: $(LIBFILE)

clean:
	rm -f *.o $(LIBFILE)

install: $(LIBFILE)
	mkdir -p /SYS/MorphOS/Libs/
	cp $(LIBFILE) /SYS/MorphOS/Libs/reqtools.library
	-flushlib reqtools.library

install-iso: $(LIBFILE)
	mkdir -p $(ISOPATH)MorphOS/Libs
	cp $(LIBFILE) $(ISOPATH)MorphOS/Libs/reqtools.library

source:
	(cd .. && tar --exclude "morphos" --transform "s,^reqtools,&.library," -cf $(SOURCEPATH)reqtools.library.tar reqtools)

$(LIBFILE): $(COBJS)
	$(LINKECHO)
	$(LINKPREFIX)$(LD) $(LDFLAGS) $^ -L$(LIBDIR) -fl libnix -lmath -lstring -lmemblock -labox -ldebug -o $@.db
	$(LINKPREFIX)$(STRIP) $(STRIPFLAGS) $@.db -o $@

##############################################################################
#
# dependicies
#

backfillhook.h:
boopsi.h:		
boopsigads.h:		
catalog.h:		
compilerspecific.h:	
filereq.h:		reqtools_intern.h general.h gadstub.h boopsigads.h mem.h rtlocale.h globalvars.h backfillhook.h
gadstub.h:		general.h
general.h:		compilerspecific.h
globalvars.h:		reqtools_intern.h
libdefs.h:		
mem.h:			
reqtools_intern.h:	general.h mempool.h
reqtools_rev.h:		
rtfuncs.h:		reqtools_intern.h
rtlocale.h:		general.h catalog.h globalvars.h


boopsi.o:			filereq.h globalvars.h
boopsigads.o:		filereq.h globalvars.h
filereq.o:			filereq.h
filereqalloc.o:		filereq.h
filereqextra.o:		filereq.h
filereqmain.o:		filereq.h
filereqsetup.o:		filereq.h
general.o:			filereq.h globalvars.h
mem.o:			filereq.h
misc.o:			filereq.h
palettereq.o:		reqtools_intern.h general.h gadstub.h boopsigads.h rtlocale.h backfillhook.h
req.o:			reqtools_intern.h filereq.h rtlocale.h backfillhook.h globalvars.h
reqtoolsami_init.o:		reqtools_intern.h general.h rtfuncs.h globalvars.h
reqtools_init.o:		reqtools_intern.h libdefs.h general.h boopsigads.h rtfuncs.h globalvars.h
rtallocrequesta.o:		reqtools_intern.h
rtchangereqattra.o:		reqtools_intern.h
rtclosewindowsafely.o:	reqtools_intern.h general.h rtfuncs.h
rtezrequesta.o:		reqtools_intern.h general.h
rtfilerequesta.o:		reqtools_intern.h
rtfontrequesta.o:		reqtools_intern.h
rtfreefilelist.o:		reqtools_intern.h
rtfreereqbuffer.o:		reqtools_intern.h
rtfreerequest.o:		reqtools_intern.h
rtfuncs.o:			filereq.h boopsi.h rtfuncs.h globalvars.h
rtgetlonga.o:		reqtools_intern.h general.h
rtgetstringa.o:		reqtools_intern.h general.h
rtgetvscreensize.o:		reqtools_intern.h
rtinternalenterpassword.o:	reqtools_intern.h general.h
rtinternalgetpassword.o:	reqtools_intern.h general.h
rtlocale.o:			filereq.h
rtlockprefs.o:		reqtools_intern.h general.h rtfuncs.h
rtlockwindow.o:		reqtools_intern.h general.h rtfuncs.h
rtpaletterequesta.o:		reqtools_intern.h
rtreqhandlera.o:		reqtools_intern.h general.h rtfuncs.h
rtscreenmoderequesta.o:	reqtools_intern.h
rtscreentofrontsafely.o:	reqtools_intern.h general.h rtfuncs.h
rtsetreqposition.o:		reqtools_intern.h general.h rtfuncs.h
rtsetwaitpointer.o:		reqtools_intern.h general.h rtfuncs.h
rtspread.o:			reqtools_intern.h general.h rtfuncs.h
rtunlockprefs.o:		reqtools_intern.h general.h rtfuncs.h
rtunlockwindow.o:		reqtools_intern.h general.h rtfuncs.h
mempool.o:			mempool.h
mos_wrappers.o:		reqtools_intern.h general.h rtfuncs.h mos_wrappers.h

