summaryrefslogtreecommitdiff
path: root/compiler/MPWMake
blob: 90ce41fe10f5808406f663928c0d2d6cb15dac3b (plain)
1
# Make file for MPW make.
# To run it, use:
#   Make <target> -f MPWMake > Makeout ; Makeout
# where <target> should be replaced with actual make target.

#############################################
# TIPS (TODO move to Wiki or something
#
# Defined variables: No quoting
# Command lines: quote paths, dont quote option strings, since 
#   they might contain several options, which must be separated.
# Recursive call to Make: 
#   - give options as -d XXX="{XXX}"
#   - in same dir, remember to ensure to have different Makeout files,
#     e g Makeout2.
# 

# NOTE Currently cycle is stopped after three rounds, no diff is checked.

FPC = {FPCDIR}bin:ppcppc

# Default language for the compiler (english):
FPCLANG = e

MSGFILE = :msg:error{FPCLANG}.msg

msg2inc Ä :utils:msg2inc.pp
	{FPC} -FE: -WT :utils:msg2inc.pp

# The msgtxt.inc only depends on the error?.msg file, not on msg2inc,
# because that one will be new almost everytime
msgtxt.inc Ä {MSGFILE}
	Make msg2inc -f MPWMake > Makeout3 ; Makeout3
	msg2inc {MSGFILE} msg msg

msg Ä msgtxt.inc

compiler Ä msg
	Set Exit 0
  NewFolder :powerpc:units: ³ Dev:Null
  NewFolder :powerpc:units:powerpc-macos: ³ Dev:Null
  Set Exit 1
	"{FPC}" {OPT} "-Fu{RTLDIR}" -Fu:systems: -Fu:powerpc: -Fu:ppcgen -dGDB -dNOOPT ¶
   -dpowerpc -WT -FE: -FU:powerpc:units:powerpc-macos: pp.pas
	Rename -y pp ppcppc

clean Ä utils_clean
	Set Exit 0
	Delete -y :powerpc:units:powerpc-macos
	Delete -y ppcppc oldfpc msg2inc
	Delete -y Å.xcoff
	Set Exit 1

cycleclean Ä
	Set Exit 0
	Delete -y :powerpc:units:powerpc-macos
	Set Exit 1

install Ä
  If {FPCDIR} == ''
    Set -e FPCDIR `GetFileName -wd -m 'Select where to install the FreePascal folder'`FreePascal:
    Set -e Commands "{Commands},{FPCDIR}bin:"
    Echo "Set -e FPCDIR ¶'{FPCDIR}¶'" > "{MPW}Startup Items:FPC Startup"
    Echo 'Set -e Commands "{Commands},{FPCDIR}bin:"' >> "{MPW}Startup Items:FPC Startup"
  End
  Set Exit 0
  NewFolder "{FPCDIR}" ³ Dev:Null
  NewFolder "{FPCDIR}bin:" ³ Dev:Null
  Set Exit 1
  Duplicate -y :ppcppc :utils:ppudump :utils:ppufiles :utils:ppumove ¶
               :utils:fpc "{FPCDIR}bin:"
  Echo "# Configuration file for Free Pascal for MPW" > "{FPCDIR}bin:fpc.cfg"
  Echo "-Fu¶'{FPCDIR}units:rtl:¶'" >> "{FPCDIR}bin:fpc.cfg"
  Echo "-l" >> "{FPCDIR}bin:fpc.cfg"
  Echo "-vi" >> "{FPCDIR}bin:fpc.cfg"

cycle Ä
	Directory ::rtl:macos
	Make clean -f MPWMake > Makeout ; Makeout
	Make all -d FPC="{FPC}" -d OPT="{OPT}" -f MPWMake > Makeout ; Makeout
	Directory :::compiler
	Make clean -f MPWMake > Makeout2 ; Makeout2
	Make compiler -d FPC="{FPC}" -d OPT="{OPT}" -d RTLDIR=::rtl:units:powerpc-macos -f MPWMake > Makeout2 ; Makeout2
	#
  Echo '******************** SECOND ROUND *********************'
	Rename -y ppcppc oldfpc
	Directory ::rtl:macos
	Make clean -f MPWMake > Makeout ; Makeout
	Make all -d FPC=:::compiler:oldfpc -d OPT="{OPT}" -f MPWMake > Makeout ; Makeout
	Directory :::compiler
	Make cycleclean -f MPWMake > Makeout2 ; Makeout2
	Make compiler -d FPC=oldfpc -d OPT="{OPT}" -d RTLDIR=::rtl:units:powerpc-macos -f MPWMake > Makeout2 ; Makeout2
  #
  Echo '********************* THIRD ROUND *********************'
	Rename -y ppcppc oldfpc
	Directory ::rtl:macos
	Make clean -f MPWMake > Makeout ; Makeout
	Make all -d FPC=:::compiler:oldfpc -d OPT="{OPT}" -f MPWMake > Makeout ; Makeout
	Directory :::compiler
	Make cycleclean -f MPWMake > Makeout2 ; Makeout2
	Make compiler -d FPC=oldfpc -d OPT="{OPT}" -d RTLDIR=::rtl:units:powerpc-macos -f MPWMake > Makeout2 ; Makeout2
  #
	Make utils_clean -f MPWMake > Makeout2 ; Makeout2
	Make utils_all -d FPC=::oldfpc -d OPT="{OPT}" -d RTLDIR=:::rtl:units:powerpc-macos -f MPWMake > Makeout2 ; Makeout2

utils_all Ä
	Directory :utils
	Set Exit 0
  NewFolder :units: ³ Dev:Null
  NewFolder :units:powerpc-macos: ³ Dev:Null
  Set Exit 1
	"{FPC}" {OPT} "-Fu{RTLDIR}" -FE: -FU:units:powerpc-macos -Fu:: -WT ppudump.pp
	"{FPC}" {OPT} "-Fu{RTLDIR}" -FE: -FU:units:powerpc-macos -Fu:: -WT ppufiles.pp
	"{FPC}" {OPT} "-Fu{RTLDIR}" -FE: -FU:units:powerpc-macos -Fu:: -WT ppumove.pp
  Duplicate -y fpc.mpw fpc
	Directory ::

utils_clean Ä
	Directory :utils
	Set Exit 0
	Delete -y :units:powerpc-macos
	Delete -y fpc ppudump ppufiles ppumove msg2inc
	Delete -y Å.xcoff
	Set Exit 1
	Directory ::