Browse Source

* fpcmake support

peter 26 years ago
parent
commit
79d331a978

File diff suppressed because it is too large
+ 912 - 72
compiler/Makefile


+ 323 - 0
compiler/Makefile.fpc

@@ -0,0 +1,323 @@
+#
+#   Makefile.fpc for shedit
+#
+
+[dirs]
+fpcdir=..
+unitdir=
+targetdir=.
+
+[defaults]
+defaultoptions=-Sg
+
+[tools]
+tooldiff=1
+toolcmp=1
+
+
+[presettings]
+# RTL
+RTL=../rtl
+UTILS=../utils
+
+# Utils used by compiler development/installation
+COMPILERUTILS=utils
+
+# Default language for the compiler
+ifndef FPCLANG
+FPCLANG=e
+endif
+
+# Local defines for the compiler only
+ifndef LOCALDEF
+LOCALDEF=
+endif
+
+# Local options for the compiler only
+ifndef LOCALOPT
+LOCALOPT=
+endif
+
+# Options for the RTL only when cycling
+ifndef RTLOPTS
+RTLOPTS=
+endif
+
+# Message files
+MSGFILES=$(wildcard error*.msg)
+
+
+[postsettings]
+# Default message file
+MSGFILE=error$(FPCLANG).msg
+
+# set correct defines (-d$(CPU_TARGET) is automaticly added in makefile.fpc)
+override LOCALDEF+=-dGDB -dBROWSERLOG
+
+# for i386 also insert MMX support
+ifeq ($(CPU_TARGET),i386)
+override LOCALDEF+=-dSUPPORT_MMX
+endif
+
+# We don't need the intel and binary writer on linux...
+ifdef inlinux
+override LOCALDEF+=-dNOAG386INT -dNOAG386BIN
+endif
+
+override LOCALOPT+=$(LOCALDEF)
+
+override FPCOPT+=$(LOCALOPT)
+
+
+[rules]
+#####################################################################
+# Setup Targets
+#####################################################################
+
+ifeq ($(OS_TARGET),win32)
+ifdef CMP
+override DIFF:=$(CMP) -i138
+endif
+endif
+
+# Used to avoid unnecessary steps in remake3
+ifdef DIFF
+ifdef OLDFPC
+DIFFRESULT:=$(shell $(DIFF) $(OLDFPC) $(FPC))
+else
+DIFFRESULT=Not equal
+endif
+else
+DIFFRESULT=No diff program
+endif
+
+
+#####################################################################
+# Setup os-independent filenames
+#####################################################################
+
+FPCEXENAME=pp$(EXEEXT)
+EXENAME=ppc386$(EXEEXT)
+M68KEXENAME=ppc68k$(EXEEXT)
+TEMPNAME=ppc$(EXEEXT)
+TEMPNAME1=ppc1$(EXEEXT)
+TEMPNAME2=ppc2$(EXEEXT)
+TEMPNAME3=ppc3$(EXEEXT)
+MAKEDEP=ppdep$(EXEEXT)
+MSG2INC=msg2inc$(EXEEXT)
+
+
+#####################################################################
+# Default makefile
+#####################################################################
+
+all: $(EXENAME)
+        $(MAKE) echotime
+
+ifeq ($(MAKELEVEL),0)
+ifndef STARTTIME
+ifdef DATE
+STARTTIME:=$(shell $(DATE) +%T)
+else
+STARTTIME:=unknown
+endif
+endif
+endif
+
+export STARTTIME
+
+ifdef DATE
+ENDTIME=$(shell $(DATE) +%T)
+else
+ENDTIME:=unknown
+endif
+
+echotime:
+        @echo Start $(STARTTIME) now $(ENDTIME)
+
+ifndef DIFFRESULT
+next :
+        @echo $(OLDFPC) and $(FPC) are equal
+        $(COPY) $(FPC) $(EXENAME)
+else
+next :
+        $(MAKE) execlean
+        $(MAKE) -C $(RTLDIR) clean
+        $(MAKE) -C $(RTLDIR) 'FPC=$(FPC)' 'OPT=$(RTLOPTS)' all
+        $(MAKE) clean
+        $(MAKE) all
+endif
+
+clean : execlean fpc_cleanall
+
+execlean :
+        -$(DEL) $(EXENAME)
+
+distclean: clean
+        -$(DEL) $(TEMPNAME) $(TEMPNAME1) $(TEMPNAME2) $(TEMPNAME3) $(MSG2INC)
+
+
+#####################################################################
+# Include depencies
+#####################################################################
+
+$(MAKEDEP): $(UTILS)/ppdep.pp
+        $(COMPILER) $(UTILS)/ppdep.pp
+        $(COPY) $(UTILS)/$(MAKEDEP) $(MAKEDEP)
+
+dependencies : $(MAKEDEP)
+        $(MAKEDEP) pp.pas $(FPCOPTDEF) $(LOCALDEF) '-F$$(COMPILER) $$(LOCALOPT)' > depend
+
+ifdef USEDEPEND
+
+include depend
+
+endif
+
+
+#####################################################################
+# Make targets
+#####################################################################
+
+$(MSG2INC): $(COMPILERUTILS)/msg2inc.pp
+        $(COMPILER) -FE. $(COMPILERUTILS)/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)
+        $(MSG2INC) $(MSGFILE) msg msg
+
+msg: msgtxt.inc
+
+# Make only the compiler
+ifndef COMPLETE
+$(EXENAME) : $(wildcard *.pas) $(wildcard *.inc) msg
+        $(COMPILER) pp.pas
+        $(EXECPPAS)
+        $(MOVE) $(FPCEXENAME) $(EXENAME)
+else
+$(EXENAME) : $(wildcard *.pas) $(wildcard *.inc) msg
+        $(COMPILER) pp.pas
+        $(EXECPPAS)
+        $(COMPILER) pp.pas
+        $(EXECPPAS)
+        $(COMPILER) pp.pas
+        $(EXECPPAS)
+        $(MOVE) $(FPCEXENAME) $(EXENAME)
+endif
+
+tokens.dat : $(wildcard *.pas) $(wildcard *.inc)
+        $(COMPILER) tokendat.pas
+        ./tokendat
+
+# This target remakes the units with the currently made version
+remake: $(EXENAME)
+        $(MOVE) $(EXENAME) $(TEMPNAME)
+        $(MAKE) execlean
+        $(MAKE) -C $(RTLDIR) clean
+        $(MAKE) clean
+        $(MAKE) 'FPC=$(BASEDIR)/$(TEMPNAME)' all
+
+remake3: $(TEMPNAME3)
+        $(MAKE) 'FPC=$(BASEDIR)/$(TEMPNAME3)' 'OLDFPC=$(BASEDIR)/$(TEMPNAME2)' next
+        $(DIFF) $(TEMPNAME3) $(EXENAME)
+
+$(TEMPNAME1) : $(EXENAME)
+        -$(DEL) $(TEMPNAME1)
+        $(MOVE) $(EXENAME) $(TEMPNAME1)
+
+$(TEMPNAME2) : $(TEMPNAME1)
+        $(MAKE) 'FPC=$(BASEDIR)/$(TEMPNAME1)' 'OLDFPC=' next
+        -$(DEL) $(TEMPNAME2)
+        $(MOVE) $(EXENAME) $(TEMPNAME2)
+
+$(TEMPNAME3) : $(TEMPNAME2)
+        $(MAKE) 'FPC=$(BASEDIR)/$(TEMPNAME2)' 'OLDFPC=$(BASEDIR)/$(TEMPNAME1)' next
+        -$(DEL) $(TEMPNAME3)
+        $(MOVE) $(EXENAME) $(TEMPNAME3)
+
+cycle:
+        $(MAKE) clean
+        $(MAKE) -C $(RTLDIR) clean
+        $(MAKE) -C $(RTLDIR) 'OPT=$(RTLOPTS)' all
+        $(MAKE) remake3
+        $(MAKE) echotime
+
+cycledep:
+        $(MAKE) cycle USEDEPEND=1
+
+cvstest:
+        $(MAKE) cycle 'LOCALOPT=-n -Se' 'RTLOPTS=-n -Se'
+
+
+#####################################################################
+# Installation
+#####################################################################
+
+# This will only install the ppc386.exe, not the message files etc.
+quickinstall:
+ifdef inlinux
+        $(MKDIR) $(LIBINSTALLDIR)
+        $(INSTALLEXE) $(EXENAME) $(LIBINSTALLDIR)
+else
+        $(MKDIR) $(BININSTALLDIR)
+ifdef UPX
+        -$(UPX) $(EXENAME)
+endif
+        $(INSTALLEXE) $(EXENAME) $(BININSTALLDIR)
+endif
+
+installlib: quickinstall
+ifdef inlinux
+        $(INSTALLEXE) $(COMPILERUTILS)/samplecfg $(LIBINSTALLDIR)/samplecfg
+endif
+        $(MKDIR) $(MSGINSTALLDIR)
+        $(INSTALL) $(MSGFILES) $(MSGINSTALLDIR)
+
+# this also installs the link /usr/bin/ppc386. The .deb does that later
+install: installlib
+ifdef inlinux
+        $(MKDIR) $(BININSTALLDIR)
+        ln -sf $(LIBINSTALLDIR)/ppc386 $(BININSTALLDIR)/ppc386
+endif
+
+
+#####################################################################
+# Misc
+#####################################################################
+
+rtl :
+        $(MAKE) -C $(RTLDIR) all
+
+rtlclean :
+        $(MAKE) -C $(RTLDIR) clean
+
+rtlinstall:
+        $(MAKE) -C $(RTLDIR) install
+
+#####################################################################
+# local user configurable file
+# in makefile.loc you can add any desired target
+#####################################################################
+
+localmake:=$(strip $(wildcard makefile.loc))
+
+ifdef localmake
+include ./$(localmake)
+endif
+
+
+#####################################################################
+# M68k test targets
+#####################################################################
+
+# just a quick way to get ppc68k
+# needs to be after makefile.def for PASFILES INCFILES
+
+$(M68KEXENAME): $(PASFILES) $(INCFILES)
+        $(MAKE) clean
+        $(FPC) -uI386 -uSUPPORT_MMX -dm68k -o$(M68KEXENAME) pp
+        $(MAKE) clean
+
+

