* lot of updates

This commit is contained in:
peter 1999-11-03 23:39:53 +00:00
parent 707675a501
commit bdd4bf7169
3 changed files with 354 additions and 157 deletions

View File

@ -4,6 +4,11 @@
; Templates used by fpcmake to create a Makefile from Makefile.fpc
;
[makefilerule]
Makefile: Makefile.fpc
fpcmake
$(MAKE)
[osdetect]
#####################################################################
# Autodetect OS (Linux or Dos or Windows NT)
@ -15,9 +20,9 @@
override PATH:=$(subst \,/,$(PATH))
# Search for PWD and determine also if we are under linux
PWD=$(strip $(wildcard $(addsuffix /pwd.exe,$(subst ;, ,$(PATH)))))
PWD:=$(strip $(wildcard $(addsuffix /pwd.exe,$(subst ;, ,$(PATH)))))
ifeq ($(PWD),)
PWD=$(strip $(wildcard $(addsuffix /pwd,$(subst :, ,$(PATH)))))
PWD:=$(strip $(wildcard $(addsuffix /pwd,$(subst :, ,$(PATH)))))
ifeq ($(PWD),)
nopwd:
@echo You need the GNU utils package to use this Makefile!
@ -60,6 +65,10 @@ else
SEARCHPATH=$(subst ;, ,$(PATH))
endif
[defaulttarget]
#####################################################################
# Default target
#####################################################################
[fpcdetect]
#####################################################################
@ -77,22 +86,27 @@ endif
# Target OS
ifndef OS_TARGET
export OS_TARGET=$(shell $(FPC) -iTO)
export OS_TARGET:=$(shell $(FPC) -iTO)
endif
# Source OS
ifndef OS_SOURCE
export OS_SOURCE=$(shell $(FPC) -iSO)
export OS_SOURCE:=$(shell $(FPC) -iSO)
endif
# FPC_CPU
ifndef FPC_CPU
export FPC_CPU=$(shell $(FPC) -iTP)
# Target CPU
ifndef CPU_TARGET
export CPU_TARGET:=$(shell $(FPC) -iTP)
endif
# Source CPU
ifndef CPU_SOURCE
export CPU_SOURCE:=$(shell $(FPC) -iSP)
endif
# FPC version
ifndef FPC_VERSION
export FPC_VERSION=$(shell $(FPC) -iV)
export FPC_VERSION:=$(shell $(FPC) -iV)
endif
@ -136,10 +150,13 @@ ifdef NEEDOPT
override FPCOPT+=$(NEEDOPT)
endif
[command_rtl]
# RTL first and then Unit dir (a unit can override RTLunit)
ifdef RTLDIR
override FPCOPT+=$(addprefix -Fu,$(RTLDIR))
[command_fpcdir]
# RTL first and then Unit dir (a unit can override RTLunit). Don't add the
# dirs if fpcdir=. which can be used for the rtl makefiles
ifdef FPCDIR
ifneq ($(FPCDIR),.)
override FPCOPT+=-Fu$(FPCDIR)/rtl/$(OS_TARGET) -Fu$(FPCDIR)/units/$(OS_TARGET)
endif
endif
[command_needunit]
@ -157,6 +174,11 @@ 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
@ -169,22 +191,6 @@ ifdef OTHERLIBDIR
override FPCOPT+=$(addprefix -Fl,$(OTHERLIBDIR))
endif
[command_inc]
# Add include dirs INC and PROCINC and OSINC
ifdef INC
override FPCOPT+=$(addprefix -Fi,$(INC))
endif
[command_procinc]
ifdef PROCINC
override FPCOPT+=$(addprefix -Fi,$(PROCINC))
endif
[command_osinc]
ifdef OSINC
override FPCOPT+=$(addprefix -Fi,$(OSINC))
endif
[command_target]
# Target dirs
ifdef TARGETDIR
@ -205,7 +211,7 @@ endif
[command_end]
# Add commandline options
ifdef OPT
override FPCOPT+=OPT
override FPCOPT+=$(OPT)
endif
ifdef UNITDIR
override FPCOPT+=$(addprefix -Fu,$(UNITDIR))
@ -216,6 +222,9 @@ endif
ifdef OBJDIR
override FPCOPT+=$(addprefix -Fo,$(OBJDIR))
endif
ifdef INCDIR
override FPCOPT+=$(addprefix -Fi,$(INCDIR))
endif
# Add defines from FPCOPTDEF to FPCOPT
ifdef FPCOPTDEF
@ -237,52 +246,48 @@ override COMPILER=$(FPC) $(FPCOPT)
# To copy pograms
ifndef COPY
export COPY=cp -fp
export COPY:=cp -fp
endif
# To move pograms
ifndef MOVE
export MOVE=mv -f
export MOVE:=mv -f
endif
# Check delete program
ifndef DEL
export DEL=rm -f
export DEL:=rm -f
endif
# Check deltree program
ifndef DELTREE
export DELTREE=rm -rf
export DELTREE:=rm -rf
endif
# To install files
ifndef INSTALL
ifdef inlinux
export INSTALL=install -m 644
export INSTALL:=install -m 644
else
export INSTALL=$(COPY)
# ginstall has the strange thing to stubify all .o files !
#INSTALL=ginstall -m 644
export INSTALL:=$(COPY)
endif
endif
# To install programs
ifndef INSTALLEXE
ifdef inlinux
export INSTALLEXE=install -m 755
export INSTALLEXE:=install -m 755
else
export INSTALLEXE=$(COPY)
# ginstall has the strange thing to stubify all .o files !
#INSTALLEXE=ginstall -m 755
export INSTALLEXE:=$(COPY)
endif
endif
# To make a directory.
ifndef MKDIR
ifdef inlinux
export MKDIR=install -m 755 -d
export MKDIR:=install -m 755 -d
else
export MKDIR=ginstall -m 755 -d
export MKDIR:=ginstall -m 755 -d
endif
endif
@ -307,6 +312,11 @@ ifndef PPUMOVE
PPUMOVE=ppumove
endif
# Where is the ppdep program ?
ifndef PPDEP
PPDEP=ppdep
endif
# ppas.bat / ppas.sh
ifdef inlinux
PPAS=ppas.sh
@ -334,7 +344,7 @@ endif
# echo
ifndef ECHO
ECHO=$(strip $(wildcard $(addsuffix /echo$(EXEEXT),$(SEARCHPATH))))
ECHO:=$(strip $(wildcard $(addsuffix /echo$(EXEEXT),$(SEARCHPATH))))
ifeq ($(ECHO),)
export ECHO:=echo
else
@ -346,7 +356,7 @@ endif
[tool_diff]
# diff
ifndef DIFF
DIFF=$(strip $(wildcard $(addsuffix /diff$(EXEEXT),$(SEARCHPATH))))
DIFF:=$(strip $(wildcard $(addsuffix /diff$(EXEEXT),$(SEARCHPATH))))
ifeq ($(DIFF),)
DIFF=
else
@ -357,7 +367,7 @@ endif
[tool_cmp]
# cmp
ifndef CMP
CMP=$(strip $(wildcard $(addsuffix /cmp$(EXEEXT),$(SEARCHPATH))))
CMP:=$(strip $(wildcard $(addsuffix /cmp$(EXEEXT),$(SEARCHPATH))))
ifeq ($(CMP),)
CMP=
else
@ -368,7 +378,7 @@ endif
[tool_sed]
# Sed
ifndef SED
SED=$(strip $(wildcard $(addsuffix /sed$(EXEEXT),$(SEARCHPATH))))
SED:=$(strip $(wildcard $(addsuffix /sed$(EXEEXT),$(SEARCHPATH))))
ifeq ($(SED),)
SED=
else
@ -381,13 +391,13 @@ endif
# upx uses that one itself (PFV)
ifndef UPXPROG
ifeq ($(OS_TARGET),go32v2)
UPXPROG=1
UPXPROG:=1
endif
ifeq ($(OS_TARGET),win32)
UPXPROG=1
UPXPROG:=1
endif
ifdef UPXPROG
UPXPROG=$(strip $(wildcard $(addsuffix /upx$(EXEEXT),$(SEARCHPATH))))
UPXPROG:=$(strip $(wildcard $(addsuffix /upx$(EXEEXT),$(SEARCHPATH))))
ifeq ($(UPX),)
UPXPROG=
else
@ -401,9 +411,9 @@ endif
[tool_date]
# gdate/date
ifndef DATE
DATE=$(strip $(wildcard $(addsuffix /date$(EXEEXT),$(SEARCHPATH))))
DATE:=$(strip $(wildcard $(addsuffix /date$(EXEEXT),$(SEARCHPATH))))
ifeq ($(DATE),)
DATE=$(strip $(wildcard $(addsuffix /gdate$(EXEEXT),$(SEACHPATH))))
DATE:=$(strip $(wildcard $(addsuffix /gdate$(EXEEXT),$(SEACHPATH))))
ifeq ($(DATE),)
DATE=
else
@ -415,7 +425,7 @@ endif
endif
ifdef DATE
DATESTR=$(shell $(DATE) +%Y%m%d)
DATESTR:=$(shell $(DATE) +%Y%m%d)
else
DATESTR=
endif
@ -423,7 +433,7 @@ endif
[tool_zip]
# ZipProg, you can't use Zip as the var name (PFV)
ifndef ZIPPROG
ZIPPROG=$(strip $(wildcard $(addsuffix /zip$(EXEEXT),$(SEARCHPATH))))
ZIPPROG:=$(strip $(wildcard $(addsuffix /zip$(EXEEXT),$(SEARCHPATH))))
ifeq ($(ZIPPROG),)
ZIPPROG=
else
@ -680,8 +690,9 @@ endif
# Default rules
#####################################################################
.PHONY: all staticlib sharedlib install staticinstall sharedinstall \
libinstall zipinstall zipinstalladd clean depend info
.PHONY: defaultrule all staticlib sharedlib showinstall install \
staticinstall sharedinstall libinstall zipinstall zipinstalladd \
clean cleanall depend info
[compilerules]
@ -769,6 +780,13 @@ endif
.PHONY: fpc_showinstallfiles fpc_install
ifdef EXTRAINSTALLUNITS
override EXTRAINSTALLFILES=$(wildcard $(addsuffix $(OEXT),$(EXTRAINSTALLUNITS)) $(addsuffix $(STATICLIBEXT),$(EXTRAINSTALLUNITS)) $(addsuffix $(PPUEXT),$(EXTRAINSTALLUNITS)))
endif
ifdef UNITOBJECTS
override UNITINSTALLFILES=$(wildcard $(UNITPPUFILES) $(UNITOFILES) $(UNITAFILES))
endif
fpc_showinstallfiles : all
ifndef DEFAULTUNITS
ifdef EXEOBJECTS
@ -778,18 +796,15 @@ endif
ifdef LOADEROBJECTS
@$(ECHO) $(addprefix "\n"$(UNITINSTALLDIR)/,$(LOADEROFILES))
endif
ifdef UNITOBJECTS
@$(ECHO) $(addprefix "\n"$(UNITINSTALLDIR)/,$(wildcard $(UNITPPUFILES) $(UNITOFILES) $(UNITAFILES)))
ifdef UNITINSTALLFILES
@$(ECHO) $(addprefix "\n"$(UNITINSTALLDIR)/,$(UNITINSTALLFILES))
endif
ifdef EXTRAINSTALLUNITS
@$(ECHO) $(addprefix "\n"$(UNITINSTALLDIR)/,$(wildcard $(addsuffix $(OEXT),$(EXTRAINSTALLUNITS)) $(addsuffix $(STATICLIBEXT),$(EXTRAINSTALLUNITS)) $(addsuffix $(PPUEXT),$(EXTRAINSTALLUNITS))))
ifdef EXTRAINSTALLFILES
@$(ECHO) $(addprefix "\n"$(UNITINSTALLDIR)/,$(EXTRAINSTALLFILES))
endif
fpc_install:
# Create UnitInstallFiles
ifdef EXTRAINSTALLUNITS
override EXTRAINSTALLFILES=$(wildcard $(addsuffix $(OEXT),$(EXTRAINSTALLUNITS)) $(addsuffix $(STATICLIBEXT),$(EXTRAINSTALLUNITS)) $(addsuffix $(PPUEXT),$(EXTRAINSTALLUNITS)))
endif
ifndef DEFAULTUNITS
ifdef EXEOBJECTS
$(MKDIR) $(BININSTALLDIR)
@ -804,13 +819,13 @@ ifdef LOADEROBJECTS
$(MKDIR) $(UNITINSTALLDIR)
$(INSTALL) $(LOADEROFILES) $(UNITINSTALLDIR)
endif
ifdef UNITOBJECTS
ifdef UNITINSTALLFILES
$(MKDIR) $(UNITINSTALLDIR)
$(INSTALL) $(wildcard $(UNITPPUFILES) $(UNITOFILES) $(UNITAFILES)) $(UNITINSTALLDIR)
$(INSTALL) $(UNITINSTALLFILES) $(UNITINSTALLDIR)
endif
ifneq ($(wildcard $(addsuffix $(OEXT),$(EXTRAINSTALLUNITS)) $(addsuffix $(STATICLIBEXT),$(EXTRAINSTALLUNITS)) $(addsuffix $(PPUEXT),$(EXTRAINSTALLUNITS))),)
ifdef EXTRAINSTALLFILES
$(MKDIR) $(UNITINSTALLDIR)
$(INSTALL) $(wildcard $(addsuffix $(OEXT),$(EXTRAINSTALLUNITS)) $(addsuffix $(STATICLIBEXT),$(EXTRAINSTALLUNITS)) $(addsuffix $(PPUEXT),$(EXTRAINSTALLUNITS))) $(UNITINSTALLDIR)
$(INSTALL) $(EXTRAINSTALLFILES) $(UNITINSTALLDIR)
endif
@ -917,6 +932,13 @@ endif
.PHONY: fpc_clean fpc_libsclean fpc_cleanall
ifdef UNITOBJECTS
override UNITCLEANFILES=$(wildcard $(UNITPPUFILES) $(UNITOFILES) $(UNITAFILES))
endif
ifdef EXTRACLEANUNITS
override EXTRACLEANFILES=$(wildcard $(addsuffix $(OEXT),$(EXTRACLEANUNITS)) $(addsuffix $(STATICLIBEXT),$(EXTRACLEANUNITS)) $(addsuffix $(PPUEXT),$(EXTRACLEANUNITS)))
endif
fpc_clean:
ifdef EXEOBJECTS
-$(DEL) $(EXEFILES) $(EXEOFILES)
@ -924,11 +946,11 @@ endif
ifdef LOADEROBJECTS
-$(DEL) $(LOADEROFILES)
endif
ifdef UNITOBJECTS
-$(DEL) $(wildcard $(UNITPPUFILES) $(UNITOFILES) $(UNITAFILES))
ifdef UNITCLEANFILES
-$(DEL) $(UNITCLEANFILES)
endif
ifneq ($(wildcard $(addsuffix $(OEXT),$(EXTRACLEANUNITS)) $(addsuffix $(STATICLIBEXT),$(EXTRACLEANUNITS)) $(addsuffix $(PPUEXT),$(EXTRACLEANUNITS))) ,)
-$(DEL) $(wildcard $(addsuffix $(OEXT),$(EXTRACLEANUNITS)) $(addsuffix $(STATICLIBEXT),$(EXTRACLEANUNITS)) $(addsuffix $(PPUEXT),$(EXTRACLEANUNITS)))
ifdef EXTRACLEANFILES
-$(DEL) $(EXTRACLEANFILES)
endif
-$(DEL) $(PPAS) link.res log
@ -951,7 +973,7 @@ endif
.PHONY: fpc_depend
fpc_depend:
makedep $(UNITOBJECTS)
$(PPDEP) $(UNITOBJECTS)
[inforules]
@ -971,13 +993,13 @@ fpc_infocfg:
@$(ECHO)
@$(ECHO) FPC....... $(FPC)
@$(ECHO) Version... $(FPC_VERSION)
@$(ECHO) CPU....... $(FPC_CPU)
@$(ECHO) CPU....... $(CPU_TARGET)
@$(ECHO) Source.... $(OS_SOURCE)
@$(ECHO) Target.... $(OS_TARGET)
@$(ECHO)
[info_dir]
fpc_infodir:
[info_dirs]
fpc_infodirs:
ifdef inlinux
@$(ECHO)
@$(ECHO) == Directory info ==
@ -1023,7 +1045,7 @@ endif
@$(ECHO)
[info_object]
fpc_infoobject:
fpc_infoobjects:
@$(ECHO)
@$(ECHO) == Object info ==
@$(ECHO)
@ -1097,7 +1119,10 @@ endif
;
; $Log$
; Revision 1.1 1999-11-02 23:57:40 peter
; Revision 1.2 1999-11-03 23:39:53 peter
; * lot of updates
;
; Revision 1.1 1999/11/02 23:57:40 peter
; * initial version
;
;

