#
#   Makefile.fpc for Free Pascal OS/2 RTL
#

[targets]
loaders=prt0 prt1 code2 code3
units=$(SYSTEMUNIT) objpas strings \
      ports os2def doscalls moncalls kbdcalls moucalls viocalls \
      pmbitmap pmwin pmgpi dive pmerr \
      dos crt objects printer \
      sysutils math typinfo \
      ucomplex cpu mmx getopts heaptrc lineinfo
rst=math

[require]
rtl=0

[defaults]
defaulttarget=os2
defaultcpu=i386

[install]
unitsubdir=rtl

[dirs]
fpcdir=.
incdir=$(INC) $(PROCINC)
targetdir=.


[presettings]
RTL=..
INC=$(RTL)/inc
PROCINC=$(RTL)/$(CPU_TARGET)

UNITPREFIX=rtl

# Paths
OBJPASDIR=$(RTL)/objpas
GRAPHDIR=$(INC)/graph

# Define Go32v2 Units
SYSTEMUNIT=sysos2


[postsettings]
SYSTEMPPU=$(addsuffix $(PPUEXT),$(SYSTEMUNIT))

# Get the system independent include file names.
# This will set the following variables :
# SYSINCNAMES
include $(INC)/makefile.inc
SYSINCDEPS=$(addprefix $(INC)/,$(SYSINCNAMES))

# Get the processor dependent include file names.
# This will set the following variables :
# CPUINCNAMES
include $(PROCINC)/makefile.cpu
SYSCPUDEPS=$(addprefix $(PROCINC)/,$(CPUINCNAMES))

# Put system unit dependencies together.
SYSDEPS=$(SYSINCDEPS) $(SYSCPUDEPS)


[rules]
vpath %.pas $(INC) $(PROCINC)
vpath %.pp $(INC) $(PROCINC)

#
# Loaders
#

%$(OEXT) : %.as
        $(AS) -o $*$(OEXT) $*.as


#
# Base Units (System, strings, os-dependent-base-unit)
#

$(SYSTEMPPU) : sysos2.pas $(SYSDEPS)
        $(COMPILER) -Us -Sg sysos2.pas $(REDIR)

objpas$(PPUEXT): $(OBJPASDIR)/objpas.pp $(INC)/except.inc $(SYSTEMPPU)
        $(COMPILER) -I$(OBJPASDIR) $(OBJPASDIR)/objpas.pp $(REDIR)

strings$(PPUEXT) : $(INC)/strings.pp $(INC)/stringsi.inc \
                   $(PROCINC)/strings.inc $(PROCINC)/stringss.inc \
                   $(SYSTEMPPU)

#
# System Dependent Units
#

ports$(PPUEXT) : ports.pas objpas$(PPUEXT) $(SYSTEMPPU)

doscalls$(PPUEXT) : doscalls.pas strings$(PPUEXT) objects$(PPUEXT) $(SYSTEMPPU)

kbdcalls$(PPUEXT) : kbdcalls.pas $(SYSTEMPPU)

moucalls$(PPUEXT) : moucalls.pas $(SYSTEMPPU)

moncalls$(PPUEXT) : moncalls.pas strings$(PPUEXT) $(SYSTEMPPU)

os2def$(PPUEXT) : os2def.pas $(SYSTEMPPU)

pmwin$(PPUEXT) : pmwin.pas os2def$(PPUEXT) $(SYSTEMPPU)

pmbitmap$(PPUEXT) : pmbitmap.pas $(SYSTEMPPU)

pmerr$(PPUEXT) : pmerr.pas $(SYSTEMPPU)

pmgpi$(PPUEXT) : pmgpi.pas pmbitmap$(PPUEXT) $(SYSTEMPPU)

dive$(PPUEXT) : dive.pas os2def$(PPUEXT) pmwin$(PPUEXT) $(SYSTEMPPU)

#
# TP7 Compatible RTL Units
#

dos$(PPUEXT) : dos.pas $(INC)/filerec.inc $(INC)/textrec.inc strings$(PPUEXT) \
               $(SYSTEMPPU)

crt$(PPUEXT) : crt.pas $(INC)/textrec.inc $(SYSTEMPPU)

objects$(PPUEXT) : $(INC)/objects.pp objinc.inc $(SYSTEMPPU)

printer$(PPUEXT) : printer.pas $(INC)/textrec.inc $(SYSTEMPPU)

#graph$(PPUEXT) : graph.pp

#
# Delphi Compatible Units
#

sysutils$(PPUEXT) : $(OBJPASDIR)/sysutils.pp $(wildcard $(OBJPASDIR)/*.inc) \
                    filutil.inc disk.inc objpas$(PPUEXT)
        $(COMPILER) -I$(OBJPASDIR) $(OBJPASDIR)/sysutils.pp $(REDIR)

typinfo$(PPUEXT): $(OBJPASDIR)/typinfo.pp objpas$(PPUEXT)
        $(COMPILER) -Sg $(OBJPASDIR)/typinfo.pp $(REDIR)

math$(PPUEXT): $(OBJPASDIR)/math.pp objpas$(PPUEXT) sysutils$(PPUEXT)
        $(COMPILER) $(OBJPASDIR)/math.pp $(REDIR)

#
# Other system-independent RTL Units
#

ucomplex$(PPUEXT): $(INC)/ucomplex.pp math$(PPUEXT) $(SYSTEMPPU)

cpu$(PPUEXT) : $(PROCINC)/cpu.pp $(SYSTEMPPU)

mmx$(PPUEXT) : $(PROCINC)/mmx.pp cpu$(PPUEXT) $(SYSTEMPPU)

getopts$(PPUEXT) : $(INC)/getopts.pp $(SYSTEMPPU)

heaptrc$(PPUEXT) : $(INC)/heaptrc.pp $(SYSTEMPPU)
        $(COMPILER) -Sg $(INC)/heaptrc.pp $(REDIR)

lineinfo$(PPUEXT) : $(INC)/lineinfo.pp $(SYSTEMPPU)

#
# Other system-dependent RTL Units
#
