Browse Source

+ internal .ini file
+ packages support
* ppufiles,data2inc support

peter 26 years ago
parent
commit
7859c176a3
3 changed files with 1389 additions and 252 deletions
  1. 1128 0
      utils/fpcmake.inc
  2. 180 231
      utils/fpcmake.ini
  3. 81 21
      utils/fpcmake.pp

+ 1128 - 0
utils/fpcmake.inc

@@ -0,0 +1,1128 @@
+{$ifdef Delphi}
+const fpcmakeini : array[0..93] of string[240]=(
+{$else Delphi}
+const fpcmakeini : array[0..93,1..240] of char=(
+{$endif Delphi}
+  ';'#010+
+  '; $Id$'#010+
+  ';'#010+
+  '; Templates used by fpcmake to create a Makefile from Makefile.fpc'#010+
+  ';'#010+
+  #010+
+  '[osdetect]'#010+
+  '#####################################################################'#010+
+  '# Autodetect OS (Linux or Do','s or Windows NT)'#010+
+  '# define inlinux when running under linux'#010+
+  '# define inWinNT when running under WinNT'#010+
+  '#####################################################################'#010+
+  #010+
+  '# We need only / in the path'#010+
+  'override PATH:=$(subst \,/,$(PATH))'#010+
+  #010+
+  '# ','Search for PWD and determine also if we are under linux'#010+
+  'PWD:=$(strip $(wildcard $(addsuffix /pwd.exe,$(subst ;, ,$(PATH)))))'#010+
+  'ifeq ($(PWD),)'#010+
+  'PWD:=$(strip $(wildcard $(addsuffix /pwd,$(subst :, ,$(PATH)))))'#010+
+  'ifeq ($(PWD),)'#010+
+  'nopwd:'#010+
+  '        @echo',' You need the GNU utils package to use this Makefile!'#010+
+  '        @echo Get ftp://ftp.freepascal.org/pub/fpc/dist/go32v2/utilgo3'+
+  '2.zip'#010+
+  '        @exit'#010+
+  'else'#010+
+  'inlinux=1'#010+
+  'endif'#010+
+  'else'#010+
+  'PWD:=$(firstword $(PWD))'#010+
+  'endif'#010+
+  #010+
+  '# Detect NT - NT sets OS to Windows_NT',#010+
+  'ifndef inlinux'#010+
+  'ifeq ($(OS),Windows_NT)'#010+
+  'inWinNT=1'#010+
+  'endif'#010+
+  'endif'#010+
+  #010+
+  '# Detect OS/2 - OS/2 has OS2_SHELL defined'#010+
+  'ifndef inlinux'#010+
+  'ifndef inWinNT'#010+
+  'ifdef OS2_SHELL'#010+
+  'inOS2=1'#010+
+  'endif'#010+
+  'endif'#010+
+  'endif'#010+
+  #010+
+  '# The extension of executables'#010+
+  'ifdef inlinux'#010+
+  'EXEEXT='#010+
+  'else'#010+
+  'EXE','EXT=.exe'#010+
+  'endif'#010+
+  #010+
+  '# The path which is search separated by spaces'#010+
+  'ifdef inlinux'#010+
+  'SEARCHPATH=$(subst :, ,$(PATH))'#010+
+  'else'#010+
+  'SEARCHPATH=$(subst ;, ,$(PATH))'#010+
+  'endif'#010+
+  #010+
+  '[defaulttarget]'#010+
+  '#####################################################################'#010+
+  '#',' Default target'#010+
+  '#####################################################################'#010+
+  #010+
+  '[fpcdetect]'#010+
+  '#####################################################################'#010+
+  '# FPC version/target Detection'#010+
+  '########################################','############################'+
+  '#'#010+
+  #010+
+  '# What compiler to use ?'#010+
+  'ifndef FPC'#010+
+  'ifdef inOS2'#010+
+  'export FPC=ppos2$(EXEEXT)'#010+
+  'else'#010+
+  'export FPC=ppc386$(EXEEXT)'#010+
+  'endif'#010+
+  'endif'#010+
+  #010+
+  '# Target OS'#010+
+  'ifndef OS_TARGET'#010+
+  'export OS_TARGET:=$(shell $(FPC) -iTO)'#010+
+  'endif'#010+
+  #010+
+  '# Source OS'#010+
+  'ifn','def OS_SOURCE'#010+
+  'export OS_SOURCE:=$(shell $(FPC) -iSO)'#010+
+  'endif'#010+
+  #010+
+  '# Target CPU'#010+
+  'ifndef CPU_TARGET'#010+
+  'export CPU_TARGET:=$(shell $(FPC) -iTP)'#010+
+  'endif'#010+
+  #010+
+  '# Source CPU'#010+
+  'ifndef CPU_SOURCE'#010+
+  'export CPU_SOURCE:=$(shell $(FPC) -iSP)'#010+
+  'endif'#010+
+  #010+
+  '# FPC version'#010+
+  'ifndef FPC','_VERSION'#010+
+  'export FPC_VERSION:=$(shell $(FPC) -iV)'#010+
+  'endif'#010+
+  #010+
+  #010+
+  '[defaultsettings]'#010+
+  '#####################################################################'#010+
+  '# Default Settings'#010+
+  '#####################################################################'#010+
+  #010+
+  '# Rel','ease ? Then force OPT and don'#039't use extra opts via commandl'+
+  'ine'#010+
+  'ifdef RELEASE'#010+
+  'override OPT:=-Xs -OG2p3 -n'#010+
+  'endif'#010+
+  #010+
+  '# Verbose settings (warning,note,info)'#010+
+  'ifdef VERBOSE'#010+
+  'override OPT+=-vwni'#010+
+  'endif'#010+
+  #010+
+  #010+
+  '[usersettings]'#010+
+  '################################','####################################'+
+  '#'#010+
+  '# User Settings'#010+
+  '#####################################################################'#010+
+  #010+
+  #010+
+  '[dir_default]'#010+
+  '#####################################################################'#010+
+  '# Default Directories'#010+
+  '########','############################################################'+
+  '#'#010+
+  #010+
+  '# Base dir'#010+
+  'ifdef PWD'#010+
+  'BASEDIR:=$(shell $(PWD))'#010+
+  'else'#010+
+  'BASEDIR=.'#010+
+  'endif'#010+
+  #010+
+  '# this can be set to '#039'rtl'#039' when the RTL units are installed'#010+
+  'ifndef UNITPREFIX'#010+
+  'UNITPREFIX=units'#010+
+  'endif'#010+
+  #010+
+  '# set t','he prefix directory where to install everything'#010+
+  'ifndef PREFIXINSTALLDIR'#010+
+  'ifdef inlinux'#010+
+  'export PREFIXINSTALLDIR=/usr'#010+
+  'else'#010+
+  'export PREFIXINSTALLDIR=/pp'#010+
+  'endif'#010+
+  'endif'#010+
+  #010+
+  #010+
+  '[dir_install]'#010+
+  '################################################################','####'+
+  '#'#010+
+  '# Install Directories'#010+
+  '#####################################################################'#010+
+  #010+
+  '# set the base directory where to install everything'#010+
+  'ifndef BASEINSTALLDIR'#010+
+  'ifdef inlinux'#010+
+  'BASEINSTALLDIR=$(PREFIXINSTALLDIR)/lib/fpc/$(FPC_VER','SION)'#010+
+  'else'#010+
+  'BASEINSTALLDIR=$(PREFIXINSTALLDIR)'#010+
+  'endif'#010+
+  'endif'#010+
+  #010+
+  '# set the directory where to install the binaries'#010+
+  'ifndef BININSTALLDIR'#010+
+  'ifdef inlinux'#010+
+  'BININSTALLDIR=$(PREFIXINSTALLDIR)/bin'#010+
+  'else'#010+
+  'BININSTALLDIR=$(BASEINSTALLDIR)/bin/$(OS_TARGET)'#010+
+  'endi','f'#010+
+  'endif'#010+
+  #010+
+  '# set the directory where to install the units.'#010+
+  'ifndef UNITINSTALLDIR'#010+
+  'UNITINSTALLDIR=$(BASEINSTALLDIR)/$(UNITPREFIX)/$(OS_TARGET)'#010+
+  'endif'#010+
+  #010+
+  '# Where to install shared libraries'#010+
+  'ifndef LIBINSTALLDIR'#010+
+  'ifdef inlinux'#010+
+  'LIBINSTALLDIR=$(PREFIXI','NSTALLDIR)/lib'#010+
+  'else'#010+
+  'LIBINSTALLDIR=$(UNITINSTALLDIR)'#010+
+  'endif'#010+
+  'endif'#010+
+  #010+
+  '# Where the source files will be stored'#010+
+  'ifndef SOURCEINSTALLDIR'#010+
+  'ifdef inlinux'#010+
+  'SOURCEINSTALLDIR=$(PREFIXINSTALLDIR)/src/fpc-$(FPC_VERSION)'#010+
+  'else'#010+
+  'SOURCEINSTALLDIR=$(BASEINSTALLDI','R)/source'#010+
+  'endif'#010+
+  'endif'#010+
+  #010+
+  '# Where the doc files will be stored'#010+
+  'ifndef DOCINSTALLDIR'#010+
+  'ifdef inlinux'#010+
+  'DOCINSTALLDIR=$(PREFIXINSTALLDIR)/doc/fpc/$(FPC_VERSION)'#010+
+  'else'#010+
+  'DOCINSTALLDIR=$(BASEINSTALLDIR)/doc'#010+
+  'endif'#010+
+  'endif'#010+
+  #010+
+  '# Where the some extra (data)files',' will be stored'#010+
+  'ifndef EXTRAINSTALLDIR'#010+
+  'EXTRAINSTALLDIR=$(BASEINSTALLDIR)'#010+
+  'endif'#010+
+  #010+
+  #010+
+  #010+
+  '[dir_gcclib]'#010+
+  '# On linux, try to find where libgcc.a is.'#010+
+  'ifdef inlinux'#010+
+  'ifndef GCCLIBDIR'#010+
+  'export GCCLIBDIR:=$(shell dirname `(gcc -v 2>&1)| head -n 1| awk '#039'{'+
+  ' pri','nt $$4 } '#039'`)'#010+
+  'endif'#010+
+  'endif'#010+
+  #010+
+  #010+
+  '[dir_otherlib]'#010+
+  '# Where to find other libraries'#010+
+  'ifdef inlinux'#010+
+  'ifndef OTHERLIBDIR'#010+
+  'export OTHERLIBDIR:=$(shell grep -v "^\#" /etc/ld.so.conf | awk '#039'{'+
+  ' ORS=" "; print $1 }'#039')'#010+
+  'endif'#010+
+  'endif'#010+
+  #010+
+  #010+
+  '[command_begin]'#010+
+  '##############','######################################################'+
+  '#'#010+
+  '# Compiler Command Line'#010+
+  '#####################################################################'#010+
+  #010+
+  '# Load commandline OPTDEF and add FPC_CPU define'#010+
+  'override FPCOPTDEF:=-d$(CPU_TARGET)'#010+
+  #010+
+  '# L','oad commandline OPT and add target and unit dir to be sure'#010+
+  'ifneq ($(OS_TARGET),$(OS_SOURCE))'#010+
+  'override FPCOPT+=-T$(OS_TARGET)'#010+
+  'endif'#010+
+  #010+
+  '[command_needopt]'#010+
+  'ifdef NEEDOPT'#010+
+  'override FPCOPT+=$(NEEDOPT)'#010+
+  'endif'#010+
+  #010+
+  '[command_fpcdir]'#010+
+  '# RTL first and then Uni','t dir (a unit can override RTLunit). Don'#039+
+  't add the'#010+
+  '# dirs if fpcdir=. which can be used for the rtl makefiles'#010+
+  'ifdef FPCDIR'#010+
+  'ifneq ($(FPCDIR),.)'#010+
+  'override FPCOPT+=-Fu$(FPCDIR)/rtl/$(OS_TARGET) -Fu$(FPCDIR)/units/$(OS'+
+  '_TARGET)'#010+
+  'endif'#010+
+  'endif'#010+
+  #010+
+  '[comm','and_needunit]'#010+
+  'ifdef NEEDUNITDIR'#010+
+  'override FPCOPT+=$(addprefix -Fu,$(NEEDUNITDIR))'#010+
+  'endif'#010+
+  #010+
+  '[command_needlib]'#010+
+  'ifdef NEEDLIBDIR'#010+
+  'override FPCOPT+=$(addprefix -Fl,$(NEEDLIBDIR))'#010+
+  'endif'#010+
+  #010+
+  '[command_needobj]'#010+
+  'ifdef NEEDOBJDIR'#010+
+  'override FPCOPT+=$(addprefi','x -Fo,$(NEEDOBJDIR))'#010+
+  'endif'#010+
+  #010+
+  '[command_needinc]'#010+
+  'ifdef NEEDINCDIR'#010+
+  'override FPCOPT+=$(addprefix -Fi,$(NEEDINCDIR))'#010+
+  'endif'#010+
+  #010+
+  '[command_gcclib]'#010+
+  '# Add GCC lib path if asked'#010+
+  'ifdef GCCLIBDIR'#010+
+  'override FPCOPT+=-Fl$(GCCLIBDIR)'#010+
+  'endif'#010+
+  #010+
+  '[command_otherlib]'#010+
+  '# ','Add Other dirs path if asked'#010+
+  'ifdef OTHERLIBDIR'#010+
+  'override FPCOPT+=$(addprefix -Fl,$(OTHERLIBDIR))'#010+
+  'endif'#010+
+  #010+
+  '[command_target]'#010+
+  '# Target dirs'#010+
+  'ifdef TARGETDIR'#010+
+  'override FPCOPT+=-FE$(TARGETDIR)'#010+
+  'endif'#010+
+  #010+
+  '[command_unittarget]'#010+
+  'ifdef UNITTARGETDIR'#010+
+  'override ','FPCOPT+=-FU$(UNITTARGETDIR)'#010+
+  'endif'#010+
+  #010+
+  '[command_smartlink]'#010+
+  '# Smartlinking'#010+
+  'ifdef SMARTLINK'#010+
+  'override FPCOPT+=-CX'#010+
+  'endif'#010+
+  #010+
+  '[command_end]'#010+
+  '# Add commandline options'#010+
+  'ifdef OPT'#010+
+  'override FPCOPT+=$(OPT)'#010+
+  'endif'#010+
+  'ifdef UNITDIR'#010+
+  'override FPCOPT+=$(addprefix -Fu',',$(UNITDIR))'#010+
+  'endif'#010+
+  'ifdef LIBDIR'#010+
+  'override FPCOPT+=$(addprefix -Fl,$(LIBDIR))'#010+
+  'endif'#010+
+  'ifdef OBJDIR'#010+
+  'override FPCOPT+=$(addprefix -Fo,$(OBJDIR))'#010+
+  'endif'#010+
+  'ifdef INCDIR'#010+
+  'override FPCOPT+=$(addprefix -Fi,$(INCDIR))'#010+
+  'endif'#010+
+  #010+
+  '# Add defines from FPCOPTDEF to',' FPCOPT'#010+
+  'ifdef FPCOPTDEF'#010+
+  'override FPCOPT+=$(FPCOPTDEF)'#010+
+  'endif'#010+
+  #010+
+  '# Was a config file specified ?'#010+
+  'ifdef CFGFILE'#010+
+  'override FPCOPT+=@$(CFGFILE)'#010+
+  'endif'#010+
+  #010+
+  'override COMPILER=$(FPC) $(FPCOPT)'#010+
+  #010+
+  #010+
+  '[shelltools]'#010+
+  '###############################################','#####################'+
+  '#'#010+
+  '# Shell tools'#010+
+  '#####################################################################'#010+
+  #010+
+  '# To copy pograms'#010+
+  'ifndef COPY'#010+
+  'export COPY:=cp -fp'#010+
+  'endif'#010+
+  #010+
+  '# To move pograms'#010+
+  'ifndef MOVE'#010+
+  'export MOVE:=mv -f'#010+
+  'endif'#010+
+  #010+
+  '# Check delete prog','ram'#010+
+  'ifndef DEL'#010+
+  'export DEL:=rm -f'#010+
+  'endif'#010+
+  #010+
+  '# Check deltree program'#010+
+  'ifndef DELTREE'#010+
+  'export DELTREE:=rm -rf'#010+
+  'endif'#010+
+  #010+
+  '# To install files'#010+
+  'ifndef INSTALL'#010+
+  'ifdef inlinux'#010+
+  'export INSTALL:=install -m 644'#010+
+  'else'#010+
+  'export INSTALL:=$(COPY)'#010+
+  'endif'#010+
+  'endif'#010+
+  #010+
+  '# To insta','ll programs'#010+
+  'ifndef INSTALLEXE'#010+
+  'ifdef inlinux'#010+
+  'export INSTALLEXE:=install -m 755'#010+
+  'else'#010+
+  'export INSTALLEXE:=$(COPY)'#010+
+  'endif'#010+
+  'endif'#010+
+  #010+
+  '# To make a directory.'#010+
+  'ifndef MKDIR'#010+
+  'ifdef inlinux'#010+
+  'export MKDIR:=install -m 755 -d'#010+
+  'else'#010+
+  'export MKDIR:=ginstall -m 755 ','-d'#010+
+  'endif'#010+
+  'endif'#010+
+  #010+
+  #010+
+  '[tool_default]'#010+
+  '#####################################################################'#010+
+  '# Default Tools'#010+
+  '#####################################################################'#010+
+  #010+
+  '# assembler, redefine it if cross compiling'#010+
+  'ifndef ','AS'#010+
+  'AS=as'#010+
+  'endif'#010+
+  #010+
+  '# linker, but probably not used'#010+
+  'ifndef LD'#010+
+  'LD=ld'#010+
+  'endif'#010+
+  #010+
+  '# ppas.bat / ppas.sh'#010+
+  'ifdef inlinux'#010+
+  'PPAS=ppas.sh'#010+
+  'else'#010+
+  'ifdef inOS2'#010+
+  'PPAS=ppas.cmd'#010+
+  'else'#010+
+  'PPAS=ppas.bat'#010+
+  'endif'#010+
+  'endif'#010+
+  #010+
+  '# also call ppas if with command option -s'#010+
+  'ifeq (,$(findst','ring -s ,$(COMPILER)))'#010+
+  'EXECPPAS='#010+
+  'else'#010+
+  'EXECPPAS=@$(PPAS)'#010+
+  'endif'#010+
+  #010+
+  '# ldconfig to rebuild .so cache'#010+
+  'ifdef inlinux'#010+
+  'LDCONFIG=ldconfig'#010+
+  'else'#010+
+  'LDCONFIG='#010+
+  'endif'#010+
+  #010+
+  '# echo'#010+
+  'ifndef ECHO'#010+
+  'ECHO:=$(strip $(wildcard $(addsuffix /echo$(EXEEXT),$(SEARCHPATH))))'#010+
+  'ife','q ($(ECHO),)'#010+
+  'export ECHO:=echo'#010+
+  'else'#010+
+  'export ECHO:=$(firstword $(ECHO))'#010+
+  'endif'#010+
+  'endif'#010+
+  #010+
+  #010+
+  '[tool_ppdep]'#010+
+  '# ppdep'#010+
+  'ifndef PPDEP'#010+
+  'PPDEP:=$(strip $(wildcard $(addsuffix /ppdep$(EXEEXT),$(SEARCHPATH))))'+
+  #010+
+  'ifeq ($(PPDEP),)'#010+
+  'PPDEP='#010+
+  'else'#010+
+  'export PPDEP:=$(firstw','ord $(PPDEP))'#010+
+  'endif'#010+
+  'endif'#010+
+  #010+
+  '[tool_ppumove]'#010+
+  '# ppumove'#010+
+  'ifndef PPUMOVE'#010+
+  'PPUMOVE:=$(strip $(wildcard $(addsuffix /ppumove$(EXEEXT),$(SEARCHPATH'+
+  '))))'#010+
+  'ifeq ($(PPUMOVE),)'#010+
+  'PPUMOVE='#010+
+  'else'#010+
+  'export PPUMOVE:=$(firstword $(PPUMOVE))'#010+
+  'endif'#010+
+  'endif'#010+
+  #010+
+  '[tool_ppufil','es]'#010+
+  '# ppufiles'#010+
+  'ifndef PPUFILES'#010+
+  'PPUFILES:=$(strip $(wildcard $(addsuffix /ppufiles$(EXEEXT),$(SEARCHPA'+
+  'TH))))'#010+
+  'ifeq ($(PPUFILES),)'#010+
+  'PPUFILES='#010+
+  'else'#010+
+  'export PPUFILES:=$(firstword $(PPUFILES))'#010+
+  'endif'#010+
+  'endif'#010+
+  #010+
+  '[tool_data2inc]'#010+
+  '# data2inc'#010+
+  'ifndef DATA2INC',#010+
+  'DATA2INC:=$(strip $(wildcard $(addsuffix /data2inc$(EXEEXT),$(SEARCHPA'+
+  'TH))))'#010+
+  'ifeq ($(DATA2INC),)'#010+
+  'DATA2INC='#010+
+  'else'#010+
+  'export DATA2INC:=$(firstword $(DATA2INC))'#010+
+  'endif'#010+
+  'endif'#010+
+  #010+
+  '[tool_diff]'#010+
+  '# diff'#010+
+  'ifndef DIFF'#010+
+  'DIFF:=$(strip $(wildcard $(addsuffix /dif','f$(EXEEXT),$(SEARCHPATH))))'+
+  #010+
+  'ifeq ($(DIFF),)'#010+
+  'DIFF='#010+
+  'else'#010+
+  'export DIFF:=$(firstword $(DIFF))'#010+
+  'endif'#010+
+  'endif'#010+
+  #010+
+  '[tool_cmp]'#010+
+  '# cmp'#010+
+  'ifndef CMP'#010+
+  'CMP:=$(strip $(wildcard $(addsuffix /cmp$(EXEEXT),$(SEARCHPATH))))'#010+
+  'ifeq ($(CMP),)'#010+
+  'CMP='#010+
+  'else'#010+
+  'export CMP:=$(firs','tword $(CMP))'#010+
+  'endif'#010+
+  'endif'#010+
+  #010+
+  '[tool_sed]'#010+
+  '# Sed'#010+
+  'ifndef SED'#010+
+  'SED:=$(strip $(wildcard $(addsuffix /sed$(EXEEXT),$(SEARCHPATH))))'#010+
+  'ifeq ($(SED),)'#010+
+  'SED='#010+
+  'else'#010+
+  'export SED:=$(firstword $(SED))'#010+
+  'endif'#010+
+  'endif'#010+
+  #010+
+  '[tool_upx]'#010+
+  '# Look if UPX is found for go32v2 and',' win32. We can'#039't use $UPX b'+
+  'ecuase'#010+
+  '# upx uses that one itself (PFV)'#010+
+  'ifndef UPXPROG'#010+
+  'ifeq ($(OS_TARGET),go32v2)'#010+
+  'UPXPROG:=1'#010+
+  'endif'#010+
+  'ifeq ($(OS_TARGET),win32)'#010+
+  'UPXPROG:=1'#010+
+  'endif'#010+
+  'ifdef UPXPROG'#010+
+  'UPXPROG:=$(strip $(wildcard $(addsuffix /upx$(EXEEXT),$(S','EARCHPATH))'+
+  '))'#010+
+  'ifeq ($(UPXPROG),)'#010+
+  'UPXPROG='#010+
+  'else'#010+
+  'export UPXPROG:=$(firstword $(UPXPROG))'#010+
+  'endif'#010+
+  'else'#010+
+  'UPXPROG='#010+
+  'endif'#010+
+  'endif'#010+
+  #010+
+  '[tool_date]'#010+
+  '# gdate/date'#010+
+  'ifndef DATE'#010+
+  'DATE:=$(strip $(wildcard $(addsuffix /date$(EXEEXT),$(SEARCHPATH))))'#010+
+  'ifeq ($(DATE),',')'#010+
+  'DATE:=$(strip $(wildcard $(addsuffix /gdate$(EXEEXT),$(SEACHPATH))))'#010+
+  'ifeq ($(DATE),)'#010+
+  'DATE='#010+
+  'else'#010+
+  'export DATE:=$(firstword $(DATE))'#010+
+  'endif'#010+
+  'else'#010+
+  'export DATE:=$(firstword $(DATE))'#010+
+  'endif'#010+
+  'endif'#010+
+  #010+
+  'ifdef DATE'#010+
+  'DATESTR:=$(shell $(DATE) +%Y%m%d)'#010+
+  'else'#010,
+  'DATESTR='#010+
+  'endif'#010+
+  #010+
+  '[tool_zip]'#010+
+  '# ZipProg, you can'#039't use Zip as the var name (PFV)'#010+
+  'ifndef ZIPPROG'#010+
+  'ZIPPROG:=$(strip $(wildcard $(addsuffix /zip$(EXEEXT),$(SEARCHPATH))))'+
+  #010+
+  'ifeq ($(ZIPPROG),)'#010+
+  'ZIPPROG='#010+
+  'else'#010+
+  'export ZIPPROG:=$(firstword $(ZIPPROG)) -D9',' -r'#010+
+  'endif'#010+
+  'endif'#010+
+  #010+
+  'ifndef ZIPEXT'#010+
+  'ZIPEXT=.zip'#010+
+  'endif'#010+
+  #010+
+  #010+
+  '[extensions]'#010+
+  '#####################################################################'#010+
+  '# Default extensions'#010+
+  '#####################################################################'#010+
+  #010+
+  '# Default need','ed extensions (Go32v2,Linux)'#010+
+  'LOADEREXT=.as'#010+
+  'PPLEXT=.ppl'#010+
+  'PPUEXT=.ppu'#010+
+  'OEXT=.o'#010+
+  'ASMEXT=.s'#010+
+  'SMARTEXT=.sl'#010+
+  'STATICLIBEXT=.a'#010+
+  'SHAREDLIBEXT=.so'#010+
+  'PACKAGESUFFIX='#010+
+  #010+
+  '# Go32v1'#010+
+  'ifeq ($(OS_TARGET),go32v1)'#010+
+  'PPUEXT=.pp1'#010+
+  'OEXT=.o1'#010+
+  'ASMEXT=.s1'#010+
+  'SMARTEXT=.sl1'#010+
+  'STATICLIBEX','T=.a1'#010+
+  'SHAREDLIBEXT=.so1'#010+
+  'PACKAGESUFFIX=v1'#010+
+  'endif'#010+
+  #010+
+  '# Go32v2'#010+
+  'ifeq ($(OS_TARGET),go32v2)'#010+
+  'PACKAGESUFFIX=go32'#010+
+  'endif'#010+
+  #010+
+  '# Linux'#010+
+  'ifeq ($(OS_TARGET),linux)'#010+
+  'PACKAGESUFFIX=linux'#010+
+  'endif'#010+
+  #010+
+  '# Win32'#010+
+  'ifeq ($(OS_TARGET),win32)'#010+
+  'PPUEXT=.ppw'#010+
+  'OEXT=.ow'#010+
+  'ASMEXT=.sw'#010+
+  'SMA','RTEXT=.slw'#010+
+  'STATICLIBEXT=.aw'#010+
+  'SHAREDLIBEXT=.dll'#010+
+  'PACKAGESUFFIX=win32'#010+
+  'endif'#010+
+  #010+
+  '# OS/2'#010+
+  'ifeq ($(OS_TARGET),os2)'#010+
+  'PPUEXT=.ppo'#010+
+  'ASMEXT=.so2'#010+
+  'OEXT=.oo2'#010+
+  'SMARTEXT=.so'#010+
+  'STATICLIBEXT=.ao2'#010+
+  'SHAREDLIBEXT=.dll'#010+
+  'PACKAGESUFFIX=os2'#010+
+  'endif'#010+
+  #010+
+  '# library prefix'#010+
+  'LIBPREFIX=l','ib'#010+
+  'ifeq ($(OS_TARGET),go32v2)'#010+
+  'LIBPREFIX='#010+
+  'endif'#010+
+  'ifeq ($(OS_TARGET),go32v1)'#010+
+  'LIBPREFIX='#010+
+  'endif'#010+
+  #010+
+  '# determine which .pas extension is used'#010+
+  'ifndef PASEXT'#010+
+  'ifdef EXEOBJECTS'#010+
+  'override TESTPAS:=$(strip $(wildcard $(addsuffix .pas,$(firstword $(EX'+
+  'EOBJEC','TS)))))'#010+
+  'else'#010+
+  'override TESTPAS:=$(strip $(wildcard $(addsuffix .pas,$(firstword $(UN'+
+  'ITOBJECTS)))))'#010+
+  'endif'#010+
+  'ifeq ($(TESTPAS),)'#010+
+  'PASEXT=.pp'#010+
+  'else'#010+
+  'PASEXT=.pas'#010+
+  'endif'#010+
+  'endif'#010+
+  #010+
+  #010+
+  '[defaultrules]'#010+
+  '############################################################','########'+
+  '#'#010+
+  '# Default rules'#010+
+  '#####################################################################'#010+
+  #010+
+  '.PHONY: defaultrule all smart shared \'#010+
+  '        showinstall install zipinstall zipinstalladd \'#010+
+  '        clean cleanall depend info'#010+
+  #010+
+  #010+
+  '[compilerule','s]'#010+
+  '#####################################################################'#010+
+  '# General compile rules'#010+
+  '#####################################################################'#010+
+  #010+
+  '.PHONY: fpc_all fpc_units fpc_exes fpc_loaders'#010+
+  #010+
+  '# Create Filenames'#010+
+  'ifdef',' LOADEROBJECTS'#010+
+  'LOADEROFILES=$(addsuffix $(OEXT),$(LOADEROBJECTS))'#010+
+  'endif'#010+
+  'ifdef EXEOBJECTS'#010+
+  'EXEFILES=$(addsuffix $(EXEEXT),$(EXEOBJECTS))'#010+
+  'EXEOFILES=$(addsuffix $(OEXT),$(EXEOBJECTS))'#010+
+  'endif'#010+
+  'ifdef UNITOBJECTS'#010+
+  'UNITPPUFILES=$(addsuffix $(PPUEXT),$','(UNITOBJECTS))'#010+
+  'endif'#010+
+  #010+
+  '.SUFFIXES: $(EXEEXT) $(PPUEXT) $(OEXT) .pas .pp'#010+
+  #010+
+  'ifdef DEFAULTUNITS'#010+
+  'fpc_all: fpc_loaders fpc_units'#010+
+  'else'#010+
+  'fpc_all: fpc_loaders fpc_units fpc_exes'#010+
+  'endif'#010+
+  #010+
+  'fpc_loaders: $(LOADEROFILES)'#010+
+  #010+
+  'fpc_units: $(UNITPPUFILES)'#010+
+  #010+
+  'fpc_exes:',' $(EXEFILES)'#010+
+  #010+
+  '# General compile rules, available for both possible PASEXT'#010+
+  '%$(PPUEXT): %.pp'#010+
+  '        $(COMPILER) $< $(REDIR)'#010+
+  '        $(EXECPASS)'#010+
+  #010+
+  '%$(PPUEXT): %.pas'#010+
+  '        $(COMPILER) $< $(REDIR)'#010+
+  '        $(EXECPASS)'#010+
+  #010+
+  '%$(EXEEXT): %.pp'#010+
+  '        ','$(COMPILER) $< $(REDIR)'#010+
+  '        $(EXECPASS)'#010+
+  #010+
+  '%$(EXEEXT): %.pas'#010+
+  '        $(COMPILER) $< $(REDIR)'#010+
+  '        $(EXECPASS)'#010+
+  #010+
+  '%$(OEXT): %$(LOADEREXT)'#010+
+  '        $(AS) -o $*$(OEXT) $<'#010+
+  #010+
+  #010+
+  '[libraryrules]'#010+
+  '#####################################################','###############'+
+  '#'#010+
+  '# Library'#010+
+  '#####################################################################'#010+
+  #010+
+  '.PHONY: fpc_smart fpc_shared'#010+
+  #010+
+  '# Default sharedlib units are all unit objects'#010+
+  'ifndef SHAREDLIBUNITOBJECTS'#010+
+  'SHAREDLIBUNITOBJECTS=$(UNITOBJECTS)'#010+
+  'e','ndif'#010+
+  #010+
+  'fpc_smart:'#010+
+  '        $(MAKE) all SMARTLINK=1'#010+
+  #010+
+  'fpc_shared: all'#010+
+  'ifdef inlinux'#010+
+  'ifndef LIBNAME'#010+
+  '        @$(ECHO) LIBNAME not set'#010+
+  'else'#010+
+  '        $(PPUMOVE) $(SHAREDLIBUNITOBJECTS) -o$(LIBNAME)'#010+
+  'endif'#010+
+  'else'#010+
+  '        @$(ECHO) Shared Libraries not su','pported'#010+
+  'endif'#010+
+  #010+
+  #010+
+  '[installrules]'#010+
+  '#####################################################################'#010+
+  '# Install rules'#010+
+  '#####################################################################'#010+
+  #010+
+  '.PHONY: fpc_showinstall fpc_install'#010+
+  #010+
+  'ifdef UNITPPUFI','LES'#010+
+  'override INSTALLPPUFILES:=$(UNITPPUFILES)'#010+
+  'endif'#010+
+  'ifdef EXTRAINSTALLUNITS'#010+
+  'override INSTALLPPUFILES+=$(addsuffix $(PPUEXT),$(EXTRAINSTALLUNITS))'#010+
+  'endif'#010+
+  #010+
+  'ifdef INSTALLPPUFILES'#010+
+  'ifdef PPUFILES'#010+
+  'ifdef inlinux'#010+
+  'INSTALLPPULINKFILES=$(shell $(PPUFIL','ES) -S -O $(INSTALLPPUFILES))'#010+
+  'INSTALLPPULIBFILES=$(shell $(PPUFILES) -L $(INSTALLPPUFILES))'#010+
+  'else'#010+
+  'INSTALLPPULINKFILES=$(shell $(PPUFILES) $(INSTALLPPUFILES))'#010+
+  'endif'#010+
+  'endif'#010+
+  'endif'#010+
+  #010+
+  'fpc_showinstall:'#010+
+  'ifndef DEFAULTUNITS'#010+
+  'ifdef EXEOBJECTS'#010+
+  '        @$','(ECHO) $(addprefix "\n"$(BININSTALLDIR)/,$(EXEFILES))'#010+
+  'endif'#010+
+  'endif'#010+
+  'ifdef LOADEROBJECTS'#010+
+  '        @$(ECHO) $(addprefix "\n"$(UNITINSTALLDIR)/,$(LOADEROFILES))'#010+
+  'endif'#010+
+  'ifdef INSTALLPPUFILES'#010+
+  '        @$(ECHO) $(addprefix "\n"$(UNITINSTALLDIR)/,$(INS','TALLPPUFILE'+
+  'S))'#010+
+  'ifneq ($(INSTALLPPULINKFILES),)'#010+
+  '        @$(ECHO) $(addprefix "\n"$(UNITINSTALLDIR)/,$(INSTALLPPULINKFI'+
+  'LES))'#010+
+  'endif'#010+
+  'ifneq ($(INSTALLPPULIBFILES),)'#010+
+  '        @$(ECHO) $(addprefix "\n"$(LIBINSTALLDIR)/,$(INSTALLPPULIBFILE'+
+  'S))'#010+
+  'endif'#010,
+  'endif'#010+
+  'ifdef EXTRAINSTALLFILES'#010+
+  '        @$(ECHO) $(addprefix "\n"$(EXTRAINSTALLDIR)/,$(EXTRAINSTALLFIL'+
+  'ES))'#010+
+  'endif'#010+
+  #010+
+  'fpc_install:'#010+
+  '# Create UnitInstallFiles'#010+
+  'ifndef DEFAULTUNITS'#010+
+  'ifdef EXEOBJECTS'#010+
+  '        $(MKDIR) $(BININSTALLDIR)'#010+
+  '# Compress the exe','s if upx is defined'#010+
+  'ifdef UPXPROG'#010+
+  '        -$(UPXPROG) $(EXEFILES)'#010+
+  'endif'#010+
+  '        $(INSTALLEXE) $(EXEFILES) $(BININSTALLDIR)'#010+
+  'endif'#010+
+  'endif'#010+
+  'ifdef LOADEROBJECTS'#010+
+  '        $(MKDIR) $(UNITINSTALLDIR)'#010+
+  '        $(INSTALL) $(LOADEROFILES) $(UNITINSTALLDI','R)'#010+
+  'endif'#010+
+  'ifdef INSTALLPPUFILES'#010+
+  '        $(MKDIR) $(UNITINSTALLDIR)'#010+
+  '        $(INSTALL) $(INSTALLPPUFILES) $(UNITINSTALLDIR)'#010+
+  'ifneq ($(INSTALLPPULINKFILES),)'#010+
+  '        $(INSTALL) $(INSTALLPPULINKFILES) $(UNITINSTALLDIR)'#010+
+  'endif'#010+
+  'ifneq ($(INSTALLPPUL','IBFILES),)'#010+
+  '        $(MKDIR) $(LIBINSTALLDIR)'#010+
+  '        $(INSTALL) $(INSTALLPPULIBFILES) $(LIBINSTALLDIR)'#010+
+  'endif'#010+
+  'endif'#010+
+  'ifdef EXTRAINSTALLFILES'#010+
+  '        $(MKDIR) $(EXTRAINSTALLDIR)'#010+
+  '        $(INSTALL) $(EXTRAINSTALLFILES) $(EXTRAINSTALLDIR)'#010+
+  'endif'#010,
+  #010+
+  #010+
+  '[zipinstallrules]'#010+
+  '#####################################################################'#010+
+  '# Zip'#010+
+  '#####################################################################'#010+
+  #010+
+  '.PHONY: fpc_zipinstall fpc_zipinstalladd'#010+
+  #010+
+  '# Temporary path to pack a file',#010+
+  'ifndef PACKDIR'#010+
+  'ifndef inlinux'#010+
+  'PACKDIR=pack_tmp'#010+
+  'else'#010+
+  'PACKDIR=/tmp/fpc-pack'#010+
+  'endif'#010+
+  'endif'#010+
+  #010+
+  '# Test dir if none specified'#010+
+  'ifndef PACKAGEDIR'#010+
+  'PACKAGEDIR=$(BASEDIR)'#010+
+  'endif'#010+
+  #010+
+  '# Add .zip/.tar.gz extension'#010+
+  'ifdef ZIPNAME'#010+
+  'ifndef inlinux'#010+
+  'override ZIPNAME:=','$(ZIPNAME)$(ZIPEXT)'#010+
+  'endif'#010+
+  'endif'#010+
+  #010+
+  '# Default target which is call before zipping'#010+
+  'ifndef ZIPTARGET'#010+
+  'ZIPTARGET=install'#010+
+  'endif'#010+
+  #010+
+  '# Note: This will not remove the zipfile first'#010+
+  'fpc_zipinstalladd:'#010+
+  'ifndef ZIPNAME'#010+
+  '        @$(ECHO) Please specify ZIPNAM','E!'#010+
+  '        @exit'#010+
+  'else'#010+
+  '        $(MAKE) $(ZIPTARGET) PREFIXINSTALLDIR=$(PACKDIR)'#010+
+  'ifdef inlinux'#010+
+  '        gzip -d $(PACKAGEDIR)/$(ZIPNAME).tar.gz'#010+
+  '        cd $(PACKDIR) ; tar rv --file $(PACKAGEDIR)/$(ZIPNAME).tar * ;'+
+  ' cd $(BASEDIR)'#010+
+  '        gzip $','(PACKAGEDIR)/$(ZIPNAME).tar'#010+
+  'else'#010+
+  '        cd $(PACKDIR) ; $(ZIPPROG) $(PACKAGEDIR)/$(ZIPNAME) * ; cd $(B'+
+  'ASEDIR)'#010+
+  'endif'#010+
+  '        $(DELTREE) $(PACKDIR)'#010+
+  'endif'#010+
+  #010+
+  '# First remove the zip and then install'#010+
+  'fpc_zipinstall:'#010+
+  'ifndef ZIPNAME'#010+
+  '        @$(ECHO',') Please specify ZIPNAME!'#010+
+  '        @exit'#010+
+  'else'#010+
+  '        $(DEL) $(PACKAGEDIR)/$(ZIPNAME)'#010+
+  '        $(MAKE) $(ZIPTARGET) PREFIXINSTALLDIR=$(PACKDIR)'#010+
+  'ifdef inlinux'#010+
+  '        cd $(PACKDIR) ; tar cvz --file $(PACKAGEDIR)/$(ZIPNAME).tar.gz'+
+  ' * ; cd $(BASE','DIR)'#010+
+  'else'#010+
+  '        cd $(PACKDIR) ; $(ZIPPROG) $(PACKAGEDIR)/$(ZIPNAME) * ; cd $(B'+
+  'ASEDIR)'#010+
+  'endif'#010+
+  '        $(DELTREE) $(PACKDIR)'#010+
+  'endif'#010+
+  #010+
+  #010+
+  '[cleanrules]'#010+
+  '#####################################################################'#010+
+  '# Clean rules'#010+
+  '###########','#########################################################'+
+  '#'#010+
+  #010+
+  '.PHONY: fpc_clean fpc_cleanall'#010+
+  #010+
+  'ifdef UNITPPUFILES'#010+
+  'override CLEANPPUFILES=$(UNITPPUFILES)'#010+
+  'endif'#010+
+  'ifdef EXTRACLEANUNITS'#010+
+  'override CLEANPPUFILES+=$(addsuffix $(PPUEXT),$(EXTRACLEANUNIT','S))'#010+
+  'endif'#010+
+  #010+
+  'fpc_clean:'#010+
+  'ifdef EXEOBJECTS'#010+
+  '        -$(DEL) $(EXEFILES) $(EXEOFILES)'#010+
+  'endif'#010+
+  'ifdef LOADEROBJECTS'#010+
+  '        -$(DEL) $(LOADEROFILES)'#010+
+  'endif'#010+
+  'ifdef CLEANPPUFILES'#010+
+  '        -$(DEL) $(CLEANPPUFILES)'#010+
+  'ifdef PPUFILES'#010+
+  '        -$(DEL) $(shell $(PP','UFILES) $(CLEANPPUFILES))'#010+
+  'endif'#010+
+  'endif'#010+
+  'ifdef EXTRACLEANFILES'#010+
+  '        -$(DEL) $(EXTRACLEANFILES)'#010+
+  'endif'#010+
+  '        -$(DEL) $(PPAS) link.res log'#010+
+  #010+
+  'fpc_cleanall:'#010+
+  'ifdef EXEOBJECTS'#010+
+  '        -$(DEL) $(EXEFILES)'#010+
+  'endif'#010+
+  '        -$(DEL) *$(OEXT) *$(PPUEXT) ','*$(ASMEXT) *$(STATICLIBEXT) *$(S'+
+  'HAREDLIBEXT) *$(PPLEXT)'#010+
+  '        -$(DELTREE) *$(SMARTEXT)'#010+
+  '        -$(DEL) $(PPAS) link.res log'#010+
+  #010+
+  #010+
+  '[dependrules]'#010+
+  '#####################################################################'#010+
+  '# Depend rules'#010+
+  '#############','#######################################################'+
+  '#'#010+
+  #010+
+  '.PHONY: fpc_depend'#010+
+  #010+
+  'fpc_depend:'#010+
+  '        $(PPDEP) $(UNITOBJECTS)'#010+
+  #010+
+  #010+
+  '[inforules]'#010+
+  '#####################################################################'#010+
+  '# Info rules'#010+
+  '#####################','###############################################'+
+  '#'#010+
+  #010+
+  '.PHONY: fpc_info fpc_cfginfo fpc_objectinfo fpc_toolsinfo fpc_installi'+
+  'nfo \'#010+
+  '        fpc_dirinfo'#010+
+  #010+
+  'fpc_info: $(FPCINFO)'#010+
+  #010+
+  '[info_cfg]'#010+
+  'fpc_infocfg:'#010+
+  '        @$(ECHO)'#010+
+  '        @$(ECHO)  == Configura','tion info =='#010+
+  '        @$(ECHO)'#010+
+  '        @$(ECHO)  FPC....... $(FPC)'#010+
+  '        @$(ECHO)  Version... $(FPC_VERSION)'#010+
+  '        @$(ECHO)  CPU....... $(CPU_TARGET)'#010+
+  '        @$(ECHO)  Source.... $(OS_SOURCE)'#010+
+  '        @$(ECHO)  Target.... $(OS_TARGET)'#010+
+  '   ','     @$(ECHO)'#010+
+  #010+
+  '[info_dirs]'#010+
+  'fpc_infodirs:'#010+
+  'ifdef inlinux'#010+
+  '        @$(ECHO)'#010+
+  '        @$(ECHO)  == Directory info =='#010+
+  '        @$(ECHO)'#010+
+  'ifdef NEEDGCCLIB'#010+
+  '        @$(ECHO)  GCC library is needed.'#010+
+  'endif'#010+
+  'ifdef NEEDOTHERLIB'#010+
+  '        @$(ECHO)  Other libra','ry is needed.'#010+
+  'endif'#010+
+  '        @$(ECHO)  Basedir......... $(BASEDIR)'#010+
+  '        @$(ECHO)'#010+
+  '        @$(ECHO)  GCC library..... $(GCCLIBDIR)'#010+
+  '        @$(ECHO)  Other library... $(OTHERLIBDIR)'#010+
+  '        @$(ECHO)'#010+
+  'endif'#010+
+  #010+
+  '[info_tools]'#010+
+  'fpc_infotools:'#010+
+  '       ',' @$(ECHO)'#010+
+  '        @$(ECHO)  == Tools info =='#010+
+  '        @$(ECHO)'#010+
+  '        @$(ECHO)  Pwd....... $(PWD)'#010+
+  '        @$(ECHO)  Echo...... $(ECHO)'#010+
+  'ifdef PPDEP'#010+
+  '        @$(ECHO)  PPDep..... $(PPDEP)'#010+
+  'endif'#010+
+  'ifdef PPUMOVE'#010+
+  '        @$(ECHO)  PPUMove... $(PPUM','OVE)'#010+
+  'endif'#010+
+  'ifdef PPUFILES'#010+
+  '        @$(ECHO)  PPUFiles.. $(PPUFILES)'#010+
+  'endif'#010+
+  'ifdef DATA2INC'#010+
+  '        @$(ECHO)  Data2Inc.. $(DATA2INC)'#010+
+  'endif'#010+
+  'ifdef SED'#010+
+  '        @$(ECHO)  Sed....... $(SED)'#010+
+  'endif'#010+
+  'ifdef DATE'#010+
+  '        @$(ECHO)  Date...... $(DATE)'#010+
+  'endif',#010+
+  'ifdef DIFF'#010+
+  '        @$(ECHO)  Diff...... $(DIFF)'#010+
+  'endif'#010+
+  'ifdef CMP'#010+
+  '        @$(ECHO)  Cmp....... $(CMP)'#010+
+  'endif'#010+
+  'ifdef UPXPROG'#010+
+  '        @$(ECHO)  Upx....... $(UPXPROG)'#010+
+  'endif'#010+
+  'ifdef ZIPPROG'#010+
+  '        @$(ECHO)  Zip....... $(ZIPPROG)'#010+
+  'endif'#010+
+  '        @$(EC','HO)'#010+
+  #010+
+  '[info_objects]'#010+
+  'fpc_infoobjects:'#010+
+  '        @$(ECHO)'#010+
+  '        @$(ECHO)  == Object info =='#010+
+  '        @$(ECHO)'#010+
+  '        @$(ECHO)  LoaderObjects..... $(LOADEROBJECTS)'#010+
+  '        @$(ECHO)  UnitObjects....... $(UNITOBJECTS)'#010+
+  '        @$(ECHO)  ExeObject','s........ $(EXEOBJECTS)'#010+
+  '        @$(ECHO)'#010+
+  '        @$(ECHO)  ExtraCleanUnits... $(EXTRACLEANUNITS)'#010+
+  '        @$(ECHO)  ExtraCleanFiles... $(EXTRACLEANFILES)'#010+
+  '        @$(ECHO)'#010+
+  '        @$(ECHO)  ExtraInstallUnits. $(EXTRAINSTALLUNITS)'#010+
+  '        @$(E','CHO)  ExtraInstallFiles. $(EXTRAINSTALLFILES)'#010+
+  '        @$(ECHO)'#010+
+  #010+
+  '[info_install]'#010+
+  'fpc_infoinstall:'#010+
+  '        @$(ECHO)'#010+
+  '        @$(ECHO)  == Install info =='#010+
+  '        @$(ECHO)'#010+
+  'ifdef DATE'#010+
+  '        @$(ECHO)  DateStr.............. $(DATESTR)'#010+
+  'endif'#010+
+  '     ','   @$(ECHO)  PackageSuffix........ $(PACKAGESUFFIX)'#010+
+  '        @$(ECHO)'#010+
+  '        @$(ECHO)  BaseInstallDir....... $(BASEINSTALLDIR)'#010+
+  '        @$(ECHO)  BinInstallDir........ $(BININSTALLDIR)'#010+
+  '        @$(ECHO)  LibInstallDir........ $(LIBINSTALLDIR)',#010+
+  '        @$(ECHO)  UnitInstallDir....... $(UNITINSTALLDIR)'#010+
+  '        @$(ECHO)  SourceInstallDir..... $(SOURCEINSTALLDIR)'#010+
+  '        @$(ECHO)  DocInstallDir........ $(DOCINSTALLDIR)'#010+
+  '        @$(ECHO)  ExtraInstallDir...... $(EXTRAINSTALLDIR)'#010+
+  '     ','   @$(ECHO)'#010+
+  #010+
+  '[userrules]'#010+
+  '#####################################################################'#010+
+  '# Users rules'#010+
+  '#####################################################################'#010+
+  #010+
+  ';'#010+
+  '; $Log$
+  '; Revision 1.1  1999-11-23 09:43:35  peter
+  ';   + internal .ini file
+  ';   + packages support
+  ';   * ppufiles,data2inc support
+  ';'#010+
+  ';'#010
+);

+ 180 - 231
utils/fpcmake.ini

@@ -139,6 +139,11 @@ else
 BASEDIR=.
 endif
 
+# this can be set to 'rtl' when the RTL units are installed
+ifndef UNITPREFIX
+UNITPREFIX=units
+endif
+
 # set the prefix directory where to install everything
 ifndef PREFIXINSTALLDIR
 ifdef inlinux
@@ -149,31 +154,68 @@ endif
 endif
 
 
-[dir_rtl]
-# set the directory to the rtl base
-ifndef RTLDIR
-ifdef RTL
-RTLDIR:=$(RTL)/$(OS_TARGET)
+[dir_install]
+#####################################################################
+# Install Directories
+#####################################################################
+
+# set the base directory where to install everything
+ifndef BASEINSTALLDIR
+ifdef inlinux
+BASEINSTALLDIR=$(PREFIXINSTALLDIR)/lib/fpc/$(FPC_VERSION)
+else
+BASEINSTALLDIR=$(PREFIXINSTALLDIR)
+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
+
+# set the directory where to install the units.
+ifndef UNITINSTALLDIR
+UNITINSTALLDIR=$(BASEINSTALLDIR)/$(UNITPREFIX)/$(OS_TARGET)
+endif
+
+# Where to install shared libraries
+ifndef LIBINSTALLDIR
+ifdef inlinux
+LIBINSTALLDIR=$(PREFIXINSTALLDIR)/lib
 else
-RTLDIR:=$(FPCDIR)/rtl/$(OS_TARGET)
+LIBINSTALLDIR=$(UNITINSTALLDIR)
 endif
 endif
 
+# Where the source files will be stored
+ifndef SOURCEINSTALLDIR
+ifdef inlinux
+SOURCEINSTALLDIR=$(PREFIXINSTALLDIR)/src/fpc-$(FPC_VERSION)
+else
+SOURCEINSTALLDIR=$(BASEINSTALLDIR)/source
+endif
+endif
 
-[dir_units]
-# specify where units are.
-ifndef UNITDIR
-ifdef UNITS
-UNITDIR=$(UNITS)/$(OS_TARGET)
+# Where the doc files will be stored
+ifndef DOCINSTALLDIR
+ifdef inlinux
+DOCINSTALLDIR=$(PREFIXINSTALLDIR)/doc/fpc/$(FPC_VERSION)
 else
-UNITDIR=$(FPCDIR)/units/$(OS_TARGET)
+DOCINSTALLDIR=$(BASEINSTALLDIR)/doc
 endif
 endif
-ifeq ($(strip $(wildcard $(UNITDIR)/*)),)
-UNITDIR=
+
+# Where the some extra (data)files will be stored
+ifndef EXTRAINSTALLDIR
+EXTRAINSTALLDIR=$(BASEINSTALLDIR)
 endif
 
 
+
 [dir_gcclib]
 # On linux, try to find where libgcc.a is.
 ifdef inlinux
@@ -264,8 +306,8 @@ endif
 
 [command_smartlink]
 # Smartlinking
-ifeq ($(SMARTLINK),YES)
-override FPCOPT+=-Cx
+ifdef SMARTLINK
+override FPCOPT+=-CX
 endif
 
 [command_end]
@@ -367,16 +409,6 @@ ifndef LD
 LD=ld
 endif
 
-# 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
@@ -413,6 +445,50 @@ endif
 endif
 
 
+[tool_ppdep]
+# ppdep
+ifndef PPDEP
+PPDEP:=$(strip $(wildcard $(addsuffix /ppdep$(EXEEXT),$(SEARCHPATH))))
+ifeq ($(PPDEP),)
+PPDEP=
+else
+export PPDEP:=$(firstword $(PPDEP))
+endif
+endif
+
+[tool_ppumove]
+# ppumove
+ifndef PPUMOVE
+PPUMOVE:=$(strip $(wildcard $(addsuffix /ppumove$(EXEEXT),$(SEARCHPATH))))
+ifeq ($(PPUMOVE),)
+PPUMOVE=
+else
+export PPUMOVE:=$(firstword $(PPUMOVE))
+endif
+endif
+
+[tool_ppufiles]
+# ppufiles
+ifndef PPUFILES
+PPUFILES:=$(strip $(wildcard $(addsuffix /ppufiles$(EXEEXT),$(SEARCHPATH))))
+ifeq ($(PPUFILES),)
+PPUFILES=
+else
+export PPUFILES:=$(firstword $(PPUFILES))
+endif
+endif
+
+[tool_data2inc]
+# data2inc
+ifndef DATA2INC
+DATA2INC:=$(strip $(wildcard $(addsuffix /data2inc$(EXEEXT),$(SEARCHPATH))))
+ifeq ($(DATA2INC),)
+DATA2INC=
+else
+export DATA2INC:=$(firstword $(DATA2INC))
+endif
+endif
+
 [tool_diff]
 # diff
 ifndef DIFF
@@ -506,97 +582,6 @@ ZIPEXT=.zip
 endif
 
 
-[dir_install]
-#####################################################################
-# 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
-
-
 [extensions]
 #####################################################################
 # Default extensions
@@ -685,8 +670,8 @@ endif
 # Default rules
 #####################################################################
 
-.PHONY: defaultrule all staticlib sharedlib showinstall install \
-        staticinstall sharedinstall libinstall zipinstall zipinstalladd \
+.PHONY: defaultrule all smart shared \
+        showinstall install zipinstall zipinstalladd \
         clean cleanall depend info
 
 
@@ -698,12 +683,16 @@ endif
 .PHONY: fpc_all fpc_units fpc_exes fpc_loaders
 
 # Create Filenames
+ifdef LOADEROBJECTS
 LOADEROFILES=$(addsuffix $(OEXT),$(LOADEROBJECTS))
+endif
+ifdef EXEOBJECTS
 EXEFILES=$(addsuffix $(EXEEXT),$(EXEOBJECTS))
 EXEOFILES=$(addsuffix $(OEXT),$(EXEOBJECTS))
+endif
+ifdef UNITOBJECTS
 UNITPPUFILES=$(addsuffix $(PPUEXT),$(UNITOBJECTS))
-UNITOFILES=$(addsuffix $(OEXT),$(UNITOBJECTS))
-UNITAFILES=$(addsuffix $(STATICLIBEXT),$(UNITOBJECTS))
+endif
 
 .SUFFIXES: $(EXEEXT) $(PPUEXT) $(OEXT) .pas .pp
 
@@ -745,18 +734,17 @@ fpc_exes: $(EXEFILES)
 # Library
 #####################################################################
 
-.PHONY: fpc_staticlib fpc_sharedlib
+.PHONY: fpc_smart fpc_shared
 
 # Default sharedlib units are all unit objects
 ifndef SHAREDLIBUNITOBJECTS
 SHAREDLIBUNITOBJECTS=$(UNITOBJECTS)
 endif
 
-fpc_staticlib:
-        $(MAKE) libsclean
-        $(MAKE) all SMARTLINK=YES
+fpc_smart:
+        $(MAKE) all SMARTLINK=1
 
-fpc_sharedlib: all
+fpc_shared: all
 ifdef inlinux
 ifndef LIBNAME
         @$(ECHO) LIBNAME not set
@@ -773,16 +761,27 @@ endif
 # Install rules
 #####################################################################
 
-.PHONY: fpc_showinstallfiles fpc_install
+.PHONY: fpc_showinstall fpc_install
 
-ifdef UNITOBJECTS
-override UNITINSTALLFILES=$(wildcard $(UNITPPUFILES) $(UNITOFILES) $(UNITAFILES))
+ifdef UNITPPUFILES
+override INSTALLPPUFILES:=$(UNITPPUFILES)
 endif
 ifdef EXTRAINSTALLUNITS
-override EXTRAINSTALLFILES+=$(wildcard $(addsuffix $(OEXT),$(EXTRAINSTALLUNITS)) $(addsuffix $(STATICLIBEXT),$(EXTRAINSTALLUNITS)) $(addsuffix $(PPUEXT),$(EXTRAINSTALLUNITS)))
+override INSTALLPPUFILES+=$(addsuffix $(PPUEXT),$(EXTRAINSTALLUNITS))
+endif
+
+ifdef INSTALLPPUFILES
+ifdef PPUFILES
+ifdef inlinux
+INSTALLPPULINKFILES=$(shell $(PPUFILES) -S -O $(INSTALLPPUFILES))
+INSTALLPPULIBFILES=$(shell $(PPUFILES) -L $(INSTALLPPUFILES))
+else
+INSTALLPPULINKFILES=$(shell $(PPUFILES) $(INSTALLPPUFILES))
+endif
+endif
 endif
 
-fpc_showinstallfiles : all
+fpc_showinstall:
 ifndef DEFAULTUNITS
 ifdef EXEOBJECTS
         @$(ECHO) $(addprefix "\n"$(BININSTALLDIR)/,$(EXEFILES))
@@ -791,11 +790,17 @@ endif
 ifdef LOADEROBJECTS
         @$(ECHO) $(addprefix "\n"$(UNITINSTALLDIR)/,$(LOADEROFILES))
 endif
-ifdef UNITINSTALLFILES
-        @$(ECHO) $(addprefix "\n"$(UNITINSTALLDIR)/,$(UNITINSTALLFILES))
+ifdef INSTALLPPUFILES
+        @$(ECHO) $(addprefix "\n"$(UNITINSTALLDIR)/,$(INSTALLPPUFILES))
+ifneq ($(INSTALLPPULINKFILES),)
+        @$(ECHO) $(addprefix "\n"$(UNITINSTALLDIR)/,$(INSTALLPPULINKFILES))
+endif
+ifneq ($(INSTALLPPULIBFILES),)
+        @$(ECHO) $(addprefix "\n"$(LIBINSTALLDIR)/,$(INSTALLPPULIBFILES))
+endif
 endif
 ifdef EXTRAINSTALLFILES
-        @$(ECHO) $(addprefix "\n"$(UNITINSTALLDIR)/,$(EXTRAINSTALLFILES))
+        @$(ECHO) $(addprefix "\n"$(EXTRAINSTALLDIR)/,$(EXTRAINSTALLFILES))
 endif
 
 fpc_install:
@@ -814,44 +819,22 @@ ifdef LOADEROBJECTS
         $(MKDIR) $(UNITINSTALLDIR)
         $(INSTALL) $(LOADEROFILES) $(UNITINSTALLDIR)
 endif
-ifdef UNITINSTALLFILES
+ifdef INSTALLPPUFILES
         $(MKDIR) $(UNITINSTALLDIR)
-        $(INSTALL) $(UNITINSTALLFILES) $(UNITINSTALLDIR)
+        $(INSTALL) $(INSTALLPPUFILES) $(UNITINSTALLDIR)
+ifneq ($(INSTALLPPULINKFILES),)
+        $(INSTALL) $(INSTALLPPULINKFILES) $(UNITINSTALLDIR)
 endif
-ifdef EXTRAINSTALLFILES
-        $(MKDIR) $(UNITINSTALLDIR)
-        $(INSTALL) $(EXTRAINSTALLFILES) $(UNITINSTALLDIR)
+ifneq ($(INSTALLPPULIBFILES),)
+        $(MKDIR) $(LIBINSTALLDIR)
+        $(INSTALL) $(INSTALLPPULIBFILES) $(LIBINSTALLDIR)
 endif
-
-
-[libinstallrules]
-.PHONY: fpc_staticinstall fpc_sharedinstall fpc_libinstall
-
-fpc_staticinstall: staticlib
-        $(MKDIR) $(STATIC_UNITINSTALLDIR)
-        $(INSTALL) $(UNITINSTALLFILES) $(STATIC_UNITINSTALLDIR)
-        $(MKDIR) $(STATIC_LIBINSTALLDIR)
-        $(INSTALLEXE) *$(STATICLIBEXT) $(STATIC_LIBINSTALLDIR)
-
-fpc_sharedinstall: sharedlib
-        $(MKDIR) $(SHARED_UNITINSTALLDIR)
-ifdef UNITINSTALLFILES
-        $(INSTALL) $(UNITINSTALLFILES) $(SHARED_UNITINSTALLDIR)
-else
-        $(INSTALL) $(UNITOFILES) $(SHARED_UNITINSTALLDIR)
 endif
-        $(MKDIR) $(SHARED_LIBINSTALLDIR)
-        $(INSTALLEXE) *$(SHAREDLIBEXT) $(SHARED_LIBINSTALLDIR)
-
-# Target for the sharedlib install which is not avail for all targets
-ifdef inlinux
-SHAREDINSTALL=sharedinstall
-else
-SHAREDINSTALL=
+ifdef EXTRAINSTALLFILES
+        $(MKDIR) $(EXTRAINSTALLDIR)
+        $(INSTALL) $(EXTRAINSTALLFILES) $(EXTRAINSTALLDIR)
 endif
 
-fpc_libinstall: staticinstall $(SHAREDINSTALL)
-
 
 [zipinstallrules]
 #####################################################################
@@ -925,13 +908,13 @@ endif
 # Clean rules
 #####################################################################
 
-.PHONY: fpc_clean fpc_libsclean fpc_cleanall
+.PHONY: fpc_clean fpc_cleanall
 
-ifdef UNITOBJECTS
-override UNITCLEANFILES=$(wildcard $(UNITPPUFILES) $(UNITOFILES) $(UNITAFILES))
+ifdef UNITPPUFILES
+override CLEANPPUFILES=$(UNITPPUFILES)
 endif
 ifdef EXTRACLEANUNITS
-override EXTRACLEANFILES+=$(wildcard $(addsuffix $(OEXT),$(EXTRACLEANUNITS)) $(addsuffix $(STATICLIBEXT),$(EXTRACLEANUNITS)) $(addsuffix $(PPUEXT),$(EXTRACLEANUNITS)))
+override CLEANPPUFILES+=$(addsuffix $(PPUEXT),$(EXTRACLEANUNITS))
 endif
 
 fpc_clean:
@@ -941,17 +924,17 @@ endif
 ifdef LOADEROBJECTS
         -$(DEL) $(LOADEROFILES)
 endif
-ifdef UNITCLEANFILES
-        -$(DEL) $(UNITCLEANFILES)
+ifdef CLEANPPUFILES
+        -$(DEL) $(CLEANPPUFILES)
+ifdef PPUFILES
+        -$(DEL) $(shell $(PPUFILES) $(CLEANPPUFILES))
+endif
 endif
 ifdef EXTRACLEANFILES
         -$(DEL) $(EXTRACLEANFILES)
 endif
         -$(DEL) $(PPAS) link.res log
 
-fpc_libsclean: clean
-        -$(DEL) *$(STATICLIBEXT) *$(SHAREDLIBEXT) *$(PPLEXT)
-
 fpc_cleanall:
 ifdef EXEOBJECTS
         -$(DEL) $(EXEFILES)
@@ -1020,6 +1003,18 @@ fpc_infotools:
         @$(ECHO)
         @$(ECHO)  Pwd....... $(PWD)
         @$(ECHO)  Echo...... $(ECHO)
+ifdef PPDEP
+        @$(ECHO)  PPDep..... $(PPDEP)
+endif
+ifdef PPUMOVE
+        @$(ECHO)  PPUMove... $(PPUMOVE)
+endif
+ifdef PPUFILES
+        @$(ECHO)  PPUFiles.. $(PPUFILES)
+endif
+ifdef DATA2INC
+        @$(ECHO)  Data2Inc.. $(DATA2INC)
+endif
 ifdef SED
         @$(ECHO)  Sed....... $(SED)
 endif
@@ -1040,7 +1035,7 @@ ifdef ZIPPROG
 endif
         @$(ECHO)
 
-[info_object]
+[info_objects]
 fpc_infoobjects:
         @$(ECHO)
         @$(ECHO)  == Object info ==
@@ -1050,14 +1045,11 @@ fpc_infoobjects:
         @$(ECHO)  ExeObjects........ $(EXEOBJECTS)
         @$(ECHO)
         @$(ECHO)  ExtraCleanUnits... $(EXTRACLEANUNITS)
+        @$(ECHO)  ExtraCleanFiles... $(EXTRACLEANFILES)
+        @$(ECHO)
         @$(ECHO)  ExtraInstallUnits. $(EXTRAINSTALLUNITS)
         @$(ECHO)  ExtraInstallFiles. $(EXTRAINSTALLFILES)
         @$(ECHO)
-        @$(ECHO)  == Unit info ==
-        @$(ECHO)
-        @$(ECHO)  UnitInstallFiles. $(UNITINSTALLFILES)
-        @$(ECHO)  UnitCleanFiles... $(UNITCLEANFILES)
-        @$(ECHO)
 
 [info_install]
 fpc_infoinstall:
@@ -1071,43 +1063,13 @@ endif
         @$(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)  UnitInstallDir....... $(UNITINSTALLDIR)
+        @$(ECHO)  SourceInstallDir..... $(SOURCEINSTALLDIR)
         @$(ECHO)  DocInstallDir........ $(DOCINSTALLDIR)
+        @$(ECHO)  ExtraInstallDir...... $(EXTRAINSTALLDIR)
         @$(ECHO)
 
-[info_files]
-# try to get the files in the currentdir
-PASFILES:=$(wildcard *.pas)
-PPFILES:=$(wildcard *.pp)
-INCFILES:=$(wildcard *.inc)
-MSGFILES:=$(wildcard *.msg)
-ASFILES:=$(wildcard *.as)
-fpc_infofiles:
-        @$(ECHO)
-        @$(ECHO)  == Files info ==
-        @$(ECHO)
-ifdef PASFILES
-        @$(ECHO)  Pas files are $(PASFILES)
-endif
-ifdef PPFILES
-        @$(ECHO)  PP  files are $(PPFILES)
-endif
-ifdef INCFILES
-        @$(ECHO)  Inc files are $(INCFILES)
-endif
-ifdef MSGFILES
-        @$(ECHO)  Msg files are $(MSGFILES)
-endif
-ifdef ASFILES
-        @$(ECHO)  As  files are $(ASFILES)
-endif
-
 [userrules]
 #####################################################################
 # Users rules
@@ -1115,22 +1077,9 @@ endif
 
 ;
 ; $Log$
-; Revision 1.6  1999-11-15 21:48:22  peter
-;   * cleanall cleans also now ppas link.res log
-;
-; Revision 1.5  1999/11/10 22:10:48  peter
-;   * fpcmake updated
-;
-; Revision 1.4  1999/11/08 22:47:04  peter
-;   * remove MAKE call in makefile target
-;
-; 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
-;   * initial version
+; Revision 1.7  1999-11-23 09:43:35  peter
+;   + internal .ini file
+;   + packages support
+;   * ppufiles,data2inc support
 ;
 ;

+ 81 - 21
utils/fpcmake.pp

@@ -22,6 +22,9 @@ uses
   dos,
   sysutils,classes,inifiles;
 
+{ Include default fpcmake.ini }
+{$i fpcmake.inc}
+
 const
   Version='v0.99.13';
   Title='fpcmake '+Version;
@@ -39,6 +42,7 @@ const
   sec_install='install';
   sec_clean='clean';
   sec_dirs='dirs';
+  sec_packages='packages';
   sec_libs='libs';
   sec_targets='targets';
   sec_info='info';
@@ -61,12 +65,15 @@ type
     DefaultCPU,
     DefaultOptions : string;
     DirFpc,
+    DirPackage,
     DirUnit,
     DirLib,
     DirObj,
     DirTarget,
     DirUnitTarget,
     DirInc         : string;
+    PackageFCL     : boolean;
+    Packages       : string;
     LibName,
     LibUnits       : string;
     LibGCC,
@@ -75,8 +82,7 @@ type
     InfoDirs,
     InfoTools,
     InfoInstall,
-    InfoObjects,
-    InfoFiles      : boolean;
+    InfoObjects    : boolean;
     SectionNone,
     SectionCompile,
     SectionDepend,
@@ -89,6 +95,10 @@ type
     SectionDirs,
     SectionTools,
     SectionInfo    : boolean;
+    ToolsPPDep,
+    ToolsPPUMove,
+    ToolsPPUFiles,
+    ToolsData2Inc,
     ToolsSed,
     ToolsDiff,
     ToolsCmp,
@@ -100,9 +110,16 @@ type
     Rules          : TStringList;
   end;
 
+  TMyMemoryStream=class(TMemoryStream)
+  public
+    constructor Create(p:pointer;mysize:integer);
+  end;
+
 var
   userini : TFpcMake;
   fpcini  : TIniFile;
+  IniStream : TMyMemoryStream;
+
 
 {*****************************************************************************
                                      Helpers
@@ -121,6 +138,17 @@ begin
 end;
 
 
+{*****************************************************************************
+                                  TMyMemoryStream
+*****************************************************************************}
+
+constructor TMyMemoryStream.Create(p:pointer;mysize:integer);
+begin
+  inherited Create;
+  SetPointer(p,mysize);
+end;
+
+
 {*****************************************************************************
                                Makefile.fpc reading
 *****************************************************************************}
@@ -170,8 +198,12 @@ begin
      DefaultTarget:=ReadString(sec_defaults,'defaulttarget','');
      DefaultCPU:=ReadString(sec_defaults,'defaultcpu','');
      DefaultOptions:=ReadString(sec_defaults,'defaultoptions','');
+   { packages }
+     Packages:=Readstring(sec_packages,'packages','');
+     PackageFCL:=ReadBool(sec_packages,'fcl',false);
    { dirs }
      DirFpc:=ReadString(sec_dirs,'fpcdir','');
+     DirPackage:=ReadString(sec_dirs,'packagedir','$(FPCDIR)/packages');
      DirUnit:=ReadString(sec_dirs,'unitdir','');
      DirLib:=ReadString(sec_dirs,'libdir','');
      DirObj:=ReadString(sec_dirs,'objdir','');
@@ -184,7 +216,11 @@ begin
      LibGcc:=ReadBool(sec_libs,'libgcc',false);
      LibOther:=ReadBool(sec_libs,'libother',false);
    { tools }
+     ToolsPPDep:=ReadBool(sec_tools,'toolppdep',true);
+     ToolsPPUMove:=ReadBool(sec_tools,'toolppumove',true);
+     ToolsPPUFiles:=ReadBool(sec_tools,'toolppufiles',true);
      ToolsSed:=ReadBool(sec_tools,'toolsed',false);
+     ToolsData2Inc:=ReadBool(sec_tools,'tooldata2inc',false);
      ToolsDiff:=ReadBool(sec_tools,'tooldiff',false);
      ToolsCmp:=ReadBool(sec_tools,'toolcmp',false);
      ToolsUpx:=ReadBool(sec_tools,'toolupx',true);
@@ -223,7 +259,6 @@ begin
      InfoTools:=ReadBool(sec_info,'infotools',false);
      InfoInstall:=ReadBool(sec_info,'infoinstall',true);
      InfoObjects:=ReadBool(sec_info,'infoobjects',true);
-     InfoFiles:=ReadBool(sec_info,'infofiles',false);
    { rules }
      PreSettings:=TStringList.Create;
      ReadSectionRaw('presettings',PreSettings);
@@ -263,10 +298,18 @@ begin
     fn:=ChangeFileExt(paramstr(0),'.ini')
 {$endif}
   else
-   exit;
-
-  Verbose('Opening '+fn);
-  result:=TIniFile.Create(fn);
+   fn:='';
+  if fn='' then
+   begin
+     Verbose('Opening internal ini');
+     IniStream:=TMyMemoryStream.Create(@fpcmakeini,sizeof(fpcmakeini));
+     result:=TIniFile.Create(IniStream);
+   end
+  else
+   begin
+     Verbose('Opening '+fn);
+     result:=TIniFile.Create(fn);
+   end;
 end;
 
 
@@ -452,6 +495,13 @@ begin
         Add('FPCDIR='+userini.dirfpc);
         Add('endif');
       end;
+     if userini.dirpackage<>'' then
+      begin
+        { this dir can be set in the environment, it's more a default }
+        Add('ifndef PACKAGEDIR');
+        Add('PACKAGEDIR='+userini.dirpackage);
+        Add('endif');
+      end;
      if userini.dirunit<>'' then
       Add('override NEEDUNITDIR='+userini.dirunit);
      if userini.dirlib<>'' then
@@ -473,6 +523,15 @@ begin
         Add('endif');
       end;
 
+   { Packages }
+     AddHead('Packages');
+     if userini.Packages<>'' then
+      Add('PACKAGES='+userini.Packages);
+     if userini.PackageFCL then
+      Add('override NEEDUNITDIR+=$(FPCDIR)/fcl/$(OS_TARGET)');
+     if userini.Packages<>'' then
+      Add('override NEEDUNITDIR+=$(addprefix $(PACKAGEDIR)/,$(PACKAGES))');
+
    { Libs }
      AddHead('Libraries');
      if userini.libname<>'' then
@@ -499,8 +558,6 @@ begin
          hs:=hs+'fpc_infoobjects ';
         if userini.infoinstall then
          hs:=hs+'fpc_infoinstall ';
-        if userini.infofiles then
-         hs:=hs+'fpc_infofiles ';
         Add('FPCINFO='+hs);
       end;
 
@@ -517,10 +574,8 @@ begin
      if userini.sectiondirs then
       begin
         AddSection(true,'dir_default');
-        AddSection(true,'dir_rtl');
-        AddSection(true,'dir_units');
-        AddSection(true,'dir_gcclib');
-        AddSection(true,'dir_otherlib');
+        AddSection(userini.libgcc,'dir_gcclib');
+        AddSection(userini.libother,'dir_otherlib');
         AddSection(true,'dir_install');
       end;
 
@@ -532,7 +587,7 @@ begin
         AddSection(true,'command_rtl');
         AddSection(true,'command_needopt');
         AddSection((userini.dirfpc<>''),'command_fpcdir');
-        AddSection((userini.dirunit<>''),'command_needunit');
+        AddSection((userini.dirunit<>'') or (userini.packages<>'') or (userini.packagefcl),'command_needunit');
         AddSection((userini.dirlib<>''),'command_needlib');
         AddSection((userini.dirobj<>''),'command_needobj');
         AddSection((userini.dirinc<>''),'command_needinc');
@@ -550,6 +605,10 @@ begin
       begin
         AddSection(true,'shelltools');
         AddSection(true,'tool_default');
+        AddSection(userini.toolsppdep,'tool_ppdep');
+        AddSection(userini.toolsppumove,'tool_ppumove');
+        AddSection(userini.toolsppufiles,'tool_ppufiles');
+        AddSection(userini.toolsdata2inc,'tool_data2inc');
         AddSection(userini.toolsupx,'tool_upx');
         AddSection(userini.toolssed,'tool_sed');
         AddSection(userini.toolsdate,'tool_date');
@@ -565,13 +624,10 @@ begin
    { add default rules }
      AddSection(true,'defaultrules');
      AddRule('all');
-     AddRule('staticlib');
-     AddRule('sharedlib');
+     AddRule('smart');
+     AddRule('shared');
      AddRule('showinstall');
      AddRule('install');
-     AddRule('staticinstall');
-     AddRule('sharedinstall');
-     AddRule('libinstall');
      AddRule('zipinstall');
      AddRule('zipinstalladd');
      AddRule('clean');
@@ -600,7 +656,6 @@ begin
         AddSection(userini.infotools,'info_tools');
         AddSection(userini.infoobjects,'info_objects');
         AddSection(userini.infoinstall,'info_install');
-        AddSection(userini.infofiles,'info_files');
       end;
 
    { insert users rules }
@@ -639,7 +694,12 @@ begin
 end.
 {
   $Log$
-  Revision 1.6  1999-11-10 22:10:49  peter
+  Revision 1.7  1999-11-23 09:43:35  peter
+    + internal .ini file
+    + packages support
+    * ppufiles,data2inc support
+
+  Revision 1.6  1999/11/10 22:10:49  peter
     * fpcmake updated
 
   Revision 1.5  1999/11/09 14:38:32  peter