View File

@ -19,25 +19,39 @@ uses
{$ifdef go32v2}
dpmiexcp,
{$endif}
dos,
sysutils,classes,inifiles;
const
Version='v0.99.13';
Title='fpcmake '+Version;
const
EnvVar='FPCMAKEINI'; { should be FPCMAKE in the future }
TimeFormat='yyyy/mm/dd hh:nn';
targets=4;
targetstr : array[1..targets] of string=(
'linux','go32v2','win32','os2'
);
{ Sections in Makefile.fpc }
sec_dirs='dirs';
sec_libs='libs';
sec_targets='targets';
sec_info='info';
sec_misc='misc';
sec_rules='rules';
sec_defaults='defaults';
sec_tools='tools';
type
TFpcMake=record
DefaultUnits : boolean;
TargetUnits,
TargetPrograms : string;
TargetPrograms : array[0..targets] of string;
DefaultUnits : boolean;
DefaultRule,
DefaultTarget,
DefaultCPU,
DefaultOptions : string;
DirFpc,
DirUnit,
DirLib,
DirObj,
@ -49,11 +63,19 @@ type
LibGCC,
LibOther : boolean;
InfoCfg,
InfoDir,
InfoDirs,
InfoTools,
InfoInstall,
InfoObjects,
InfoFiles : boolean;
ToolsSed,
ToolsDiff,
ToolsCmp,
ToolsUpx,
ToolsDate,
ToolsZip : boolean;
PreSettings,
PostSettings,
Rules : TStringList;
end;
@ -86,6 +108,7 @@ function ReadMakefilefpc:boolean;
var
fn : string;
ini : TIniFile;
i : integer;
begin
ReadMakefilefpc:=false;
if FileExists('Makefile.fpc') then
@ -102,31 +125,55 @@ begin
with userini,ini do
begin
{ targets }
DefaultUnits:=ReadBool(sec_targets,'defaultunits',false);
TargetUnits:=ReadString(sec_targets,'units','');
TargetPrograms:=ReadString(sec_targets,'programs','');
TargetUnits[0]:=ReadString(sec_targets,'units','');
TargetPrograms[0]:=ReadString(sec_targets,'programs','');
for i:=1 to targets do
begin
TargetUnits[i]:=ReadString(sec_targets,'units_'+targetstr[i],'');
TargetPrograms[i]:=ReadString(sec_targets,'programs_'+targetstr[i],'');
end;
{ defaults }
DefaultUnits:=ReadBool(sec_defaults,'defaultunits',false);
DefaultRule:=ReadString(sec_defaults,'defaultrule','all');
DefaultTarget:=ReadString(sec_defaults,'defaulttarget','');
DefaultCPU:=ReadString(sec_defaults,'defaultcpu','');
DefaultOptions:=ReadString(sec_defaults,'defaultoptions','');
{ dirs }
DirUnit:=ReadString(sec_dirs,'unit','');
DirLib:=ReadString(sec_dirs,'lib','');
DirObj:=ReadString(sec_dirs,'obj','');
DirTarget:=ReadString(sec_dirs,'target','');
DirUnitTarget:=ReadString(sec_dirs,'unittarget','');
DirInc:=ReadString(sec_dirs,'inc','');
DirProcInc:=ReadString(sec_dirs,'procinc','');
DirOSInc:=ReadString(sec_dirs,'osinc','');
DirFpc:=ReadString(sec_dirs,'fpcdir','');
DirUnit:=ReadString(sec_dirs,'unitdir','');
DirLib:=ReadString(sec_dirs,'libdir','');
DirObj:=ReadString(sec_dirs,'objdir','');
DirTarget:=ReadString(sec_dirs,'targetdir','');
DirUnitTarget:=ReadString(sec_dirs,'unittargetdir','');
DirInc:=ReadString(sec_dirs,'incdir','');
DirProcInc:=ReadString(sec_dirs,'procincdir','');
DirOSInc:=ReadString(sec_dirs,'osincdir','');
{ libs }
LibGcc:=ReadBool(sec_libs,'gcc',false);
LibOther:=ReadBool(sec_libs,'other',false);
LibGcc:=ReadBool(sec_libs,'libgcc',false);
LibOther:=ReadBool(sec_libs,'libother',false);
{ tools }
ToolsSed:=ReadBool(sec_tools,'toolsed',false);
ToolsDiff:=ReadBool(sec_tools,'tooldiff',false);
ToolsCmp:=ReadBool(sec_tools,'toolcmp',false);
ToolsUpx:=ReadBool(sec_tools,'toolupx',true);
ToolsDate:=ReadBool(sec_tools,'tooldate',true);
ToolsZip:=ReadBool(sec_tools,'toolzip',true);
{ info }
InfoCfg:=ReadBool(sec_info,'config',true);
InfoDir:=ReadBool(sec_info,'dir',false);
InfoTools:=ReadBool(sec_info,'tools',false);
InfoInstall:=ReadBool(sec_info,'install',true);
InfoObjects:=ReadBool(sec_info,'objects',true);
InfoFiles:=ReadBool(sec_info,'files',false);
InfoCfg:=ReadBool(sec_info,'infoconfig',true);
InfoDirs:=ReadBool(sec_info,'infodirs',false);
InfoTools:=ReadBool(sec_info,'infotools',false);
InfoInstall:=ReadBool(sec_info,'infoinstall',true);
InfoObjects:=ReadBool(sec_info,'infoobjects',true);
InfoFiles:=ReadBool(sec_info,'infofiles',false);
{ rules }
PreSettings:=TStringList.Create;
ReadSectionRaw('presettings',PreSettings);
{ rules }
PostSettings:=TStringList.Create;
ReadSectionRaw('postsettings',PostSettings);
{ rules }
rules:=TStringList.Create;
ReadSectionRaw(sec_rules,rules);
ReadSectionRaw('rules',rules);
end;
ini.Destroy;
@ -143,15 +190,18 @@ var
fn : string;
begin
ReadFpcMakeIni:=nil;
if FileExists('userini.ini') then
fn:='userini.ini'
if FileExists('fpcmake.ini') then
fn:='fpcmake.ini'
else
if (FileExists(GetEnv('FPCMAKEINI'))) then
fn:=GetEnv('FPCMAKEINI')
else
{$ifdef linux}
if FileExists('/usr/lib/fpc/userini.ini') then
fn:='/usr/lib/fpc/userini.ini'
if FileExists('/usr/lib/fpc/fpcmake.ini') then
fn:='/usr/lib/fpc/fpcmake.ini'
{$else}
if FileExists(paramstr(0)+'/userini.ini') then
fn:=paramstr(0)+'/userini.ini'
if FileExists(ChangeFileExt(paramstr(0),'.ini')) then
fn:=ChangeFileExt(paramstr(0),'.ini')
{$endif}
else
exit;
@ -178,7 +228,7 @@ var
i:=0;
while (i<sl.Count) do
begin
if sl[i][1] in [' ',#9] then
if (sl[i]<>'') and (sl[i][1] in [' ',#9]) then
begin
s:=sl[i];
k:=0;
@ -233,7 +283,8 @@ var
i:=0;
while (i<userini.rules.Count) do
begin
if (userini.rules[i][1]=s[1]) and
if (userini.rules[i]<>'') and
(userini.rules[i][1]=s[1]) and
(Copy(userini.rules[i],1,length(s))=s) then
exit;
inc(i);
@ -244,6 +295,7 @@ var
var
hs : string;
i : integer;
begin
{ Open the Makefile }
Verbose('Creating Makefile');
@ -255,69 +307,127 @@ begin
begin
{ write header & autodetection }
Add('#');
Add('# Makefile generated from Makefile.fpc by '+Title);
Add('# Makefile generated from Makefile.fpc on '+FormatDateTime(TimeFormat,Now));
Add('#');
Add('');
Add('defaultrule: Makefile '+userini.defaultrule);
Add('');
AddSection(true,'makefilerule');
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');
{ write the default & user settings }
AddSection(true,'defaultsettings');
AddSection(true,'usersettings');
{ Pre Settings }
if userini.PreSettings.count>0 then
AddStrings(userini.PreSettings);
{ Targets }
Add('');
Add('UNITOBJECTS='+userini.targetunits[0]);
Add('EXEOBJECTS='+userini.targetprograms[0]);
for i:=1to targets do
if (userini.targetunits[i]<>'') or
(userini.targetprograms[i]<>'') then
begin
Add('ifeq ($(OS_TARGET),'+targetstr[i]+')');
if userini.targetunits[i]<>'' then
Add('UNITOBJECTS+='+userini.targetunits[i]);
if userini.targetprograms[i]<>'' then
Add('EXEOBJECTS+='+userini.targetprograms[i]);
Add('endif');
end;
{ Defaults }
Add('');
if userini.defaultunits then
Add('DEFAULTUNITS=1');
Add('UNITOBJECTS='+userini.targetunits);
Add('EXEOBJECTS='+userini.targetprograms);
if userini.defaultoptions<>'' then
Add('override NEEDOPT='+userini.defaultoptions);
{ Dirs }
Add('');
if userini.dirfpc<>'' then
begin
{ this dir can be set in the environment, it's more a default }
Add('ifndef FPCDIR');
Add('FPCDIR='+userini.dirfpc);
Add('endif');
end;
if userini.dirunit<>'' then
Add('NEEDUNITDIR='+userini.dirunit);
Add('override NEEDUNITDIR='+userini.dirunit);
if userini.dirlib<>'' then
Add('NEEDLIBDIR='+userini.dirlib);
Add('override NEEDLIBDIR='+userini.dirlib);
if userini.dirobj<>'' then
Add('NEEDOBJDIR='+userini.dirobj);
Add('override NEEDOBJDIR='+userini.dirobj);
if userini.dirinc<>'' then
Add('INC='+userini.dirinc);
if userini.dirprocinc<>'' then
Add('PROCINC='+userini.dirprocinc);
if userini.dirosinc<>'' then
Add('OSINC='+userini.dirosinc);
Add('override NEEDINCDIR='+userini.dirinc);
if userini.dirtarget<>'' then
Add('TARGETDIR='+userini.dirtarget);
begin
Add('ifndef TARGETDIR');
Add('TARGETDIR='+userini.dirtarget);
Add('endif');
end;
if userini.dirunittarget<>'' then
Add('UNITTARGETDIR='+userini.dirunittarget);
begin
Add('ifndef UNITTARGETDIR');
Add('UNITTARGETDIR='+userini.dirunittarget);
Add('endif');
end;
{ Libs }
Add('');
if userini.libgcc then
Add('NEEDGCCLIB=1');
Add('override NEEDGCCLIB=1');
if userini.libother then
Add('NEEDOTHERLIB=1');
Add('override NEEDOTHERLIB=1');
{ Info }
Add('');
hs:='';
if userini.infocfg then
hs:=hs+'fpc_infocfg ';
if userini.infodir then
hs:=hs+'fpc_infodir ';
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 ';
if userini.infofiles then
hs:=hs+'fpc_infofiles ';
Add('FPCINFO='+hs);
{ Post Settings }
if userini.PostSettings.count>0 then
AddStrings(userini.PostSettings);
{ commandline }
Add('');
AddSection(true,'command_begin');
AddSection(true,'command_rtl');
AddSection(true,'command_needopt');
AddSection((userini.dirfpc<>''),'command_fpcdir');
AddSection((userini.dirunit<>''),'command_needunit');
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');
@ -331,12 +441,12 @@ begin
{ write tools }
AddSection(true,'shelltools');
AddSection(true,'tool_default');
AddSection(true,'tool_upx');
AddSection(true,'tool_sed');
AddSection(true,'tool_date');
AddSection(true,'tool_zip');
AddSection(true,'tool_cmp');
AddSection(true,'tool_diff');
AddSection(userini.toolsupx,'tool_upx');
AddSection(userini.toolssed,'tool_sed');
AddSection(userini.toolsdate,'tool_date');
AddSection(userini.toolszip,'tool_zip');
AddSection(userini.toolscmp,'tool_cmp');
AddSection(userini.toolsdiff,'tool_diff');
{ write dirs }
AddSection(true,'dir_default');
@ -354,6 +464,7 @@ begin
AddRule('all');
AddRule('staticlib');
AddRule('sharedlib');
AddRule('showinstall');
AddRule('install');
AddRule('staticinstall');
AddRule('sharedinstall');
@ -361,6 +472,7 @@ begin
AddRule('zipinstall');
AddRule('zipinstalladd');
AddRule('clean');
AddRule('clean_all');
AddRule('depend');
AddRule('info');
@ -373,9 +485,9 @@ begin
AddSection(true,'dependrules');
AddSection(true,'inforules');
AddSection(userini.infocfg,'info_cfg');
AddSection(userini.infodir,'info_dir');
AddSection(userini.infodirs,'info_dirs');
AddSection(userini.infotools,'info_tools');
AddSection(userini.infoobjects,'info_object');
AddSection(userini.infoobjects,'info_objects');
AddSection(userini.infoinstall,'info_install');
AddSection(userini.infofiles,'info_files');
@ -401,7 +513,7 @@ begin
{ Open userini.ini }
fpcini:=ReadFpcMakeIni;
if not assigned(fpcini) then
Error('Can''t read userini.ini');
Error('Can''t read fpcmake.ini');
{ Open Makefile.fpc }
if not ReadMakefilefpc then
@ -415,7 +527,10 @@ begin
end.
{
$Log$
Revision 1.1 1999-11-02 23:57:40 peter
Revision 1.2 1999-11-03 23:39:53 peter
* lot of updates
Revision 1.1 1999/11/02 23:57:40 peter
* initial version
}

View File

@ -5,31 +5,88 @@
#
[targets]
;defaultunits=0
units=<your units>
programs=<your programs>
; The units which should be compiled
units=
; The programs which should be compiled
programs=
[defaults]
; the default build target should only compile the units ?
defaultunits=0
; What is the default rule to call
defaultrule=all
; force target OS
defaulttarget=
; force target CPU
defaultcpu=
; options needed to compile (like -S2 or -Sg)
defaultoptions=
[dirs]
;unitdir=
;libdir=
;objdir=
;incdir=
;procincdir=
;osincdir=
;targetdir=
;unittargetdir=
; what is the default location of FPC
fpcdir=
; which dirs need to be searched for units
unitdir=
; which dirs need to be searched for libs
libdir=
; which dirs need to be searched for object files
objdir=
; which dirs need to be searched for include files
incdir=
; where to place the created units/files
targetdir=
; where to place the created units
unittargetdir=
[libs]
;libgcc=0
;libother=0
; linking with libgcc.a needed ?
libgcc=0
; linking with other libraries needed (not in the /lib;/usr/lib;/usr/X11R6/lib)
libother=0
[tools]
; sed needed?
toolsed=0
; cmp needed?
toolcmp=0
; diff needed?
tooldiff=0
; try to use upx for compression ?
toolupx=1
; date needed?
tooldate=1
; zip needed?
toolzip=1
[info]
;infocfg=1
;infodir=0
;infotools=0
;infoinstall=1
;infoobjects=1
;infofiles=0
; show configuration info
infocfg=1
; show directory info
infodir=0
; show which tools are found
infotools=0
; show install dirs
infoinstall=1
; show build objects
infoobjects=1
; show files found in current dir
infofiles=0
[presettings]
; Add here the makefile commands which need to be done at the beginning
; of the user settings section
[postsettings]
; Add here the makefile commands which need to be done at the end
; of the user settings section
[rules]
; here you can add your own rules, the general rules will automaticly