diff --git a/utils/fpcmake.inc b/utils/fpcmake.inc deleted file mode 100644 index c14ffcfc5a..0000000000 --- a/utils/fpcmake.inc +++ /dev/null @@ -1,1689 +0,0 @@ -{$ifdef Delphi} -const fpcmakeini : array[0..147] of string[240]=( -{$else Delphi} -const fpcmakeini : array[0..147,1..240] of char=( -{$endif Delphi} - ';'#013#010+ - '; Templates used by fpcmake to create a Makefile from Makefile.fpc'#013+ - #010+ - ';'#013#010+ - #013#010+ - '[osdetect]'#013#010+ - '#####################################################################'#013+ - #010+ - '# Autodetect OS (Linux or Dos or Windows NT or OS/2)'#013#010+ - '# define inUnix when runnin','g under Unix (Linux,FreeBSD)'#013#010+ - '# define inWinNT when running under WinNT'#013#010+ - '# define inOS2 when running under OS/2'#013#010+ - '#####################################################################'#013+ - #010+ - #013#010+ - '# We need only / in the path'#013#010+ - 'override PATH:=$(subst \',',/,$(PATH))'#013#010+ - #013#010+ - '# Search for PWD and determine also if we are under linux'#013#010+ - 'PWD:=$(strip $(wildcard $(addsuffix /pwd.exe,$(subst ;, ,$(PATH)))))'#013+ - #010+ - 'ifeq ($(PWD),)'#013#010+ - 'PWD:=$(strip $(wildcard $(addsuffix /pwd,$(subst :, ,$(PATH)))))'#013#010+ - 'ifeq ($(PWD),)',#013#010+ - 'nopwd:'#013#010+ - ' @echo You need the GNU utils package to use this Makefile!'#013+ - #010+ - ' @echo Get ftp://ftp.freepascal.org/pub/fpc/dist/go32v2/utilgo3'+ - '2.zip'#013#010+ - ' @exit'#013#010+ - 'else'#013#010+ - 'inUnix=1'#013#010+ - 'PWD:=$(firstword $(PWD))'#013#010+ - 'endif'#013#010+ - 'else'#013#010+ - 'PWD:=$(firstwor','d $(PWD))'#013#010+ - 'endif'#013#010+ - #013#010+ - '# Detect NT - NT sets OS to Windows_NT'#013#010+ - '# Detect OS/2 - OS/2 has OS2_SHELL defined'#013#010+ - 'ifndef inUnix'#013#010+ - 'ifeq ($(OS),Windows_NT)'#013#010+ - 'inWinNT=1'#013#010+ - 'else'#013#010+ - 'ifdef OS2_SHELL'#013#010+ - 'inOS2=1'#013#010+ - 'endif'#013#010+ - 'endif'#013#010+ - 'endif'#013#010+ - #013#010+ - '# The extension of executables',#013#010+ - 'ifdef inUnix'#013#010+ - 'SRCEXEEXT='#013#010+ - 'else'#013#010+ - 'SRCEXEEXT=.exe'#013#010+ - 'endif'#013#010+ - #013#010+ - '# The extension of batch files / scripts'#013#010+ - 'ifdef inUnix'#013#010+ - 'BATCHEXT=.sh'#013#010+ - 'else'#013#010+ - 'ifdef inOS2'#013#010+ - 'BATCHEXT=.cmd'#013#010+ - 'else'#013#010+ - 'BATCHEXT=.bat'#013#010+ - 'endif'#013#010+ - 'endif'#013#010+ - #013#010+ - '# Path Separator, the subst trick is nec','essary for the \ that can'#039+ - 't exists'#013#010+ - '# at the end of a line'#013#010+ - 'ifdef inUnix'#013#010+ - 'PATHSEP=/'#013#010+ - 'else'#013#010+ - 'PATHSEP=$(subst /,\,/)'#013#010+ - 'endif'#013#010+ - #013#010+ - '# The path which is searched separated by spaces'#013#010+ - 'ifdef inUnix'#013#010+ - 'SEARCHPATH=$(subst :, ,$(PATH))'#013#010+ - 'else'#013#010+ - 'SEARCHPATH=$(','subst ;, ,$(PATH))'#013#010+ - 'endif'#013#010+ - #013#010+ - '# Base dir'#013#010+ - 'ifdef PWD'#013#010+ - 'BASEDIR:=$(shell $(PWD))'#013#010+ - 'else'#013#010+ - 'BASEDIR=.'#013#010+ - 'endif'#013#010+ - #013#010+ - #013#010+ - '[defaulttarget]'#013#010+ - '#####################################################################'#013+ - #010+ - '# Default target'#013#010+ - '############################','########################################'+ - '#'#013#010+ - #013#010+ - '[fpcdetect]'#013#010+ - '#####################################################################'#013+ - #010+ - '# FPC version/target Detection'#013#010+ - '#####################################################################'#013+ - #010+ - #013#010+ - '# What',' compiler to use ?'#013#010+ - 'ifndef FPC'#013#010+ - '# Compatibility with old makefiles'#013#010+ - 'ifdef PP'#013#010+ - 'FPC=$(PP)'#013#010+ - 'else'#013#010+ - 'FPC=ppc386'#013#010+ - 'endif'#013#010+ - 'endif'#013#010+ - 'override FPC:=$(subst $(SRCEXEEXT),,$(FPC))'#013#010+ - 'override FPC:=$(subst \,/,$(FPC))$(SRCEXEEXT)'#013#010+ - #013#010+ - '# Target OS'#013#010+ - 'ifndef OS_TA','RGET'#013#010+ - 'OS_TARGET:=$(shell $(FPC) -iTO)'#013#010+ - 'endif'#013#010+ - #013#010+ - '# Source OS'#013#010+ - 'ifndef OS_SOURCE'#013#010+ - 'OS_SOURCE:=$(shell $(FPC) -iSO)'#013#010+ - 'endif'#013#010+ - #013#010+ - '# Target CPU'#013#010+ - 'ifndef CPU_TARGET'#013#010+ - 'CPU_TARGET:=$(shell $(FPC) -iTP)'#013#010+ - 'endif'#013#010+ - #013#010+ - '# Source CPU'#013#010+ - 'ifndef CPU_SOURCE'#013#010+ - 'CPU_SOURCE',':=$(shell $(FPC) -iSP)'#013#010+ - 'endif'#013#010+ - #013#010+ - '# FPC version'#013#010+ - 'ifndef FPC_VERSION'#013#010+ - 'FPC_VERSION:=$(shell $(FPC) -iV)'#013#010+ - 'endif'#013#010+ - #013#010+ - 'export FPC OS_TARGET OS_SOURCE CPU_TARGET CPU_SOURCE FPC_VERSION'#013#010+ - #013#010+ - #013#010+ - '[fpcdircheckenv]'#013#010+ - '#########################################','###########################'+ - '#'#013#010+ - '# FPCDIR Setting'#013#010+ - '#####################################################################'#013+ - #010+ - #013#010+ - '# Test FPCDIR to look if the RTL dir exists'#013#010+ - 'ifdef FPCDIR'#013#010+ - 'override FPCDIR:=$(subst \,/,$(FPCDIR))'#013#010+ - 'ifeq ($(wildcard $(','FPCDIR)/rtl),)'#013#010+ - 'ifeq ($(wildcard $(FPCDIR)/units),)'#013#010+ - 'override FPCDIR=wrong'#013#010+ - 'endif'#013#010+ - 'endif'#013#010+ - 'else'#013#010+ - 'override FPCDIR=wrong'#013#010+ - 'endif'#013#010+ - #013#010+ - '[fpcdirdetect]'#013#010+ - '# Detect FPCDIR'#013#010+ - 'ifeq ($(FPCDIR),wrong)'#013#010+ - 'ifdef inUnix'#013#010+ - 'override FPCDIR=/usr/local/lib/fpc/$(FPC_','VERSION)'#013#010+ - 'ifeq ($(wildcard $(FPCDIR)/units),)'#013#010+ - 'override FPCDIR=/usr/lib/fpc/$(FPC_VERSION)'#013#010+ - 'endif'#013#010+ - 'else'#013#010+ - 'override FPCDIR:=$(subst /$(FPC),,$(firstword $(strip $(wildcard $(add'+ - 'suffix /$(FPC),$(SEARCHPATH))))))'#013#010+ - 'override FPCDIR:=$(FPCDIR)/..'#013,#010+ - 'ifeq ($(wildcard $(FPCDIR)/rtl),)'#013#010+ - 'ifeq ($(wildcard $(FPCDIR)/units),)'#013#010+ - 'override FPCDIR:=$(FPCDIR)/..'#013#010+ - 'ifeq ($(wildcard $(FPCDIR)/rtl),)'#013#010+ - 'ifeq ($(wildcard $(FPCDIR)/units),)'#013#010+ - 'override FPCDIR=c:/pp'#013#010+ - 'endif'#013#010+ - 'endif'#013#010+ - 'endif'#013#010+ - 'endif'#013#010+ - 'endif'#013#010+ - 'endif'#013,#010+ - #013#010+ - '[fpcdirsubs]'#013#010+ - '# Create units dir'#013#010+ - 'ifneq ($(FPCDIR),.)'#013#010+ - 'UNITSDIR=$(FPCDIR)/units/$(OS_TARGET)'#013#010+ - 'endif'#013#010+ - #013#010+ - '[checkfpcdirsubs]'#013#010+ - '# Check if the dirs really exists, else turn it off'#013#010+ - 'ifeq ($(wildcard $(UNITSDIR)),)'#013#010+ - 'UNITSDIR='#013#010+ - 'endif'#013#010+ - 'ifeq ($(wil','dcard $(TOOLKITSDIR)),)'#013#010+ - 'TOOLKITSDIR='#013#010+ - 'endif'#013#010+ - 'ifeq ($(wildcard $(PACKAGESDIR)),)'#013#010+ - 'PACKAGESDIR='#013#010+ - 'endif'#013#010+ - 'ifeq ($(wildcard $(COMPONENTSDIR)),)'#013#010+ - 'COMPONENTSDIR='#013#010+ - 'endif'#013#010+ - #013#010+ - #013#010+ - '[presettings]'#013#010+ - '#########################################################','###########'+ - '#'#013#010+ - '# Pre Settings'#013#010+ - '#####################################################################'#013+ - #010+ - #013#010+ - #013#010+ - '[usersettings]'#013#010+ - '#####################################################################'#013+ - #010+ - '# User Settings'#013#010+ - '###############################','#####################################'+ - '#'#013#010+ - #013#010+ - #013#010+ - '[postsettings]'#013#010+ - '#####################################################################'#013+ - #010+ - '# Post Settings'#013#010+ - '#####################################################################'#013+ - #010+ - #013#010+ - #013#010+ - '[shelltools]'#013#010+ - '###','#################################################################'+ - '#'#013#010+ - '# Shell tools'#013#010+ - '#####################################################################'#013+ - #010+ - #013#010+ - '# echo'#013#010+ - 'ifndef ECHO'#013#010+ - 'ECHO:=$(strip $(wildcard $(addsuffix /gecho$(EXEEXT),$(SEARCHPA','TH)))'+ - ')'#013#010+ - 'ifeq ($(ECHO),)'#013#010+ - 'ECHO:=$(strip $(wildcard $(addsuffix /echo$(SRCEXEEXT),$(SEARCHPATH)))'+ - ')'#013#010+ - 'ifeq ($(ECHO),)'#013#010+ - 'ECHO:=echo'#013#010+ - 'ECHOE:=echo'#013#010+ - 'else'#013#010+ - 'ECHO:=$(firstword $(ECHO))'#013#010+ - 'ECHOE=$(ECHO) -E'#013#010+ - 'endif'#013#010+ - 'else'#013#010+ - 'ECHO:=$(firstword $(ECHO))'#013#010+ - 'ECHOE=$','(ECHO) -E'#013#010+ - 'endif'#013#010+ - 'endif'#013#010+ - #013#010+ - '# To copy pograms'#013#010+ - 'ifndef COPY'#013#010+ - 'COPY:=cp -fp'#013#010+ - 'endif'#013#010+ - #013#010+ - '# Copy a whole tree'#013#010+ - 'ifndef COPYTREE'#013#010+ - 'COPYTREE:=cp -rfp'#013#010+ - 'endif'#013#010+ - #013#010+ - '# To move pograms'#013#010+ - 'ifndef MOVE'#013#010+ - 'MOVE:=mv -f'#013#010+ - 'endif'#013#010+ - #013#010+ - '# Check delete program'#013#010+ - 'ifndef DEL'#013#010+ - 'DE','L:=rm -f'#013#010+ - 'endif'#013#010+ - #013#010+ - '# Check deltree program'#013#010+ - 'ifndef DELTREE'#013#010+ - 'DELTREE:=rm -rf'#013#010+ - 'endif'#013#010+ - #013#010+ - '# To install files'#013#010+ - 'ifndef INSTALL'#013#010+ - 'ifdef inUnix'#013#010+ - 'INSTALL:=install -c -m 644'#013#010+ - 'else'#013#010+ - 'INSTALL:=$(COPY)'#013#010+ - 'endif'#013#010+ - 'endif'#013#010+ - #013#010+ - '# To install programs'#013#010+ - 'ifndef INSTAL','LEXE'#013#010+ - 'ifdef inUnix'#013#010+ - 'INSTALLEXE:=install -c -m 755'#013#010+ - 'else'#013#010+ - 'INSTALLEXE:=$(COPY)'#013#010+ - 'endif'#013#010+ - 'endif'#013#010+ - #013#010+ - '# To make a directory.'#013#010+ - 'ifndef MKDIR'#013#010+ - 'ifdef inUnix'#013#010+ - 'MKDIR:=install -m 755 -d'#013#010+ - 'else'#013#010+ - 'MKDIR:=ginstall -m 755 -d'#013#010+ - 'endif'#013#010+ - 'endif'#013#010+ - #013#010+ - 'export ECHO ECHOE C','OPY COPYTREE MOVE DEL DELTREE INSTALL INSTALLEXE '+ - 'MKDIR'#013#010+ - #013#010+ - #013#010+ - '[tool_default]'#013#010+ - '#####################################################################'#013+ - #010+ - '# Default Tools'#013#010+ - '#####################################################################'#013+ - #010+ - #013#010+ - '# a','ssembler, redefine it if cross compiling'#013#010+ - 'ifndef AS'#013#010+ - 'AS=as'#013#010+ - 'endif'#013#010+ - #013#010+ - '# linker, but probably not used'#013#010+ - 'ifndef LD'#013#010+ - 'LD=ld'#013#010+ - 'endif'#013#010+ - #013#010+ - '# ppas.bat / ppas.sh'#013#010+ - 'PPAS=$(BATCHEXT)'#013#010+ - #013#010+ - '# ldconfig to rebuild .so cache'#013#010+ - 'ifdef inUnix'#013#010+ - 'LDCONFIG=ldconfig'#013#010+ - 'els','e'#013#010+ - 'LDCONFIG='#013#010+ - 'endif'#013#010+ - #013#010+ - '[tool_ppdep]'#013#010+ - '# ppdep'#013#010+ - 'ifndef PPDEP'#013#010+ - 'PPDEP:=$(strip $(wildcard $(addsuffix /ppdep$(SRCEXEEXT),$(SEARCHPATH)'+ - ')))'#013#010+ - 'ifeq ($(PPDEP),)'#013#010+ - 'PPDEP='#013#010+ - 'else'#013#010+ - 'PPDEP:=$(firstword $(PPDEP))'#013#010+ - 'endif'#013#010+ - 'endif'#013#010+ - 'export PPDEP'#013#010+ - #013#010+ - '[tool_ppumove',']'#013#010+ - '# ppumove'#013#010+ - 'ifndef PPUMOVE'#013#010+ - 'PPUMOVE:=$(strip $(wildcard $(addsuffix /ppumove$(SRCEXEEXT),$(SEARCHP'+ - 'ATH))))'#013#010+ - 'ifeq ($(PPUMOVE),)'#013#010+ - 'PPUMOVE='#013#010+ - 'else'#013#010+ - 'PPUMOVE:=$(firstword $(PPUMOVE))'#013#010+ - 'endif'#013#010+ - 'endif'#013#010+ - 'export PPUMOVE'#013#010+ - #013#010+ - '[tool_ppufiles]'#013#010+ - '# ppufiles'#013#010, - 'ifndef PPUFILES'#013#010+ - 'PPUFILES:=$(strip $(wildcard $(addsuffix /ppufiles$(SRCEXEEXT),$(SEARC'+ - 'HPATH))))'#013#010+ - 'ifeq ($(PPUFILES),)'#013#010+ - 'PPUFILES='#013#010+ - 'else'#013#010+ - 'PPUFILES:=$(firstword $(PPUFILES))'#013#010+ - 'endif'#013#010+ - 'endif'#013#010+ - 'export PPUFILES'#013#010+ - #013#010+ - '[tool_data2inc]'#013#010+ - '# data2inc'#013#010+ - 'ifndef',' DATA2INC'#013#010+ - 'DATA2INC:=$(strip $(wildcard $(addsuffix /data2inc$(SRCEXEEXT),$(SEARC'+ - 'HPATH))))'#013#010+ - 'ifeq ($(DATA2INC),)'#013#010+ - 'DATA2INC='#013#010+ - 'else'#013#010+ - 'DATA2INC:=$(firstword $(DATA2INC))'#013#010+ - 'endif'#013#010+ - 'endif'#013#010+ - 'export DATA2INC'#013#010+ - #013#010+ - '[tool_diff]'#013#010+ - '# diff'#013#010+ - 'ifndef DIFF'#013#010+ - 'DIFF:=$','(strip $(wildcard $(addsuffix /diff$(SRCEXEEXT),$(SEARCHPATH)'+ - ')))'#013#010+ - 'ifeq ($(DIFF),)'#013#010+ - 'DIFF='#013#010+ - 'else'#013#010+ - 'DIFF:=$(firstword $(DIFF))'#013#010+ - 'endif'#013#010+ - 'endif'#013#010+ - 'export DIFF'#013#010+ - #013#010+ - '[tool_cmp]'#013#010+ - '# cmp'#013#010+ - 'ifndef CMP'#013#010+ - 'CMP:=$(strip $(wildcard $(addsuffix /cmp$(SRCEXEEXT),$(S','EARCHPATH)))'+ - ')'#013#010+ - 'ifeq ($(CMP),)'#013#010+ - 'CMP='#013#010+ - 'else'#013#010+ - 'CMP:=$(firstword $(CMP))'#013#010+ - 'endif'#013#010+ - 'endif'#013#010+ - 'export CMP'#013#010+ - #013#010+ - '[tool_sed]'#013#010+ - '# Sed'#013#010+ - 'ifndef SED'#013#010+ - 'SED:=$(strip $(wildcard $(addsuffix /sed$(SRCEXEEXT),$(SEARCHPATH))))'#013+ - #010+ - 'ifeq ($(SED),)'#013#010+ - 'SED='#013#010+ - 'else'#013#010+ - 'SED:=$(firstw','ord $(SED))'#013#010+ - 'endif'#013#010+ - 'endif'#013#010+ - 'export SED'#013#010+ - #013#010+ - '[tool_upx]'#013#010+ - '# Look if UPX is found for go32v2 and win32. We can'#039't use $UPX bec'+ - 'uase'#013#010+ - '# upx uses that one itself (PFV)'#013#010+ - 'ifndef UPXPROG'#013#010+ - 'ifeq ($(OS_TARGET),go32v2)'#013#010+ - 'UPXPROG:=1'#013#010+ - 'endif'#013#010+ - 'ifeq ($(OS_TARGET)',',win32)'#013#010+ - 'UPXPROG:=1'#013#010+ - 'endif'#013#010+ - 'ifdef UPXPROG'#013#010+ - 'UPXPROG:=$(strip $(wildcard $(addsuffix /upx$(SRCEXEEXT),$(SEARCHPATH)'+ - ')))'#013#010+ - 'ifeq ($(UPXPROG),)'#013#010+ - 'UPXPROG='#013#010+ - 'else'#013#010+ - 'UPXPROG:=$(firstword $(UPXPROG))'#013#010+ - 'endif'#013#010+ - 'else'#013#010+ - 'UPXPROG='#013#010+ - 'endif'#013#010+ - 'endif'#013#010+ - 'export UPXPROG'#013,#010+ - #013#010+ - '[tool_date]'#013#010+ - '# gdate/date'#013#010+ - 'ifndef DATE'#013#010+ - 'DATE:=$(strip $(wildcard $(addsuffix /date$(SRCEXEEXT),$(SEARCHPATH)))'+ - ')'#013#010+ - 'ifeq ($(DATE),)'#013#010+ - 'DATE:=$(strip $(wildcard $(addsuffix /gdate$(SRCEXEEXT),$(SEACHPATH)))'+ - ')'#013#010+ - 'ifeq ($(DATE),)'#013#010+ - 'DATE='#013#010+ - 'else'#013#010+ - 'DATE',':=$(firstword $(DATE))'#013#010+ - 'endif'#013#010+ - 'else'#013#010+ - 'DATE:=$(firstword $(DATE))'#013#010+ - 'endif'#013#010+ - 'endif'#013#010+ - 'export DATE'#013#010+ - #013#010+ - 'ifdef DATE'#013#010+ - 'DATESTR:=$(shell $(DATE) +%Y%m%d)'#013#010+ - 'else'#013#010+ - 'DATESTR='#013#010+ - 'endif'#013#010+ - #013#010+ - '[tool_zip]'#013#010+ - '# ZipProg, you can'#039't use Zip as the var name (PFV)'#013#010+ - 'ifndef ZIP','PROG'#013#010+ - 'ZIPPROG:=$(strip $(wildcard $(addsuffix /zip$(SRCEXEEXT),$(SEARCHPATH)'+ - ')))'#013#010+ - 'ifeq ($(ZIPPROG),)'#013#010+ - 'ZIPPROG='#013#010+ - 'else'#013#010+ - 'ZIPPROG:=$(firstword $(ZIPPROG))'#013#010+ - 'endif'#013#010+ - 'endif'#013#010+ - 'export ZIPPROG'#013#010+ - #013#010+ - 'ZIPOPT=-9'#013#010+ - 'ZIPEXT=.zip'#013#010+ - #013#010+ - '[tool_tar]'#013#010+ - '# Tar'#013#010+ - 'ifndef TARPR','OG'#013#010+ - 'TARPROG:=$(strip $(wildcard $(addsuffix /tar$(SRCEXEEXT),$(SEARCHPATH)'+ - ')))'#013#010+ - 'ifeq ($(TARPROG),)'#013#010+ - 'TARPROG='#013#010+ - 'else'#013#010+ - 'TARPROG:=$(firstword $(TARPROG))'#013#010+ - 'endif'#013#010+ - 'endif'#013#010+ - 'export TARPROG'#013#010+ - #013#010+ - 'ifeq ($(USETAR),bz2)'#013#010+ - 'TAROPT=vI'#013#010+ - 'TAREXT=.tar.bz2'#013#010+ - 'else'#013#010+ - 'TAR','OPT=vz'#013#010+ - 'TAREXT=.tar.gz'#013#010+ - 'endif'#013#010+ - #013#010+ - #013#010+ - '[extensions]'#013#010+ - '#####################################################################'#013+ - #010+ - '# Default extensions'#013#010+ - '#####################################################################'#013+ - #010+ - #013#010+ - '# Default needed extensio','ns (Go32v2,Linux)'#013#010+ - 'LOADEREXT=.as'#013#010+ - 'EXEEXT=.exe'#013#010+ - 'PPLEXT=.ppl'#013#010+ - 'PPUEXT=.ppu'#013#010+ - 'OEXT=.o'#013#010+ - 'ASMEXT=.s'#013#010+ - 'SMARTEXT=.sl'#013#010+ - 'STATICLIBEXT=.a'#013#010+ - 'SHAREDLIBEXT=.so'#013#010+ - 'RSTEXT=.rst'#013#010+ - 'FPCMADE=fpcmade'#013#010+ - #013#010+ - '# Go32v1'#013#010+ - 'ifeq ($(OS_TARGET),go32v1)'#013#010+ - 'PPUEXT=.pp1'#013#010+ - 'OEXT=.o1'#013#010+ - 'ASMEX','T=.s1'#013#010+ - 'SMARTEXT=.sl1'#013#010+ - 'STATICLIBEXT=.a1'#013#010+ - 'SHAREDLIBEXT=.so1'#013#010+ - 'FPCMADE=fpcmade.v1'#013#010+ - 'endif'#013#010+ - #013#010+ - '# Go32v2'#013#010+ - 'ifeq ($(OS_TARGET),go32v2)'#013#010+ - 'FPCMADE=fpcmade.dos'#013#010+ - 'endif'#013#010+ - #013#010+ - '# Linux'#013#010+ - 'ifeq ($(OS_TARGET),linux)'#013#010+ - 'EXEEXT='#013#010+ - 'HASSHAREDLIB=1'#013#010+ - 'FPCMADE=fpcmade.lnx'#013#010+ - 'en','dif'#013#010+ - #013#010+ - '# Linux'#013#010+ - 'ifeq ($(OS_TARGET),freebsd)'#013#010+ - 'EXEEXT='#013#010+ - 'HASSHAREDLIB=1'#013#010+ - 'FPCMADE=fpcmade.freebsd'#013#010+ - 'endif'#013#010+ - #013#010+ - '# Win32'#013#010+ - 'ifeq ($(OS_TARGET),win32)'#013#010+ - 'PPUEXT=.ppw'#013#010+ - 'OEXT=.ow'#013#010+ - 'ASMEXT=.sw'#013#010+ - 'SMARTEXT=.slw'#013#010+ - 'STATICLIBEXT=.aw'#013#010+ - 'SHAREDLIBEXT=.dll'#013#010+ - 'FPCMADE=fpcma','de.w32'#013#010+ - 'endif'#013#010+ - #013#010+ - '# OS/2'#013#010+ - 'ifeq ($(OS_TARGET),os2)'#013#010+ - 'PPUEXT=.ppo'#013#010+ - 'ASMEXT=.so2'#013#010+ - 'OEXT=.oo2'#013#010+ - 'SMARTEXT=.so'#013#010+ - 'STATICLIBEXT=.ao2'#013#010+ - 'SHAREDLIBEXT=.dll'#013#010+ - 'FPCMADE=fpcmade.os2'#013#010+ - 'endif'#013#010+ - #013#010+ - '# library prefix'#013#010+ - 'LIBPREFIX=lib'#013#010+ - 'ifeq ($(OS_TARGET),go32v2)'#013#010+ - 'LIBPREFIX=',#013#010+ - 'endif'#013#010+ - 'ifeq ($(OS_TARGET),go32v1)'#013#010+ - 'LIBPREFIX='#013#010+ - 'endif'#013#010+ - #013#010+ - '# determine which .pas extension is used'#013#010+ - 'ifndef PASEXT'#013#010+ - 'ifdef EXEOBJECTS'#013#010+ - 'override TESTPAS:=$(strip $(wildcard $(addsuffix .pas,$(firstword $(EX'+ - 'EOBJECTS)))))'#013#010+ - 'else'#013#010+ - 'override TESTPAS',':=$(strip $(wildcard $(addsuffix .pas,$(firstword $('+ - 'UNITOBJECTS)))))'#013#010+ - 'endif'#013#010+ - 'ifeq ($(TESTPAS),)'#013#010+ - 'PASEXT=.pp'#013#010+ - 'else'#013#010+ - 'PASEXT=.pas'#013#010+ - 'endif'#013#010+ - 'endif'#013#010+ - #013#010+ - #013#010+ - '[dir_default]'#013#010+ - '#####################################################################'#013+ - #010+ - '# Defaul','t Directories'#013#010+ - '#####################################################################'#013+ - #010+ - #013#010+ - '# Linux and freebsd use unix dirs with /usr/bin, /usr/lib'#013#010+ - '# When zipping use the target as default, when normal install then'#013+ - #010+ - '# use the source os as de','fault'#013#010+ - 'ifdef ZIPNAME'#013#010+ - '# Zipinstall'#013#010+ - 'ifeq ($(OS_TARGET),linux)'#013#010+ - 'UNIXINSTALLDIR=1'#013#010+ - 'endif'#013#010+ - 'ifeq ($(OS_TARGET),freebsd)'#013#010+ - 'UNIXINSTALLDIR=1'#013#010+ - 'endif'#013#010+ - 'else'#013#010+ - '# Normal install'#013#010+ - 'ifeq ($(OS_SOURCE),linux)'#013#010+ - 'UNIXINSTALLDIR=1'#013#010+ - 'endif'#013#010+ - 'ifeq ($(OS_SOURCE),fre','ebsd)'#013#010+ - 'UNIXINSTALLDIR=1'#013#010+ - 'endif'#013#010+ - 'endif'#013#010+ - #013#010+ - '# set the prefix directory where to install everything'#013#010+ - 'ifndef PREFIXINSTALLDIR'#013#010+ - 'ifdef UNIXINSTALLDIR'#013#010+ - 'PREFIXINSTALLDIR=/usr'#013#010+ - 'else'#013#010+ - 'PREFIXINSTALLDIR=/pp'#013#010+ - 'endif'#013#010+ - 'endif'#013#010+ - 'export PREFIXINSTALLDIR'#013#010+ - #013#010+ - '# Wh','ere to place the resulting zip files'#013#010+ - 'ifndef DESTZIPDIR'#013#010+ - 'DESTZIPDIR:=$(BASEDIR)'#013#010+ - 'endif'#013#010+ - 'export DESTZIPDIR'#013#010+ - #013#010+ - #013#010+ - '[dir_install]'#013#010+ - '#####################################################################'#013+ - #010+ - '# Install Directories'#013#010+ - '####################','################################################'+ - '#'#013#010+ - #013#010+ - '# set the base directory where to install everything'#013#010+ - 'ifndef BASEINSTALLDIR'#013#010+ - 'ifdef UNIXINSTALLDIR'#013#010+ - 'BASEINSTALLDIR=$(PREFIXINSTALLDIR)/lib/fpc/$(FPC_VERSION)'#013#010+ - 'else'#013#010+ - 'BASEINSTALLDIR=$(PREFIX','INSTALLDIR)'#013#010+ - 'endif'#013#010+ - 'endif'#013#010+ - #013#010+ - '# set the directory where to install the binaries'#013#010+ - 'ifndef BININSTALLDIR'#013#010+ - 'ifdef UNIXINSTALLDIR'#013#010+ - 'BININSTALLDIR=$(PREFIXINSTALLDIR)/bin'#013#010+ - 'else'#013#010+ - 'BININSTALLDIR=$(BASEINSTALLDIR)/bin/$(OS_TARGET)'#013#010+ - 'endif'#013#010+ - 'endif'#013#010+ - #013#010+ - '# set',' the directory where to install the units.'#013#010+ - 'ifndef UNITINSTALLDIR'#013#010+ - 'UNITINSTALLDIR=$(BASEINSTALLDIR)/units/$(OS_TARGET)'#013#010+ - 'ifdef UNITSUBDIR'#013#010+ - 'UNITINSTALLDIR:=$(UNITINSTALLDIR)/$(UNITSUBDIR)'#013#010+ - 'endif'#013#010+ - 'endif'#013#010+ - #013#010+ - '# Where to install shared libraries'#013#010, - 'ifndef LIBINSTALLDIR'#013#010+ - 'ifdef UNIXINSTALLDIR'#013#010+ - 'LIBINSTALLDIR=$(PREFIXINSTALLDIR)/lib'#013#010+ - 'else'#013#010+ - 'LIBINSTALLDIR=$(UNITINSTALLDIR)'#013#010+ - 'endif'#013#010+ - 'endif'#013#010+ - #013#010+ - '# Where the source files will be stored'#013#010+ - 'ifndef SOURCEINSTALLDIR'#013#010+ - 'ifdef UNIXINSTALLDIR'#013#010+ - 'SOURCEINSTALLD','IR=$(PREFIXINSTALLDIR)/src/fpc-$(FPC_VERSION)'#013#010+ - 'else'#013#010+ - 'SOURCEINSTALLDIR=$(BASEINSTALLDIR)/source'#013#010+ - 'endif'#013#010+ - 'ifdef SOURCESUBDIR'#013#010+ - 'SOURCEINSTALLDIR:=$(SOURCEINSTALLDIR)/$(SOURCESUBDIR)'#013#010+ - 'endif'#013#010+ - 'endif'#013#010+ - #013#010+ - '# Where the doc files will be stored'#013#010+ - 'ifndef D','OCINSTALLDIR'#013#010+ - 'ifdef UNIXINSTALLDIR'#013#010+ - 'DOCINSTALLDIR=$(PREFIXINSTALLDIR)/doc/fpc-$(FPC_VERSION)'#013#010+ - 'else'#013#010+ - 'DOCINSTALLDIR=$(BASEINSTALLDIR)/doc'#013#010+ - 'endif'#013#010+ - 'endif'#013#010+ - #013#010+ - '# Where to install the examples, under linux we use the doc dir'#013#010+ - '# because the copytree',' command will create a subdir itself'#013#010+ - 'ifndef EXAMPLEINSTALLDIR'#013#010+ - 'ifdef UNIXINSTALLDIR'#013#010+ - 'EXAMPLEINSTALLDIR=$(DOCINSTALLDIR)/examples'#013#010+ - 'else'#013#010+ - 'EXAMPLEINSTALLDIR=$(BASEINSTALLDIR)/examples'#013#010+ - 'endif'#013#010+ - 'ifdef EXAMPLESUBDIR'#013#010+ - 'EXAMPLEINSTALLDIR:=$(EXAMPLEI','NSTALLDIR)/$(EXAMPLESUBDIR)'#013#010+ - 'endif'#013#010+ - 'endif'#013#010+ - #013#010+ - '# Where the some extra (data)files will be stored'#013#010+ - 'ifndef DATAINSTALLDIR'#013#010+ - 'DATAINSTALLDIR=$(BASEINSTALLDIR)'#013#010+ - 'endif'#013#010+ - #013#010+ - #013#010+ - '[dir_gcclib]'#013#010+ - '# On linux, try to find where libgcc.a is.'#013#010+ - 'ifdef inUnix'#013#010+ - 'ifnd','ef GCCLIBDIR'#013#010+ - 'GCCLIBDIR:=$(shell dirname `(gcc -v 2>&1)| head -n 1| awk '#039'{ print'+ - ' $$4 } '#039'`)'#013#010+ - 'endif'#013#010+ - 'endif'#013#010+ - 'export GCCLIBDIR'#013#010+ - #013#010+ - #013#010+ - '[dir_otherlib]'#013#010+ - '# Where to find other libraries'#013#010+ - 'ifdef inUnix'#013#010+ - 'ifndef OTHERLIBDIR'#013#010+ - 'OTHERLIBDIR:=$(shell grep -v ','"^\#" /etc/ld.so.conf | awk '#039'{ ORS='+ - '" "; print $1 }'#039')'#013#010+ - 'endif'#013#010+ - 'endif'#013#010+ - 'export OTHERLIBDIR'#013#010+ - #013#010+ - #013#010+ - '[redir]'#013#010+ - '#####################################################################'#013+ - #010+ - '# Redirection'#013#010+ - '#####################################################','###############'+ - '#'#013#010+ - #013#010+ - 'ifndef REDIRFILE'#013#010+ - 'REDIRFILE=log'#013#010+ - 'endif'#013#010+ - #013#010+ - 'ifdef REDIR'#013#010+ - 'ifndef inUnix'#013#010+ - 'override FPC=redir -eo $(FPC)'#013#010+ - 'endif'#013#010+ - '# set the verbosity to max'#013#010+ - 'override FPCOPT+=-va'#013#010+ - 'override REDIR:= >> $(REDIRFILE)'#013#010+ - 'endif'#013#010+ - #013#010+ - '[command_begin]'#013#010+ - '##','##################################################################'+ - '#'#013#010+ - '# Compiler Command Line'#013#010+ - '#####################################################################'#013+ - #010+ - #013#010+ - '# Load commandline OPTDEF and add FPC_CPU define'#013#010+ - 'override FPCOPTDEF:=-d$','(CPU_TARGET)'#013#010+ - #013#010+ - '# Load commandline OPT and add target and unit dir to be sure'#013#010+ - 'ifneq ($(OS_TARGET),$(OS_SOURCE))'#013#010+ - 'override FPCOPT+=-T$(OS_TARGET)'#013#010+ - 'endif'#013#010+ - #013#010+ - '# User dirs should be first, so they are looked at first'#013#010+ - 'ifdef UNITDIR'#013#010+ - 'override FP','COPT+=$(addprefix -Fu,$(UNITDIR))'#013#010+ - 'endif'#013#010+ - 'ifdef LIBDIR'#013#010+ - 'override FPCOPT+=$(addprefix -Fl,$(LIBDIR))'#013#010+ - 'endif'#013#010+ - 'ifdef OBJDIR'#013#010+ - 'override FPCOPT+=$(addprefix -Fo,$(OBJDIR))'#013#010+ - 'endif'#013#010+ - 'ifdef INCDIR'#013#010+ - 'override FPCOPT+=$(addprefix -Fi,$(INCDIR))'#013#010+ - 'endif'#013#010, - #013#010+ - '# Smartlinking'#013#010+ - 'ifdef LINKSMART'#013#010+ - 'override FPCOPT+=-XX'#013#010+ - 'endif'#013#010+ - #013#010+ - '# Smartlinking creation'#013#010+ - 'ifdef CREATESMART'#013#010+ - 'override FPCOPT+=-CX'#013#010+ - 'endif'#013#010+ - #013#010+ - '# Debug'#013#010+ - 'ifdef DEBUG'#013#010+ - 'override FPCOPT+=-gl -dDEBUG'#013#010+ - 'endif'#013#010+ - #013#010+ - '# Release mode (strip, optimize and do','n'#039't load ppc386.cfg)'#013#010+ - '# 0.99.12b has a bug in the optimizer so don'#039't use it by default'#013+ - #010+ - 'ifdef RELEASE'#013#010+ - 'ifeq ($(FPC_VERSION),0.99.12)'#013#010+ - 'override FPCOPT+=-Xs -OGp3 -n'#013#010+ - 'else'#013#010+ - 'override FPCOPT+=-Xs -OG2p3 -n'#013#010+ - 'endif'#013#010+ - 'endif'#013#010+ - #013#010+ - '# Strip'#013#010+ - 'ifdef STRIP'#013,#010+ - 'override FPCOPT+=-Xs'#013#010+ - 'endif'#013#010+ - #013#010+ - '# Optimizer'#013#010+ - 'ifdef OPTIMIZE'#013#010+ - 'override FPCOPT+=-OG2p3'#013#010+ - 'endif'#013#010+ - #013#010+ - '# Verbose settings (warning,note,info)'#013#010+ - 'ifdef VERBOSE'#013#010+ - 'override FPCOPT+=-vwni'#013#010+ - 'endif'#013#010+ - #013#010+ - #013#010+ - '[command_needopt]'#013#010+ - 'ifdef NEEDOPT'#013#010+ - 'override FPCOPT+=$(NE','EDOPT)'#013#010+ - 'endif'#013#010+ - #013#010+ - #013#010+ - '[command_needunit]'#013#010+ - 'ifdef NEEDUNITDIR'#013#010+ - 'override FPCOPT+=$(addprefix -Fu,$(NEEDUNITDIR))'#013#010+ - 'endif'#013#010+ - #013#010+ - #013#010+ - '[command_unitsdir]'#013#010+ - 'ifdef UNITSDIR'#013#010+ - 'override FPCOPT+=-Fu$(UNITSDIR)'#013#010+ - 'endif'#013#010+ - #013#010+ - #013#010+ - '[command_needlib]'#013#010+ - 'ifdef NEEDLIBDIR'#013#010+ - 'over','ride FPCOPT+=$(addprefix -Fl,$(NEEDLIBDIR))'#013#010+ - 'endif'#013#010+ - #013#010+ - #013#010+ - '[command_needobj]'#013#010+ - 'ifdef NEEDOBJDIR'#013#010+ - 'override FPCOPT+=$(addprefix -Fo,$(NEEDOBJDIR))'#013#010+ - 'endif'#013#010+ - #013#010+ - #013#010+ - '[command_needinc]'#013#010+ - 'ifdef NEEDINCDIR'#013#010+ - 'override FPCOPT+=$(addprefix -Fi,$(NEEDINCDIR))'#013#010+ - 'e','ndif'#013#010+ - #013#010+ - '[command_gcclib]'#013#010+ - '# Add GCC lib path if asked'#013#010+ - 'ifdef GCCLIBDIR'#013#010+ - 'override FPCOPT+=-Fl$(GCCLIBDIR)'#013#010+ - 'endif'#013#010+ - #013#010+ - '[command_otherlib]'#013#010+ - '# Add Other dirs path if asked'#013#010+ - 'ifdef OTHERLIBDIR'#013#010+ - 'override FPCOPT+=$(addprefix -Fl,$(OTHERLIBDIR))'#013#010+ - 'endi','f'#013#010+ - #013#010+ - '[command_target]'#013#010+ - '# Target dirs and the prefix to use for clean/install'#013#010+ - 'ifdef TARGETDIR'#013#010+ - 'override FPCOPT+=-FE$(TARGETDIR)'#013#010+ - 'ifeq ($(TARGETDIR),.)'#013#010+ - 'override TARGETDIRPREFIX='#013#010+ - 'else'#013#010+ - 'override TARGETDIRPREFIX=$(TARGETDIR)/'#013#010+ - 'endif'#013#010+ - 'endif'#013#010+ - 'i','fdef UNITTARGETDIR'#013#010+ - 'override FPCOPT+=-FU$(UNITTARGETDIR)'#013#010+ - 'ifeq ($(UNITTARGETDIR),.)'#013#010+ - 'override UNITTARGETDIRPREFIX='#013#010+ - 'else'#013#010+ - 'override UNITTARGETDIRPREFIX=$(TARGETDIR)/'#013#010+ - 'endif'#013#010+ - 'else'#013#010+ - 'ifdef TARGETDIR'#013#010+ - 'override UNITTARGETDIR=$(TARGETDIR)'#013#010+ - 'overrid','e UNITTARGETDIRPREFIX=$(TARGETDIRPREFIX)'#013#010+ - 'endif'#013#010+ - 'endif'#013#010+ - #013#010+ - '[command_end]'#013#010+ - '# Add commandline options last so they can override'#013#010+ - 'ifdef OPT'#013#010+ - 'override FPCOPT+=$(OPT)'#013#010+ - 'endif'#013#010+ - #013#010+ - '# Add defines from FPCOPTDEF to FPCOPT'#013#010+ - 'ifdef FPCOPTDEF'#013#010+ - 'override FPC','OPT+=$(FPCOPTDEF)'#013#010+ - 'endif'#013#010+ - #013#010+ - '# Error file ?'#013#010+ - 'ifdef ERRORFILE'#013#010+ - 'override FPCOPT+=-Fr$(ERRORFILE)'#013#010+ - 'endif'#013#010+ - #013#010+ - '# Was a config file specified ?'#013#010+ - 'ifdef CFGFILE'#013#010+ - 'override FPCOPT+=@$(CFGFILE)'#013#010+ - 'endif'#013#010+ - #013#010+ - #013#010+ - '[command_win32file]'#013#010+ - '# For win32 the options ar','e passed using the file fpcext.cmd'#013#010+ - 'ifndef FPCEXTFILE'#013#010+ - 'FPCEXTFILE=fpcext.cmd'#013#010+ - 'endif'#013#010+ - 'ifeq ($(OS_SOURCE),win32)'#013#010+ - 'override TMPVAR:=$(shell "$(DEL) $(FPCEXTFILE)")'#013#010+ - 'override TMPVAR:=$(foreach A,$(FPCOPT),$(shell "$(ECHOE) "$(A)" >> $(F'+ - 'PCEXTFIL','E)"))'#013#010+ - 'override FPCOPT:=@$(FPCEXTFILE)'#013#010+ - 'endif'#013#010+ - #013#010+ - '[command_win32env]'#013#010+ - '# For win32 the options are passed using the environment FPCEXTCMD'#013+ - #010+ - 'ifeq ($(OS_SOURCE),win32)'#013#010+ - 'override FPCEXTCMD:=$(FPCOPT)'#013#010+ - 'override FPCOPT:=!FPCEXTCMD'#013#010+ - 'export FPCEXTCMD',#013#010+ - 'endif'#013#010+ - #013#010+ - '[command_compiler]'#013#010+ - '# Compiler commandline'#013#010+ - 'override COMPILER:=$(FPC) $(FPCOPT)'#013#010+ - #013#010+ - '# also call ppas if with command option -s'#013#010+ - '# but only if the OS_SOURCE and OS_TARGE are equal'#013#010+ - 'ifeq (,$(findstring -s ,$(COMPILER)))'#013#010+ - 'EXECPPAS='#013#010, - 'else'#013#010+ - 'ifeq ($(OS_SOURCE),$(OS_TARGET))'#013#010+ - 'EXECPPAS:=@$(PPAS)'#013#010+ - 'endif'#013#010+ - 'endif'#013#010+ - #013#010+ - #013#010+ - '[standardrules]'#013#010+ - '#####################################################################'#013+ - #010+ - '# Standard rules'#013#010+ - '########################################################','############'+ - '#'#013#010+ - #013#010+ - '[packagedependrules]'#013#010+ - '#####################################################################'#013+ - #010+ - '# Package depends'#013#010+ - '#####################################################################'#013+ - #010+ - #013#010+ - #013#010+ - '[loaderrules]'#013#010+ - '#####################','###############################################'+ - '#'#013#010+ - '# Loaders'#013#010+ - '#####################################################################'#013+ - #010+ - #013#010+ - '.PHONY: fpc_loaders'#013#010+ - #013#010+ - '%$(OEXT): %$(LOADEREXT)'#013#010+ - ' $(AS) -o $*$(OEXT) $<'#013#010+ - #013#010+ - 'override ALLTARGET+=fpc_l','oaders'#013#010+ - 'override CLEANTARGET+=fpc_loaders_clean'#013#010+ - 'override SHOWINSTALLTARGET+=fpc_loaders_showinstall'#013#010+ - 'override INSTALLTARGET+=fpc_loaders_install'#013#010+ - #013#010+ - 'override LOADEROFILES:=$(addsuffix $(OEXT),$(LOADEROBJECTS))'#013#010+ - #013#010+ - 'fpc_loaders: $(LOADEROFILES',')'#013#010+ - #013#010+ - 'fpc_loaders_clean:'#013#010+ - ' -$(DEL) $(LOADEROFILES)'#013#010+ - #013#010+ - 'fpc_loaders_showinstall:'#013#010+ - ' @$(ECHO) -e $(addprefix "\n"$(UNITINSTALLDIR)/,$(LOADEROFILES)'+ - ')'#013#010+ - #013#010+ - 'fpc_loaders_install:'#013#010+ - ' $(MKDIR) $(UNITINSTALLDIR)'#013#010+ - ' $(INSTALL) $(','LOADEROFILES) $(UNITINSTALLDIR)'#013#010+ - #013#010+ - #013#010+ - '[unitrules]'#013#010+ - '#####################################################################'#013+ - #010+ - '# Units'#013#010+ - '#####################################################################'#013+ - #010+ - #013#010+ - '.PHONY: fpc_units'#013#010+ - #013#010+ - 'override ALLTARG','ET+=fpc_units'#013#010+ - #013#010+ - 'override UNITPPUFILES=$(addsuffix $(PPUEXT),$(UNITOBJECTS))'#013#010+ - 'override INSTALLPPUFILES+=$(UNITPPUFILES)'#013#010+ - 'override CLEANPPUFILES+=$(UNITPPUFILES)'#013#010+ - #013#010+ - 'fpc_units: $(UNITPPUFILES)'#013#010+ - #013#010+ - #013#010+ - #013#010+ - '[exerules]'#013#010+ - '##############################','######################################'+ - '#'#013#010+ - '# Exes'#013#010+ - '#####################################################################'#013+ - #010+ - #013#010+ - '.PHONY: fpc_exes'#013#010+ - #013#010+ - 'ifdef EXEOBJECTS'#013#010+ - 'override EXEFILES=$(addsuffix $(EXEEXT),$(EXEOBJECTS))'#013#010+ - 'override EXEOFILES:=$(ad','dsuffix $(OEXT),$(EXEOBJECTS)) $(addprefix $'+ - '(LIBPREFIX),$(addsuffix $(STATICLIBEXT),$(EXEOBJECTS)))'#013#010+ - #013#010+ - 'override ALLTARGET+=fpc_exes'#013#010+ - 'override INSTALLEXEFILES+=$(EXEFILES)'#013#010+ - 'override CLEANEXEFILES+=$(EXEFILES) $(EXEOFILES)'#013#010+ - #013#010+ - 'endif'#013#010+ - #013#010+ - 'fpc_exe','s: $(EXEFILES)'#013#010+ - #013#010+ - #013#010+ - '[rstrules]'#013#010+ - '#####################################################################'#013+ - #010+ - '# Resource strings'#013#010+ - '#####################################################################'#013+ - #010+ - #013#010+ - 'ifdef RSTOBJECTS'#013#010+ - 'override RSTFILES=$(addsuf','fix $(RSTEXT),$(RSTOBJECTS))'#013#010+ - #013#010+ - 'override CLEANRSTFILES+=$(RSTFILES)'#013#010+ - 'endif'#013#010+ - #013#010+ - #013#010+ - '[examplerules]'#013#010+ - '#####################################################################'#013+ - #010+ - '# Examples'#013#010+ - '#############################################################','#######'+ - '#'#013#010+ - #013#010+ - '.PHONY: fpc_examples fpc_test'#013#010+ - #013#010+ - 'ifdef EXAMPLEOBJECTS'#013#010+ - 'override EXAMPLESOURCEFILES:=$(addsuffix $(PASEXT),$(EXAMPLEOBJECTS))'#013+ - #010+ - 'override EXAMPLEFILES:=$(addsuffix $(EXEEXT),$(EXAMPLEOBJECTS))'#013#010+ - 'override EXAMPLEOFILES:=$(addsuffix $','(OEXT),$(EXAMPLEOBJECTS)) $(add'+ - 'prefix $(LIBPREFIX),$(addsuffix $(STATICLIBEXT),$(EXAMPLEOBJECTS)))'#013+ - #010+ - #013#010+ - 'override CLEANEXEFILES+=$(EXAMPLEFILES) $(EXAMPLEOFILES)'#013#010+ - 'endif'#013#010+ - #013#010+ - 'fpc_examples: all $(EXAMPLEFILES) $(addsuffix _all,$(EXAMPLEDIROBJECTS'+ - ')',')'#013#010+ - #013#010+ - 'fpc_test: examples'#013#010+ - #013#010+ - #013#010+ - '[compilerules]'#013#010+ - '#####################################################################'#013+ - #010+ - '# General compile rules'#013#010+ - '#####################################################################'#013+ - #010+ - #013#010+ - '.PHONY: fpc_packages fpc_a','ll fpc_debug'#013#010+ - #013#010+ - '$(FPCMADE): $(ALLTARGET)'#013#010+ - ' @$(ECHO) Compiled > $(FPCMADE)'#013#010+ - #013#010+ - 'fpc_packages: $(COMPILEPACKAGES)'#013#010+ - #013#010+ - 'fpc_all: fpc_packages $(FPCMADE)'#013#010+ - #013#010+ - 'fpc_debug:'#013#010+ - ' $(MAKE) all DEBUG=1'#013#010+ - #013#010+ - '# Search paths for .ppu if targetdir is s','et'#013#010+ - 'ifdef UNITTARGETDIR'#013#010+ - 'vpath %$(PPUEXT) $(UNITTARGETDIR)'#013#010+ - 'endif'#013#010+ - #013#010+ - '# General compile rules, available for both possible PASEXT'#013#010+ - #013#010+ - '.SUFFIXES: $(EXEEXT) $(PPUEXT) $(OEXT) .pas .pp'#013#010+ - #013#010+ - '%$(PPUEXT): %.pp'#013#010+ - ' $(COMPILER) $< $(REDIR)'#013#010+ - ' ',' $(EXECPPAS)'#013#010+ - #013#010+ - '%$(PPUEXT): %.pas'#013#010+ - ' $(COMPILER) $< $(REDIR)'#013#010+ - ' $(EXECPPAS)'#013#010+ - #013#010+ - '%$(EXEEXT): %.pp'#013#010+ - ' $(COMPILER) $< $(REDIR)'#013#010+ - ' $(EXECPPAS)'#013#010+ - #013#010+ - '%$(EXEEXT): %.pas'#013#010+ - ' $(COMPILER) $< $(REDIR)'#013#010+ - ' $(EXECPPAS)'#013#010+ - #013,#010+ - #013#010+ - '[libraryrules]'#013#010+ - '#####################################################################'#013+ - #010+ - '# Library'#013#010+ - '#####################################################################'#013+ - #010+ - #013#010+ - '.PHONY: fpc_smart fpc_shared'#013#010+ - #013#010+ - 'ifdef LIBVERSION'#013#010+ - 'LIBFULLNAME=$(LI','BNAME).$(LIBVERSION)'#013#010+ - 'else'#013#010+ - 'LIBFULLNAME=$(LIBNAME)'#013#010+ - 'endif'#013#010+ - #013#010+ - '# Default sharedlib units are all unit objects'#013#010+ - 'ifndef SHAREDLIBUNITOBJECTS'#013#010+ - 'SHAREDLIBUNITOBJECTS:=$(UNITOBJECTS)'#013#010+ - 'endif'#013#010+ - #013#010+ - 'fpc_smart:'#013#010+ - ' $(MAKE) all LINKSMART=1 CREATESMART','=1'#013#010+ - #013#010+ - 'fpc_shared: all'#013#010+ - 'ifdef HASSHAREDLIB'#013#010+ - 'ifndef LIBNAME'#013#010+ - ' @$(ECHO) "LIBNAME not set"'#013#010+ - 'else'#013#010+ - ' $(PPUMOVE) $(SHAREDLIBUNITOBJECTS) -o$(LIBFULLNAME)'#013#010+ - 'endif'#013#010+ - 'else'#013#010+ - ' @$(ECHO) "Shared Libraries not supported"'#013#010+ - 'endif'#013#010+ - #013#010+ - #013#010+ - '[in','stallrules]'#013#010+ - '#####################################################################'#013+ - #010+ - '# Install rules'#013#010+ - '#####################################################################'#013+ - #010+ - #013#010+ - '.PHONY: fpc_showinstall fpc_install'#013#010+ - #013#010+ - 'ifdef EXTRAINSTALLUNITS'#013#010+ - 'ov','erride INSTALLPPUFILES+=$(addsuffix $(PPUEXT),$(EXTRAINSTALLUNITS)'+ - ')'#013#010+ - 'endif'#013#010+ - #013#010+ - 'ifdef INSTALLPPUFILES'#013#010+ - 'override INSTALLPPUFILES:=$(addprefix $(UNITTARGETDIRPREFIX),$(INSTALL'+ - 'PPUFILES))'#013#010+ - 'ifdef PPUFILES'#013#010+ - 'INSTALLPPULINKFILES:=$(shell $(PPUFILES) ','-S -O $(INSTALLPPUFILES))'#013+ - #010+ - 'else'#013#010+ - 'INSTALLPPULINKFILES:=$(wildcard $(subst $(PPUEXT),$(OEXT),$(INSTALLPPU'+ - 'FILES)) $(addprefix $(LIBPREFIX),$(subst $(PPUEXT),$(STATICLIBEXT),$(I'+ - 'NSTALLPPUFILES))))'#013#010+ - 'endif'#013#010+ - 'override INSTALLPPULINKFILES:=$(addprefi','x $(UNITTARGETDIRPREFIX),$(I'+ - 'NSTALLPPULINKFILES))'#013#010+ - 'endif'#013#010+ - #013#010+ - 'ifdef INSTALLEXEFILES'#013#010+ - 'override INSTALLEXEFILES:=$(addprefix $(TARGETDIRPREFIX),$(INSTALLEXEF'+ - 'ILES))'#013#010+ - 'endif'#013#010+ - #013#010+ - 'fpc_showinstall: $(SHOWINSTALLTARGET)'#013#010+ - 'ifdef INSTALLEXEFILES'#013#010+ - ' @','$(ECHO) -e $(addprefix "\n"$(BININSTALLDIR)/,$(INSTALLEXEFI'+ - 'LES))'#013#010+ - 'endif'#013#010+ - 'ifdef INSTALLPPUFILES'#013#010+ - ' @$(ECHO) -e $(addprefix "\n"$(UNITINSTALLDIR)/,$(INSTALLPPUFIL'+ - 'ES))'#013#010+ - 'ifneq ($(INSTALLPPULINKFILES),)'#013#010+ - ' @$(ECHO) -e $(addprefix "\n','"$(UNITINSTALLDIR)/,$(INSTALLPPUL'+ - 'INKFILES))'#013#010+ - 'endif'#013#010+ - 'ifneq ($(wildcard $(LIBFULLNAME)),)'#013#010+ - ' @$(ECHO) $(LIBINSTALLDIR)/$(LIBFULLNAME)'#013#010+ - 'ifdef HASSHAREDLIB'#013#010+ - ' @$(ECHO) $(LIBINSTALLDIR)/$(LIBNAME)'#013#010+ - 'endif'#013#010+ - 'endif'#013#010+ - 'endif'#013#010+ - 'ifdef EXTRAINS','TALLFILES'#013#010+ - ' @$(ECHO) -e $(addprefix "\n"$(DATAINSTALLDIR)/,$(EXTRAINSTALLF'+ - 'ILES))'#013#010+ - 'endif'#013#010+ - #013#010+ - 'fpc_install: $(INSTALLTARGET)'#013#010+ - '# Create UnitInstallFiles'#013#010+ - 'ifdef INSTALLEXEFILES'#013#010+ - ' $(MKDIR) $(BININSTALLDIR)'#013#010+ - '# Compress the exes if upx',' is defined'#013#010+ - 'ifdef UPXPROG'#013#010+ - ' -$(UPXPROG) $(INSTALLEXEFILES)'#013#010+ - 'endif'#013#010+ - ' $(INSTALLEXE) $(INSTALLEXEFILES) $(BININSTALLDIR)'#013#010+ - 'endif'#013#010+ - 'ifdef INSTALLPPUFILES'#013#010+ - ' $(MKDIR) $(UNITINSTALLDIR)'#013#010+ - ' $(INSTALL) $(INSTALLPPUFILES) $(','UNITINSTALLDIR)'#013#010+ - 'ifneq ($(INSTALLPPULINKFILES),)'#013#010+ - ' $(INSTALL) $(INSTALLPPULINKFILES) $(UNITINSTALLDIR)'#013#010+ - 'endif'#013#010+ - 'ifneq ($(wildcard $(LIBFULLNAME)),)'#013#010+ - ' $(MKDIR) $(LIBINSTALLDIR)'#013#010+ - ' $(INSTALL) $(LIBFULLNAME) $(LIBINSTALLDIR)',#013#010+ - 'ifdef inUnix'#013#010+ - ' ln -sf $(LIBFULLNAME) $(LIBINSTALLDIR)/$(LIBNAME)'#013#010+ - 'endif'#013#010+ - 'endif'#013#010+ - 'endif'#013#010+ - 'ifdef EXTRAINSTALLFILES'#013#010+ - ' $(MKDIR) $(DATAINSTALLDIR)'#013#010+ - ' $(INSTALL) $(EXTRAINSTALLFILES) $(DATAINSTALLDIR)'#013#010+ - 'endif'#013#010+ - #013#010+ - #013#010+ - '[sourceinstal','lrules]'#013#010+ - '#####################################################################'#013+ - #010+ - '# SourceInstall rules'#013#010+ - '#####################################################################'#013+ - #010+ - #013#010+ - '.PHONY: fpc_sourceinstall'#013#010+ - #013#010+ - 'ifndef SOURCETOPDIR'#013#010+ - 'SOURCETOPDIR=$','(BASEDIR)'#013#010+ - 'endif'#013#010+ - #013#010+ - 'fpc_sourceinstall: clean'#013#010+ - ' $(MKDIR) $(SOURCEINSTALLDIR)'#013#010+ - ' $(COPYTREE) $(SOURCETOPDIR) $(SOURCEINSTALLDIR)'#013#010+ - #013#010+ - '[exampleinstallrules]'#013#010+ - '#####################################################################'#013+ - #010+ - '# e','xampleinstall rules'#013#010+ - '#####################################################################'#013+ - #010+ - #013#010+ - '.PHONY: fpc_exampleinstall'#013#010+ - #013#010+ - 'fpc_exampleinstall: $(addsuffix _clean,$(EXAMPLEDIROBJECTS))'#013#010+ - 'ifdef EXAMPLESOURCEFILES'#013#010+ - ' $(MKDIR) $(EXAMPLEIN','STALLDIR)'#013#010+ - ' $(COPY) $(EXAMPLESOURCEFILES) $(EXAMPLEINSTALLDIR)'#013#010+ - 'endif'#013#010+ - 'ifdef EXAMPLEDIROBJECTS'#013#010+ - 'ifndef EXAMPLESOURCEFILES'#013#010+ - ' $(MKDIR) $(EXAMPLEINSTALLDIR)'#013#010+ - 'endif'#013#010+ - ' $(COPYTREE) $(addsuffix /*,$(EXAMPLEDIROBJECTS)) $(EXAMP','LEIN'+ - 'STALLDIR)'#013#010+ - 'endif'#013#010+ - #013#010+ - #013#010+ - '[zipinstallrules]'#013#010+ - '#####################################################################'#013+ - #010+ - '# Zip'#013#010+ - '#####################################################################'#013+ - #010+ - #013#010+ - '.PHONY: fpc_zipinstall'#013#010+ - #013#010+ - '# Create suffix to',' add'#013#010+ - 'ifndef PACKAGESUFFIX'#013#010+ - 'PACKAGESUFFIX=$(OS_TARGET)'#013#010+ - 'ifeq ($(OS_TARGET),go32v2)'#013#010+ - 'PACKAGESUFFIX=go32'#013#010+ - 'endif'#013#010+ - 'ifeq ($(OS_TARGET),win32)'#013#010+ - 'PACKAGESUFFIX=w32'#013#010+ - 'endif'#013#010+ - 'ifeq ($(OS_TARGET),os2)'#013#010+ - 'PACKAGESUFFIX=emx'#013#010+ - 'endif'#013#010+ - 'endif'#013#010+ - #013#010+ - '# Temporary path',' to pack a file'#013#010+ - 'ifndef PACKDIR'#013#010+ - 'ifndef inUnix'#013#010+ - 'PACKDIR=$(BASEDIR)/pack_tmp'#013#010+ - 'else'#013#010+ - 'PACKDIR=/tmp/fpc-pack'#013#010+ - 'endif'#013#010+ - 'endif'#013#010+ - #013#010+ - '# Maybe create default zipname from packagename'#013#010+ - 'ifndef ZIPNAME'#013#010+ - 'ifdef PACKAGENAME'#013#010+ - 'ZIPNAME=$(PACKAGEPREFIX)$(PACKAGEN','AME)$(PACKAGESUFFIX)'#013#010+ - 'endif'#013#010+ - 'endif'#013#010+ - #013#010+ - '# Use tar by default under linux'#013#010+ - 'ifndef USEZIP'#013#010+ - 'ifdef inUnix'#013#010+ - 'USETAR=1'#013#010+ - 'endif'#013#010+ - 'endif'#013#010+ - #013#010+ - '# Use a wrapper script by default for Os/2'#013#010+ - 'ifdef inOS2'#013#010+ - 'USEZIPWRAPPER=1'#013#010+ - 'endif'#013#010+ - #013#010+ - '# Create commands to create th','e zip/tar file'#013#010+ - 'ZIPWRAPPER=$(DESTZIPDIR)/fpczip$(BATCHEXT)'#013#010+ - 'ZIPCMD_CDPACK:=cd $(subst /,$(PATHSEP),$(PACKDIR))'#013#010+ - 'ZIPCMD_CDBASE:=cd $(subst /,$(PATHSEP),$(BASEDIR))'#013#010+ - 'ifdef USETAR'#013#010+ - 'ZIPDESTFILE:=$(DESTZIPDIR)/$(ZIPNAME)$(TAREXT)'#013#010+ - 'ZIPCMD_ZIP:=$(','TARPROG) cf$(TAROPT) $(ZIPDESTFILE) *'#013#010+ - 'else'#013#010+ - 'ZIPDESTFILE:=$(DESTZIPDIR)/$(ZIPNAME)$(ZIPEXT)'#013#010+ - 'ZIPCMD_ZIP:=$(subst /,$(PATHSEP),$(ZIPPROG)) -Dr $(ZIPOPT) $(ZIPDESTFI'+ - 'LE) *'#013#010+ - 'endif'#013#010+ - #013#010+ - 'fpc_zipinstall:'#013#010+ - 'ifndef ZIPNAME'#013#010+ - ' @$(ECHO) "Please spe','cify ZIPNAME!"'#013#010+ - ' @exit 1'#013#010+ - 'else'#013#010+ - ' $(MAKE) $(ZIPTARGET) PREFIXINSTALLDIR=$(PACKDIR)'#013#010+ - ' $(DEL) $(ZIPDESTFILE)'#013#010+ - 'ifdef USEZIPWRAPPER'#013#010+ - 'ifneq ($(ECHO),echo)'#013#010+ - ' $(ECHO) "$(ZIPCMD_CDPACK)" > $(ZIPWRAPPER)'#013#010+ - ' $(ECHO) "','$(ZIPCMD_ZIP)" >> $(ZIPWRAPPER)'#013#010+ - ' $(ECHO) "$(ZIPCMD_CDBASE)" >> $(ZIPWRAPPER)'#013#010+ - 'else'#013#010+ - ' $(ECHO) $(ZIPCMD_CDPACK) > $(ZIPWRAPPER)'#013#010+ - ' $(ECHO) $(ZIPCMD_ZIP) >> $(ZIPWRAPPER)'#013#010+ - ' $(ECHO) $(ZIPCMD_CDBASE) >> $(ZIPWRAPPER)'#013,#010+ - 'endif'#013#010+ - 'ifdef inUnix'#013#010+ - ' /bin/sh $(ZIPWRAPPER)'#013#010+ - 'else'#013#010+ - ' $(ZIPWRAPPER)'#013#010+ - 'endif'#013#010+ - ' $(DEL) $(ZIPWRAPPER)'#013#010+ - 'else'#013#010+ - ' $(ZIPCMD_CDPACK) ; $(ZIPCMD_ZIP) ; $(ZIPCMD_CDBASE)'#013#010+ - 'endif'#013#010+ - ' $(DELTREE) $(PACKDIR)'#013#010+ - 'endif'#013#010+ - #013#010+ - #013#010+ - '[zips','ourceinstallrules]'#013#010+ - '.PHONY: fpc_zipsourceinstall'#013#010+ - #013#010+ - 'fpc_zipsourceinstall:'#013#010+ - ' $(MAKE) fpc_zipinstall ZIPTARGET=sourceinstall PACKAGESUFFIX=s'+ - 'rc'#013#010+ - #013#010+ - #013#010+ - '[zipexampleinstallrules]'#013#010+ - '.PHONY: fpc_zipexampleinstall'#013#010+ - #013#010+ - 'fpc_zipexampleinstall:'#013#010+ - ' ',' $(MAKE) fpc_zipinstall ZIPTARGET=exampleinstall PACKAGESUFFI'+ - 'X=exm'#013#010+ - #013#010+ - #013#010+ - '[cleanrules]'#013#010+ - '#####################################################################'#013+ - #010+ - '# Clean rules'#013#010+ - '###############################################################','#####'+ - '#'#013#010+ - #013#010+ - '.PHONY: fpc_clean fpc_cleanall fpc_distclean'#013#010+ - #013#010+ - 'ifdef EXEFILES'#013#010+ - 'override CLEANEXEFILES:=$(addprefix $(TARGETDIRPREFIX),$(CLEANEXEFILES'+ - '))'#013#010+ - 'endif'#013#010+ - #013#010+ - 'ifdef EXTRACLEANUNITS'#013#010+ - 'override CLEANPPUFILES+=$(addsuffix $(PPUEXT),$(EXTRACLEANUN','ITS))'#013+ - #010+ - 'endif'#013#010+ - #013#010+ - 'ifdef CLEANPPUFILES'#013#010+ - 'override CLEANPPUFILES:=$(addprefix $(UNITTARGETDIRPREFIX),$(CLEANPPUF'+ - 'ILES))'#013#010+ - '# Get the .o and .a files created for the units'#013#010+ - 'ifdef PPUFILES'#013#010+ - 'CLEANPPULINKFILES:=$(shell $(PPUFILES) $(CLEANPPUFILES))'#013#010+ - 'el','se'#013#010+ - 'CLEANPPULINKFILES:=$(wildcard $(subst $(PPUEXT),$(OEXT),$(CLEANPPUFILE'+ - 'S)) $(addprefix $(LIBPREFIX),$(subst $(PPUEXT),$(STATICLIBEXT),$(CLEAN'+ - 'PPUFILES))))'#013#010+ - 'endif'#013#010+ - 'override CLEANPPULINKFILES:=$(addprefix $(UNITTARGETDIRPREFIX),$(CLEAN'+ - 'PPULI','NKFILES))'#013#010+ - 'endif'#013#010+ - #013#010+ - 'fpc_clean: $(CLEANTARGET)'#013#010+ - 'ifdef CLEANEXEFILES'#013#010+ - ' -$(DEL) $(CLEANEXEFILES)'#013#010+ - 'endif'#013#010+ - 'ifdef CLEANPPUFILES'#013#010+ - ' -$(DEL) $(CLEANPPUFILES)'#013#010+ - 'endif'#013#010+ - 'ifneq ($(CLEANPPULINKFILES),)'#013#010+ - ' -$(DEL) $(CLEANPPULINKFILES)'#013#010, - 'endif'#013#010+ - 'ifdef CLEANRSTFILES'#013#010+ - ' -$(DEL) $(addprefix $(UNITTARGETDIRPREFIX),$(CLEANRSTFILES))'#013+ - #010+ - 'endif'#013#010+ - 'ifdef EXTRACLEANFILES'#013#010+ - ' -$(DEL) $(EXTRACLEANFILES)'#013#010+ - 'endif'#013#010+ - 'ifdef LIBNAME'#013#010+ - ' -$(DEL) $(LIBNAME) $(LIBFULLNAME)'#013#010+ - 'endif'#013#010+ - ' ',' -$(DEL) $(FPCMADE) $(PPAS) link.res $(FPCEXTFILE) $(REDIRFIL'+ - 'E)'#013#010+ - #013#010+ - 'fpc_distclean: fpc_clean'#013#010+ - #013#010+ - '# Also run clean first if targetdir is set. Unittargetdir is always'#013+ - #010+ - '# set if targetdir or unittargetdir is specified'#013#010+ - 'ifdef UNITTARGETDIR'#013#010+ - 'TA','RGETDIRCLEAN=fpc_clean'#013#010+ - 'endif'#013#010+ - #013#010+ - 'fpc_cleanall: $(CLEANTARGET) $(TARGETDIRCLEAN)'#013#010+ - 'ifdef CLEANEXEFILES'#013#010+ - ' -$(DEL) $(CLEANEXEFILES)'#013#010+ - 'endif'#013#010+ - ' -$(DEL) *$(OEXT) *$(PPUEXT) *$(RSTEXT) *$(ASMEXT) *$(STATICLIB'+ - 'EXT) *$(SHAREDLIBEXT) *$(PP','LEXT)'#013#010+ - ' -$(DELTREE) *$(SMARTEXT)'#013#010+ - ' -$(DEL) $(FPCMADE) $(PPAS) link.res $(FPCEXTFILE) $(REDIRFILE)'+ - #013#010+ - #013#010+ - #013#010+ - '[dependrules]'#013#010+ - '#####################################################################'#013+ - #010+ - '# Depend rules'#013#010+ - '#####################','###############################################'+ - '#'#013#010+ - #013#010+ - '.PHONY: fpc_depend'#013#010+ - #013#010+ - 'fpc_depend:'#013#010+ - ' $(PPDEP) $(UNITOBJECTS)'#013#010+ - #013#010+ - #013#010+ - '[inforules]'#013#010+ - '#####################################################################'#013+ - #010+ - '# Info rules'#013#010+ - '##################','##################################################'+ - '#'#013#010+ - #013#010+ - '.PHONY: fpc_info fpc_cfginfo fpc_objectinfo fpc_toolsinfo fpc_installi'+ - 'nfo \'#013#010+ - ' fpc_dirinfo'#013#010+ - #013#010+ - 'fpc_info: $(INFOTARGET)'#013#010+ - #013#010+ - '[info_cfg]'#013#010+ - 'fpc_infocfg:'#013#010+ - ' @$(ECHO)'#013#010+ - ' @$(ECH','O) == Configuration info =='#013#010+ - ' @$(ECHO)'#013#010+ - ' @$(ECHO) FPC....... $(FPC)'#013#010+ - ' @$(ECHO) Version... $(FPC_VERSION)'#013#010+ - ' @$(ECHO) CPU....... $(CPU_TARGET)'#013#010+ - ' @$(ECHO) Source.... $(OS_SOURCE)'#013#010+ - ' @$(ECHO) Targe','t.... $(OS_TARGET)'#013#010+ - ' @$(ECHO)'#013#010+ - #013#010+ - '[info_dirs]'#013#010+ - 'fpc_infodirs:'#013#010+ - ' @$(ECHO)'#013#010+ - ' @$(ECHO) == Directory info =='#013#010+ - ' @$(ECHO)'#013#010+ - 'ifdef NEEDGCCLIB'#013#010+ - ' @$(ECHO) GCC library is needed.'#013#010+ - 'endif'#013#010+ - 'ifdef NEEDOTHERLIB'#013#010+ - ' @','$(ECHO) Other library is needed.'#013#010+ - 'endif'#013#010+ - ' @$(ECHO) Basedir......... $(BASEDIR)'#013#010+ - ' @$(ECHO)'#013#010+ - ' @$(ECHO) GCC library..... $(GCCLIBDIR)'#013#010+ - ' @$(ECHO) Other library... $(OTHERLIBDIR)'#013#010+ - ' @$(ECHO)'#013#010+ - #013#010+ - '[info_tools]'#013,#010+ - 'fpc_infotools:'#013#010+ - ' @$(ECHO)'#013#010+ - ' @$(ECHO) == Tools info =='#013#010+ - ' @$(ECHO)'#013#010+ - ' @$(ECHO) Pwd....... $(PWD)'#013#010+ - ' @$(ECHO) Echo...... $(ECHO)'#013#010+ - 'ifdef PPDEP'#013#010+ - ' @$(ECHO) PPDep..... $(PPDEP)'#013#010+ - 'endif'#013#010+ - 'ifdef PPUMOVE'#013#010+ - ' ',' @$(ECHO) PPUMove... $(PPUMOVE)'#013#010+ - 'endif'#013#010+ - 'ifdef PPUFILES'#013#010+ - ' @$(ECHO) PPUFiles.. $(PPUFILES)'#013#010+ - 'endif'#013#010+ - 'ifdef DATA2INC'#013#010+ - ' @$(ECHO) Data2Inc.. $(DATA2INC)'#013#010+ - 'endif'#013#010+ - 'ifdef SED'#013#010+ - ' @$(ECHO) Sed....... $(SED)'#013#010+ - 'endif'#013#010+ - 'ifdef DAT','E'#013#010+ - ' @$(ECHO) Date...... $(DATE)'#013#010+ - 'endif'#013#010+ - 'ifdef DIFF'#013#010+ - ' @$(ECHO) Diff...... $(DIFF)'#013#010+ - 'endif'#013#010+ - 'ifdef CMP'#013#010+ - ' @$(ECHO) Cmp....... $(CMP)'#013#010+ - 'endif'#013#010+ - 'ifdef UPXPROG'#013#010+ - ' @$(ECHO) Upx....... $(UPXPROG)'#013#010+ - 'endif'#013#010+ - 'ifdef ZIPPROG'#013#010+ - ' ',' @$(ECHO) Zip....... $(ZIPPROG)'#013#010+ - 'endif'#013#010+ - ' @$(ECHO)'#013#010+ - #013#010+ - '[info_objects]'#013#010+ - 'fpc_infoobjects:'#013#010+ - ' @$(ECHO)'#013#010+ - ' @$(ECHO) == Object info =='#013#010+ - ' @$(ECHO)'#013#010+ - ' @$(ECHO) LoaderObjects..... $(LOADEROBJECTS)'#013#010+ - ' @$(E','CHO) UnitObjects....... $(UNITOBJECTS)'#013#010+ - ' @$(ECHO) ExeObjects........ $(EXEOBJECTS)'#013#010+ - ' @$(ECHO)'#013#010+ - ' @$(ECHO) ExtraCleanUnits... $(EXTRACLEANUNITS)'#013#010+ - ' @$(ECHO) ExtraCleanFiles... $(EXTRACLEANFILES)'#013#010+ - ' @$(ECHO',')'#013#010+ - ' @$(ECHO) ExtraInstallUnits. $(EXTRAINSTALLUNITS)'#013#010+ - ' @$(ECHO) ExtraInstallFiles. $(EXTRAINSTALLFILES)'#013#010+ - ' @$(ECHO)'#013#010+ - #013#010+ - '[info_install]'#013#010+ - 'fpc_infoinstall:'#013#010+ - ' @$(ECHO)'#013#010+ - ' @$(ECHO) == Install info =='#013#010+ - ' @','$(ECHO)'#013#010+ - 'ifdef DATE'#013#010+ - ' @$(ECHO) DateStr.............. $(DATESTR)'#013#010+ - 'endif'#013#010+ - 'ifdef PACKAGEPREFIX'#013#010+ - ' @$(ECHO) PackagePrefix........ $(PACKAGEPREFIX)'#013#010+ - 'endif'#013#010+ - 'ifdef PACKAGENAME'#013#010+ - ' @$(ECHO) PackageName.......... $(PACKAGENAME)'#013,#010+ - 'endif'#013#010+ - ' @$(ECHO) PackageSuffix........ $(PACKAGESUFFIX)'#013#010+ - ' @$(ECHO)'#013#010+ - ' @$(ECHO) BaseInstallDir....... $(BASEINSTALLDIR)'#013#010+ - ' @$(ECHO) BinInstallDir........ $(BININSTALLDIR)'#013#010+ - ' @$(ECHO) LibInstallDir........',' $(LIBINSTALLDIR)'#013#010+ - ' @$(ECHO) UnitInstallDir....... $(UNITINSTALLDIR)'#013#010+ - ' @$(ECHO) SourceInstallDir..... $(SOURCEINSTALLDIR)'#013#010+ - ' @$(ECHO) DocInstallDir........ $(DOCINSTALLDIR)'#013#010+ - ' @$(ECHO) DataInstallDir....... $(D','ATAINSTALLDIR)'#013#010+ - ' @$(ECHO)'#013#010+ - ' @$(ECHO) DestZipDir........... $(DESTZIPDIR)'#013#010+ - ' @$(ECHO) ZipName.............. $(ZIPNAME)'#013#010+ - ' @$(ECHO)'#013#010+ - #013#010+ - '[directorytargets]'#013#010+ - '###########################################################','#########'+ - '#'#013#010+ - '# Directories'#013#010+ - '#####################################################################'#013+ - #010+ - #013#010+ - '[localmakefile]'#013#010+ - '#####################################################################'#013+ - #010+ - '# Local Makefile'#013#010+ - '##################################','##################################'+ - '#'#013#010+ - #013#010+ - 'ifneq ($(wildcard fpcmake.loc),)'#013#010+ - 'include fpcmake.loc'#013#010+ - 'endif'#013#010+ - #013#010+ - '[userrules]'#013#010+ - '#####################################################################'#013+ - #010+ - '# Users rules'#013#010+ - '######################################','##############################'+ - '#'#013#010+ - #013#010+ - #013#010+ - '[end]'#013#010 -); diff --git a/utils/fpcmake.ini b/utils/fpcmake.ini deleted file mode 100644 index 8f71071cc4..0000000000 --- a/utils/fpcmake.ini +++ /dev/null @@ -1,1554 +0,0 @@ -; -; Templates used by fpcmake to create a Makefile from Makefile.fpc -; - -[osdetect] -##################################################################### -# Autodetect OS (Linux or Dos or Windows NT or OS/2) -# define inUnix when running under Unix (Linux,FreeBSD) -# define inWinNT when running under WinNT -# define inOS2 when running under OS/2 -##################################################################### - -# 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 -inUnix=1 -PWD:=$(firstword $(PWD)) -endif -else -PWD:=$(firstword $(PWD)) -endif - -# Detect NT - NT sets OS to Windows_NT -# Detect OS/2 - OS/2 has OS2_SHELL defined -ifndef inUnix -ifeq ($(OS),Windows_NT) -inWinNT=1 -else -ifdef OS2_SHELL -inOS2=1 -endif -endif -endif - -# The extension of executables -ifdef inUnix -SRCEXEEXT= -else -SRCEXEEXT=.exe -endif - -# The extension of batch files / scripts -ifdef inUnix -BATCHEXT=.sh -else -ifdef inOS2 -BATCHEXT=.cmd -else -BATCHEXT=.bat -endif -endif - -# Path Separator, the subst trick is necessary for the \ that can't exists -# at the end of a line -ifdef inUnix -PATHSEP=/ -else -PATHSEP=$(subst /,\,/) -endif - -# The path which is searched separated by spaces -ifdef inUnix -SEARCHPATH=$(subst :, ,$(PATH)) -else -SEARCHPATH=$(subst ;, ,$(PATH)) -endif - -# Base dir -ifdef PWD -BASEDIR:=$(shell $(PWD)) -else -BASEDIR=. -endif - - -[defaulttarget] -##################################################################### -# Default target -##################################################################### - -[fpcdetect] -##################################################################### -# FPC version/target Detection -##################################################################### - -# What compiler to use ? -ifndef FPC -# Compatibility with old makefiles -ifdef PP -FPC=$(PP) -else -FPC=ppc386 -endif -endif -override FPC:=$(subst $(SRCEXEEXT),,$(FPC)) -override FPC:=$(subst \,/,$(FPC))$(SRCEXEEXT) - -# Target OS -ifndef OS_TARGET -OS_TARGET:=$(shell $(FPC) -iTO) -endif - -# Source OS -ifndef OS_SOURCE -OS_SOURCE:=$(shell $(FPC) -iSO) -endif - -# Target CPU -ifndef CPU_TARGET -CPU_TARGET:=$(shell $(FPC) -iTP) -endif - -# Source CPU -ifndef CPU_SOURCE -CPU_SOURCE:=$(shell $(FPC) -iSP) -endif - -# FPC version -ifndef FPC_VERSION -FPC_VERSION:=$(shell $(FPC) -iV) -endif - -export FPC OS_TARGET OS_SOURCE CPU_TARGET CPU_SOURCE FPC_VERSION - - -[fpcdircheckenv] -##################################################################### -# FPCDIR Setting -##################################################################### - -# Test FPCDIR to look if the RTL dir exists -ifdef FPCDIR -override FPCDIR:=$(subst \,/,$(FPCDIR)) -ifeq ($(wildcard $(FPCDIR)/rtl),) -ifeq ($(wildcard $(FPCDIR)/units),) -override FPCDIR=wrong -endif -endif -else -override FPCDIR=wrong -endif - -[fpcdirdetect] -# Detect FPCDIR -ifeq ($(FPCDIR),wrong) -ifdef inUnix -override FPCDIR=/usr/local/lib/fpc/$(FPC_VERSION) -ifeq ($(wildcard $(FPCDIR)/units),) -override FPCDIR=/usr/lib/fpc/$(FPC_VERSION) -endif -else -override FPCDIR:=$(subst /$(FPC),,$(firstword $(strip $(wildcard $(addsuffix /$(FPC),$(SEARCHPATH)))))) -override FPCDIR:=$(FPCDIR)/.. -ifeq ($(wildcard $(FPCDIR)/rtl),) -ifeq ($(wildcard $(FPCDIR)/units),) -override FPCDIR:=$(FPCDIR)/.. -ifeq ($(wildcard $(FPCDIR)/rtl),) -ifeq ($(wildcard $(FPCDIR)/units),) -override FPCDIR=c:/pp -endif -endif -endif -endif -endif -endif - -[fpcdirsubs] -# Create units dir -ifneq ($(FPCDIR),.) -UNITSDIR=$(FPCDIR)/units/$(OS_TARGET) -endif - -[checkfpcdirsubs] -# Check if the dirs really exists, else turn it off -ifeq ($(wildcard $(UNITSDIR)),) -UNITSDIR= -endif -ifeq ($(wildcard $(TOOLKITSDIR)),) -TOOLKITSDIR= -endif -ifeq ($(wildcard $(PACKAGESDIR)),) -PACKAGESDIR= -endif -ifeq ($(wildcard $(COMPONENTSDIR)),) -COMPONENTSDIR= -endif - - -[presettings] -##################################################################### -# Pre Settings -##################################################################### - - -[usersettings] -##################################################################### -# User Settings -##################################################################### - - -[postsettings] -##################################################################### -# Post Settings -##################################################################### - - -[shelltools] -##################################################################### -# Shell tools -##################################################################### - -# echo -ifndef ECHO -ECHO:=$(strip $(wildcard $(addsuffix /gecho$(EXEEXT),$(SEARCHPATH)))) -ifeq ($(ECHO),) -ECHO:=$(strip $(wildcard $(addsuffix /echo$(SRCEXEEXT),$(SEARCHPATH)))) -ifeq ($(ECHO),) -ECHO:=echo -ECHOE:=echo -else -ECHO:=$(firstword $(ECHO)) -ECHOE=$(ECHO) -E -endif -else -ECHO:=$(firstword $(ECHO)) -ECHOE=$(ECHO) -E -endif -endif - -# To copy pograms -ifndef COPY -COPY:=cp -fp -endif - -# Copy a whole tree -ifndef COPYTREE -COPYTREE:=cp -rfp -endif - -# To move pograms -ifndef MOVE -MOVE:=mv -f -endif - -# Check delete program -ifndef DEL -DEL:=rm -f -endif - -# Check deltree program -ifndef DELTREE -DELTREE:=rm -rf -endif - -# To install files -ifndef INSTALL -ifdef inUnix -INSTALL:=install -c -m 644 -else -INSTALL:=$(COPY) -endif -endif - -# To install programs -ifndef INSTALLEXE -ifdef inUnix -INSTALLEXE:=install -c -m 755 -else -INSTALLEXE:=$(COPY) -endif -endif - -# To make a directory. -ifndef MKDIR -ifdef inUnix -MKDIR:=install -m 755 -d -else -MKDIR:=ginstall -m 755 -d -endif -endif - -export ECHO ECHOE COPY COPYTREE MOVE DEL DELTREE INSTALL INSTALLEXE MKDIR - - -[tool_default] -##################################################################### -# Default Tools -##################################################################### - -# assembler, redefine it if cross compiling -ifndef AS -AS=as -endif - -# linker, but probably not used -ifndef LD -LD=ld -endif - -# ppas.bat / ppas.sh -PPAS=$(BATCHEXT) - -# ldconfig to rebuild .so cache -ifdef inUnix -LDCONFIG=ldconfig -else -LDCONFIG= -endif - -[tool_ppdep] -# ppdep -ifndef PPDEP -PPDEP:=$(strip $(wildcard $(addsuffix /ppdep$(SRCEXEEXT),$(SEARCHPATH)))) -ifeq ($(PPDEP),) -PPDEP= -else -PPDEP:=$(firstword $(PPDEP)) -endif -endif -export PPDEP - -[tool_ppumove] -# ppumove -ifndef PPUMOVE -PPUMOVE:=$(strip $(wildcard $(addsuffix /ppumove$(SRCEXEEXT),$(SEARCHPATH)))) -ifeq ($(PPUMOVE),) -PPUMOVE= -else -PPUMOVE:=$(firstword $(PPUMOVE)) -endif -endif -export PPUMOVE - -[tool_ppufiles] -# ppufiles -ifndef PPUFILES -PPUFILES:=$(strip $(wildcard $(addsuffix /ppufiles$(SRCEXEEXT),$(SEARCHPATH)))) -ifeq ($(PPUFILES),) -PPUFILES= -else -PPUFILES:=$(firstword $(PPUFILES)) -endif -endif -export PPUFILES - -[tool_data2inc] -# data2inc -ifndef DATA2INC -DATA2INC:=$(strip $(wildcard $(addsuffix /data2inc$(SRCEXEEXT),$(SEARCHPATH)))) -ifeq ($(DATA2INC),) -DATA2INC= -else -DATA2INC:=$(firstword $(DATA2INC)) -endif -endif -export DATA2INC - -[tool_diff] -# diff -ifndef DIFF -DIFF:=$(strip $(wildcard $(addsuffix /diff$(SRCEXEEXT),$(SEARCHPATH)))) -ifeq ($(DIFF),) -DIFF= -else -DIFF:=$(firstword $(DIFF)) -endif -endif -export DIFF - -[tool_cmp] -# cmp -ifndef CMP -CMP:=$(strip $(wildcard $(addsuffix /cmp$(SRCEXEEXT),$(SEARCHPATH)))) -ifeq ($(CMP),) -CMP= -else -CMP:=$(firstword $(CMP)) -endif -endif -export CMP - -[tool_sed] -# Sed -ifndef SED -SED:=$(strip $(wildcard $(addsuffix /sed$(SRCEXEEXT),$(SEARCHPATH)))) -ifeq ($(SED),) -SED= -else -SED:=$(firstword $(SED)) -endif -endif -export SED - -[tool_upx] -# 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$(SRCEXEEXT),$(SEARCHPATH)))) -ifeq ($(UPXPROG),) -UPXPROG= -else -UPXPROG:=$(firstword $(UPXPROG)) -endif -else -UPXPROG= -endif -endif -export UPXPROG - -[tool_date] -# gdate/date -ifndef DATE -DATE:=$(strip $(wildcard $(addsuffix /date$(SRCEXEEXT),$(SEARCHPATH)))) -ifeq ($(DATE),) -DATE:=$(strip $(wildcard $(addsuffix /gdate$(SRCEXEEXT),$(SEACHPATH)))) -ifeq ($(DATE),) -DATE= -else -DATE:=$(firstword $(DATE)) -endif -else -DATE:=$(firstword $(DATE)) -endif -endif -export DATE - -ifdef DATE -DATESTR:=$(shell $(DATE) +%Y%m%d) -else -DATESTR= -endif - -[tool_zip] -# ZipProg, you can't use Zip as the var name (PFV) -ifndef ZIPPROG -ZIPPROG:=$(strip $(wildcard $(addsuffix /zip$(SRCEXEEXT),$(SEARCHPATH)))) -ifeq ($(ZIPPROG),) -ZIPPROG= -else -ZIPPROG:=$(firstword $(ZIPPROG)) -endif -endif -export ZIPPROG - -ZIPOPT=-9 -ZIPEXT=.zip - -[tool_tar] -# Tar -ifndef TARPROG -TARPROG:=$(strip $(wildcard $(addsuffix /tar$(SRCEXEEXT),$(SEARCHPATH)))) -ifeq ($(TARPROG),) -TARPROG= -else -TARPROG:=$(firstword $(TARPROG)) -endif -endif -export TARPROG - -ifeq ($(USETAR),bz2) -TAROPT=vI -TAREXT=.tar.bz2 -else -TAROPT=vz -TAREXT=.tar.gz -endif - - -[extensions] -##################################################################### -# Default extensions -##################################################################### - -# Default needed extensions (Go32v2,Linux) -LOADEREXT=.as -EXEEXT=.exe -PPLEXT=.ppl -PPUEXT=.ppu -OEXT=.o -ASMEXT=.s -SMARTEXT=.sl -STATICLIBEXT=.a -SHAREDLIBEXT=.so -RSTEXT=.rst -FPCMADE=fpcmade - -# Go32v1 -ifeq ($(OS_TARGET),go32v1) -PPUEXT=.pp1 -OEXT=.o1 -ASMEXT=.s1 -SMARTEXT=.sl1 -STATICLIBEXT=.a1 -SHAREDLIBEXT=.so1 -FPCMADE=fpcmade.v1 -endif - -# Go32v2 -ifeq ($(OS_TARGET),go32v2) -FPCMADE=fpcmade.dos -endif - -# Linux -ifeq ($(OS_TARGET),linux) -EXEEXT= -HASSHAREDLIB=1 -FPCMADE=fpcmade.lnx -endif - -# Linux -ifeq ($(OS_TARGET),freebsd) -EXEEXT= -HASSHAREDLIB=1 -FPCMADE=fpcmade.freebsd -endif - -# Win32 -ifeq ($(OS_TARGET),win32) -PPUEXT=.ppw -OEXT=.ow -ASMEXT=.sw -SMARTEXT=.slw -STATICLIBEXT=.aw -SHAREDLIBEXT=.dll -FPCMADE=fpcmade.w32 -endif - -# OS/2 -ifeq ($(OS_TARGET),os2) -PPUEXT=.ppo -ASMEXT=.so2 -OEXT=.oo2 -SMARTEXT=.so -STATICLIBEXT=.ao2 -SHAREDLIBEXT=.dll -FPCMADE=fpcmade.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 - - -[dir_default] -##################################################################### -# Default Directories -##################################################################### - -# Linux and freebsd use unix dirs with /usr/bin, /usr/lib -# When zipping use the target as default, when normal install then -# use the source os as default -ifdef ZIPNAME -# Zipinstall -ifeq ($(OS_TARGET),linux) -UNIXINSTALLDIR=1 -endif -ifeq ($(OS_TARGET),freebsd) -UNIXINSTALLDIR=1 -endif -else -# Normal install -ifeq ($(OS_SOURCE),linux) -UNIXINSTALLDIR=1 -endif -ifeq ($(OS_SOURCE),freebsd) -UNIXINSTALLDIR=1 -endif -endif - -# set the prefix directory where to install everything -ifndef PREFIXINSTALLDIR -ifdef UNIXINSTALLDIR -PREFIXINSTALLDIR=/usr -else -PREFIXINSTALLDIR=/pp -endif -endif -export PREFIXINSTALLDIR - -# Where to place the resulting zip files -ifndef DESTZIPDIR -DESTZIPDIR:=$(BASEDIR) -endif -export DESTZIPDIR - - -[dir_install] -##################################################################### -# Install Directories -##################################################################### - -# set the base directory where to install everything -ifndef BASEINSTALLDIR -ifdef UNIXINSTALLDIR -BASEINSTALLDIR=$(PREFIXINSTALLDIR)/lib/fpc/$(FPC_VERSION) -else -BASEINSTALLDIR=$(PREFIXINSTALLDIR) -endif -endif - -# set the directory where to install the binaries -ifndef BININSTALLDIR -ifdef UNIXINSTALLDIR -BININSTALLDIR=$(PREFIXINSTALLDIR)/bin -else -BININSTALLDIR=$(BASEINSTALLDIR)/bin/$(OS_TARGET) -endif -endif - -# set the directory where to install the units. -ifndef UNITINSTALLDIR -UNITINSTALLDIR=$(BASEINSTALLDIR)/units/$(OS_TARGET) -ifdef UNITSUBDIR -UNITINSTALLDIR:=$(UNITINSTALLDIR)/$(UNITSUBDIR) -endif -endif - -# Where to install shared libraries -ifndef LIBINSTALLDIR -ifdef UNIXINSTALLDIR -LIBINSTALLDIR=$(PREFIXINSTALLDIR)/lib -else -LIBINSTALLDIR=$(UNITINSTALLDIR) -endif -endif - -# Where the source files will be stored -ifndef SOURCEINSTALLDIR -ifdef UNIXINSTALLDIR -SOURCEINSTALLDIR=$(PREFIXINSTALLDIR)/src/fpc-$(FPC_VERSION) -else -SOURCEINSTALLDIR=$(BASEINSTALLDIR)/source -endif -ifdef SOURCESUBDIR -SOURCEINSTALLDIR:=$(SOURCEINSTALLDIR)/$(SOURCESUBDIR) -endif -endif - -# Where the doc files will be stored -ifndef DOCINSTALLDIR -ifdef UNIXINSTALLDIR -DOCINSTALLDIR=$(PREFIXINSTALLDIR)/doc/fpc-$(FPC_VERSION) -else -DOCINSTALLDIR=$(BASEINSTALLDIR)/doc -endif -endif - -# Where to install the examples, under linux we use the doc dir -# because the copytree command will create a subdir itself -ifndef EXAMPLEINSTALLDIR -ifdef UNIXINSTALLDIR -EXAMPLEINSTALLDIR=$(DOCINSTALLDIR)/examples -else -EXAMPLEINSTALLDIR=$(BASEINSTALLDIR)/examples -endif -ifdef EXAMPLESUBDIR -EXAMPLEINSTALLDIR:=$(EXAMPLEINSTALLDIR)/$(EXAMPLESUBDIR) -endif -endif - -# Where the some extra (data)files will be stored -ifndef DATAINSTALLDIR -DATAINSTALLDIR=$(BASEINSTALLDIR) -endif - - -[dir_gcclib] -# On linux, try to find where libgcc.a is. -ifdef inUnix -ifndef GCCLIBDIR -GCCLIBDIR:=$(shell dirname `(gcc -v 2>&1)| head -n 1| awk '{ print $$4 } '`) -endif -endif -export GCCLIBDIR - - -[dir_otherlib] -# Where to find other libraries -ifdef inUnix -ifndef OTHERLIBDIR -OTHERLIBDIR:=$(shell grep -v "^\#" /etc/ld.so.conf | awk '{ ORS=" "; print $1 }') -endif -endif -export OTHERLIBDIR - - -[redir] -##################################################################### -# Redirection -##################################################################### - -ifndef REDIRFILE -REDIRFILE=log -endif - -ifdef REDIR -ifndef inUnix -override FPC=redir -eo $(FPC) -endif -# set the verbosity to max -override FPCOPT+=-va -override REDIR:= >> $(REDIRFILE) -endif - -[command_begin] -##################################################################### -# 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 - -# User dirs should be first, so they are looked at first -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 - -# Smartlinking -ifdef LINKSMART -override FPCOPT+=-XX -endif - -# Smartlinking creation -ifdef CREATESMART -override FPCOPT+=-CX -endif - -# Debug -ifdef DEBUG -override FPCOPT+=-gl -dDEBUG -endif - -# Release mode (strip, optimize and don't load ppc386.cfg) -# 0.99.12b has a bug in the optimizer so don't use it by default -ifdef RELEASE -ifeq ($(FPC_VERSION),0.99.12) -override FPCOPT+=-Xs -OGp3 -n -else -override FPCOPT+=-Xs -OG2p3 -n -endif -endif - -# Strip -ifdef STRIP -override FPCOPT+=-Xs -endif - -# Optimizer -ifdef OPTIMIZE -override FPCOPT+=-OG2p3 -endif - -# Verbose settings (warning,note,info) -ifdef VERBOSE -override FPCOPT+=-vwni -endif - - -[command_needopt] -ifdef NEEDOPT -override FPCOPT+=$(NEEDOPT) -endif - - -[command_needunit] -ifdef NEEDUNITDIR -override FPCOPT+=$(addprefix -Fu,$(NEEDUNITDIR)) -endif - - -[command_unitsdir] -ifdef UNITSDIR -override FPCOPT+=-Fu$(UNITSDIR) -endif - - -[command_needlib] -ifdef NEEDLIBDIR -override FPCOPT+=$(addprefix -Fl,$(NEEDLIBDIR)) -endif - - -[command_needobj] -ifdef NEEDOBJDIR -override FPCOPT+=$(addprefix -Fo,$(NEEDOBJDIR)) -endif - - -[command_needinc] -ifdef NEEDINCDIR -override FPCOPT+=$(addprefix -Fi,$(NEEDINCDIR)) -endif - -[command_gcclib] -# Add GCC lib path if asked -ifdef GCCLIBDIR -override FPCOPT+=-Fl$(GCCLIBDIR) -endif - -[command_otherlib] -# Add Other dirs path if asked -ifdef OTHERLIBDIR -override FPCOPT+=$(addprefix -Fl,$(OTHERLIBDIR)) -endif - -[command_target] -# Target dirs and the prefix to use for clean/install -ifdef TARGETDIR -override FPCOPT+=-FE$(TARGETDIR) -ifeq ($(TARGETDIR),.) -override TARGETDIRPREFIX= -else -override TARGETDIRPREFIX=$(TARGETDIR)/ -endif -endif -ifdef UNITTARGETDIR -override FPCOPT+=-FU$(UNITTARGETDIR) -ifeq ($(UNITTARGETDIR),.) -override UNITTARGETDIRPREFIX= -else -override UNITTARGETDIRPREFIX=$(TARGETDIR)/ -endif -else -ifdef TARGETDIR -override UNITTARGETDIR=$(TARGETDIR) -override UNITTARGETDIRPREFIX=$(TARGETDIRPREFIX) -endif -endif - -[command_end] -# Add commandline options last so they can override -ifdef OPT -override FPCOPT+=$(OPT) -endif - -# Add defines from FPCOPTDEF to FPCOPT -ifdef FPCOPTDEF -override FPCOPT+=$(FPCOPTDEF) -endif - -# Error file ? -ifdef ERRORFILE -override FPCOPT+=-Fr$(ERRORFILE) -endif - -# Was a config file specified ? -ifdef CFGFILE -override FPCOPT+=@$(CFGFILE) -endif - - -[command_win32file] -# For win32 the options are passed using the file fpcext.cmd -ifndef FPCEXTFILE -FPCEXTFILE=fpcext.cmd -endif -ifeq ($(OS_SOURCE),win32) -override TMPVAR:=$(shell "$(DEL) $(FPCEXTFILE)") -override TMPVAR:=$(foreach A,$(FPCOPT),$(shell "$(ECHOE) "$(A)" >> $(FPCEXTFILE)")) -override FPCOPT:=@$(FPCEXTFILE) -endif - -[command_win32env] -# For win32 the options are passed using the environment FPCEXTCMD -ifeq ($(OS_SOURCE),win32) -override FPCEXTCMD:=$(FPCOPT) -override FPCOPT:=!FPCEXTCMD -export FPCEXTCMD -endif - -[command_compiler] -# Compiler commandline -override COMPILER:=$(FPC) $(FPCOPT) - -# also call ppas if with command option -s -# but only if the OS_SOURCE and OS_TARGE are equal -ifeq (,$(findstring -s ,$(COMPILER))) -EXECPPAS= -else -ifeq ($(OS_SOURCE),$(OS_TARGET)) -EXECPPAS:=@$(PPAS) -endif -endif - - -[standardrules] -##################################################################### -# Standard rules -##################################################################### - -[packagedependrules] -##################################################################### -# Package depends -##################################################################### - - -[loaderrules] -##################################################################### -# Loaders -##################################################################### - -.PHONY: fpc_loaders - -%$(OEXT): %$(LOADEREXT) - $(AS) -o $*$(OEXT) $< - -override ALLTARGET+=fpc_loaders -override CLEANTARGET+=fpc_loaders_clean -override SHOWINSTALLTARGET+=fpc_loaders_showinstall -override INSTALLTARGET+=fpc_loaders_install - -override LOADEROFILES:=$(addsuffix $(OEXT),$(LOADEROBJECTS)) - -fpc_loaders: $(LOADEROFILES) - -fpc_loaders_clean: - -$(DEL) $(LOADEROFILES) - -fpc_loaders_showinstall: - @$(ECHO) -e $(addprefix "\n"$(UNITINSTALLDIR)/,$(LOADEROFILES)) - -fpc_loaders_install: - $(MKDIR) $(UNITINSTALLDIR) - $(INSTALL) $(LOADEROFILES) $(UNITINSTALLDIR) - - -[unitrules] -##################################################################### -# Units -##################################################################### - -.PHONY: fpc_units - -override ALLTARGET+=fpc_units - -override UNITPPUFILES=$(addsuffix $(PPUEXT),$(UNITOBJECTS)) -override INSTALLPPUFILES+=$(UNITPPUFILES) -override CLEANPPUFILES+=$(UNITPPUFILES) - -fpc_units: $(UNITPPUFILES) - - - -[exerules] -##################################################################### -# Exes -##################################################################### - -.PHONY: fpc_exes - -ifdef EXEOBJECTS -override EXEFILES=$(addsuffix $(EXEEXT),$(EXEOBJECTS)) -override EXEOFILES:=$(addsuffix $(OEXT),$(EXEOBJECTS)) $(addprefix $(LIBPREFIX),$(addsuffix $(STATICLIBEXT),$(EXEOBJECTS))) - -override ALLTARGET+=fpc_exes -override INSTALLEXEFILES+=$(EXEFILES) -override CLEANEXEFILES+=$(EXEFILES) $(EXEOFILES) - -endif - -fpc_exes: $(EXEFILES) - - -[rstrules] -##################################################################### -# Resource strings -##################################################################### - -ifdef RSTOBJECTS -override RSTFILES=$(addsuffix $(RSTEXT),$(RSTOBJECTS)) - -override CLEANRSTFILES+=$(RSTFILES) -endif - - -[examplerules] -##################################################################### -# Examples -##################################################################### - -.PHONY: fpc_examples fpc_test - -ifdef EXAMPLEOBJECTS -override EXAMPLESOURCEFILES:=$(addsuffix $(PASEXT),$(EXAMPLEOBJECTS)) -override EXAMPLEFILES:=$(addsuffix $(EXEEXT),$(EXAMPLEOBJECTS)) -override EXAMPLEOFILES:=$(addsuffix $(OEXT),$(EXAMPLEOBJECTS)) $(addprefix $(LIBPREFIX),$(addsuffix $(STATICLIBEXT),$(EXAMPLEOBJECTS))) - -override CLEANEXEFILES+=$(EXAMPLEFILES) $(EXAMPLEOFILES) -endif - -fpc_examples: all $(EXAMPLEFILES) $(addsuffix _all,$(EXAMPLEDIROBJECTS)) - -fpc_test: examples - - -[compilerules] -##################################################################### -# General compile rules -##################################################################### - -.PHONY: fpc_packages fpc_all fpc_debug - -$(FPCMADE): $(ALLTARGET) - @$(ECHO) Compiled > $(FPCMADE) - -fpc_packages: $(COMPILEPACKAGES) - -fpc_all: fpc_packages $(FPCMADE) - -fpc_debug: - $(MAKE) all DEBUG=1 - -# Search paths for .ppu if targetdir is set -ifdef UNITTARGETDIR -vpath %$(PPUEXT) $(UNITTARGETDIR) -endif - -# General compile rules, available for both possible PASEXT - -.SUFFIXES: $(EXEEXT) $(PPUEXT) $(OEXT) .pas .pp - -%$(PPUEXT): %.pp - $(COMPILER) $< $(REDIR) - $(EXECPPAS) - -%$(PPUEXT): %.pas - $(COMPILER) $< $(REDIR) - $(EXECPPAS) - -%$(EXEEXT): %.pp - $(COMPILER) $< $(REDIR) - $(EXECPPAS) - -%$(EXEEXT): %.pas - $(COMPILER) $< $(REDIR) - $(EXECPPAS) - - -[libraryrules] -##################################################################### -# Library -##################################################################### - -.PHONY: fpc_smart fpc_shared - -ifdef LIBVERSION -LIBFULLNAME=$(LIBNAME).$(LIBVERSION) -else -LIBFULLNAME=$(LIBNAME) -endif - -# Default sharedlib units are all unit objects -ifndef SHAREDLIBUNITOBJECTS -SHAREDLIBUNITOBJECTS:=$(UNITOBJECTS) -endif - -fpc_smart: - $(MAKE) all LINKSMART=1 CREATESMART=1 - -fpc_shared: all -ifdef HASSHAREDLIB -ifndef LIBNAME - @$(ECHO) "LIBNAME not set" -else - $(PPUMOVE) $(SHAREDLIBUNITOBJECTS) -o$(LIBFULLNAME) -endif -else - @$(ECHO) "Shared Libraries not supported" -endif - - -[installrules] -##################################################################### -# Install rules -##################################################################### - -.PHONY: fpc_showinstall fpc_install - -ifdef EXTRAINSTALLUNITS -override INSTALLPPUFILES+=$(addsuffix $(PPUEXT),$(EXTRAINSTALLUNITS)) -endif - -ifdef INSTALLPPUFILES -override INSTALLPPUFILES:=$(addprefix $(UNITTARGETDIRPREFIX),$(INSTALLPPUFILES)) -ifdef PPUFILES -INSTALLPPULINKFILES:=$(shell $(PPUFILES) -S -O $(INSTALLPPUFILES)) -else -INSTALLPPULINKFILES:=$(wildcard $(subst $(PPUEXT),$(OEXT),$(INSTALLPPUFILES)) $(addprefix $(LIBPREFIX),$(subst $(PPUEXT),$(STATICLIBEXT),$(INSTALLPPUFILES)))) -endif -override INSTALLPPULINKFILES:=$(addprefix $(UNITTARGETDIRPREFIX),$(INSTALLPPULINKFILES)) -endif - -ifdef INSTALLEXEFILES -override INSTALLEXEFILES:=$(addprefix $(TARGETDIRPREFIX),$(INSTALLEXEFILES)) -endif - -fpc_showinstall: $(SHOWINSTALLTARGET) -ifdef INSTALLEXEFILES - @$(ECHO) -e $(addprefix "\n"$(BININSTALLDIR)/,$(INSTALLEXEFILES)) -endif -ifdef INSTALLPPUFILES - @$(ECHO) -e $(addprefix "\n"$(UNITINSTALLDIR)/,$(INSTALLPPUFILES)) -ifneq ($(INSTALLPPULINKFILES),) - @$(ECHO) -e $(addprefix "\n"$(UNITINSTALLDIR)/,$(INSTALLPPULINKFILES)) -endif -ifneq ($(wildcard $(LIBFULLNAME)),) - @$(ECHO) $(LIBINSTALLDIR)/$(LIBFULLNAME) -ifdef HASSHAREDLIB - @$(ECHO) $(LIBINSTALLDIR)/$(LIBNAME) -endif -endif -endif -ifdef EXTRAINSTALLFILES - @$(ECHO) -e $(addprefix "\n"$(DATAINSTALLDIR)/,$(EXTRAINSTALLFILES)) -endif - -fpc_install: $(INSTALLTARGET) -# Create UnitInstallFiles -ifdef INSTALLEXEFILES - $(MKDIR) $(BININSTALLDIR) -# Compress the exes if upx is defined -ifdef UPXPROG - -$(UPXPROG) $(INSTALLEXEFILES) -endif - $(INSTALLEXE) $(INSTALLEXEFILES) $(BININSTALLDIR) -endif -ifdef INSTALLPPUFILES - $(MKDIR) $(UNITINSTALLDIR) - $(INSTALL) $(INSTALLPPUFILES) $(UNITINSTALLDIR) -ifneq ($(INSTALLPPULINKFILES),) - $(INSTALL) $(INSTALLPPULINKFILES) $(UNITINSTALLDIR) -endif -ifneq ($(wildcard $(LIBFULLNAME)),) - $(MKDIR) $(LIBINSTALLDIR) - $(INSTALL) $(LIBFULLNAME) $(LIBINSTALLDIR) -ifdef inUnix - ln -sf $(LIBFULLNAME) $(LIBINSTALLDIR)/$(LIBNAME) -endif -endif -endif -ifdef EXTRAINSTALLFILES - $(MKDIR) $(DATAINSTALLDIR) - $(INSTALL) $(EXTRAINSTALLFILES) $(DATAINSTALLDIR) -endif - - -[sourceinstallrules] -##################################################################### -# SourceInstall rules -##################################################################### - -.PHONY: fpc_sourceinstall - -ifndef SOURCETOPDIR -SOURCETOPDIR=$(BASEDIR) -endif - -fpc_sourceinstall: clean - $(MKDIR) $(SOURCEINSTALLDIR) - $(COPYTREE) $(SOURCETOPDIR) $(SOURCEINSTALLDIR) - -[exampleinstallrules] -##################################################################### -# exampleinstall rules -##################################################################### - -.PHONY: fpc_exampleinstall - -fpc_exampleinstall: $(addsuffix _clean,$(EXAMPLEDIROBJECTS)) -ifdef EXAMPLESOURCEFILES - $(MKDIR) $(EXAMPLEINSTALLDIR) - $(COPY) $(EXAMPLESOURCEFILES) $(EXAMPLEINSTALLDIR) -endif -ifdef EXAMPLEDIROBJECTS -ifndef EXAMPLESOURCEFILES - $(MKDIR) $(EXAMPLEINSTALLDIR) -endif - $(COPYTREE) $(addsuffix /*,$(EXAMPLEDIROBJECTS)) $(EXAMPLEINSTALLDIR) -endif - - -[zipinstallrules] -##################################################################### -# Zip -##################################################################### - -.PHONY: fpc_zipinstall - -# Create suffix to add -ifndef PACKAGESUFFIX -PACKAGESUFFIX=$(OS_TARGET) -ifeq ($(OS_TARGET),go32v2) -PACKAGESUFFIX=go32 -endif -ifeq ($(OS_TARGET),win32) -PACKAGESUFFIX=w32 -endif -ifeq ($(OS_TARGET),os2) -PACKAGESUFFIX=emx -endif -endif - -# Temporary path to pack a file -ifndef PACKDIR -ifndef inUnix -PACKDIR=$(BASEDIR)/pack_tmp -else -PACKDIR=/tmp/fpc-pack -endif -endif - -# Maybe create default zipname from packagename -ifndef ZIPNAME -ifdef PACKAGENAME -ZIPNAME=$(PACKAGEPREFIX)$(PACKAGENAME)$(PACKAGESUFFIX) -endif -endif - -# Use tar by default under linux -ifndef USEZIP -ifdef inUnix -USETAR=1 -endif -endif - -# Use a wrapper script by default for Os/2 -ifdef inOS2 -USEZIPWRAPPER=1 -endif - -# Create commands to create the zip/tar file -ZIPWRAPPER=$(DESTZIPDIR)/fpczip$(BATCHEXT) -ZIPCMD_CDPACK:=cd $(subst /,$(PATHSEP),$(PACKDIR)) -ZIPCMD_CDBASE:=cd $(subst /,$(PATHSEP),$(BASEDIR)) -ifdef USETAR -ZIPDESTFILE:=$(DESTZIPDIR)/$(ZIPNAME)$(TAREXT) -ZIPCMD_ZIP:=$(TARPROG) cf$(TAROPT) $(ZIPDESTFILE) * -else -ZIPDESTFILE:=$(DESTZIPDIR)/$(ZIPNAME)$(ZIPEXT) -ZIPCMD_ZIP:=$(subst /,$(PATHSEP),$(ZIPPROG)) -Dr $(ZIPOPT) $(ZIPDESTFILE) * -endif - -fpc_zipinstall: -ifndef ZIPNAME - @$(ECHO) "Please specify ZIPNAME!" - @exit 1 -else - $(MAKE) $(ZIPTARGET) PREFIXINSTALLDIR=$(PACKDIR) - $(DEL) $(ZIPDESTFILE) -ifdef USEZIPWRAPPER -ifneq ($(ECHO),echo) - $(ECHO) "$(ZIPCMD_CDPACK)" > $(ZIPWRAPPER) - $(ECHO) "$(ZIPCMD_ZIP)" >> $(ZIPWRAPPER) - $(ECHO) "$(ZIPCMD_CDBASE)" >> $(ZIPWRAPPER) -else - $(ECHO) $(ZIPCMD_CDPACK) > $(ZIPWRAPPER) - $(ECHO) $(ZIPCMD_ZIP) >> $(ZIPWRAPPER) - $(ECHO) $(ZIPCMD_CDBASE) >> $(ZIPWRAPPER) -endif -ifdef inUnix - /bin/sh $(ZIPWRAPPER) -else - $(ZIPWRAPPER) -endif - $(DEL) $(ZIPWRAPPER) -else - $(ZIPCMD_CDPACK) ; $(ZIPCMD_ZIP) ; $(ZIPCMD_CDBASE) -endif - $(DELTREE) $(PACKDIR) -endif - - -[zipsourceinstallrules] -.PHONY: fpc_zipsourceinstall - -fpc_zipsourceinstall: - $(MAKE) fpc_zipinstall ZIPTARGET=sourceinstall PACKAGESUFFIX=src - - -[zipexampleinstallrules] -.PHONY: fpc_zipexampleinstall - -fpc_zipexampleinstall: - $(MAKE) fpc_zipinstall ZIPTARGET=exampleinstall PACKAGESUFFIX=exm - - -[cleanrules] -##################################################################### -# Clean rules -##################################################################### - -.PHONY: fpc_clean fpc_cleanall fpc_distclean - -ifdef EXEFILES -override CLEANEXEFILES:=$(addprefix $(TARGETDIRPREFIX),$(CLEANEXEFILES)) -endif - -ifdef EXTRACLEANUNITS -override CLEANPPUFILES+=$(addsuffix $(PPUEXT),$(EXTRACLEANUNITS)) -endif - -ifdef CLEANPPUFILES -override CLEANPPUFILES:=$(addprefix $(UNITTARGETDIRPREFIX),$(CLEANPPUFILES)) -# Get the .o and .a files created for the units -ifdef PPUFILES -CLEANPPULINKFILES:=$(shell $(PPUFILES) $(CLEANPPUFILES)) -else -CLEANPPULINKFILES:=$(wildcard $(subst $(PPUEXT),$(OEXT),$(CLEANPPUFILES)) $(addprefix $(LIBPREFIX),$(subst $(PPUEXT),$(STATICLIBEXT),$(CLEANPPUFILES)))) -endif -override CLEANPPULINKFILES:=$(addprefix $(UNITTARGETDIRPREFIX),$(CLEANPPULINKFILES)) -endif - -fpc_clean: $(CLEANTARGET) -ifdef CLEANEXEFILES - -$(DEL) $(CLEANEXEFILES) -endif -ifdef CLEANPPUFILES - -$(DEL) $(CLEANPPUFILES) -endif -ifneq ($(CLEANPPULINKFILES),) - -$(DEL) $(CLEANPPULINKFILES) -endif -ifdef CLEANRSTFILES - -$(DEL) $(addprefix $(UNITTARGETDIRPREFIX),$(CLEANRSTFILES)) -endif -ifdef EXTRACLEANFILES - -$(DEL) $(EXTRACLEANFILES) -endif -ifdef LIBNAME - -$(DEL) $(LIBNAME) $(LIBFULLNAME) -endif - -$(DEL) $(FPCMADE) $(PPAS) link.res $(FPCEXTFILE) $(REDIRFILE) - -fpc_distclean: fpc_clean - -# Also run clean first if targetdir is set. Unittargetdir is always -# set if targetdir or unittargetdir is specified -ifdef UNITTARGETDIR -TARGETDIRCLEAN=fpc_clean -endif - -fpc_cleanall: $(CLEANTARGET) $(TARGETDIRCLEAN) -ifdef CLEANEXEFILES - -$(DEL) $(CLEANEXEFILES) -endif - -$(DEL) *$(OEXT) *$(PPUEXT) *$(RSTEXT) *$(ASMEXT) *$(STATICLIBEXT) *$(SHAREDLIBEXT) *$(PPLEXT) - -$(DELTREE) *$(SMARTEXT) - -$(DEL) $(FPCMADE) $(PPAS) link.res $(FPCEXTFILE) $(REDIRFILE) - - -[dependrules] -##################################################################### -# Depend rules -##################################################################### - -.PHONY: fpc_depend - -fpc_depend: - $(PPDEP) $(UNITOBJECTS) - - -[inforules] -##################################################################### -# Info rules -##################################################################### - -.PHONY: fpc_info fpc_cfginfo fpc_objectinfo fpc_toolsinfo fpc_installinfo \ - fpc_dirinfo - -fpc_info: $(INFOTARGET) - -[info_cfg] -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) - -[info_dirs] -fpc_infodirs: - @$(ECHO) - @$(ECHO) == Directory info == - @$(ECHO) -ifdef NEEDGCCLIB - @$(ECHO) GCC library is needed. -endif -ifdef NEEDOTHERLIB - @$(ECHO) Other library is needed. -endif - @$(ECHO) Basedir......... $(BASEDIR) - @$(ECHO) - @$(ECHO) GCC library..... $(GCCLIBDIR) - @$(ECHO) Other library... $(OTHERLIBDIR) - @$(ECHO) - -[info_tools] -fpc_infotools: - @$(ECHO) - @$(ECHO) == Tools info == - @$(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 -ifdef DATE - @$(ECHO) Date...... $(DATE) -endif -ifdef DIFF - @$(ECHO) Diff...... $(DIFF) -endif -ifdef CMP - @$(ECHO) Cmp....... $(CMP) -endif -ifdef UPXPROG - @$(ECHO) Upx....... $(UPXPROG) -endif -ifdef ZIPPROG - @$(ECHO) Zip....... $(ZIPPROG) -endif - @$(ECHO) - -[info_objects] -fpc_infoobjects: - @$(ECHO) - @$(ECHO) == Object info == - @$(ECHO) - @$(ECHO) LoaderObjects..... $(LOADEROBJECTS) - @$(ECHO) UnitObjects....... $(UNITOBJECTS) - @$(ECHO) ExeObjects........ $(EXEOBJECTS) - @$(ECHO) - @$(ECHO) ExtraCleanUnits... $(EXTRACLEANUNITS) - @$(ECHO) ExtraCleanFiles... $(EXTRACLEANFILES) - @$(ECHO) - @$(ECHO) ExtraInstallUnits. $(EXTRAINSTALLUNITS) - @$(ECHO) ExtraInstallFiles. $(EXTRAINSTALLFILES) - @$(ECHO) - -[info_install] -fpc_infoinstall: - @$(ECHO) - @$(ECHO) == Install info == - @$(ECHO) -ifdef DATE - @$(ECHO) DateStr.............. $(DATESTR) -endif -ifdef PACKAGEPREFIX - @$(ECHO) PackagePrefix........ $(PACKAGEPREFIX) -endif -ifdef PACKAGENAME - @$(ECHO) PackageName.......... $(PACKAGENAME) -endif - @$(ECHO) PackageSuffix........ $(PACKAGESUFFIX) - @$(ECHO) - @$(ECHO) BaseInstallDir....... $(BASEINSTALLDIR) - @$(ECHO) BinInstallDir........ $(BININSTALLDIR) - @$(ECHO) LibInstallDir........ $(LIBINSTALLDIR) - @$(ECHO) UnitInstallDir....... $(UNITINSTALLDIR) - @$(ECHO) SourceInstallDir..... $(SOURCEINSTALLDIR) - @$(ECHO) DocInstallDir........ $(DOCINSTALLDIR) - @$(ECHO) DataInstallDir....... $(DATAINSTALLDIR) - @$(ECHO) - @$(ECHO) DestZipDir........... $(DESTZIPDIR) - @$(ECHO) ZipName.............. $(ZIPNAME) - @$(ECHO) - -[directorytargets] -##################################################################### -# Directories -##################################################################### - -[localmakefile] -##################################################################### -# Local Makefile -##################################################################### - -ifneq ($(wildcard fpcmake.loc),) -include fpcmake.loc -endif - -[userrules] -##################################################################### -# Users rules -##################################################################### - - -[end] diff --git a/utils/fpcmake.pp b/utils/fpcmake.pp deleted file mode 100644 index a5a0d3191c..0000000000 --- a/utils/fpcmake.pp +++ /dev/null @@ -1,1458 +0,0 @@ -{ - $Id$ - Copyright (c) 1999-2000 by Peter Vreman - - Convert Makefile.fpc to Makefile - - 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. - - **********************************************************************} -{$ifdef fpc}{$mode objfpc}{$endif} -{$H+} -program fpcmake; -uses -{$ifdef go32v2} - dpmiexcp, -{$endif} - dos, - sysutils,classes,makeini; - -const - Version='v1.00'; - Title='fpcmake '+Version; - TitleDate=Title+' ['+{$i %DATE}+']'; - -{ Include default fpcmake.ini } -{$i fpcmake.inc} - -type - tsections=(sec_none, - sec_units,sec_exes,sec_loaders,sec_examples,sec_package, - sec_compile,sec_require,sec_install,sec_sourceinstall,sec_exampleinstall, - sec_zipinstall,sec_zipsourceinstall,sec_zipexampleinstall, - sec_clean,sec_libs,sec_command,sec_exts,sec_dirs,sec_tools,sec_info - ); - - tbic=(bic_none,bic_build,bic_install,bic_zipinstall,bic_clean); - - tspecialdir=record - dir,unitdir,packdir : string; - end; - - -const - EnvVar='FPCMAKEINI'; - - sectionstr : array[tsections] of string=('none', - 'units','exes','loaders','examples','package', - 'compile','require','install','sourceinstall','exampleinstall', - 'zipinstall','zipsourceinstall','zipexampleinstall', - 'clean','libs','command','exts','dirs','tools','info' - ); - - sectiondef : array[tsections] of boolean=(false, - true,true,false,false,false, - true,false,true,true,true, - true,true,true, - true,true,true,true,true,true,true - ); - - targets=5; - targetstr : array[1..targets] of string=( - 'linux','go32v2','win32','os2','freebsd' - ); - - rules=18; - rulestr : array[1..rules] of string=( - 'all','debug', - 'examples','test', - 'smart','shared', - 'showinstall','install','sourceinstall','exampleinstall', - 'zipinstall','zipsourceinstall','zipexampleinstall', - 'clean','distclean','cleanall', - 'require','info' - ); - - rule2sec : array[1..rules] of tsections=( - sec_compile,sec_compile, - sec_examples,sec_examples, - sec_libs,sec_libs, - sec_install,sec_install,sec_sourceinstall,sec_exampleinstall, - sec_zipinstall,sec_zipsourceinstall,sec_zipexampleinstall, - sec_clean,sec_clean,sec_clean, - sec_require,sec_info - ); - - rule2bic : array[1..rules] of tbic=( - bic_build,bic_build, - bic_build,bic_build, - bic_build,bic_build, - bic_install,bic_install,bic_install,bic_install,bic_zipinstall,bic_zipinstall,bic_zipinstall, - bic_clean,bic_clean,bic_clean, - bic_none,bic_none - ); - - rulediralso : array[1..rules] of boolean=( - true,true, - true,true, - true,true, - true,true,true,true, - false,false,false, - true,true,true, - true,false - ); - - specialdirs = 4; - specialdir : array[1..specialdirs] of tspecialdir=( - (dir: 'rtl'; unitdir: '$(UNITSDIR)/rtl'; packdir: '$(FPCDIR)/rtl'), - (dir: 'fcl'; unitdir: '$(UNITSDIR)/fcl'; packdir: '$(FPCDIR)/fcl'), - (dir: 'api'; unitdir: '$(UNITSDIR)/api'; packdir: '$(FPCDIR)/api'), - (dir: 'fv'; unitdir: '$(UNITSDIR)/fv'; packdir: '$(FPCDIR)/fv') - ); - -{ Sections in Makefile.fpc } - ini_sections='sections'; - ini_install='install'; - ini_zip='zip'; - ini_clean='clean'; - ini_dirs='dirs'; - ini_require='require'; - ini_libs='libs'; - ini_targets='targets'; - ini_info='info'; - ini_defaults='defaults'; - ini_tools='tools'; - -type - TTargetsString=array[0..targets] of string; - TFpcMake=record - TargetDirs, - TargetLoaders, - TargetUnits, - TargetPrograms, - TargetExamples, - TargetExampleDirs, - TargetPkgs, - TargetRST : TTargetsString; - Installexamplesubdirs, - InstallSourceSubdirs : boolean; - InstallPackageName, - InstallUnitSubDir, - InstallExampleSubDir, - InstallPrefixDir, - InstallDataDir, - InstallBaseDir : string; - InstallUnits, - InstallFiles : TTargetsString; - CleanUnits, - CleanFiles : TTargetsString; - ZipName, - ZipTarget : string; - DefaultRule, - DefaultBuildDir, - DefaultInstallDir, - DefaultZipInstallDir, - DefaultCleanDir, - DefaultDir, - DefaultTarget, - DefaultCPU : string; - DirFpc, - DirPackage, - DirToolkit, - DirComponent, - DirUnit, - DirLib, - DirObj, - DirTarget, - DirUnitTarget, - DirSources, - DirInc : string; - RequireRTL : boolean; - RequireOptions : string; - RequireToolkits, - RequirePackages, - RequireComponents : TTargetsString; - LibName, - LibVersion, - LibUnits : string; - LibGCC, - LibOther : boolean; - InfoCfg, - InfoDirs, - InfoTools, - InfoInstall, - InfoObjects : boolean; - Section : array[tsections] of boolean; - ToolsPPDep, - ToolsPPUMove, - ToolsPPUFiles, - ToolsData2Inc, - ToolsSed, - ToolsDiff, - ToolsCmp, - ToolsUpx, - ToolsDate, - ToolsZip, - ToolsTar : boolean; - MultiPacks, - PreSettings, - PostSettings, - Rules : TStringList; - end; - - TMyMemoryStream=class(TMemoryStream) - public - constructor Create(p:pointer;mysize:integer); - end; - -var - userini : TFpcMake; - fpcini : TIniFile; - IniStream : TMyMemoryStream; - - -{***************************************************************************** - Helpers -*****************************************************************************} - -procedure Verbose(s:string); -begin - writeln(s); -end; - - -procedure Error(s:string); -begin - Writeln(s); - Halt(1); -end; - - -function posidx(const substr,s : string;idx:integer):integer; -var - i,j : integer; - e : boolean; -begin - i := idx; - j := 0; - e:=(length(SubStr)>0); - while e and (i<=Length(s)-Length(SubStr)) do - begin - inc(i); - if (SubStr[1]=s[i]) and (Substr=Copy(s,i,Length(SubStr))) then - begin - j:=i; - e:=false; - end; - end; - PosIdx:=j; -end; - - -function TargetStringEmpty(const t:TTargetsString):boolean; -var - i : integer; -begin - for i:=0 to targets do - if t[i]<>'' then - begin - TargetStringEmpty:=false; - exit; - end; - TargetStringEmpty:=true; -end; - - -procedure AddStrNoDup(var s:string;const s2:string); -var - i,idx : longint; - again,add : boolean; -begin - add:=false; - idx:=0; - repeat - again:=false; - i:=posidx(s2,s,idx); - if (i=0) then - add:=true - else - if (i=1) then - begin - if (length(s)>length(s2)) and - (s[length(s2)+1]<>' ') then - add:=true; - end - else - if (i>1) and - ((s[i-1]<>' ') or - ((length(s)>=i+length(s2)) and (s[i+length(s2)]<>' '))) then - begin - idx:=i+length(s2); - again:=true; - end; - until not again; - if add then - begin - if s='' then - s:=s2 - else - s:=s+' '+s2; - end; -end; - - -{***************************************************************************** - TMyMemoryStream -*****************************************************************************} - -constructor TMyMemoryStream.Create(p:pointer;mysize:integer); -begin - inherited Create; - SetPointer(p,mysize); -end; - - -{***************************************************************************** - Makefile.fpc reading -*****************************************************************************} - -function ReadMakefilefpc(const fn:string):boolean; -var - ini : TIniFile; - - 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; - -var - sec : tsections; - b : boolean; -begin - ReadMakefilefpc:=false; - - Verbose('Reading '+fn); - ini:=TIniFile.Create(fn); - ini.escapelinefeeds:=True; - - with userini,ini do - begin - { targets } - ReadTargetsString(TargetDirs,ini_targets,'dirs',''); - ReadTargetsString(TargetLoaders,ini_targets,'loaders',''); - ReadTargetsString(TargetUnits,ini_targets,'units',''); - ReadTargetsString(TargetPrograms,ini_targets,'programs',''); - ReadTargetsString(TargetExamples,ini_targets,'examples',''); - ReadTargetsString(TargetExampleDirs,ini_targets,'exampledirs',''); - ReadTargetsString(TargetRST,ini_targets,'rst',''); - ReadTargetsString(TargetPkgs,ini_targets,'pkgs',''); - if not TargetStringEmpty(TargetPkgs) then - TargetPkgs[0]:='all '+TargetPkgs[0]; - { clean } - ReadTargetsString(CleanUnits,ini_clean,'units',''); - ReadTargetsString(CleanFiles,ini_clean,'files',''); - { install } - InstallPackageName:=ReadString(ini_install,'packagename',''); - InstallPrefixDir:=ReadString(ini_install,'dirprefix',''); - InstallBaseDir:=ReadString(ini_install,'basedir',''); - InstallDataDir:=ReadString(ini_install,'datadir',''); - InstallUnitSubDir:=ReadString(ini_install,'unitsubdir',''); - Installexamplesubdir:=ReadString(ini_install,'examplesubdir',''); - InstallSourceSubdirs:=ReadBool(ini_install,'sourcesubdirs',false); - Installexamplesubdirs:=ReadBool(ini_install,'examplesubdirs',false); - ReadTargetsString(InstallUnits,ini_install,'units',''); - ReadTargetsString(InstallFiles,ini_install,'files',''); - { zip } - ZipName:=ReadString(ini_zip,'zipname',''); - ZipTarget:=ReadString(ini_zip,'ziptarget','install'); - { defaults } - DefaultDir:=ReadString(ini_defaults,'defaultdir',''); - DefaultBuildDir:=ReadString(ini_defaults,'defaultbuilddir',''); - DefaultInstallDir:=ReadString(ini_defaults,'defaultinstalldir',''); - DefaultZipInstallDir:=ReadString(ini_defaults,'defaultzipinstalldir',''); - DefaultCleanDir:=ReadString(ini_defaults,'defaultcleandir',''); - DefaultRule:=ReadString(ini_defaults,'defaultrule','all'); - DefaultTarget:=ReadString(ini_defaults,'defaulttarget',''); - DefaultCPU:=ReadString(ini_defaults,'defaultcpu',''); - { require } - b:=not(TargetStringEmpty(targetunits) and TargetStringEmpty(targetprograms) and TargetStringEmpty(targetexamples)); - RequireRTL:=ReadBool(ini_require,'rtl',b); - RequireOptions:=ReadString(ini_require,'options',''); - ReadTargetsString(requireToolkits,ini_require,'toolkit',''); - ReadTargetsString(requirePackages,ini_require,'packages',''); - ReadTargetsString(requireComponents,ini_require,'components',''); - if userini.RequireRTL then - begin - if userini.Requirepackages[0]<>'' then - userini.Requirepackages[0]:='rtl '+userini.Requirepackages[0] - else - userini.Requirepackages[0]:='rtl'; - end; - { sections, but allow overriding the 'none' option to include a few sects only } - for sec:=low(tsections) to high(tsections) do - Section[sec]:=sectiondef[sec]; - Section[sec_None]:=ReadBool(ini_sections,sectionstr[sec_none],sectiondef[sec_none]); - if Section[sec_None] then - FillChar(Section,sizeof(Section),0); - for sec:=low(tsections) to high(tsections) do - Section[sec]:=ReadBool(ini_sections,sectionstr[sec],section[sec]); - { turn on needed sections } - if not TargetStringEmpty(TargetLoaders) then - section[sec_loaders]:=true; - if not TargetStringEmpty(TargetUnits) then - section[sec_units]:=true; - if not TargetStringEmpty(TargetPrograms) then - section[sec_exes]:=true; - if not(TargetStringEmpty(TargetExamples) and TargetStringEmpty(TargetExampleDirs)) then - section[sec_examples]:=true; - { dependencies } - if section[sec_zipsourceinstall] then - begin - section[sec_zipinstall]:=true; - section[sec_sourceinstall]:=true; - end; - if section[sec_zipexampleinstall] then - begin - section[sec_zipinstall]:=true; - section[sec_exampleinstall]:=true; - end; - if section[sec_sourceinstall] or - section[sec_exampleinstall] then - begin - section[sec_tools]:=true; - section[sec_dirs]:=true; - end; - { dirs } - DirFpc:=ReadString(ini_dirs,'fpcdir',''); - DirPackage:=ReadString(ini_dirs,'packagedir','$(FPCDIR)/packages'); - DirToolkit:=ReadString(ini_dirs,'toolkitdir',''); - DirComponent:=ReadString(ini_dirs,'componentdir',''); - DirUnit:=ReadString(ini_dirs,'unitdir',''); - DirLib:=ReadString(ini_dirs,'libdir',''); - DirObj:=ReadString(ini_dirs,'objdir',''); - DirTarget:=ReadString(ini_dirs,'targetdir',''); - DirSources:=ReadString(ini_dirs,'sourcesdir',''); - DirUnitTarget:=ReadString(ini_dirs,'unittargetdir',''); - DirInc:=ReadString(ini_dirs,'incdir',''); - { libs } - LibName:=ReadString(ini_libs,'libname',''); - LibVersion:=ReadString(ini_libs,'libversion',''); - LibUnits:=ReadString(ini_libs,'libunits',''); - LibGcc:=ReadBool(ini_libs,'libgcc',false); - LibOther:=ReadBool(ini_libs,'libother',false); - { tools } - ToolsPPUMove:=ReadBool(ini_tools,'toolppumove',section[sec_compile]); - ToolsPPUFiles:=ReadBool(ini_tools,'toolppufiles',section[sec_install] or section[sec_clean]); - ToolsUpx:=ReadBool(ini_tools,'toolupx',section[sec_install]); - ToolsZip:=ReadBool(ini_tools,'toolzip',section[sec_zipinstall]); - ToolsTar:=ReadBool(ini_tools,'tooltar',section[sec_zipinstall]); - ToolsPPDep:=ReadBool(ini_tools,'toolppdep',false); - ToolsSed:=ReadBool(ini_tools,'toolsed',false); - ToolsData2Inc:=ReadBool(ini_tools,'tooldata2inc',false); - ToolsDiff:=ReadBool(ini_tools,'tooldiff',false); - ToolsCmp:=ReadBool(ini_tools,'toolcmp',false); - ToolsDate:=ReadBool(ini_tools,'tooldate',false); - { info } - InfoCfg:=ReadBool(ini_info,'infoconfig',true); - InfoDirs:=ReadBool(ini_info,'infodirs',false); - InfoTools:=ReadBool(ini_info,'infotools',false); - InfoInstall:=ReadBool(ini_info,'infoinstall',true); - InfoObjects:=ReadBool(ini_info,'infoobjects',true); - { multipacks } - MultiPacks:=TStringList.Create; - ReadSectionRaw('multipack',MultiPacks); - { rules } - PreSettings:=TStringList.Create; - ReadSectionRaw('presettings',PreSettings); - { rules } - PostSettings:=TStringList.Create; - ReadSectionRaw('postsettings',PostSettings); - { rules } - rules:=TStringList.Create; - ReadSectionRaw('rules',rules); - end; - - ini.Destroy; - ReadMakefilefpc:=true; -end; - - -{***************************************************************************** - userini.ini loading -*****************************************************************************} - -function ReadFpcMakeIni:TIniFile; -var - fn : string; -begin - ReadFpcMakeIni:=nil; - if FileExists('fpcmake.ini') then - fn:='fpcmake.ini' - else - begin - fn:=GetEnv(envvar); - if (Length (FN) = 0) or not (FileExists(fn)) then -{$ifdef linux} - if FileExists('/usr/lib/fpc/fpcmake.ini') then - fn:='/usr/lib/fpc/fpcmake.ini' -{$else} - if FileExists(ChangeFileExt(paramstr(0),'.ini')) then - fn:=ChangeFileExt(paramstr(0),'.ini') -{$endif} - else - fn:=''; - end; - 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; - result.Escapelinefeeds:=True; -end; - - -{***************************************************************************** - Makefile writing -*****************************************************************************} - -function VarName(const s:string):string; -var - i,j : longint; -begin - i:=0; - result:=s; - while i0 then - Delete(result,i,j-i+1) - else - Delete(result,i,1); - dec(i); - end; - '$','(',')' : - begin - Delete(result,i,1); - dec(i); - end; - 'a'..'z' : - result[i]:=chr(ord(result[i])-32); - end; - end; -end; - -function WriteMakefile(const fn:string):boolean; -var - mf : TStringList; - ss : TStringList; - Phony : string; - - procedure FixTab(sl:TStringList); - var - i,j,k : integer; - s,s2 : string; - begin - i:=0; - while (i'') and (sl[i][1] in [' ',#9]) then - begin - s:=sl[i]; - k:=0; - j:=0; - repeat - inc(j); - case s[j] of - ' ' : - inc(k); - #9 : - k:=(k+7) and not(7); - else - break; - end; - until (j=length(s)); - if k>7 then - begin - s2:=''; - Delete(s,1,j-1); - while (k>7) do - begin - s2:=s2+#9; - dec(k,8); - end; - while (k>0) do - begin - s2:=s2+' '; - dec(k); - end; - sl[i]:=s2+s; - end; - end; - inc(i); - end; - end; - - procedure AddHead(const s:string); - begin - mf.Add(''); - mf.Add('# '+s); - mf.Add(''); - end; - - procedure AddSection(b:boolean;s:string); - begin - if b then - begin - ss.Clear; - fpcini.ReadSectionRaw(s,ss); - mf.AddStrings(ss); - mf.Add(''); - end; - end; - - procedure AddRule(rule:integer); - var - i : integer; - hs : string; - begin - i:=0; - while (ilength(rulestr[rule])) and - (userini.rules[i][1]=rulestr[rule][1]) and - ((userini.rules[i][length(rulestr[rule])+1]=':') or - ((length(userini.rules[i])>length(rulestr[rule])+1) and - (userini.rules[i][length(rulestr[rule])+2]=':'))) and - (Copy(userini.rules[i],1,length(rulestr[rule]))=rulestr[rule]) then - exit; - inc(i); - end; - hs:=''; - { zipinstall,exampleinstall are special, it allows packages } - if ((not userini.installsourcesubdirs) and - ((rulestr[rule]='zipsourceinstall') or (rulestr[rule]='sourceinstall'))) or - ((not userini.installexamplesubdirs) and - ((rulestr[rule]='examples') or (rulestr[rule]='test') or (rulestr[rule]='zipexampleinstall') or (rulestr[rule]='exampleinstall'))) then - begin - if userini.section[rule2sec[rule]] then - hs:=hs+' fpc_'+rulestr[rule]; - end - else - if ((rulestr[rule]='zipinstall') or - (rulestr[rule]='zipsourceinstall')) and - (not TargetStringEmpty(userini.targetpkgs)) then - hs:=hs+' $(addsuffix _'+rulestr[rule]+',$(PKGOBJECTS))' - else - begin - if userini.section[rule2sec[rule]] then - hs:=hs+' fpc_'+rulestr[rule]; - if rulediralso[rule] then - begin - if userini.DefaultDir<>'' then - hs:=hs+' $(addsuffix _'+rulestr[rule]+','+userini.defaultdir+')' - else - if (userini.DefaultBuildDir<>'') and (rule2bic[rule]=bic_build) then - hs:=hs+' $(addsuffix _'+rulestr[rule]+','+userini.defaultbuilddir+')' - else - if (userini.DefaultInstallDir<>'') and (rule2bic[rule]=bic_install) then - hs:=hs+' $(addsuffix _'+rulestr[rule]+','+userini.defaultinstalldir+')' - else - if (userini.DefaultZipInstallDir<>'') and (rule2bic[rule]=bic_zipinstall) then - hs:=hs+' $(addsuffix _'+rulestr[rule]+','+userini.defaultzipinstalldir+')' - else - if (userini.DefaultCleanDir<>'') and (rule2bic[rule]=bic_clean) then - hs:=hs+' $(addsuffix _'+rulestr[rule]+','+userini.defaultcleandir+')' - else - if (not TargetStringEmpty(userini.targetdirs)) then - hs:=hs+' $(addsuffix _'+rulestr[rule]+',$(DIROBJECTS))'; - end; - { include cleaning of example dirs } - if (rulestr[rule]='clean') and - (not TargetStringEmpty(userini.targetexampledirs)) then - hs:=hs+' $(addsuffix _'+rulestr[rule]+',$(EXAMPLEDIROBJECTS))'; - end; - if hs<>'' then - begin - Phony:=Phony+' '+rulestr[rule]; - mf.Add(rulestr[rule]+':'+hs); - mf.Add(''); - end; - end; - - procedure AddTargets(const pre:string;var t:TTargetsString;wildcard:boolean); - var - i : integer; - begin - for i:=0 to targets do - if (t[i]<>'') then - begin - if i<>0 then - mf.Add('ifeq ($(OS_TARGET),'+targetstr[i]+')'); - if t[i]<>'' then - begin - if wildcard then - mf.Add('override '+pre+'+=$(wildcard '+t[i]+')') - else - mf.Add('override '+pre+'+='+t[i]); - end; - if i<>0 then - mf.Add('endif'); - end; - end; - - procedure AddTargetDir(const s,defpref:string); - var - j : integer; - hs : string; - begin - AddHead('Dir '+s); - mf.Add('ifdef '+defpref+VarName(s)); - hs:='.PHONY: '; - for j:=1to rules do - hs:=hs+' '+s+'_'+rulestr[j]; - mf.Add(hs); - mf.Add(''); - for j:=1to rules do - begin - mf.Add(s+'_'+rulestr[j]+':'); - mf.Add(#9+'$(MAKE) -C '+s+' '+rulestr[j]); - if j'') then - begin - if j<>0 then - mf.Add('ifeq ($(OS_TARGET),'+targetstr[j]+')'); - hs:=ts[j]; - repeat - i:=pos(' ',hs); - if i=0 then - i:=length(hs)+1; - name:=Copy(hs,1,i-1); - k1:=pos('{',name); - if k1>0 then - begin - k2:=PosIdx('}',name,k1); - if k2=0 then - begin - Writeln('Error: missing closing } for "',name,'"'); - k2:=length(name)+1; - end; - hs3:=Copy(name,k1+1,k2-k1-1); - for k3:=1to length(hs3) do - if hs3[k3]=',' then - hs3[k3]:=' '; - name:=Copy(name,1,k1-1); - mf.Add(prefix+VarName(name)+'='+hs3); - end - else - mf.Add(prefix+VarName(name)+'=1'); - { add to the list of dirs without duplicates } - AddStrNoDup(hs2,name); - system.delete(hs,1,i); - until hs=''; - if j<>0 then - mf.Add('endif'); - end; - AddTargetDefines:=hs2; - end; - - procedure AddPackage(const path,pack:string); - var - k : integer; - packdirvar,unitdirvar,unitdir,packdir : string; - begin - mf.Add('ifdef PACKAGE'+VarName(pack)); - { create needed variables } - packdirvar:='PACKAGEDIR_'+VarName(pack); - unitdirvar:='UNITDIR_'+VarName(pack); - packdir:=path+'/'+pack; - unitdir:='$(UNITSDIR)/'+pack; - for k:=1to specialdirs do - begin - if specialdir[k].dir=pack then - begin - packdir:=specialdir[k].packdir; - unitdir:=specialdir[k].unitdir; - break; - end; - end; - mf.Add('ifneq ($(wildcard '+packdir+'),)'); - { Use Package dir, add build rules } - mf.Add('ifneq ($(wildcard '+packdir+'/$(OS_TARGET)),)'); - mf.Add(packdirvar+'='+packdir+'/$(OS_TARGET)'); - mf.Add('else'); - mf.Add(packdirvar+'='+packdir); - mf.Add('endif'); - mf.Add('ifeq ($(wildcard $('+packdirvar+')/$(FPCMADE)),)'); - mf.Add('override COMPILEPACKAGES+=package_'+pack); - Phony:=Phony+'package_'+pack; - mf.Add('package_'+pack+':'); - mf.Add(#9'$(MAKE) -C $('+packdirvar+') all'); - mf.Add('endif'); - mf.Add(unitdirvar+'=$('+packdirvar+')'); - mf.Add('else'); - { Package dir doesn''t exists, create unit dir } - mf.Add(packdirvar+'='); - mf.Add('ifneq ($(wildcard '+unitdir+'),)'); - mf.Add('ifneq ($(wildcard '+unitdir+'/$(OS_TARGET)),)'); - mf.Add(unitdirvar+'='+unitdir+'/$(OS_TARGET)'); - mf.Add('else'); - mf.Add(unitdirvar+'='+unitdir); - mf.Add('endif'); - mf.Add('else'); - mf.Add(unitdirvar+'='); - mf.Add('endif'); - mf.Add('endif'); - { Add Unit dir to the command line -Fu } - mf.Add('ifdef '+unitdirvar); - mf.Add('override NEEDUNITDIR+=$('+unitdirvar+')'); - mf.Add('endif'); - mf.Add('endif'); - end; - - procedure AddTargetsPackages(const path:string;const ts:TTargetsString); - var - Phony,hs : string; - i : integer; - begin - { Components } - Phony:=''; - if not TargetStringEmpty(ts) then - begin - AddHead(VarName(path)+' packages'); - hs:=AddTargetDefines(ts,'PACKAGE'); - mf.Add(''); - repeat - i:=pos(' ',hs); - if i=0 then - i:=length(hs)+1; - AddPackage(path,Copy(hs,1,i-1)); - system.delete(hs,1,i); - until hs=''; - mf.Add(''); - end; - if Phony<>'' then - begin - mf.Add('.PHONY: '+Phony); - mf.Add(''); - end; - end; - - procedure AddPkg(const pack:string); - var - j : integer; - packname,pkgdirsvar,hs : string; - begin - packname:=pack; - AddHead('Pkg '+packname); - mf.Add('ifdef PKG'+VarName(packname)); - hs:='.PHONY: '; - for j:=1 to rules do - hs:=hs+' pkg'+packname+'_'+rulestr[j]; - mf.Add(hs); - mf.Add(''); - { pkgall is special which processes all directories } - if pack='all' then - pkgdirsvar:='DIROBJECTS' - else - begin - mf.Add('override PKGOBJECTS+=pkg'+packname); - pkgdirsvar:='PKG'+VarName(packname); - end; - for j:=1to rules do - if rulediralso[j] then - begin - mf.Add('pkg'+packname+'_'+rulestr[j]+': $(addsuffix _'+rulestr[j]+',$('+pkgdirsvar+'))'); - if j'' then - begin - mf.Add('.PHONY: '+Phony); - mf.Add(''); - end; - end; - -var - hs : string; - i : integer; -begin -{ Open the Makefile } - mf:=TStringList.Create; -{ Buffer for reading and writing the sections } - ss:=TStringList.Create; - - with mf do - begin - { write header & autodetection } - Add('#'); - Add('# Makefile generated by '+titledate); - Add('#'); - Add(''); - Add('defaultrule: '+userini.defaultrule); - Add(''); - AddSection(true,'osdetect'); - - { set the forced target os/cpu } - if (userini.defaulttarget<>'') or (userini.defaultcpu<>'') then - begin - AddSection(true,'defaulttarget'); - if userini.defaulttarget<>'' then - Add('override OS_TARGET:='+userini.defaulttarget); - if userini.defaultcpu<>'' then - Add('override CPU_TARGET:='+userini.defaultcpu); - Add(''); - end; - - { fpc detection } - AddSection(true,'fpcdetect'); - - { Pre Settings } - if userini.PreSettings.count>0 then - begin - AddSection(true,'presettings'); - AddStrings(userini.PreSettings); - end; - - { fpc dir } - AddSection(true,'fpcdircheckenv'); - if userini.dirfpc<>'' then - begin - Add('# Default FPCDIR'); - Add('ifeq ($(FPCDIR),wrong)'); - Add('override FPCDIR='+userini.dirfpc); - Add('ifeq ($(wildcard $(FPCDIR)/rtl),)'); - Add('ifeq ($(wildcard $(FPCDIR)/units),)'); - Add('override FPCDIR=wrong'); - Add('endif'); - Add('endif'); - Add('endif'); - Add(''); - end; - AddSection(true,'fpcdirdetect'); - - { fpcdir subdirs } - if userini.RequireRTL then - begin - Add('ifndef PACKAGESDIR'); - Add('PACKAGESDIR='+userini.dirpackage); - Add('endif'); - Add('ifndef TOOLKITSDIR'); - Add('TOOLKITSDIR='+userini.dirtoolkit); - Add('endif'); - Add('ifndef COMPONENTSDIR'); - Add('COMPONENTSDIR='+userini.dircomponent); - Add('endif'); - Add(''); - AddSection(true,'fpcdirsubs'); - end; - - { write the default & user settings } - AddSection(true,'usersettings'); - - { Targets } - AddHead('Targets'); - AddTargets('DIROBJECTS',userini.targetdirs,true); - AddTargets('LOADEROBJECTS',userini.targetloaders,false); - AddTargets('UNITOBJECTS',userini.targetunits,false); - AddTargets('EXEOBJECTS',userini.targetprograms,false); - AddTargets('EXAMPLEOBJECTS',userini.targetexamples,false); - AddTargets('EXAMPLEDIROBJECTS',userini.targetexampledirs,false); - AddTargets('RSTOBJECTS',userini.targetrst,false); - - { Clean } - AddHead('Clean'); - AddTargets('EXTRACLEANUNITS',userini.cleanunits,false); - AddTargets('EXTRACLEANFILES',userini.cleanfiles,false); - - { Install } - AddHead('Install'); - AddTargets('EXTRAINSTALLUNITS',userini.installunits,false); - AddTargets('EXTRAINSTALLFILES',userini.installfiles,false); - if userini.installprefixdir<>'' then - Add('PREFIXINSTALLDIR='+userini.installprefixdir); - if userini.installbasedir<>'' then - Add('BASEINSTALLDIR='+userini.installbasedir); - if userini.installdatadir<>'' then - Add('DATAINSTALLDIR='+userini.installdatadir); - if userini.InstallUnitSubDir<>'' then - Add('UNITSUBDIR='+userini.InstallUnitSubDir); - if userini.InstallExampleSubDir<>'' then - Add('EXAMPLESUBDIR='+userini.InstallExampleSubDir); - if userini.installpackagename<>'' then - Add('PACKAGENAME='+userini.installpackagename); - - { Zip } - if userini.zipname<>'' then - Add('ZIPNAME='+userini.zipname); - if userini.ziptarget<>'' then - Add('ZIPTARGET='+userini.ziptarget); - - { Defaults } - AddHead('Defaults'); - if userini.Requireoptions<>'' then - Add('override NEEDOPT='+userini.Requireoptions); - - { Dirs } - AddHead('Directories'); - if userini.dirsources<>'' then - Add('vpath %$(PASEXT) '+userini.dirsources); - if userini.dirunit<>'' then - Add('override NEEDUNITDIR='+userini.dirunit); - if userini.dirlib<>'' then - Add('override NEEDLIBDIR='+userini.dirlib); - if userini.dirobj<>'' then - Add('override NEEDOBJDIR='+userini.dirobj); - if userini.dirinc<>'' then - Add('override NEEDINCDIR='+userini.dirinc); - if userini.dirtarget<>'' then - begin - Add('ifndef TARGETDIR'); - Add('TARGETDIR='+userini.dirtarget); - Add('endif'); - end; - if userini.dirunittarget<>'' then - begin - Add('ifndef UNITTARGETDIR'); - Add('UNITTARGETDIR='+userini.dirunittarget); - Add('endif'); - end; - - { Packages } - AddHead('Packages'); - Phony:=''; - AddTargets('PACKAGES',userini.Requirepackages,false); - AddTargets('TOOLKITS',userini.Requiretoolkits,false); - AddTargets('COMPONENTS',userini.Requirecomponents,false); - if Phony<>'' then - begin - Add('.PHONY: '+Phony); - Add(''); - end; - - { Libs } - AddHead('Libraries'); - if userini.libname<>'' then - Add('LIBNAME='+userini.libname); - if userini.libversion<>'' then - Add('LIBVERSION='+userini.libversion); - if userini.libunits<>'' then - Add('SHAREDLIBUNITOBJECTS='+userini.libunits); - if userini.libgcc then - Add('override NEEDGCCLIB=1'); - if userini.libother then - Add('override NEEDOTHERLIB=1'); - - { Info } - if userini.Section[sec_Info] then - begin - AddHead('Info'); - hs:=''; - if userini.infocfg then - hs:=hs+'fpc_infocfg '; - if userini.infodirs then - hs:=hs+'fpc_infodirs '; - if userini.infotools then - hs:=hs+'fpc_infotools '; - if userini.infoobjects then - hs:=hs+'fpc_infoobjects '; - if userini.infoinstall then - hs:=hs+'fpc_infoinstall '; - Add('INFOTARGET='+hs); - end; - Add(''); - - { Post Settings } - if userini.PostSettings.count>0 then - begin - AddSection(true,'postsettings'); - AddStrings(userini.PostSettings); - Add(''); - end; - - { shell tools like copy,del,echo } - AddSection(userini.section[sec_command] or userini.section[sec_tools],'shelltools'); - - { write tools } - AddSection(userini.section[sec_tools],'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.toolscmp,'tool_cmp'); - AddSection(userini.toolsdiff,'tool_diff'); - AddSection(userini.toolsdate,'tool_date'); - AddSection(userini.toolszip,'tool_zip'); - AddSection(userini.toolstar,'tool_tar'); - - { extensions } - if userini.section[sec_exts] then - AddSection(true,'extensions'); - - { package/component dirs } - AddSection(true,'packagerequirerules'); - AddSection(userini.requirertl,'checkfpcdirsubs'); - AddTargetsPackages('$(PACKAGESDIR)',userini.Requirepackages); - AddTargetsPackages('$(TOOLKITSDIR)',userini.Requiretoolkits); - AddTargetsPackages('$(COMPONENTSDIR)',userini.Requirecomponents); - Add(''); - - { Pkgs } - AddTargetsPkgs(userini.targetpkgs); - - { write dirs } - AddSection(true,'dir_default'); - if userini.section[sec_dirs] then - begin - AddSection(userini.libgcc,'dir_gcclib'); - AddSection(userini.libother,'dir_otherlib'); - AddSection(true,'dir_install'); - end; - - { redirection } - AddSection(true,'redir'); - - { commandline } - if userini.section[sec_command] then - begin - Add(''); - AddSection(true,'command_begin'); - AddSection((userini.Requireoptions<>''),'command_needopt'); - AddSection((userini.dirunit<>'') or - (not TargetStringEmpty(userini.Requiretoolkits)) or - (not TargetStringEmpty(userini.Requirepackages)) or - (not TargetStringEmpty(userini.Requirecomponents)) - ,'command_needunit'); - AddSection(true,'command_unitsdir'); - AddSection((userini.dirlib<>''),'command_needlib'); - AddSection((userini.dirobj<>''),'command_needobj'); - AddSection((userini.dirinc<>''),'command_needinc'); - AddSection(userini.libgcc,'command_gcclib'); - AddSection(userini.libother,'command_otherlib'); - AddSection((userini.dirinc<>''),'command_inc'); - AddSection(true,'command_target'); - AddSection(true,'command_end'); - AddSection(true,'command_win32env'); - AddSection(true,'command_compiler'); - end; - - { add default rules } - AddSection(true,'standardrules'); - Phony:=''; - for i:=1 to rules do - AddRule(i); - if Phony<>'' then - begin - Add('.PHONY: '+Phony); - Add(''); - end; - - { compile rules for making loaders/units/exes/examples } - AddSection(not TargetStringEmpty(userini.targetloaders),'loaderrules'); - AddSection(not TargetStringEmpty(userini.targetunits),'unitrules'); - AddSection(not TargetStringEmpty(userini.targetprograms),'exerules'); - AddSection(not(TargetStringEmpty(userini.targetexamples) and - TargetStringEmpty(userini.targetexampledirs)),'examplerules'); - AddSection(not TargetStringEmpty(userini.targetrst),'rstrules'); - - { default fpc_ rules } - AddSection(userini.Section[sec_Compile],'compilerules'); - AddSection(userini.Section[sec_Libs],'libraryrules'); - AddSection(userini.Section[sec_Install],'installrules'); - AddSection(userini.Section[sec_SourceInstall],'sourceinstallrules'); - AddSection(userini.Section[sec_ExampleInstall],'exampleinstallrules'); - AddSection(userini.Section[sec_ZipInstall],'zipinstallrules'); - AddSection(userini.Section[sec_ZipSourceInstall],'zipsourceinstallrules'); - AddSection(userini.Section[sec_ZipExampleInstall],'zipexampleinstallrules'); - AddSection(userini.Section[sec_Clean],'cleanrules'); - AddSection(userini.Section[sec_require],'requirerules'); - if userini.Section[sec_Info] then - begin - AddSection(true,'inforules'); - AddSection(userini.infocfg,'info_cfg'); - AddSection(userini.infodirs,'info_dirs'); - AddSection(userini.infotools,'info_tools'); - AddSection(userini.infoobjects,'info_objects'); - AddSection(userini.infoinstall,'info_install'); - end; - - { Target dirs } - if not(TargetStringEmpty(userini.targetdirs) and - TargetStringEmpty(userini.targetexampledirs)) then - begin - AddSection(true,'directorytargets'); - hs:=AddTargetDefines(userini.targetdirs,'OBJECTDIR'); - while hs<>'' do - begin - i:=pos(' ',hs); - if i=0 then - i:=length(hs)+1; - AddTargetDir(Copy(hs,1,i-1),'OBJECTDIR'); - system.delete(hs,1,i); - end; - hs:=AddTargetDefines(userini.targetexampledirs,'EXAMPLEDIR'); - while hs<>'' do - begin - i:=pos(' ',hs); - if i=0 then - i:=length(hs)+1; - AddTargetDir(Copy(hs,1,i-1),'EXAMPLEDIR'); - system.delete(hs,1,i); - end; - Add(''); - end; - - { local makefile } - AddSection(true,'localmakefile'); - - { insert users rules } - if userini.rules.count>0 then - begin - AddSection(true,'userrules'); - AddStrings(userini.rules); - end; - end; - -{ Write the Makefile and cleanup } - Verbose('Writing '+fn); - FixTab(mf); - mf.SaveToFile(fn); - mf.Destroy; - ss.Destroy; - WriteMakefile:=true; -end; - - -procedure UseMakefilefpc; -var - fn : string; -begin - if FileExists('Makefile.fpc') then - fn:='Makefile.fpc' - else - fn:='makefile.fpc'; -{ Open Makefile.fpc } - if not ReadMakefilefpc(fn) then - Error('Can''t read '+fn); -{ Write Makefile } - if not WriteMakefile('Makefile') then - Error('Can''t write Makefile'); -end; - - -procedure UseParameters; -var - i : integer; - fn : string; -begin - for i:=1 to ParamCount do - begin - fn:=ParamStr(i); - { Open Makefile.fpc } - if not ReadMakefilefpc(fn) then - Error('Can''t read '+fn); - { Write Makefile } - if not WriteMakefile(ExtractFilePath(fn)+'Makefile') then - Error('Can''t write '+ExtractFilePath(fn)+'Makefile'); - end; -end; - - -begin -{ Open userini.ini } - fpcini:=ReadFpcMakeIni; - if not assigned(fpcini) then - Error('Can''t read fpcmake.ini'); - - if ParamCount=0 then - UseMakefilefpc - else - UseParameters; - - fpcini.destroy; -end. -{ - $Log$ - Revision 1.4 2001-01-13 17:27:19 hajny - * fixed to really work without the ini file (buggy before) - - Revision 1.3 2000/10/26 22:39:34 peter - * freebsd updates - - Revision 1.2 2000/09/01 21:37:30 peter - * targetdir support (merged) - - Revision 1.1 2000/07/13 10:16:22 michael - + Initial import - - Revision 1.38 2000/07/04 19:05:54 peter - * be optimistic: version 1.00 for some utils - - Revision 1.37 2000/07/01 23:03:32 peter - * exampleinstall target added - - Revision 1.36 2000/06/01 12:35:04 peter - * library support including symlink of .so to .so.1.0 - - Revision 1.35 2000/05/11 17:59:12 peter - * makeini unit added as replacement for old inifiles unit - - Revision 1.34 2000/04/11 15:34:58 peter - * added extra ifdef to check if there are some objects else some - targets aren't added anymore - - Revision 1.33 2000/03/11 15:58:56 michael - + Added escapelinefeeds:=true after inifile.create - - Revision 1.32 2000/02/09 16:44:14 peter - * log truncated - - Revision 1.31 2000/02/08 00:03:35 peter - * fixed zipinstall with defaultdir - - Revision 1.30 2000/02/02 11:30:00 peter - * fixed sharedlibunitobjects typo - - Revision 1.29 2000/01/28 12:10:46 peter - * reinserted lost diff of rev 1.30 - * distclean target - - Revision 1.28 2000/01/26 21:16:26 peter - * SMARTLINK=1 split into CREATESMART=1 and LINKSMART=1 - * FPCDIR checks enhanced - - Revision 1.27 2000/01/16 22:26:47 peter - * use environment variable again for win32, the file writing gives to - much trouble - - Revision 1.26 2000/01/14 12:14:41 peter - * sourceinstall updates - - Revision 1.25 2000/01/13 21:08:46 peter - * zipsourcesinstall - * zip fixes, bzip2 support with USETAR=bz2 - * multi pkg's support to include several dirs - - Revision 1.24 2000/01/13 11:34:26 peter - * better package dep creation - - Revision 1.23 2000/01/12 23:20:37 peter - * gecho support - * use foreach to write fpcext.cmd - * add fpcext.cmd to clean targets - - Revision 1.22 2000/01/10 22:55:49 peter - * zipname creation from packagename - - Revision 1.21 2000/01/08 16:31:04 peter - * support variable in packagenames - * fpcmake.loc support - * fixed place of presettings which must be before FPCDIR is set - - Revision 1.20 2000/01/07 16:46:02 daniel - * copyright 2000 - - Revision 1.19 2000/01/06 15:49:23 peter - * rtldir removed, it's now handled like any other package - - Revision 1.18 2000/01/06 01:29:59 peter - * FPCDIR setting/detect - * lot of other updates to create .deb files correctly - - Revision 1.17 2000/01/04 00:00:23 peter - * Makefile updates again - - Revision 1.16 2000/01/03 19:42:41 peter - * regenerated - - Revision 1.15 1999/12/23 19:32:28 peter - * automatic support for package/target dir structure - - Revision 1.14 1999/12/23 13:52:23 peter - + default[install,build,clean]dir - - Revision 1.13 1999/12/21 16:06:47 peter - * don't call dirobjects for zipisntall,info - - Revision 1.12 1999/12/19 15:15:04 peter - * fpcmade. added - * parameter support. So it can be using with "find -name 'Makefile.fpc'" - -} diff --git a/utils/makeini.pp b/utils/makeini.pp deleted file mode 100644 index 9af80e27be..0000000000 --- a/utils/makeini.pp +++ /dev/null @@ -1,496 +0,0 @@ -{ - $Id$ - This file is part of the Free Component Library (FCL) - Copyright (c) 1999-2000 by Michael A. Hess - - Old inifiles unit adapted for fpcmake - - 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. - - **********************************************************************} - -unit MakeIni; - -{$mode objfpc} -{$H+} - -interface - -uses Classes; - -type - -{ TIniFile class } - - TIniFile = class(TObject) - private - FEscapeLineFeeds : Boolean; - FFileName : string; - FStream : TStream; - FFileBuffer : TStringList; - function GetName(const line : string) : string; - function GetValue(const line, name : string) : string; - function IsComment(const line : string) : boolean; - function IsSection(const line : string) : boolean; - function GetSectionIndex(const section : string) : integer; - protected - procedure SetFileName(const fn:string); - procedure SetStream(s:TStream); - procedure LoadFromFile; - procedure SaveToFile; - procedure LoadFromStream; - procedure SaveToStream; - public - constructor Create(const theFileName : string); - constructor Create(s:TStream); - destructor Destroy; override; - procedure DeleteKey(const section, ident : string); - procedure EraseSection(const section : string); - function ReadBool(const section, ident : string; defaultValue : boolean) : boolean; - function ReadInteger(const section, ident : string; defaultValue : longint) : longint; - procedure ReadSection(const section : string; strings : TStrings); - procedure ReadSections(strings : TStrings); - procedure ReadSectionValues(const section : string; strings : TStrings); - procedure ReadSectionRaw(const section : string; strings : TStrings); - function ReadString(const section, ident, defaultValue : string) : string; - procedure WriteBool(const section, ident : string; value : boolean); - procedure WriteInteger(const section, ident : string; value : longint); - procedure WriteString(const section, ident, value : string); - property FileName : String read FFileName; - property EscapeLineFeeds : Boolean Read FEscapeLineFeeds Write FEscapeLineFeeds default false; - end; - -implementation - -uses SysUtils; - -const - brackets : array[0..1] of Char = ('[', ']'); - separator : Char = '='; - comment : Char = ';'; - - -{ TIniFile } - -constructor TIniFile.Create(const theFileName : string); -begin - FFileName := theFileName; - FStream:=nil; - FEscapeLineFeeds:=False; - FFileBuffer := TStringList.Create; - - if FileExists(fileName) then - LoadFromFile; -end; - -constructor TIniFile.Create(s:TStream); -begin - FFileName := ''; - FStream:=s; - FEscapeLineFeeds:=False; - FFileBuffer := TStringList.Create; - LoadFromStream; -end; - -destructor TIniFile.Destroy; -begin - FFileBuffer.Free; -end; - -function TIniFile.GetName(const line : string) : string; -var - index,index2 : integer; -begin - Result := ''; - index := Pos(separator, line); - if index <> 0 then - begin - index2:=Pos(comment, line); - if (index2=0) or (index2>index) then - result := Trim(Copy(line, 1, index - 1)); - end; -end; - -function TIniFile.GetValue(const line, name : string) : string; -var - index1,index2,index3 : integer; -begin - result := ''; - if (line <> '') and (name <> '') then - begin - index1 := Pos(name, line); - index2 := Pos(separator, line); - index3 := Pos(comment, line); - if index3=0 then - index3:=MaxInt; - if (index1 <> 0) and (index2 <> 0) and (index2 > index1) then - result := Trim(Copy(line, index2 + 1, index3)); - end; -end; - -function TIniFile.IsSection(const line : string) : boolean; -var - str : string; -begin - result := False; - if line <> '' then - begin - str := Trim(line); - if (str<>'') and (str[1] = brackets[0]) and (str[Length(str)] = brackets[1]) then - result := True; - end; -end; - -function TIniFile.IsComment(const line : string) : boolean; -var - str : string; -begin - result := False; - if line <> '' then - begin - str := Trim(line); - result := (str<>'') and (str[1]=comment); - end; -end; - -function TIniFile.GetSectionIndex(const section : string) : integer; -begin - result := FFileBuffer.IndexOf(brackets[0] + section + brackets[1]); -end; - -{ Load/Save } - -procedure TIniFile.SetFileName(const fn:string); -begin - FFileName:=fn; -end; - -procedure TIniFile.SetStream(s:TStream); -begin - FStream:=s; -end; - -procedure TIniFile.LoadFromFile; -begin - if FFileName<>'' then - FFileBuffer.LoadFromFile(FFileName); -end; - -procedure TIniFile.SaveToFile; -begin - if FFileName<>'' then - FFileBuffer.SaveToFile(FFileName); -end; - -procedure TIniFile.LoadFromStream; -begin - if assigned(FStream) then - FFileBuffer.LoadFromStream(FStream); -end; - -procedure TIniFile.SaveToStream; -begin - if assigned(FStream) then - FFileBuffer.SaveToStream(FStream); -end; - -{ Read all Names of one Section } - -procedure TIniFile.ReadSection(const section : string; strings : TStrings); -var - index : integer; - name : string; -begin - strings.BeginUpdate; - try - strings.Clear; - if FFileBuffer.Count > 0 then - begin - index := GetSectionIndex(section); - if index <> -1 then - begin - Inc(index); - while (index < FFileBuffer.Count) and not IsSection(FFileBuffer[index]) do - begin - name := GetName(FFileBuffer[index]); - if name <> '' then - strings.Add(name); - Inc(index); - end; - end; - end; - finally - strings.EndUpdate; - end; -end; - -{ Read all Sections of the Ini-File } - -procedure TIniFile.ReadSections(strings : TStrings); -var - index : integer; - section : string; -begin - strings.BeginUpdate; - try - strings.Clear; - if FFileBuffer.Count > 0 then - begin - index := 0; - while (index < FFileBuffer.Count) do - begin - if IsSection(FFileBuffer[index]) then - begin - section := Trim(FFileBuffer[index]); - Delete(section, 1, 1); - Delete(section, Length(section), 1); - strings.Add(Trim(section)); - end; - Inc(index); - end; - end; - finally - strings.EndUpdate; - end; -end; - -{ Reads a String-Value of "ident" in one "section". - The result is "defaultValue" if - o section doesn't exists - o ident doesn't exists - o ident doesn't have any assigned value } - -function TIniFile.ReadString(const section, ident, defaultValue : string) : string; -var - index : integer; - value : string; -begin - result := defaultValue; - if FFileBuffer.Count > 0 then - begin - index := GetSectionIndex(section); - if index <> -1 then - begin - Inc(index); - while (index < FFileBuffer.Count) and not IsSection(FFileBuffer[index]) do - begin - if CompareText(GetName(FFileBuffer[index]),ident)=0 then - begin - value := GetValue(FFileBuffer[index], ident); - if value <> '' then - begin - result := value; - if EscapeLineFeeds and (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; - end; - end; -end; - -{ Reads an Integer-Value of Ident in one Section } - -function TIniFile.ReadInteger(const section, ident : string; defaultValue : longint) : longint; -var - intStr : string; -begin - intStr := ReadString(section, ident, ''); - { convert a Hex-Value } - if (Length(intStr) > 2) and (intStr[1] = '0') and ((intStr[2] = 'X') or (intStr[2] = 'x')) then - intStr := '$' + Copy(intStr, 3, Maxint); - result := StrToIntDef(intStr, defaultValue); -end; - -{ Reads a Bool-Value of Ident in one Section } - -function TIniFile.ReadBool(const section, ident : string; defaultValue : boolean) : boolean; -begin - result := ReadInteger(section, ident, Ord(defaultValue)) <> 0; -end; - -{ Reads all Names + Values of one Section } - -procedure TIniFile.ReadSectionValues(const section : string; strings : TStrings); -var - name : string; - value : string; - index : integer; -begin - strings.BeginUpdate; - try - strings.Clear; - if FFileBuffer.Count > 0 then - begin - index := GetSectionIndex(section); - if index <> -1 then - begin - Inc(index); - while (index < FFileBuffer.Count) and not IsSection(FFileBuffer[index]) do - begin - name := GetName(FFileBuffer[index]); - if name <> '' then - begin - value := GetValue(FFileBuffer[index], name); - strings.Add(name + separator + value); - end; - Inc(index); - end; - end; - end; - finally - strings.EndUpdate; - end; -end; - -procedure TIniFile.ReadSectionRaw(const section : string; strings : TStrings); -var - eols,index : integer; -begin - strings.BeginUpdate; - try - eols:=0; - strings.Clear; - if FFileBuffer.Count > 0 then - begin - index := GetSectionIndex(section); - if index <> -1 then - begin - Inc(index); - while (index < FFileBuffer.Count) and not IsSection(FFileBuffer[index]) do - begin - { Skip empty lines at the end of the section } - if FFileBuffer[index]='' then - inc(eols) - else - begin - while eols>0 do - begin - Strings.Add(''); - dec(eols); - end; - if not IsComment(FFileBuffer[index]) then - strings.Add(FFileBuffer[index]); - end; - Inc(index); - end; - end; - end; - finally - strings.EndUpdate; - end; -end; - -{ Writes a String-Value for Ident in one Section. - Note: If Section and/or Ident don't exist, they will be placed in the Ini-File } - -procedure TIniFile.WriteString(const section, ident, value : string); -var - index : integer; -begin - index := GetSectionIndex(section); - { Section exists } - if index <> -1 then - begin - Inc(index); - while (index < FFileBuffer.Count) and not IsSection(FFileBuffer[index]) and - (GetName(FFileBuffer[index]) <> ident) do - Inc(index); - if (index >= FFileBuffer.Count) or IsSection(FFileBuffer[index]) then - begin { End of File or ident doesn't exists in the section } - if ident <> '' then - FFileBuffer.Insert(index, ident + separator + value); - end - else if ident <> '' then { Ident does exists in the section } - FFileBuffer[index] := ident + separator + value; - end - else { section doesn't exists, so add new [section] with ident=value } - begin - FFileBuffer.Add(''); - FFileBuffer.Add(brackets[0] + section + brackets[1]); - if ident <> '' then - FFileBuffer.Add(ident + separator + value); - end; - SaveToFile; -end; - -{ Writes an Integer-Value for Ident in one Section } - -procedure TIniFile.WriteInteger(const section, ident : string; value : longint); -begin - WriteString(section, ident, IntToStr(value)); -end; - -{ Writes a Bool-Value for Ident in one Section } - -procedure TIniFile.WriteBool(const section, ident : string; value : boolean); -const - values: array[boolean] of string = ('0', '1'); -begin - WriteString(section, ident, values[Value]); -end; - -{ Deletes the value of ident in one section. - Note: Only if section and ident exist, the value of ident will be set to NULL } - -procedure TIniFile.DeleteKey(const section, ident : string); -var - index : integer; -begin - index := GetSectionIndex(section); - if index <> -1 then - begin - Inc(index); - while (index < FFileBuffer.Count) and not IsSection(FFileBuffer[index]) and - (GetName(FFileBuffer[index]) <> ident) do - Inc(index); - if not (index >= FFileBuffer.Count) and not IsSection(FFileBuffer[index]) then - begin { Ident does exists } - FFileBuffer.Delete(index); - SaveToFile; - end; - end; -end; - -{ Erases the whole Section from an Ini-File } - -procedure TIniFile.EraseSection(const section : string); -var - index : integer; -begin - index := GetSectionIndex(section); - if index <> -1 then - begin - FFileBuffer.Delete(index); { Delete Section-Header } - while (index < FFileBuffer.Count) and not IsSection(FFileBuffer[index]) do - FFileBuffer.Delete(index); { Delete Section-Items } - if index > 0 then FFileBuffer.Insert(index, ''); - SaveToFile; - end; -end; - -end. - -{ - $Log$ - Revision 1.2 2000-09-01 21:37:30 peter - * targetdir support (merged) - - Revision 1.1 2000/07/13 10:16:22 michael - + Initial import - - Revision 1.1 2000/05/11 17:59:12 peter - * makeini unit added as replacement for old inifiles unit - -} \ No newline at end of file