# ------------------------------------------------------------------
# (C) Copyright 2008 Bill Buckels 
# makefile by bill buckels 2007
#
# note: I am copying ovld.r and samain.r to the current directory
# otherwise linker commandline exceeds maximum length
# note: the libraries a listed twice on the linker line
#       this ensures that LN65 resolves routines in libraries 
#       that have depencies on other libraries
# big
# note: my utility MAKEPRO2 is required to strip the BLOADable header
#       from the linker output in the root module and to embed the
#       the raw bitmap splash screen and the cursor library 
#       (snail cursor and musical note) in the memory holes in the
#       root module. the xfer program provided by Aztec C strips 
#       off the BLOADable header when xfering to a ProDOS xfer slave
#       if a serial cable used to transfer this to a real Apple IIe
#       We use the same linker for programs that are created for
#       for Apple DOS 3.3 in which case the load address needs to
#       be left in place and in which case the xfer program does not
#       strip the load address. I never have built DOS 3.3 programs
#       and did not much care for the tedious task of using xfer
#       to transfer files one at a time from the IBM-PC to the Apple IIe
#       even when this was all current so wrote myself the MAKEPRO
#       and MAKEPRO2 utilitities to prepare the final output and then
#       used proper communications packages on the Apple and IBM to
#       transfer multiple files en-masse using YMODEM protocol.
#       Anyways, it is also notable that the MKBASIC utility provided
#       with the Aztec C cross-development environment for the 
#       Commodore 64 took almost the opposite approach as I did and 
#       appended some Commodore BASIC startup code to the beginning of 
#       programs linked with that linker. The other consideration that Manx's
#       developers made was to support whatever version of Pcode C
#       which ran in their shell. Since they insisted on using the
#       same linker for all their programs in any given environment
#       some little process needed to be run to produce a fit
#       executable for the real world, after they produced their
#       initial output for their lowest common denominator.
#       For your purposes since you are unlikely to produce programs
#       that run in their shell, and if you are like me you won't bother
#       with DOS 3.3 and you won't ever worry about using xfer, just use
#       my MAKEPRO and MAKEPRO2 utilities for all your own Apple IIe efforts.
#       Off topic, but if you do use my Aztec64 Commodore 64 
#       cross-development environment for Windows XP. the makefiles
#       in that particular environment use a separate utility that
#       I wrote for embedding Splash Screens, Fonts, and Cursor Libraries
#       into Commodore 64 executables after linking, and then Manx's
#       MKBASIC utility is always run afterwards to produce a fit 
#       executable for the C64. That's all I want to say on the subject.
#       Delve deepr if you wish.
#
#       Have Fun!
#       Bill Buckels 
#       bbuckels@mts.net
#
# ------------------------------------------------------------------

time.sys: time.r cinit.r plogo.r flogo.r mainmenu.r time0.r time0a.r time1.r time1a.r time2.r time2a.r
    copy $(CR65)ovld.r ovld.r
    copy $(CR65)samain.r samain.r
    LN65 -t -r +s +H 4000,6004 time.r +C 2800 +D 400 ovld.r samain.r -lSYSIO -lg2 -lc -ls -lm -lSYSIO -lg2 -lc -ls -lm
    del time.r
    MAKEPRO2 time RES\OLDIES.BIN
    del time
    @echo time.sys now created!
    LN65 -t cinit.r $(CR65)ovbgn.r time.rsm -lSYSIO -lg2 -lc -ls -lm -lSYSIO -lg2 -lc -ls -lm
    del cinit.r
    @echo cinit.ovr now created!
    LN65 -t plogo.r $(CR65)ovbgn.r time.rsm -lSYSIO -lg2 -lc -ls -lm -lSYSIO -lg2 -lc -ls -lm
    del plogo.r
    @echo plogo.ovr now created!
    LN65 -t flogo.r $(CR65)ovbgn.r time.rsm -lSYSIO -lg2 -lc -ls -lm -lSYSIO -lg2 -lc -ls -lm
    del flogo.r
    @echo flogo.ovr now created!
    LN65 -t mainmenu.r $(CR65)ovbgn.r time.rsm -lSYSIO -lg2 -lc -ls -lm -lSYSIO -lg2 -lc -ls -lm
    del mainmenu.r
    @echo mainmenu.ovr now created!
    LN65 -t time0.r $(CR65)ovbgn.r time.rsm -lSYSIO -lg2 -lc -ls -lm -lSYSIO -lg2 -lc -ls -lm
    del time0.r
    @echo time0.ovr now created!
    LN65 -t time0a.r $(CR65)ovbgn.r time.rsm -lSYSIO -lg2 -lc -ls -lm -lSYSIO -lg2 -lc -ls -lm
    del time0a.r
    @echo time0a.ovr now created!
    LN65 -t time1.r $(CR65)ovbgn.r time.rsm -lSYSIO -lg2 -lc -ls -lm -lSYSIO -lg2 -lc -ls -lm
    del time1.r
    @echo time1.ovr now created!
    LN65 -t time1a.r $(CR65)ovbgn.r time.rsm -lSYSIO -lg2 -lc -ls -lm -lSYSIO -lg2 -lc -ls -lm
    del time1a.r
    @echo time1a.ovr now created!
    LN65 -t time2.r $(CR65)ovbgn.r time.rsm -lSYSIO -lg2 -lc -ls -lm -lSYSIO -lg2 -lc -ls -lm
    del time2.r
    @echo time2.ovr now created!
    LN65 -t time2a.r $(CR65)ovbgn.r time.rsm -lSYSIO -lg2 -lc -ls -lm -lSYSIO -lg2 -lc -ls -lm
    del time2a.r
    @echo time2a.ovr now created!
    del time.rsm
    del time.sym
    del cinit.sym
    del plogo.sym
    del flogo.sym
    del mainmenu.sym
    del time0.sym
    del time0a.sym
    del time1.sym
    del time1a.sym
    del time2.sym
    del time2a.sym
    del ovld.r
    del samain.r
    copy *.ovr ENGLISH\*.*
    copy *.ovr FRENCH\*.*
    copy flogo.ovr FRENCH\plogo.ovr
    del ENGLISH\flogo.ovr
    del FRENCH\flogo.ovr
    copy time.sys ENGLISH\TIME.SYSTEM
    copy time.sys FRENCH\TIME.SYSTEM
    del time.sys
    del *.ovr
    copy RES\*.FNT ENGLISH\*.*
    copy RES\*.FNT FRENCH\*.*
    copy RES\SNAIL.RIB ENGLISH\*.*
    copy RES\SNAIL.RIB FRENCH\*.*   
    copy RES\PLOGO.RAG ENGLISH\PLOGO.RAG
    copy RES\FLOGO.RAG FRENCH\PLOGO.RAG
    copy RES\TIME.RIB ENGLISH\TIME.RIB
    copy RES\FTIME.RIB FRENCH\TIME.RIB
    cls
    @echo Done!
    
      
time.r: time.c
        c65 time.c

cinit.r: cinit.c
        c65 cinit.c

plogo.r: plogo.c
        c65 plogo.c
        
flogo.r: flogo.c
        c65 flogo.c        

mainmenu.r: mainmenu.c        
           c65 mainmenu.c
 
time0.r: time0.c
        c65 time0.c
 
time0a.r: time0a.c
        c65 time0a.c
        
time1.r: time1.c
        c65 time1.c
        
time1a.r: time1a.c
        c65 time1a.c
        
time2.r: time2.c
        c65 time2.c
        
time2a.r: time2a.c
        c65 time2a.c
        
