diff --git a/rtl/macos/Makefile b/rtl/macos/Makefile index 49fb835462..4a5944ad59 100644 --- a/rtl/macos/Makefile +++ b/rtl/macos/Makefile @@ -1,8 +1,8 @@ # -# Don't edit, this file is generated by FPCMake Version 1.1 [2003/06/27] +# Don't edit, this file is generated by FPCMake Version 1.1 [2004/02/06] # default: all -MAKEFILETARGETS=win32 +MAKEFILETARGETS=macos override PATH:=$(subst \,/,$(PATH)) ifeq ($(findstring ;,$(PATH)),) inUnix=1 @@ -10,6 +10,7 @@ SEARCHPATH:=$(filter-out .,$(subst :, ,$(PATH))) else SEARCHPATH:=$(subst ;, ,$(PATH)) endif +SEARCHPATH+=$(patsubst %/,%,$(subst \,/,$(dir $(MAKE)))) PWD:=$(strip $(wildcard $(addsuffix /pwd.exe,$(SEARCHPATH)))) ifeq ($(PWD),) PWD:=$(strip $(wildcard $(addsuffix /pwd,$(SEARCHPATH)))) @@ -184,11 +185,14 @@ override FPCDIR:=$(FPCDIR)/.. ifeq ($(wildcard $(addprefix $(FPCDIR)/,rtl units)),) override FPCDIR:=$(FPCDIR)/.. ifeq ($(wildcard $(addprefix $(FPCDIR)/,rtl units)),) +override FPCDIR:=$(BASEDIR) +ifeq ($(wildcard $(addprefix $(FPCDIR)/,rtl units)),) override FPCDIR=c:/pp endif endif endif endif +endif ifndef CROSSDIR CROSSDIR:=$(FPCDIR)/cross/$(FULL_TARGET) endif @@ -307,9 +311,17 @@ endif endif ifndef INSTALL_BINDIR ifdef UNIXINSTALLDIR +ifdef CROSSCOMPILE +INSTALL_BINDIR:=$(INSTALL_BASEDIR)/cross/$(FULL_TARGET)/bin +else INSTALL_BINDIR:=$(INSTALL_PREFIX)/bin +endif +else +ifdef CROSSCOMPILE +INSTALL_BINDIR:=$(INSTALL_BASEDIR)/cross/$(FULL_TARGET)/bin else INSTALL_BINDIR:=$(INSTALL_BASEDIR)/bin +endif ifdef INSTALL_FPCPACKAGE INSTALL_BINDIR:=$(INSTALL_BINDIR)/$(OS_TARGET) endif @@ -441,6 +453,14 @@ STATICLIBPREFIX= FPCMADE=fpcmade.dos ZIPSUFFIX=go32 endif +ifeq ($(OS_TARGET),watcom) +STATICLIBPREFIX= +FPCMADE=fpcmade.wat +ZIPSUFFIX=watc +OEXT=.obj +ASMEXT=.asm +SHAREDLIBEXT=.dll +endif ifeq ($(OS_TARGET),linux) EXEEXT= HASSHAREDLIB=1 @@ -543,6 +563,11 @@ STATICLIBPREFIX= FPCMADE=fpcmade.dos ZIPSUFFIX=go32 endif +ifeq ($(OS_TARGET),watcom) +STATICLIBPREFIX= +FPCMADE=fpcmade.dos +ZIPSUFFIX=watcom +endif ifeq ($(OS_TARGET),linux) EXEEXT= HASSHAREDLIB=1 @@ -731,7 +756,11 @@ endif endif export MVPROG ifndef ECHOREDIR -ECHOREDIR:=$(subst /,$(PATHSEP),$(ECHO)) +ifndef inUnix +ECHOREDIR=echo +else +ECHOREDIR=$(ECHO) +endif endif ifndef COPY COPY:=$(CPPROG) -fp @@ -802,14 +831,16 @@ TARPROG:=$(firstword $(TARPROG)) endif endif export TARPROG +ASNAME=$(BINUTILSPREFIX)as +LDNAME=$(BINUTILSPREFIX)ld +ARNAME=$(BINUTILSPREFIX)ar +RCNAME=$(BINUTILSPREFIX)rc +ifneq ($(findstring 1.0.,$(FPC_VERSION)),) +ifeq ($(OS_TARGET),win32) ASNAME=as LDNAME=ld ARNAME=ar -RCNAME=rc -ifeq ($(OS_TARGET),win32) -ASNAME=asw -LDNAME=ldw -ARNAME=arw +endif endif ifndef ASPROG ifdef CROSSBINDIR @@ -891,6 +922,14 @@ endif ifeq ($(OS_SOURCE),openbsd) override FPCOPT+=-FD$(NEW_BINUTILS_PATH) endif +ifndef CROSSBOOTSTRAP +ifneq ($(BINUTILSPREFIX),) +override FPCOPT+=-XP$(BINUTILSPREFIX) -Xc +endif +ifneq ($(BINUTILSPREFIX),) +override FPCOPT+=-Xr$(RLINKPATH) +endif +endif ifdef UNITDIR override FPCOPT+=$(addprefix -Fu,$(UNITDIR)) endif @@ -1022,7 +1061,7 @@ fpc_debug: $(MAKE) all DEBUG=1 fpc_release: $(MAKE) all RELEASE=1 -.SUFFIXES: $(EXEEXT) $(PPUEXT) $(OEXT) .pas .pp .rc .res +.SUFFIXES: $(EXEEXT) $(PPUEXT) $(OEXT) .pas .dpr .pp .rc .res %$(PPUEXT): %.pp $(COMPILER) $< $(EXECPPAS) @@ -1035,10 +1074,14 @@ fpc_release: %$(EXEEXT): %.pas $(COMPILER) $< $(EXECPPAS) +%$(EXEEXT): %.dpr + $(COMPILER) $< + $(EXECPPAS) %.res: %.rc windres -i $< -o $@ vpath %.pp $(COMPILER_SOURCEDIR) $(COMPILER_INCLUDEDIR) vpath %.pas $(COMPILER_SOURCEDIR) $(COMPILER_INCLUDEDIR) +vpath %.dpr $(COMPILER_SOURCEDIR) $(COMPILER_INCLUDEDIR) vpath %$(PPUEXT) $(COMPILER_UNITTARGETDIR) .PHONY: fpc_install fpc_sourceinstall fpc_exampleinstall ifdef INSTALL_UNITS diff --git a/rtl/macos/README b/rtl/macos/README index 0938dfe239..310d13a7a9 100644 --- a/rtl/macos/README +++ b/rtl/macos/README @@ -1,53 +1,77 @@ -Wellcome to the MacOS port of FreePascal (FPC) +Welcome to the MacOS port of FreePascal (FPC) ============================================== It is considered under construction, at the moment. +Most of the programs in demo/text works. +Prerequisites: +-------------- Please note that compiling must be done on a platform -supported by FPC, e g a PC. Then the generated assemble files -is to be transfered to a Macintosh with MPW installed. +supported by FPC, either in Darwin (MacOS X) or e g on +Windows or Linux. +MPW must be installed on the target Macintosh. -For compiling with FPC, use it as for other operating systems -and add these options: +Compiling on host: +------------------ +When compiling for target MacOS, use FPC as for other +operating systems with these options: -Tmacos # target macos --dpowerpc --al # dont delete asm output --s # dont generate executable +-st # dont generate executable, link on target -Note that at the moment, FPC yells about not supporting -creating of executables at the platform, nevertheless -it creates all asm files to produce an application on the Mac. +If make is used, add OPT=-st OS_TARGET=macos (on foreign platforms +CPU_TARGET=powerpc must also be added) + +Note that one must build the RTL by issuing make in rtl/macos, with +the above options, to be able to buld other programs. (Currently only +system.pp is available) -Use MPW to assemble and link the output from FreePascal +Assembling and linking on target: +--------------------------------- +In case that host and target machine is different, transfer the produced +files, that is assembler files (*.s) and link script *_ppas, to the host. -For PPCAsm, use options: +On the target, use MPW to assemble and link the output from FreePascal by +executing the link script (which is an MPW script), with its directory +as current directory. Unfortunatelly the link script does not have the +proper file type, so this has to be fixed first e. g with +the MPW command SetFile. --case on +Example: To build Hello World, execute: -For PPCLink, use options +Directory HD:Projekt:FreePascal:fpc:rtl:macos +SetFile -c 'MPS ' -t 'TEXT' system_ppas +system_ppas #executes the script +Directory HD:Projekt:FreePascal:fpc:demo:text +SetFile -c 'MPS ' -t 'TEXT' hello_ppas +magic_hello #executes the script --dead on --tocdataref off --m program_init Note on the compiler implementation =================================== -Procedure pointers ------------------- -The entries in the transition vector is used as procedure pointers. -That is the symbol xxx[DS]. - Global variables ---------------- Currently all global variables are indirect, that is the entry in the TOC is always a pointer to data. (In the future small data items -may be stored directly in the TOC, but I have not found out how this -is supported by PPCLink.) +may be stored directly in the TOC) Thus all references to globals are via a construct like: -lwz rX, yyy[TC](r2) ;loads a pointer to a global into rX \ No newline at end of file +lwz rX, yyy[TC](r2) ;loads a pointer to a global into rX + +Debugging +---------- +-g is considered under construction. + +When -g is working, one should be able to see source code +in the Power Mac Debugger 2.1 (can be downloaded from Apple), +but it will not be possible to examine variables. +One can of course examine registers, especially +at entry and exit point where the parameter lists is stored +in registers, according to the calling conventions. + +A suggestion is to do the main debugging in the darwin version of the +program.