+ 19 - 5
fcl/inc/inifiles.pp

@@ -233,10 +233,21 @@ begin
          begin
             if GetName(FFileBuffer[index]) = ident then
             begin
-               value := GetValue(FFileBuffer[index], ident);
-               if value <> '' then
-                  result := value;
-               break;
+              value := GetValue(FFileBuffer[index], ident);
+              if value <> '' then
+               begin
+                 result := value;
+                 if (result[length(result)]='\') then
+                  begin
+                    inc(index);
+                    while (index < FFileBuffer.Count) and (result[length(result)]='\') do
+                     begin
+                       result:=Copy(result,1,length(result)-1)+Trim(FFileBuffer[index]);
+                       inc(index);
+                     end;
+                  end;
+               end;
+              break;
             end;
             Inc(index);
          end;
@@ -428,7 +439,10 @@ end.
 
 {
   $Log$
-  Revision 1.3  1999-11-02 23:58:37  peter
+  Revision 1.4  1999-11-08 15:01:38  peter
+    * fpcmake support
+
+  Revision 1.3  1999/11/02 23:58:37  peter
     * comment support
     * readsectionraw method
 

File diff suppressed because it is too large
+ 905 - 91
rtl/go32v2/Makefile


+ 159 - 0
rtl/go32v2/Makefile.fpc

@@ -0,0 +1,159 @@
+#
+#   Makefile.fpc for Go32v2 RTL
+#
+
+[targets]
+loaders=prt0 exceptn fpu
+units=$(SYSTEMUNIT) objpas strings \
+      go32 initc dpmiexcp profile dxeload emu387 \
+      dos crt objects printer graph \
+      sysutils math typinfo \
+      cpu mmx getopts heaptrc \
+      msmouse ports
+
+programs=
+
+
+[defaults]
+defaultunits=1
+defaulttarget=go32v2
+defaultcpu=i386
+
+
+[dirs]
+fpcdir=.
+incdir=$(INC) $(PROCINC)
+targetdir=.
+
+
+[presettings]
+RTL=..
+INC=../inc
+PROCINC=../$(CPU_TARGET)
+
+UNITPREFIX=rtl
+
+# Paths
+OBJPASDIR=$(RTL)/objpas
+GRAPHDIR=$(INC)/graph
+
+# Define Go32v2 Units
+SYSTEMUNIT=system
+
+
+[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 %$(PASEXT) $(INC) $(PROCINC)
+
+#
+# Loaders
+#
+
+prt0$(OEXT) : v2prt0.as
+        $(AS) -o prt0$(OEXT) v2prt0.as
+
+#
+# System Units (System, Objpas, Strings)
+#
+
+$(SYSTEMPPU) : system.pp $(SYSDEPS)
+        $(COMPILER) -Us -Sg system.pp $(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
+#
+
+go32$(PPUEXT) : go32.pp $(SYSTEMPPU)
+
+dpmiexcp$(PPUEXT) : dpmiexcp.pp exceptn$(OEXT) $(SYSTEMPPU)
+        $(COMPILER) -Sg dpmiexcp.pp $(REDIR)
+
+initc$(PPUEXT) : initc.pp $(SYSTEMPPU)
+
+profile$(PPUEXT) : profile.pp dpmiexcp$(PPUEXT) go32$(PPUEXT)
+
+dxeload$(PPUEXT) : dxeload.pp $(SYSTEMPPU)
+
+emu387$(PPUEXT) : emu387.pp fpu$(OEXT) strings$(PPUEXT) dxeload$(PPUEXT) \
+                  dpmiexcp$(PPUEXT)
+
+#
+# TP7 Compatible RTL Units
+#
+
+dos$(PPUEXT) : dos.pp $(INC)/filerec.inc $(INC)/textrec.inc \
+               go32$(PPUEXT) strings$(PPUEXT) $(SYSTEMPPU)
+
+crt$(PPUEXT) : crt.pp $(INC)/textrec.inc go32$(PPUEXT) $(SYSTEMPPU)
+
+objects$(PPUEXT) : $(INC)/objects.pp objinc.inc $(SYSTEMPPU)
+
+printer$(PPUEXT) : printer.pp $(SYSTEMPPU)
+
+#
+# Graph
+#
+
+include $(GRAPHDIR)/makefile.inc
+GRAPHINCDEPS=$(addprefix $(GRAPHDIR)/,$(GRAPHINCNAMES))
+
+graph$(PPUEXT) : $(GRAPHDIR)/graph.pp go32$(PPUEXT) ports$(PPUEXT) $(SYSTEMPPU) \
+                 $(GRAPHINCDEPS) graph.inc graphh.inc vesa.inc vesah.inc dpmi.inc
+        $(COMPILER) -I$(GRAPHDIR) $(GRAPHDIR)/graph.pp $(REDIR)
+
+#
+# Delphi Compatible Units
+#
+
+sysutils$(PPUEXT) : $(OBJPASDIR)/sysutils.pp $(wildcard $(OBJPASDIR)/*.inc) \
+                    filutil.inc disk.inc objpas$(PPUEXT) dos$(PPUEXT) go32$(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
+#
+
+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)
+
+msmouse$(PPUEXT) : msmouse.pp $(SYSTEMPPU)
+
+ports$(PPUEXT) : ports.pp $(SYSTEMPPU)
+

+ 0 - 0
rtl/inc/graph/graphmod.inc → rtl/go32v2/graphh.inc


+ 7 - 4
rtl/inc/graph/graph.pp

@@ -346,9 +346,6 @@ Interface
        { Hercules mono card }
        HercMonoHi = 0;
 
-
-       {$i graphmod.inc}
-
        MaxColors   = 255;   { Maximum possible colors using a palette }
                             { otherwise, direct color encoding        }
 
@@ -682,6 +679,9 @@ Function GetDriverName: string;
  procedure OutTextXY(x,y : integer;const TextString : string);
  procedure OutText(const TextString : string);
 
+{ Load extra graph additions per system like mode constants }
+{$i graphh.inc}
+
 
 Implementation
 
@@ -2961,7 +2961,10 @@ SetGraphBufSize
 
 {
   $Log$
-  Revision 1.35  1999-11-08 11:15:22  peter
+  Revision 1.36  1999-11-08 15:01:38  peter
+    * fpcmake support
+
+  Revision 1.35  1999/11/08 11:15:22  peter
     * move graph.inc to the target dir
 
   Revision 1.34  1999/11/03 20:23:01  florian

+ 1 - 5
rtl/inc/graph/makefile.inc

@@ -1,5 +1 @@
-GRAPHINCNAMES=graph.inc fontdata.inc clip.inc fills.inc gtext.inc palette.inc modes.inc
-
-ifeq ($(OS_TARGET),go32v2)
-GRAPHINCNAMES+=vesa.inc vesah.inc dpmi.inc
-endif
+GRAPHINCNAMES=fontdata.inc clip.inc fills.inc gtext.inc palette.inc modes.inc

File diff suppressed because it is too large
+ 908 - 98
rtl/win32/Makefile


+ 167 - 0
rtl/win32/Makefile.fpc

@@ -0,0 +1,167 @@
+#
+#   Makefile.fpc for Free Pascal Win32 RTL
+#
+
+[targets]
+loaders=wprt0 wdllprt0
+units=$(SYSTEMUNIT) objpas strings \
+      windows ole2 opengl32 winsock \
+      sockets initc \
+      dos crt objects graph \
+      sysutils typinfo math \
+      cpu mmx getopts heaptrc
+programs=
+
+
+[defaults]
+defaultunits=1
+defaulttarget=win32
+defaultcpu=i386
+
+
+[dirs]
+fpcdir=.
+incdir=$(INC) $(PROCINC)
+targetdir=.
+
+
+[presettings]
+RTL=..
+INC=$(RTL)/inc
+PROCINC=$(RTL)/$(CPU_TARGET)
+WININC=wininc
+
+UNITPREFIX=rtl
+
+# Paths
+OBJPASDIR=$(RTL)/objpas
+GRAPHDIR=$(INC)/graph
+
+SYSTEMUNIT=syswin32
+
+# Files used by windows.pp
+include $(WININC)/makefile.inc
+
+WINDOWS_SOURCE_FILES=$(addprefix $(WININC)/,$(addsuffix .inc,$(WINDOWS_FILES)))
+
+
+[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 %$(PASEXT) $(INC) $(PROCINC)
+
+#
+# Loaders
+#
+
+override AS=asw
+
+wprt0$(OEXT) : wprt0.as
+        $(AS) -o wprt0$(OEXT) wprt0.as
+
+wdllprt0$(OEXT) : wdllprt0.as
+        $(AS) -o wdllprt0$(OEXT) wdllprt0.as
+
+
+#
+# System Units (System, Objpas, Strings)
+#
+
+$(SYSTEMPPU) : syswin32.pp win32.inc $(SYSDEPS)
+        $(COMPILER) -Us -Sg syswin32.pp $(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
+#
+
+windows$(PPUEXT) : windows.pp $(WINDOWS_SOURCE_FILES) $(SYSTEMPPU)
+        $(COMPILER) -I$(WININC) windows.pp $(REDIR)
+
+ole2$(PPUEXT) : ole2.pp windows$(PPUEXT) $(SYSTEMPPU)
+
+opengl32$(PPUEXT) : opengl32.pp windows$(PPUEXT) $(SYSTEMPPU)
+
+winsock$(PPUEXT) : winsock.pp windows$(PPUEXT) $(SYSTEMPPU)
+
+sockets$(PPUEXT) : sockets.pp windows$(PPUEXT) winsock$(PPUEXT) $(SYSTEMPPU) \
+                   $(INC)/sockets.inc $(INC)/socketsh.inc
+
+initc$(PPUEXT) : initc.pp $(SYSTEMPPU)
+
+#
+# TP7 Compatible RTL Units
+#
+
+dos$(PPUEXT) : dos.pp $(INC)/filerec.inc $(INC)/textrec.inc strings$(PPUEXT) $(SYSTEMPPU)
+
+crt$(PPUEXT) : crt.pp $(INC)/textrec.inc $(SYSTEMPPU) objpas$(PPUEXT) dos$(PPUEXT) windows$(PPUEXT)
+
+objects$(PPUEXT) : $(INC)/objects.pp objinc.inc $(SYSTEMPPU)
+
+#
+# Graph
+#
+
+include $(GRAPHDIR)/makefile.inc
+GRAPHINCDEPS=$(addprefix $(GRAPHDIR)/,$(GRAPHINCNAMES))
+
+graph$(PPUEXT) : $(GRAPHDIR)/graph.pp $(SYSTEMPPU) \
+                 $(GRAPHINCDEPS) graph.inc graphh.inc
+        $(COMPILER) -I$(GRAPHDIR) $(GRAPHDIR)/graph.pp $(REDIR)
+
+
+#
+# Delphi Compatible Units
+#
+
+sysutils$(PPUEXT) : $(OBJPASDIR)/sysutils.pp $(wildcard $(OBJPASDIR)/*.inc) \
+                    filutil.inc disk.inc objpas$(PPUEXT) dos$(PPUEXT) windows$(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
+#
+
+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)
+
+#
+# Other system-dependent RTL Units
+#
+

+ 23 - 0
rtl/win32/graphh.inc

@@ -0,0 +1,23 @@
+{
+    $Id$
+    This file is part of the Free Pascal run time library.
+    Copyright (c) 1999 by Florian Klaempfl
+
+    This file implements the win32 gui support for the graph unit
+
+    See the file COPYING.FPC, included in this distribution,
+    for details about the copyright.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+
+ **********************************************************************}
+
+
+{
+  $Log$
+  Revision 1.1  1999-11-08 15:01:39  peter
+    * fpcmake support
+
+}

File diff suppressed because it is too large
+ 891 - 55
utils/Makefile


+ 61 - 0
utils/Makefile.fpc

@@ -0,0 +1,61 @@
+#
+#   Makefile.fpc for shedit
+#
+
+[targets]
+units=
+programs=ppudump ppumove ppdep ptop rstconv fpcmake
+
+[clean]
+units=ppu ptopu
+
+[dirs]
+fpcdir=..
+unitdir=$(FPCDIR)/fcl/$(OS_TARGET)
+targetdir=.
+
+[rules]
+.PHONY: h2pas_all h2pas_clean h2pas_install
+
+all: fpc_all h2pas_all
+
+clean: fpc_clean h2pas_clean
+
+install: fpc_install h2pas_install
+
+#
+# PPU Tools
+#
+ppu$(PPUEXT): ppu.pas
+
+ppudump$(EXEEXT): ppudump.pp ppu$(PPUEXT)
+
+ppumove$(EXEEXT): ppumove.pp ppu$(PPUEXT)
+
+#
+# Pascal beautifier
+#
+ptop$(EXEEXT): ptop.pp ptopu$(PPUEXT)
+
+ptopu$(PPUEXT): ptopu.pp
+
+#
+# Other
+#
+
+fpcmake$(EXEEXT): fpcmake.pp
+
+ppdep$(EXEEXT): ppdep.pp
+
+#
+# H2Pas
+#
+h2pas_all:
+        $(MAKE) -C h2pas all
+
+h2pas_clean:
+        $(MAKE) -C h2pas clean
+
+h2pas_install:
+        $(MAKE) -C h2pas install
+

+ 9 - 6
utils/fpcmake.ini

@@ -138,7 +138,7 @@ endif
 #####################################################################
 
 # Load commandline OPTDEF and add FPC_CPU define
-override FPCOPTDEF:=-d$(FPC_CPU)
+override FPCOPTDEF:=-d$(CPU_TARGET)
 
 # Load commandline OPT and add target and unit dir to be sure
 ifneq ($(OS_TARGET),$(OS_SOURCE))
@@ -780,12 +780,12 @@ endif
 
 .PHONY: fpc_showinstallfiles fpc_install
 
-ifdef EXTRAINSTALLUNITS
-override EXTRAINSTALLFILES=$(wildcard $(addsuffix $(OEXT),$(EXTRAINSTALLUNITS)) $(addsuffix $(STATICLIBEXT),$(EXTRAINSTALLUNITS)) $(addsuffix $(PPUEXT),$(EXTRAINSTALLUNITS)))
-endif
 ifdef UNITOBJECTS
 override UNITINSTALLFILES=$(wildcard $(UNITPPUFILES) $(UNITOFILES) $(UNITAFILES))
 endif
+ifdef EXTRAINSTALLUNITS
+override EXTRAINSTALLFILES+=$(wildcard $(addsuffix $(OEXT),$(EXTRAINSTALLUNITS)) $(addsuffix $(STATICLIBEXT),$(EXTRAINSTALLUNITS)) $(addsuffix $(PPUEXT),$(EXTRAINSTALLUNITS)))
+endif
 
 fpc_showinstallfiles : all
 ifndef DEFAULTUNITS
@@ -936,7 +936,7 @@ ifdef UNITOBJECTS
 override UNITCLEANFILES=$(wildcard $(UNITPPUFILES) $(UNITOFILES) $(UNITAFILES))
 endif
 ifdef EXTRACLEANUNITS
-override EXTRACLEANFILES=$(wildcard $(addsuffix $(OEXT),$(EXTRACLEANUNITS)) $(addsuffix $(STATICLIBEXT),$(EXTRACLEANUNITS)) $(addsuffix $(PPUEXT),$(EXTRACLEANUNITS)))
+override EXTRACLEANFILES+=$(wildcard $(addsuffix $(OEXT),$(EXTRACLEANUNITS)) $(addsuffix $(STATICLIBEXT),$(EXTRACLEANUNITS)) $(addsuffix $(PPUEXT),$(EXTRACLEANUNITS)))
 endif
 
 fpc_clean:
@@ -1119,7 +1119,10 @@ endif
 
 ;
 ; $Log$
-; Revision 1.2  1999-11-03 23:39:53  peter
+; Revision 1.3  1999-11-08 15:01:39  peter
+;   * fpcmake support
+;
+; Revision 1.2  1999/11/03 23:39:53  peter
 ;   * lot of updates
 ;
 ; Revision 1.1  1999/11/02 23:57:40  peter

+ 82 - 38
utils/fpcmake.pp

@@ -35,6 +35,8 @@ const
   );
 
 { Sections in Makefile.fpc }
+  sec_install='install';
+  sec_clean='clean';
   sec_dirs='dirs';
   sec_libs='libs';
   sec_targets='targets';
@@ -43,9 +45,15 @@ const
   sec_tools='tools';
 
 type
+  TTargetsString=array[0..targets] of string;
   TFpcMake=record
+    TargetLoaders,
     TargetUnits,
-    TargetPrograms : array[0..targets] of string;
+    TargetPrograms,
+    InstallUnits,
+    InstallFiles,
+    CleanUnits,
+    CleanFiles     : TTargetsString;
     DefaultUnits   : boolean;
     DefaultRule,
     DefaultTarget,
@@ -57,9 +65,7 @@ type
     DirObj,
     DirTarget,
     DirUnitTarget,
-    DirInc,
-    DirProcInc,
-    DirOSInc       : string;
+    DirInc         : string;
     LibGCC,
     LibOther       : boolean;
     InfoCfg,
@@ -108,7 +114,16 @@ function ReadMakefilefpc:boolean;
 var
   fn  : string;
   ini : TIniFile;
-  i   : integer;
+
+  procedure ReadTargetsString(var t:Ttargetsstring;const sec,name,def:string);
+  var
+    i : integer;
+  begin
+    t[0]:=ini.ReadString(sec,name,def);
+    for i:=1 to targets do
+     t[i]:=ini.ReadString(sec,name+'_'+targetstr[i],'');
+  end;
+
 begin
   ReadMakefilefpc:=false;
   if FileExists('Makefile.fpc') then
@@ -125,13 +140,15 @@ begin
   with userini,ini do
    begin
    { targets }
-     TargetUnits[0]:=ReadString(sec_targets,'units','');
-     TargetPrograms[0]:=ReadString(sec_targets,'programs','');
-     for i:=1 to targets do
-      begin
-        TargetUnits[i]:=ReadString(sec_targets,'units_'+targetstr[i],'');
-        TargetPrograms[i]:=ReadString(sec_targets,'programs_'+targetstr[i],'');
-      end;
+     ReadTargetsString(TargetLoaders,sec_targets,'loaders','');
+     ReadTargetsString(TargetUnits,sec_targets,'units','');
+     ReadTargetsString(TargetPrograms,sec_targets,'programs','');
+   { clean }
+     ReadTargetsString(CleanUnits,sec_clean,'units','');
+     ReadTargetsString(CleanFiles,sec_clean,'files','');
+   { install }
+     ReadTargetsString(InstallUnits,sec_install,'units','');
+     ReadTargetsString(InstallFiles,sec_install,'files','');
    { defaults }
      DefaultUnits:=ReadBool(sec_defaults,'defaultunits',false);
      DefaultRule:=ReadString(sec_defaults,'defaultrule','all');
@@ -146,8 +163,6 @@ begin
      DirTarget:=ReadString(sec_dirs,'targetdir','');
      DirUnitTarget:=ReadString(sec_dirs,'unittargetdir','');
      DirInc:=ReadString(sec_dirs,'incdir','');
-     DirProcInc:=ReadString(sec_dirs,'procincdir','');
-     DirOSInc:=ReadString(sec_dirs,'osincdir','');
    { libs }
      LibGcc:=ReadBool(sec_libs,'libgcc',false);
      LibOther:=ReadBool(sec_libs,'libother',false);
@@ -293,9 +308,31 @@ var
     mf.Add('');
   end;
 
+  procedure AddTargets(const pre:string;var t:TTargetsString);
+  var
+    i : integer;
+  begin
+    if t[0]<>'' then
+     mf.Add(pre+'='+t[0]);
+    for i:=1to targets do
+     if (t[i]<>'') then
+      begin
+        mf.Add('ifeq ($(OS_TARGET),'+targetstr[i]+')');
+        if t[i]<>'' then
+         mf.Add(pre+'+='+t[i]);
+        mf.Add('endif');
+      end;
+  end;
+
+  procedure AddHead(const s:string);
+  begin
+    mf.Add('');
+    mf.Add('# '+s);
+    mf.Add('');
+  end;
+
 var
   hs : string;
-  i  : integer;
 begin
 { Open the Makefile }
   Verbose('Creating Makefile');
@@ -335,33 +372,36 @@ begin
 
    { Pre Settings }
      if userini.PreSettings.count>0 then
-      AddStrings(userini.PreSettings);
-
-   { Targets }
-     Add('');
-     Add('UNITOBJECTS='+userini.targetunits[0]);
-     Add('EXEOBJECTS='+userini.targetprograms[0]);
-     for i:=1to targets do
-      if (userini.targetunits[i]<>'') or
-         (userini.targetprograms[i]<>'') then
       begin
-        Add('ifeq ($(OS_TARGET),'+targetstr[i]+')');
-        if userini.targetunits[i]<>'' then
-         Add('UNITOBJECTS+='+userini.targetunits[i]);
-        if userini.targetprograms[i]<>'' then
-         Add('EXEOBJECTS+='+userini.targetprograms[i]);
-        Add('endif');
+        AddHead('Pre Settings');
+        AddStrings(userini.PreSettings);
       end;
 
+   { Targets }
+     AddHead('Targets');
+     AddTargets('LOADEROBJECTS',userini.targetloaders);
+     AddTargets('UNITOBJECTS',userini.targetunits);
+     AddTargets('EXEOBJECTS',userini.targetprograms);
+
+   { Clean }
+     AddHead('Clean');
+     AddTargets('EXTRACLEANUNITS',userini.cleanunits);
+     AddTargets('EXTRACLEANFILES',userini.cleanfiles);
+
+   { Install }
+     AddHead('Install');
+     AddTargets('EXTRAINSTALLUNITS',userini.installunits);
+     AddTargets('EXTRAINSTALLFILES',userini.installfiles);
+
    { Defaults }
-     Add('');
+     AddHead('Defaults');
      if userini.defaultunits then
       Add('DEFAULTUNITS=1');
      if userini.defaultoptions<>'' then
       Add('override NEEDOPT='+userini.defaultoptions);
 
    { Dirs }
-     Add('');
+     AddHead('Directories');
      if userini.dirfpc<>'' then
       begin
         { this dir can be set in the environment, it's more a default }
@@ -391,14 +431,14 @@ begin
       end;
 
    { Libs }
-     Add('');
+     AddHead('Libraries');
      if userini.libgcc then
       Add('override NEEDGCCLIB=1');
      if userini.libother then
       Add('override NEEDOTHERLIB=1');
 
    { Info }
-     Add('');
+     AddHead('Info');
      hs:='';
      if userini.infocfg then
       hs:=hs+'fpc_infocfg ';
@@ -416,7 +456,10 @@ begin
 
    { Post Settings }
      if userini.PostSettings.count>0 then
-      AddStrings(userini.PostSettings);
+      begin
+        AddHead('Post Settings');
+        AddStrings(userini.PostSettings);
+      end;
 
    { commandline }
      Add('');
@@ -431,8 +474,6 @@ begin
      AddSection(userini.libgcc,'command_gcclib');
      AddSection(userini.libother,'command_otherlib');
      AddSection((userini.dirinc<>''),'command_inc');
-     AddSection((userini.dirprocinc<>''),'command_procinc');
-     AddSection((userini.dirosinc<>''),'command_osinc');
      AddSection((userini.dirtarget<>''),'command_target');
      AddSection((userini.dirunittarget<>''),'command_unittarget');
      AddSection(true,'command_smartlink');
@@ -527,7 +568,10 @@ begin
 end.
 {
   $Log$
-  Revision 1.3  1999-11-04 12:07:13  michael
+  Revision 1.4  1999-11-08 15:01:39  peter
+    * fpcmake support
+
+  Revision 1.3  1999/11/04 12:07:13  michael
   + Now envvar is used
 
   Revision 1.2  1999/11/03 23:39:53  peter

+ 868 - 83
utils/h2pas/Makefile

@@ -1,114 +1,926 @@
 #
-#   $Id$
-#   Copyright (c) 1999 by the Free Pascal Development Team
-#
-#   Makefile for Free Pascal Utils
-#
-#   See the file COPYING.FPC, included in this distribution,
-#   for details about the copyright.
-#
-#   This program is distributed in the hope that it will be useful,
-#   but WITHOUT ANY WARRANTY; without even the implied warranty of
-#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+# Makefile generated from Makefile.fpc on 1999-11-08 15:25
 #
 
+defaultrule: Makefile all
+
+Makefile: Makefile.fpc
+	fpcmake
+	$(MAKE)
 
 #####################################################################
-# Defaults
+# Autodetect OS (Linux or Dos or Windows NT)
+# define inlinux when running under linux
+# define inWinNT when running under WinNT
 #####################################################################
 
-# Default place of the makefile.fpc
-DEFAULTFPCDIR=../..
+# We need only / in the path
+override PATH:=$(subst \,/,$(PATH))
+
+# Search for PWD and determine also if we are under linux
+PWD:=$(strip $(wildcard $(addsuffix /pwd.exe,$(subst ;, ,$(PATH)))))
+ifeq ($(PWD),)
+PWD:=$(strip $(wildcard $(addsuffix /pwd,$(subst :, ,$(PATH)))))
+ifeq ($(PWD),)
+nopwd:
+	@echo You need the GNU utils package to use this Makefile!
+	@echo Get ftp://ftp.freepascal.org/pub/fpc/dist/go32v2/utilgo32.zip
+	@exit
+else
+inlinux=1
+endif
+else
+PWD:=$(firstword $(PWD))
+endif
+
+# Detect NT - NT sets OS to Windows_NT
+ifndef inlinux
+ifeq ($(OS),Windows_NT)
+inWinNT=1
+endif
+endif
 
-# We need -Sg
-NEEDOPT=-Sg
+# Detect OS/2 - OS/2 has OS2_SHELL defined
+ifndef inlinux
+ifndef inWinNT
+ifdef OS2_SHELL
+inOS2=1
+endif
+endif
+endif
 
+# The extension of executables
+ifdef inlinux
+EXEEXT=
+else
+EXEEXT=.exe
+endif
+
+# The path which is search separated by spaces
+ifdef inlinux
+SEARCHPATH=$(subst :, ,$(PATH))
+else
+SEARCHPATH=$(subst ;, ,$(PATH))
+endif
 
 #####################################################################
-# Real targets
+# FPC version/target Detection
+#####################################################################
+
+# What compiler to use ?
+ifndef FPC
+ifdef inOS2
+export FPC=ppos2$(EXEEXT)
+else
+export FPC=ppc386$(EXEEXT)
+endif
+endif
+
+# Target OS
+ifndef OS_TARGET
+export OS_TARGET:=$(shell $(FPC) -iTO)
+endif
+
+# Source OS
+ifndef OS_SOURCE
+export OS_SOURCE:=$(shell $(FPC) -iSO)
+endif
+
+# Target CPU
+ifndef CPU_TARGET
+export CPU_TARGET:=$(shell $(FPC) -iTP)
+endif
+
+# Source CPU
+ifndef CPU_SOURCE
+export CPU_SOURCE:=$(shell $(FPC) -iSP)
+endif
+
+# FPC version
+ifndef FPC_VERSION
+export FPC_VERSION:=$(shell $(FPC) -iV)
+endif
+
+#####################################################################
+# Default Settings
+#####################################################################
+
+# Release ? Then force OPT and don't use extra opts via commandline
+ifdef RELEASE
+override OPT:=-Xs -OG2p3 -n
+endif
+
+# Verbose settings (warning,note,info)
+ifdef VERBOSE
+override OPT+=-vwni
+endif
+
+#####################################################################
+# User Settings
 #####################################################################
 
-# the files in this dir use .pas
-PASEXT=.pas
+
+# Targets
 
 EXEOBJECTS=h2pas
-UNITOBJECTS=
+
+# Clean
 
 EXTRACLEANUNITS=options lexlib scan yacclib converu
 
+# Install
+
+
+# Defaults
+
+override NEEDOPT=-Sg
+
+# Directories
+
+ifndef FPCDIR
+FPCDIR=../..
+endif
+
+# Libraries
+
+
+# Info
+
+FPCINFO=fpc_infocfg fpc_infoobjects fpc_infoinstall 
+
+#####################################################################
+# Compiler Command Line
+#####################################################################
+
+# Load commandline OPTDEF and add FPC_CPU define
+override FPCOPTDEF:=-d$(CPU_TARGET)
+
+# Load commandline OPT and add target and unit dir to be sure
+ifneq ($(OS_TARGET),$(OS_SOURCE))
+override FPCOPT+=-T$(OS_TARGET)
+endif
+
+
+ifdef NEEDOPT
+override FPCOPT+=$(NEEDOPT)
+endif
+
+# RTL first and then Unit dir (a unit can override RTLunit). Don't add the
+# dirs if fpcdir=. which can be used for the rtl makefiles
+ifdef FPCDIR
+ifneq ($(FPCDIR),.)
+override FPCOPT+=-Fu$(FPCDIR)/rtl/$(OS_TARGET) -Fu$(FPCDIR)/units/$(OS_TARGET)
+endif
+endif
+
+# Smartlinking
+ifeq ($(SMARTLINK),YES)
+override FPCOPT+=-Cx
+endif
+
+# Add commandline options
+ifdef OPT
+override FPCOPT+=$(OPT)
+endif
+ifdef UNITDIR
+override FPCOPT+=$(addprefix -Fu,$(UNITDIR))
+endif
+ifdef LIBDIR
+override FPCOPT+=$(addprefix -Fl,$(LIBDIR))
+endif
+ifdef OBJDIR
+override FPCOPT+=$(addprefix -Fo,$(OBJDIR))
+endif
+ifdef INCDIR
+override FPCOPT+=$(addprefix -Fi,$(INCDIR))
+endif
+
+# Add defines from FPCOPTDEF to FPCOPT
+ifdef FPCOPTDEF
+override FPCOPT+=$(FPCOPTDEF)
+endif
+
+# Was a config file specified ?
+ifdef CFGFILE
+override FPCOPT+=@$(CFGFILE)
+endif
+
+override COMPILER=$(FPC) $(FPCOPT)
 
 #####################################################################
-# Common targets
+# Shell tools
 #####################################################################
 
-.PHONY: all clean install info \
-        staticlib sharedlib libsclean \
-        staticinstall sharedinstall libinstall \
-        
-all: testfpcmake fpc_all
+# To copy pograms
+ifndef COPY
+export COPY:=cp -fp
+endif
+
+# To move pograms
+ifndef MOVE
+export MOVE:=mv -f
+endif
+
+# Check delete program
+ifndef DEL
+export DEL:=rm -f
+endif
+
+# Check deltree program
+ifndef DELTREE
+export DELTREE:=rm -rf
+endif
+
+# To install files
+ifndef INSTALL
+ifdef inlinux
+export INSTALL:=install -m 644
+else
+export INSTALL:=$(COPY)
+endif
+endif
 
-clean: testfpcmake fpc_clean
+# To install programs
+ifndef INSTALLEXE
+ifdef inlinux
+export INSTALLEXE:=install -m 755
+else
+export INSTALLEXE:=$(COPY)
+endif
+endif
 
-install: testfpcmake fpc_install
+# To make a directory.
+ifndef MKDIR
+ifdef inlinux
+export MKDIR:=install -m 755 -d
+else
+export MKDIR:=ginstall -m 755 -d
+endif
+endif
 
-info: testfpcmake fpc_info
+#####################################################################
+# Default Tools
+#####################################################################
 
-staticlib: testfpcmake fpc_staticlib
+# assembler, redefine it if cross compiling
+ifndef AS
+AS=as
+endif
 
-sharedlib: testfpcmake fpc_sharedlib
+# linker, but probably not used
+ifndef LD
+LD=ld
+endif
 
-libsclean: testfpcmake fpc_libsclean
+# Where is the ppumove program ?
+ifndef PPUMOVE
+PPUMOVE=ppumove
+endif
+
+# Where is the ppdep program ?
+ifndef PPDEP
+PPDEP=ppdep
+endif
+
+# ppas.bat / ppas.sh
+ifdef inlinux
+PPAS=ppas.sh
+else
+ifdef inOS2
+PPAS=ppas.cmd
+else
+PPAS=ppas.bat
+endif
+endif
+
+# also call ppas if with command option -s
+ifeq (,$(findstring -s ,$(COMPILER)))
+EXECPPAS=
+else
+EXECPPAS=@$(PPAS)
+endif
+
+# ldconfig to rebuild .so cache
+ifdef inlinux
+LDCONFIG=ldconfig
+else
+LDCONFIG=
+endif
+
+# echo
+ifndef ECHO
+ECHO:=$(strip $(wildcard $(addsuffix /echo$(EXEEXT),$(SEARCHPATH))))
+ifeq ($(ECHO),)
+export ECHO:=echo
+else
+export ECHO:=$(firstword $(ECHO))
+endif
+endif
+
+# Look if UPX is found for go32v2 and win32. We can't use $UPX becuase
+# upx uses that one itself (PFV)
+ifndef UPXPROG
+ifeq ($(OS_TARGET),go32v2)
+UPXPROG:=1
+endif
+ifeq ($(OS_TARGET),win32)
+UPXPROG:=1
+endif
+ifdef UPXPROG
+UPXPROG:=$(strip $(wildcard $(addsuffix /upx$(EXEEXT),$(SEARCHPATH))))
+ifeq ($(UPX),)
+UPXPROG=
+else
+export UPXPROG:=$(firstword $(UPX))
+endif
+else
+UPXPROG=
+endif
+endif
 
-staticinstall: testfpcmake fpc_staticinstall
+# gdate/date
+ifndef DATE
+DATE:=$(strip $(wildcard $(addsuffix /date$(EXEEXT),$(SEARCHPATH))))
+ifeq ($(DATE),)
+DATE:=$(strip $(wildcard $(addsuffix /gdate$(EXEEXT),$(SEACHPATH))))
+ifeq ($(DATE),)
+DATE=
+else
+export DATE:=$(firstword $(DATE))
+endif
+else
+export DATE:=$(firstword $(DATE))
+endif
+endif
 
-sharedinstall: testfpcmake fpc_sharedinstall
+ifdef DATE
+DATESTR:=$(shell $(DATE) +%Y%m%d)
+else
+DATESTR=
+endif
 
-libinstall: testfpcmake fpc_libinstall
+# ZipProg, you can't use Zip as the var name (PFV)
+ifndef ZIPPROG
+ZIPPROG:=$(strip $(wildcard $(addsuffix /zip$(EXEEXT),$(SEARCHPATH))))
+ifeq ($(ZIPPROG),)
+ZIPPROG=
+else
+export ZIPPROG:=$(firstword $(ZIPPROG)) -D9 -r
+endif
+endif
 
+ifndef ZIPEXT
+ZIPEXT=.zip
+endif
 
 #####################################################################
-# Include default makefile
+# Default Directories
 #####################################################################
 
-# test if FPCMAKE is still valid
-ifdef FPCMAKE
-ifeq ($(strip $(wildcard $(FPCMAKE))),)
-FPCDIR=
-FPCMAKE=
+# Base dir
+ifdef PWD
+BASEDIR:=$(shell $(PWD))
+else
+BASEDIR=.
+endif
+
+# set the prefix directory where to install everything
+ifndef PREFIXINSTALLDIR
+ifdef inlinux
+export PREFIXINSTALLDIR=/usr
+else
+export PREFIXINSTALLDIR=/pp
 endif
 endif
 
-ifndef FPCDIR
-ifdef DEFAULTFPCDIR
-FPCDIR=$(DEFAULTFPCDIR)
+# set the directory to the rtl base
+ifndef RTLDIR
+ifdef RTL
+RTLDIR:=$(RTL)/$(OS_TARGET)
+else
+RTLDIR:=$(FPCDIR)/rtl/$(OS_TARGET)
 endif
 endif
 
-ifndef FPCMAKE
-ifdef FPCDIR
-FPCMAKE=$(FPCDIR)/makefile.fpc
+# specify where units are.
+ifndef UNITDIR
+ifdef UNITS
+UNITDIR=$(UNITS)/$(OS_TARGET)
+else
+UNITDIR=$(FPCDIR)/units/$(OS_TARGET)
+endif
+endif
+ifeq ($(strip $(wildcard $(UNITDIR)/*)),)
+UNITDIR=
+endif
+
+# On linux, try to find where libgcc.a is.
+ifdef inlinux
+ifndef GCCLIBDIR
+export GCCLIBDIR:=$(shell dirname `(gcc -v 2>&1)| head -n 1| awk '{ print $$4 } '`)
+endif
+endif
+
+# Where to find other libraries
+ifdef inlinux
+ifndef OTHERLIBDIR
+export OTHERLIBDIR:=$(shell grep -v "^\#" /etc/ld.so.conf | awk '{ ORS=" "; print $1 }')
+endif
+endif
+
+#####################################################################
+# Install Directories based on BASEINSTALLDIR
+#####################################################################
+
+# set the base directory where to install everything
+ifndef BASEINSTALLDIR
+ifdef inlinux
+BASEINSTALLDIR=$(PREFIXINSTALLDIR)/lib/fpc/$(FPC_VERSION)
+else
+BASEINSTALLDIR=$(PREFIXINSTALLDIR)
+endif
+endif
+
+
+# Linux binary really goes to baseinstalldir
+ifndef LIBINSTALLDIR
+ifdef inlinux
+LIBINSTALLDIR=$(BASEINSTALLDIR)
+else
+LIBINSTALLDIR=$(BASEINSTALLDIR)/lib
+endif
+endif
+
+# set the directory where to install the binaries
+ifndef BININSTALLDIR
+ifdef inlinux
+BININSTALLDIR=$(PREFIXINSTALLDIR)/bin
+else
+BININSTALLDIR=$(BASEINSTALLDIR)/bin/$(OS_TARGET)
+endif
+endif
+
+# Where the .msg files will be stored
+ifndef MSGINSTALLDIR
+MSGINSTALLDIR=$(BASEINSTALLDIR)/msg
+endif
+
+# Where the .msg files will be stored
+ifndef SOURCEINSTALLDIR
+SOURCEINSTALLDIR=$(BASEINSTALLDIR)/source
+endif
+
+# Where the doc files will be stored
+ifndef DOCINSTALLDIR
+ifdef inlinux
+DOCINSTALLDIR=$(PREFIXINSTALLDIR)/doc/fpc/$(FPC_VERSION)
+else
+DOCINSTALLDIR=$(BASEINSTALLDIR)/doc
+endif
+endif
+
+########################
+# Unit Directories
+########################
+
+# this can be set to 'rtl' when the RTL units are installed
+ifndef UNITPREFIX
+UNITPREFIX=units
+endif
+
+# set the directory where to install the units.
+ifndef UNITINSTALLDIR
+UNITINSTALLDIR=$(BASEINSTALLDIR)/$(UNITPREFIX)/$(OS_TARGET)
+endif
+
+# set the directory where to install the units.
+ifndef STATIC_UNITINSTALLDIR
+STATIC_UNITINSTALLDIR=$(UNITINSTALLDIR)/static
+endif
+
+# set the directory where to install the units.
+ifndef SHARED_UNITINSTALLDIR
+SHARED_UNITINSTALLDIR=$(UNITINSTALLDIR)/shared
+endif
+
+# set the directory where to install the libs (must exist)
+ifndef STATIC_LIBINSTALLDIR
+STATIC_LIBINSTALLDIR=$(STATIC_UNITINSTALLDIR)
+endif
+
+# set the directory where to install the libs (must exist)
+ifndef SHARED_LIBINSTALLDIR
+ifdef inlinux
+SHARED_LIBINSTALLDIR=$(PREFIXINSTALLDIR)/lib
+else
+SHARED_LIBINSTALLDIR=$(SHARED_UNITINSTALLDIR)
+endif
+endif
+
+#####################################################################
+# Default extensions
+#####################################################################
+
+# Default needed extensions (Go32v2,Linux)
+LOADEREXT=.as
+PPLEXT=.ppl
+PPUEXT=.ppu
+OEXT=.o
+ASMEXT=.s
+SMARTEXT=.sl
+STATICLIBEXT=.a
+SHAREDLIBEXT=.so
+PACKAGESUFFIX=
+
+# Go32v1
+ifeq ($(OS_TARGET),go32v1)
+PPUEXT=.pp1
+OEXT=.o1
+ASMEXT=.s1
+SMARTEXT=.sl1
+STATICLIBEXT=.a1
+SHAREDLIBEXT=.so1
+PACKAGESUFFIX=v1
+endif
+
+# Go32v2
+ifeq ($(OS_TARGET),go32v2)
+PACKAGESUFFIX=go32
+endif
+
+# Linux
+ifeq ($(OS_TARGET),linux)
+PACKAGESUFFIX=linux
+endif
+
+# Win32
+ifeq ($(OS_TARGET),win32)
+PPUEXT=.ppw
+OEXT=.ow
+ASMEXT=.sw
+SMARTEXT=.slw
+STATICLIBEXT=.aw
+SHAREDLIBEXT=.dll
+PACKAGESUFFIX=win32
+endif
+
+# OS/2
+ifeq ($(OS_TARGET),os2)
+PPUEXT=.ppo
+ASMEXT=.so2
+OEXT=.oo2
+SMARTEXT=.so
+STATICLIBEXT=.ao2
+SHAREDLIBEXT=.dll
+PACKAGESUFFIX=os2
+endif
+
+# library prefix
+LIBPREFIX=lib
+ifeq ($(OS_TARGET),go32v2)
+LIBPREFIX=
+endif
+ifeq ($(OS_TARGET),go32v1)
+LIBPREFIX=
+endif
+
+# determine which .pas extension is used
+ifndef PASEXT
+ifdef EXEOBJECTS
+override TESTPAS:=$(strip $(wildcard $(addsuffix .pas,$(firstword $(EXEOBJECTS)))))
+else
+override TESTPAS:=$(strip $(wildcard $(addsuffix .pas,$(firstword $(UNITOBJECTS)))))
+endif
+ifeq ($(TESTPAS),)
+PASEXT=.pp
+else
+PASEXT=.pas
+endif
+endif
+
+#####################################################################
+# Default rules
+#####################################################################
+
+.PHONY: defaultrule all staticlib sharedlib showinstall install \
+	staticinstall sharedinstall libinstall zipinstall zipinstalladd \
+	clean cleanall depend info
+
+all: fpc_all
+
+staticlib: fpc_staticlib
+
+sharedlib: fpc_sharedlib
+
+showinstall: fpc_showinstall
+
+install: fpc_install
+
+staticinstall: fpc_staticinstall
+
+sharedinstall: fpc_sharedinstall
+
+libinstall: fpc_libinstall
+
+zipinstall: fpc_zipinstall
+
+zipinstalladd: fpc_zipinstalladd
+
+clean: fpc_clean
+
+clean_all: fpc_clean_all
+
+depend: fpc_depend
+
+info: fpc_info
+
+#####################################################################
+# General compile rules
+#####################################################################
+
+.PHONY: fpc_all fpc_units fpc_exes fpc_loaders
+
+# Create Filenames
+LOADEROFILES=$(addsuffix $(OEXT),$(LOADEROBJECTS))
+EXEFILES=$(addsuffix $(EXEEXT),$(EXEOBJECTS))
+EXEOFILES=$(addsuffix $(OEXT),$(EXEOBJECTS))
+UNITPPUFILES=$(addsuffix $(PPUEXT),$(UNITOBJECTS))
+UNITOFILES=$(addsuffix $(OEXT),$(UNITOBJECTS))
+UNITAFILES=$(addsuffix $(STATICLIBEXT),$(UNITOBJECTS))
+
+.SUFFIXES: $(EXEEXT) $(PPUEXT) $(OEXT) .pas .pp
+
+ifdef DEFAULTUNITS
+fpc_all: fpc_loaders fpc_units
+else
+fpc_all: fpc_loaders fpc_units fpc_exes
+endif
+
+fpc_loaders: $(LOADEROFILES)
+
+fpc_units: $(UNITPPUFILES)
+
+fpc_exes: $(EXEFILES)
+
+# General compile rules, available for both possible PASEXT
+%$(PPUEXT): %.pp
+	$(COMPILER) $< $(REDIR)
+	$(EXECPASS)
+
+%$(PPUEXT): %.pas
+	$(COMPILER) $< $(REDIR)
+	$(EXECPASS)
+
+%$(EXEEXT): %.pp
+	$(COMPILER) $< $(REDIR)
+	$(EXECPASS)
+
+%$(EXEEXT): %.pas
+	$(COMPILER) $< $(REDIR)
+	$(EXECPASS)
+
+%$(OEXT): %$(LOADEREXT)
+	$(AS) -o $*$(OEXT) $<
+
+#####################################################################
+# Library
+#####################################################################
+
+.PHONY: fpc_staticlib fpc_sharedlib
+
+# Default sharedlib units are all unit objects
+ifndef SHAREDLIBUNITOBJECTS
+SHAREDLIBUNITOBJECTS=$(UNITOBJECTS)
+endif
+
+fpc_staticlib:
+	$(MAKE) libsclean
+	$(MAKE) all SMARTLINK=YES
+
+fpc_sharedlib: all
+ifdef inlinux
+ifndef LIBNAME
+	@$(ECHO) LIBNAME not set
+else
+	$(PPUMOVE) $(SHAREDLIBUNITOBJECTS) -o$(LIBNAME)
+endif
+else
+	@$(ECHO) Shared Libraries not supported
+endif
+
+#####################################################################
+# Install rules
+#####################################################################
+
+.PHONY: fpc_showinstallfiles fpc_install
+
+ifdef UNITOBJECTS
+override UNITINSTALLFILES=$(wildcard $(UNITPPUFILES) $(UNITOFILES) $(UNITAFILES))
+endif
+ifdef EXTRAINSTALLUNITS
+override EXTRAINSTALLFILES+=$(wildcard $(addsuffix $(OEXT),$(EXTRAINSTALLUNITS)) $(addsuffix $(STATICLIBEXT),$(EXTRAINSTALLUNITS)) $(addsuffix $(PPUEXT),$(EXTRAINSTALLUNITS)))
+endif
+
+fpc_showinstallfiles : all
+ifndef DEFAULTUNITS
+ifdef EXEOBJECTS
+	@$(ECHO) $(addprefix "\n"$(BININSTALLDIR)/,$(EXEFILES))
+endif
+endif
+ifdef LOADEROBJECTS
+	@$(ECHO) $(addprefix "\n"$(UNITINSTALLDIR)/,$(LOADEROFILES))
+endif
+ifdef UNITINSTALLFILES
+	@$(ECHO) $(addprefix "\n"$(UNITINSTALLDIR)/,$(UNITINSTALLFILES))
+endif
+ifdef EXTRAINSTALLFILES
+	@$(ECHO) $(addprefix "\n"$(UNITINSTALLDIR)/,$(EXTRAINSTALLFILES))
+endif
+
+fpc_install:
+# Create UnitInstallFiles
+ifndef DEFAULTUNITS
+ifdef EXEOBJECTS
+	$(MKDIR) $(BININSTALLDIR)
+# Compress the exes if upx is defined
+ifdef UPXPROG
+	-$(UPXPROG) $(EXEFILES)
+endif
+	$(INSTALLEXE) $(EXEFILES) $(BININSTALLDIR)
+endif
+endif
+ifdef LOADEROBJECTS
+	$(MKDIR) $(UNITINSTALLDIR)
+	$(INSTALL) $(LOADEROFILES) $(UNITINSTALLDIR)
+endif
+ifdef UNITINSTALLFILES
+	$(MKDIR) $(UNITINSTALLDIR)
+	$(INSTALL) $(UNITINSTALLFILES) $(UNITINSTALLDIR)
+endif
+ifdef EXTRAINSTALLFILES
+	$(MKDIR) $(UNITINSTALLDIR)
+	$(INSTALL) $(EXTRAINSTALLFILES) $(UNITINSTALLDIR)
+endif
+
+#####################################################################
+# Zip
+#####################################################################
+
+.PHONY: fpc_zipinstall fpc_zipinstalladd
+
+# Temporary path to pack a file
+ifndef PACKDIR
+ifndef inlinux
+PACKDIR=pack_tmp
+else
+PACKDIR=/tmp/fpc-pack
+endif
+endif
+
+# Test dir if none specified
+ifndef PACKAGEDIR
+PACKAGEDIR=$(BASEDIR)
+endif
+
+# Add .zip/.tar.gz extension
+ifdef ZIPNAME
+ifndef inlinux
+override ZIPNAME:=$(ZIPNAME)$(ZIPEXT)
+endif
+endif
+
+# Default target which is call before zipping
+ifndef ZIPTARGET
+ZIPTARGET=install
+endif
+
+# Note: This will not remove the zipfile first
+fpc_zipinstalladd:
+ifndef ZIPNAME
+	@$(ECHO) Please specify ZIPNAME!
+	@exit
 else
-FPCMAKE=makefile.fpc
+	$(MAKE) $(ZIPTARGET) PREFIXINSTALLDIR=$(PACKDIR)
+ifdef inlinux
+	gzip -d $(PACKAGEDIR)/$(ZIPNAME).tar.gz
+	cd $(PACKDIR) ; tar rv --file $(PACKAGEDIR)/$(ZIPNAME).tar * ; cd $(BASEDIR)
+	gzip $(PACKAGEDIR)/$(ZIPNAME).tar
+else
+	cd $(PACKDIR) ; $(ZIPPROG) $(PACKAGEDIR)/$(ZIPNAME) * ; cd $(BASEDIR)
 endif
+	$(DELTREE) $(PACKDIR)
 endif
 
-override FPCMAKE:=$(strip $(wildcard $(FPCMAKE)))
-ifeq ($(FPCMAKE),)
-testfpcmake:
-	@echo makefile.fpc not found!
-	@echo Check the FPCMAKE and FPCDIR environment variables.
+# First remove the zip and then install
+fpc_zipinstall:
+ifndef ZIPNAME
+	@$(ECHO) Please specify ZIPNAME!
 	@exit
 else
-include $(FPCMAKE)
-testfpcmake:
+	$(DEL) $(PACKAGEDIR)/$(ZIPNAME)
+	$(MAKE) $(ZIPTARGET) PREFIXINSTALLDIR=$(PACKDIR)
+ifdef inlinux
+	cd $(PACKDIR) ; tar cvz --file $(PACKAGEDIR)/$(ZIPNAME).tar.gz * ; cd $(BASEDIR)
+else
+	cd $(PACKDIR) ; $(ZIPPROG) $(PACKAGEDIR)/$(ZIPNAME) * ; cd $(BASEDIR)
+endif
+	$(DELTREE) $(PACKDIR)
+endif
+
+#####################################################################
+# Clean rules
+#####################################################################
+
+.PHONY: fpc_clean fpc_libsclean fpc_cleanall
+
+ifdef UNITOBJECTS
+override UNITCLEANFILES=$(wildcard $(UNITPPUFILES) $(UNITOFILES) $(UNITAFILES))
+endif
+ifdef EXTRACLEANUNITS
+override EXTRACLEANFILES+=$(wildcard $(addsuffix $(OEXT),$(EXTRACLEANUNITS)) $(addsuffix $(STATICLIBEXT),$(EXTRACLEANUNITS)) $(addsuffix $(PPUEXT),$(EXTRACLEANUNITS)))
 endif
 
+fpc_clean:
+ifdef EXEOBJECTS
+	-$(DEL) $(EXEFILES) $(EXEOFILES)
+endif
+ifdef LOADEROBJECTS
+	-$(DEL) $(LOADEROFILES)
+endif
+ifdef UNITCLEANFILES
+	-$(DEL) $(UNITCLEANFILES)
+endif
+ifdef EXTRACLEANFILES
+	-$(DEL) $(EXTRACLEANFILES)
+endif
+	-$(DEL) $(PPAS) link.res log
 
+fpc_libsclean: clean
+	-$(DEL) *$(STATICLIBEXT) *$(SHAREDLIBEXT) *$(PPLEXT)
+
+fpc_cleanall:
+ifdef EXEOBJECTS
+	-$(DEL) $(EXEFILES)
+endif
+	-$(DEL) *$(OEXT) *$(PPUEXT) *$(ASMEXT) *$(STATICLIBEXT) *$(SHAREDLIBEXT) *$(PPLEXT)
+	-$(DELTREE) *$(SMARTEXT)
 
 #####################################################################
-# Dependencies
+# Depend rules
 #####################################################################
 
+.PHONY: fpc_depend
+
+fpc_depend:
+	$(PPDEP) $(UNITOBJECTS)
+
+#####################################################################
+# Info rules
+#####################################################################
+
+.PHONY: fpc_info fpc_cfginfo fpc_objectinfo fpc_toolsinfo fpc_installinfo \
+	fpc_dirinfo
+
+fpc_info: $(FPCINFO)
+
+fpc_infocfg:
+	@$(ECHO)
+	@$(ECHO)  == Configuration info ==
+	@$(ECHO)
+	@$(ECHO)  FPC....... $(FPC)
+	@$(ECHO)  Version... $(FPC_VERSION)
+	@$(ECHO)  CPU....... $(CPU_TARGET)
+	@$(ECHO)  Source.... $(OS_SOURCE)
+	@$(ECHO)  Target.... $(OS_TARGET)
+	@$(ECHO)
+
+
+fpc_infoinstall:
+	@$(ECHO)
+	@$(ECHO)  == Install info ==
+	@$(ECHO)
+ifdef DATE
+	@$(ECHO)  DateStr.............. $(DATESTR)
+endif
+	@$(ECHO)  PackageSuffix........ $(PACKAGESUFFIX)
+	@$(ECHO)
+	@$(ECHO)  BaseInstallDir....... $(BASEINSTALLDIR)
+	@$(ECHO)  BinInstallDir........ $(BININSTALLDIR)
+	@$(ECHO)  UnitInstallDir....... $(UNITINSTALLDIR)
+	@$(ECHO)  StaticUnitInstallDir. $(STATIC_UNITINSTALLDIR)
+	@$(ECHO)  SharedUnitInstallDir. $(SHARED_UNITINSTALLDIR)
+	@$(ECHO)  LibInstallDir........ $(LIBINSTALLDIR)
+	@$(ECHO)  StaticLibInstallDir.. $(STATIC_LIBINSTALLDIR)
+	@$(ECHO)  SharedLibInstallDir.. $(SHARED_LIBINSTALLDIR)
+	@$(ECHO)  MsgInstallDir........ $(MSGINSTALLDIR)
+	@$(ECHO)  DocInstallDir........ $(DOCINSTALLDIR)
+	@$(ECHO)
+
+#####################################################################
+# Users rules
+#####################################################################
+
+
 # do we have pyacc?
 ifndef PYACC
 PYACC=$(strip $(wildcard $(addsuffix /pyacc$(EXEEXT),$(SEARCHPATH))))
@@ -146,30 +958,3 @@ yacc:
 lex :
 	$(PLEX) scan.l
 endif
-
-#
-# $Log$
-# Revision 1.3  1999-07-16 13:45:38  peter
-#   * 0.99.12b updates
-#   * merges
-#
-# Revision 1.2  1999/06/18 11:03:14  peter
-#   * merged
-#
-# Revision 1.1.2.2  1999/07/16 13:40:59  peter
-#   + extrainstallunits,extracleanunits
-#
-# Revision 1.1.2.1  1999/06/18 10:55:37  peter
-#   * version fixes
-#   * EXTRAUNITS to set extra units that are build and needs to be cleaned
-#
-# Revision 1.1  1999/05/12 16:11:39  peter
-#   * moved
-#
-# Revision 1.12  1999/04/01 22:52:01  peter
-#   * update for makefile.fpc
-#
-# Revision 1.1  1999/03/16 00:50:29  peter
-#   + init
-#
-#

+ 57 - 0
utils/h2pas/Makefile.fpc

@@ -0,0 +1,57 @@
+#
+#   Makefile.fpc for shedit
+#
+
+[targets]
+units=
+programs=h2pas
+
+[clean]
+units=options lexlib scan yacclib converu
+
+[dirs]
+fpcdir=../..
+
+[defaults]
+defaultoptions=-Sg
+
+
+[rules]
+# do we have pyacc?
+ifndef PYACC
+PYACC=$(strip $(wildcard $(addsuffix /pyacc$(EXEEXT),$(SEARCHPATH))))
+ifeq ($(PYACC),)
+PYACC=
+else
+export PYACC:=$(firstword $(PYACC))
+endif
+endif
+
+# do we have plex?
+ifndef PLEX
+PLEX=$(strip $(wildcard $(addsuffix /plex$(EXEEXT),$(SEARCHPATH))))
+ifeq ($(PLEX),)
+PLEX=
+else
+export PLEX:=$(firstword $(PLEX))
+endif
+endif
+
+h2pas$(EXEEXT): h2pas$(PASEXT)
+
+#
+# Lex and Yacc (only if pyacc is found)
+#
+ifdef  PYACC
+h2pas$(PASEXT): h2pas.y
+        $(PYACC) h2pas.y
+
+yacclex: yacc lex
+
+yacc:
+        $(PYACC) h2pas.y
+
+lex :
+        $(PLEX) scan.l
+endif
+

Some files were not shown because too many files changed in this diff