mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-10-23 11:51:53 +02:00
* Arguments added
* Start of Package.fpc creation
This commit is contained in:
parent
805b1e2eff
commit
f09b0ecc48
@ -1,5 +1,5 @@
|
||||
#
|
||||
# Don't edit, this file is generated by fpcmake v1.99.0 [2001/05/30]
|
||||
# Don't edit, this file is generated by fpcmake v1.99.0 [2001/06/04]
|
||||
#
|
||||
default: all
|
||||
override PATH:=$(subst \,/,$(PATH))
|
||||
@ -186,6 +186,15 @@ LDCONFIG=ldconfig
|
||||
else
|
||||
LDCONFIG=
|
||||
endif
|
||||
ifndef FPCMAKE
|
||||
FPCMAKE:=$(strip $(wildcard $(addsuffix /fpcmake$(SRCEXEEXT),$(SEARCHPATH))))
|
||||
ifeq ($(FPCMAKE),)
|
||||
FPCMAKE=
|
||||
else
|
||||
FPCMAKE:=$(firstword $(FPCMAKE))
|
||||
endif
|
||||
endif
|
||||
export FPCMAKE
|
||||
ifndef PPUMOVE
|
||||
PPUMOVE:=$(strip $(wildcard $(addsuffix /ppumove$(SRCEXEEXT),$(SEARCHPATH))))
|
||||
ifeq ($(PPUMOVE),)
|
||||
@ -488,6 +497,11 @@ REQUIRE_PACKAGES_RTL=1
|
||||
REQUIRE_PACKAGES_PASZLIB=1
|
||||
REQUIRE_PACKAGES_FCL=1
|
||||
endif
|
||||
ifeq ($(OS_TARGET),beos)
|
||||
REQUIRE_PACKAGES_RTL=1
|
||||
REQUIRE_PACKAGES_PASZLIB=1
|
||||
REQUIRE_PACKAGES_FCL=1
|
||||
endif
|
||||
ifdef REQUIRE_PACKAGES_RTL
|
||||
PACKAGEDIR_RTL:=$(subst /Makefile.fpc,,$(strip $(wildcard $(addsuffix /rtl/Makefile.fpc,$(PACKAGESDIR)))))
|
||||
ifneq ($(PACKAGEDIR_RTL),)
|
||||
@ -934,9 +948,10 @@ fpc_info:
|
||||
@$(ECHO)
|
||||
@$(ECHO) Pwd....... $(PWD)
|
||||
@$(ECHO) Echo...... $(ECHO)
|
||||
@$(ECHO) Date...... $(DATE)
|
||||
@$(ECHO) FPCMake... $(FPCMAKE)
|
||||
@$(ECHO) PPUMove... $(PPUMOVE)
|
||||
@$(ECHO) PPUFiles.. $(PPUFILES)
|
||||
@$(ECHO) Date...... $(DATE)
|
||||
@$(ECHO) Upx....... $(UPXPROG)
|
||||
@$(ECHO) Zip....... $(ZIPPROG)
|
||||
@$(ECHO)
|
||||
@ -985,9 +1000,9 @@ endif
|
||||
export DATA2INC
|
||||
all: fpc_all
|
||||
debug: fpc_debug
|
||||
examples: fpc_examples
|
||||
smart: fpc_smart
|
||||
shared: fpc_shared
|
||||
examples:
|
||||
shared:
|
||||
install: fpc_install
|
||||
sourceinstall: fpc_sourceinstall
|
||||
exampleinstall: fpc_exampleinstall
|
||||
@ -1000,7 +1015,7 @@ clean: fpc_clean
|
||||
distclean: fpc_distclean
|
||||
cleanall: fpc_cleanall
|
||||
info: fpc_info
|
||||
.PHONY: all debug examples smart shared install sourceinstall exampleinstall distinstall zipinstall zipsourceinstall zipexampleinstall zipdistinstall clean distclean cleanall info
|
||||
.PHONY: all debug smart examples shared install sourceinstall exampleinstall distinstall zipinstall zipsourceinstall zipexampleinstall zipdistinstall clean distclean cleanall info
|
||||
ifneq ($(wildcard fpcmake.loc),)
|
||||
include fpcmake.loc
|
||||
endif
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -277,6 +277,17 @@ else
|
||||
LDCONFIG=
|
||||
endif
|
||||
|
||||
# fpcmake
|
||||
ifndef FPCMAKE
|
||||
FPCMAKE:=$(strip $(wildcard $(addsuffix /fpcmake$(SRCEXEEXT),$(SEARCHPATH))))
|
||||
ifeq ($(FPCMAKE),)
|
||||
FPCMAKE=
|
||||
else
|
||||
FPCMAKE:=$(firstword $(FPCMAKE))
|
||||
endif
|
||||
endif
|
||||
export FPCMAKE
|
||||
|
||||
# ppumove
|
||||
ifndef PPUMOVE
|
||||
PPUMOVE:=$(strip $(wildcard $(addsuffix /ppumove$(SRCEXEEXT),$(SEARCHPATH))))
|
||||
@ -877,7 +888,7 @@ endif
|
||||
# Examples
|
||||
#####################################################################
|
||||
|
||||
.PHONY: fpc_examples fpc_test
|
||||
.PHONY: fpc_examples
|
||||
|
||||
ifdef TARGET_EXAMPLES
|
||||
HASEXAMPLES=1
|
||||
@ -1250,9 +1261,10 @@ fpc_info:
|
||||
@$(ECHO)
|
||||
@$(ECHO) Pwd....... $(PWD)
|
||||
@$(ECHO) Echo...... $(ECHO)
|
||||
@$(ECHO) Date...... $(DATE)
|
||||
@$(ECHO) FPCMake... $(FPCMAKE)
|
||||
@$(ECHO) PPUMove... $(PPUMOVE)
|
||||
@$(ECHO) PPUFiles.. $(PPUFILES)
|
||||
@$(ECHO) Date...... $(DATE)
|
||||
@$(ECHO) Upx....... $(UPXPROG)
|
||||
@$(ECHO) Zip....... $(ZIPPROG)
|
||||
@$(ECHO)
|
||||
|
@ -17,36 +17,80 @@
|
||||
program fpcmake;
|
||||
|
||||
uses
|
||||
getopts,
|
||||
sysutils,
|
||||
fpcmmain,fpcmwr;
|
||||
fpcmmain,fpcmwr,fpcmpkg;
|
||||
|
||||
procedure Verbose(s:string);
|
||||
type
|
||||
{ Verbosity Level }
|
||||
TVerboseLevel = (v_Quiet,v_Default,v_Verbose);
|
||||
|
||||
{ Operation mode }
|
||||
TMode = (m_None,m_PackageFpc,m_Makefile);
|
||||
|
||||
TFPCMakeConsole=class(TFPCMake)
|
||||
procedure Verbose(lvl:TFPCMakeVerbose;const s:string);override;
|
||||
end;
|
||||
|
||||
var
|
||||
Mode : TMode;
|
||||
VerboseLevel : TVerboseLevel;
|
||||
|
||||
|
||||
{*****************************************************************************
|
||||
Helpers
|
||||
*****************************************************************************}
|
||||
|
||||
procedure Show(lvl:TVerboseLevel;const s:string);
|
||||
begin
|
||||
writeln(s);
|
||||
if VerboseLevel>=lvl then
|
||||
Writeln(s);
|
||||
end;
|
||||
|
||||
|
||||
procedure Error(s:string);
|
||||
procedure Error(const s:string);
|
||||
begin
|
||||
Writeln('Error: ',s);
|
||||
Halt(1);
|
||||
end;
|
||||
|
||||
|
||||
procedure ProcessFile(const fn:string);
|
||||
{*****************************************************************************
|
||||
TFPCMakeConsole
|
||||
*****************************************************************************}
|
||||
|
||||
procedure TFPCMakeConsole.Verbose(lvl:TFPCMakeVerbose;const s:string);
|
||||
begin
|
||||
case lvl of
|
||||
FPCMakeInfo :
|
||||
Show(V_Default,' '+VerboseIdent+s);
|
||||
FPCMakeDebug :
|
||||
Show(V_Verbose,' '+VerboseIdent+s);
|
||||
FPCMakeError :
|
||||
Error(s);
|
||||
end;
|
||||
end;
|
||||
|
||||
|
||||
|
||||
{*****************************************************************************
|
||||
Makefile output
|
||||
*****************************************************************************}
|
||||
|
||||
procedure ProcessFile_Makefile(const fn:string);
|
||||
var
|
||||
CurrFPCMake : TFPCMake;
|
||||
CurrFPCMake : TFPCMakeConsole;
|
||||
CurrMakefile : TMakefileWriter;
|
||||
{$ifdef SUBDIRS}
|
||||
s,Subdirs : string;
|
||||
t : ttarget;
|
||||
{$endif SUBDIRS}
|
||||
begin
|
||||
Show(V_Default,'Processing '+fn);
|
||||
CurrFPCMake:=nil;
|
||||
// try
|
||||
writeln('Processing ',fn);
|
||||
{ Load Makefile.fpc }
|
||||
CurrFPCMake:=TFPCMake.Create(fn);
|
||||
CurrFPCMake:=TFPCMakeConsole.Create(fn);
|
||||
CurrFPCMake.LoadMakefileFPC;
|
||||
// CurrFPCMake.Print;
|
||||
|
||||
@ -59,7 +103,6 @@ program fpcmake;
|
||||
{ Write Makefile }
|
||||
CurrMakefile:=TMakefileWriter.Create(CurrFPCMake,ExtractFilePath(fn)+'Makefile');
|
||||
CurrMakefile.WriteGenericMakefile;
|
||||
{ Free }
|
||||
CurrMakefile.Free;
|
||||
|
||||
// except
|
||||
@ -84,6 +127,51 @@ program fpcmake;
|
||||
|
||||
end;
|
||||
|
||||
{*****************************************************************************
|
||||
Package.fpc output
|
||||
*****************************************************************************}
|
||||
|
||||
procedure ProcessFile_PackageFpc(const fn:string);
|
||||
var
|
||||
CurrFPCMake : TFPCMakeConsole;
|
||||
CurrPackageFpc : TPackageFpcWriter;
|
||||
begin
|
||||
Show(V_Default,'Processing '+fn);
|
||||
CurrFPCMake:=nil;
|
||||
// try
|
||||
{ Load Makefile.fpc }
|
||||
CurrFPCMake:=TFPCMakeConsole.Create(fn);
|
||||
CurrFPCMake.LoadMakefileFPC;
|
||||
CurrFPCMake.Print;
|
||||
|
||||
{ Write Package.fpc }
|
||||
CurrPackageFpc:=TPackageFpcWriter.Create(CurrFPCMake,ExtractFilePath(fn)+'Package.fpc');
|
||||
CurrPackageFpc.WritePackageFpc;
|
||||
CurrPackageFpc.Free;
|
||||
|
||||
// except
|
||||
// on e : exception do
|
||||
// begin
|
||||
// Error(e.message);
|
||||
// Subdirs:='';
|
||||
// end;
|
||||
// end;
|
||||
CurrFPCMake.Free;
|
||||
end;
|
||||
|
||||
|
||||
procedure ProcessFile(const fn:string);
|
||||
begin
|
||||
case Mode of
|
||||
m_None :
|
||||
Error('No operation specified, see -h for help');
|
||||
m_Makefile :
|
||||
ProcessFile_Makefile(fn);
|
||||
m_PackageFpc :
|
||||
ProcessFile_PackageFpc(fn);
|
||||
end;
|
||||
end;
|
||||
|
||||
|
||||
procedure UseMakefilefpc;
|
||||
var
|
||||
@ -101,20 +189,73 @@ procedure UseParameters;
|
||||
var
|
||||
i : integer;
|
||||
begin
|
||||
for i:=1 to ParamCount do
|
||||
for i:=OptInd to ParamCount do
|
||||
ProcessFile(ParamStr(i));
|
||||
end;
|
||||
|
||||
|
||||
Procedure Usage;
|
||||
{
|
||||
Print usage and exit.
|
||||
}
|
||||
begin
|
||||
if ParamCount=0 then
|
||||
writeln(paramstr(0),': <-pw> [-vqh] [file] [file ...]');
|
||||
writeln('Operations:');
|
||||
writeln(' -p Generate Package.fpc');
|
||||
writeln(' -w Write Makefile');
|
||||
writeln('');
|
||||
writeln('Options:');
|
||||
writeln(' -v Be more verbose');
|
||||
writeln(' -q Be quiet');
|
||||
writeln(' -h This help screen');
|
||||
Halt(0);
|
||||
end;
|
||||
|
||||
|
||||
|
||||
Procedure ProcessOpts;
|
||||
{
|
||||
Process command line opions, and checks if command line options OK.
|
||||
}
|
||||
const
|
||||
ShortOpts = 'pwqvh';
|
||||
var
|
||||
C : char;
|
||||
begin
|
||||
if paramcount=0 then
|
||||
usage;
|
||||
{ Reset }
|
||||
Mode:=m_none;
|
||||
VerboseLevel:=v_default;
|
||||
repeat
|
||||
c:=Getopt (ShortOpts);
|
||||
Case C of
|
||||
EndOfOptions : break;
|
||||
'p' : Mode:=m_PackageFpc;
|
||||
'w' : Mode:=m_Makefile;
|
||||
'q' : VerboseLevel:=v_quiet;
|
||||
'v' : VerboseLevel:=v_verbose;
|
||||
'?' : Usage;
|
||||
'h' : Usage;
|
||||
end;
|
||||
until false;
|
||||
end;
|
||||
|
||||
|
||||
begin
|
||||
ProcessOpts;
|
||||
if (OptInd>Paramcount) then
|
||||
UseMakefilefpc
|
||||
else
|
||||
UseParameters;
|
||||
end.
|
||||
{
|
||||
$Log$
|
||||
Revision 1.3 2001-02-22 21:11:24 peter
|
||||
Revision 1.4 2001-06-04 21:42:57 peter
|
||||
* Arguments added
|
||||
* Start of Package.fpc creation
|
||||
|
||||
Revision 1.3 2001/02/22 21:11:24 peter
|
||||
* fpcdir detection added
|
||||
* fixed loading of variables in fpcmake itself
|
||||
|
||||
|
@ -61,7 +61,7 @@ interface
|
||||
function insert(obj:TDictionaryItem):TDictionaryItem;
|
||||
function rename(const olds,News : string):TDictionaryItem;
|
||||
function search(const s:string):TDictionaryItem;
|
||||
function speedsearch(const s:string;SpeedValue:integer):TDictionaryItem;
|
||||
function speedsearch(const s:string;SpeedValue:Cardinal):TDictionaryItem;
|
||||
property Items[const s:string]:TDictionaryItem read Search;default;
|
||||
end;
|
||||
|
||||
@ -119,14 +119,14 @@ constructor TDictionaryItem.Create(const n:string);
|
||||
begin
|
||||
left:=nil;
|
||||
right:=nil;
|
||||
FSpeedValue:=-1;
|
||||
FSpeedValue:=$ffffffff;
|
||||
FName:=n;
|
||||
end;
|
||||
|
||||
|
||||
procedure TDictionaryItem.Setname(const n:string);
|
||||
begin
|
||||
if FSpeedValue=-1 then
|
||||
if FSpeedValue=$ffffffff then
|
||||
FName:=n;
|
||||
end;
|
||||
|
||||
@ -415,7 +415,7 @@ end;
|
||||
|
||||
function tdictionary.rename(const olds,News : string):TDictionaryItem;
|
||||
var
|
||||
spdval : integer;
|
||||
spdval : Cardinal;
|
||||
lasthp,
|
||||
hp,hp2,hp3 : TDictionaryItem;
|
||||
begin
|
||||
@ -501,7 +501,7 @@ end;
|
||||
end;
|
||||
|
||||
|
||||
function Tdictionary.speedsearch(const s:string;SpeedValue:integer):TDictionaryItem;
|
||||
function Tdictionary.speedsearch(const s:string;SpeedValue:Cardinal):TDictionaryItem;
|
||||
var
|
||||
NewNode:TDictionaryItem;
|
||||
begin
|
||||
@ -538,7 +538,11 @@ end;
|
||||
end.
|
||||
{
|
||||
$Log$
|
||||
Revision 1.1 2001-01-24 21:59:36 peter
|
||||
Revision 1.2 2001-06-04 21:42:57 peter
|
||||
* Arguments added
|
||||
* Start of Package.fpc creation
|
||||
|
||||
Revision 1.1 2001/01/24 21:59:36 peter
|
||||
* first commit of new fpcmake
|
||||
|
||||
}
|
||||
|
@ -116,7 +116,7 @@ interface
|
||||
function CopySection(Sec:TFPCMakeSection;Secname:string):TFPCMakeSection;
|
||||
protected
|
||||
VerboseIdent : string;
|
||||
procedure Verbose(lvl:TFPCMakeVerbose;const s:string);
|
||||
procedure Verbose(lvl:TFPCMakeVerbose;const s:string);virtual;
|
||||
public
|
||||
constructor Create(const AFileName:string);
|
||||
constructor CreateFromStream(s:TStream;const AFileName:string);
|
||||
@ -1202,7 +1202,11 @@ implementation
|
||||
end.
|
||||
{
|
||||
$Log$
|
||||
Revision 1.6 2001-06-02 19:20:24 peter
|
||||
Revision 1.7 2001-06-04 21:42:57 peter
|
||||
* Arguments added
|
||||
* Start of Package.fpc creation
|
||||
|
||||
Revision 1.6 2001/06/02 19:20:24 peter
|
||||
* beos target added
|
||||
|
||||
Revision 1.5 2001/02/22 21:11:24 peter
|
||||
|
91
utils/fpcm/fpcmpkg.pp
Normal file
91
utils/fpcm/fpcmpkg.pp
Normal file
@ -0,0 +1,91 @@
|
||||
{
|
||||
$Id$
|
||||
Copyright (c) 2001 by Peter Vreman
|
||||
|
||||
FPCMake - Package.Fpc writer
|
||||
|
||||
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+}
|
||||
unit fpcmpkg;
|
||||
interface
|
||||
|
||||
uses
|
||||
sysutils,classes,
|
||||
fpcmmain;
|
||||
|
||||
type
|
||||
TPackageFpcWriter=class
|
||||
private
|
||||
FFileName : string;
|
||||
FInput : TFPCMake;
|
||||
FOutput : TStringList;
|
||||
public
|
||||
constructor Create(AFPCMake:TFPCMake;const AFileName:string);
|
||||
destructor Destroy;override;
|
||||
procedure WritePackageFpc;
|
||||
end;
|
||||
|
||||
|
||||
implementation
|
||||
|
||||
{*****************************************************************************
|
||||
Helpers
|
||||
*****************************************************************************}
|
||||
|
||||
function FixVariable(s:string):string;
|
||||
var
|
||||
i : integer;
|
||||
begin
|
||||
Result:=UpperCase(s);
|
||||
i:=pos('.',Result);
|
||||
if i>0 then
|
||||
Result[i]:='_';
|
||||
end;
|
||||
|
||||
|
||||
{*****************************************************************************
|
||||
TPackageFpcWriter
|
||||
*****************************************************************************}
|
||||
|
||||
constructor TPackageFpcWriter.Create(AFPCMake:TFPCMake;const AFileName:string);
|
||||
begin
|
||||
FInput:=AFPCMake;
|
||||
FFileName:=AFileName;
|
||||
FOutput:=TStringList.Create;
|
||||
end;
|
||||
|
||||
|
||||
destructor TPackageFpcWriter.Destroy;
|
||||
begin
|
||||
FOutput.Free;
|
||||
end;
|
||||
|
||||
|
||||
procedure TPackageFpcWriter.WritePackageFpc;
|
||||
begin
|
||||
FInput.Print;
|
||||
|
||||
{ Generate Output }
|
||||
with FOutput do
|
||||
begin
|
||||
end;
|
||||
{ write to disk }
|
||||
FOutput.SaveToFile(FFileName);
|
||||
end;
|
||||
|
||||
end.
|
||||
{
|
||||
$Log$
|
||||
Revision 1.1 2001-06-04 21:42:57 peter
|
||||
* Arguments added
|
||||
* Start of Package.fpc creation
|
||||
|
||||
}
|
@ -23,16 +23,16 @@ interface
|
||||
|
||||
type
|
||||
tsections=(sec_none,
|
||||
sec_units,sec_exes,sec_loaders,sec_examples,
|
||||
sec_units,sec_exes,sec_loaders,sec_examples,sec_rsts,
|
||||
sec_compile,sec_install,
|
||||
sec_distinstall,sec_zipinstall,sec_clean,sec_libs,
|
||||
sec_command,sec_exts,sec_dirs,sec_tools,sec_info
|
||||
);
|
||||
|
||||
trules=(
|
||||
r_all,r_debug,
|
||||
r_all,r_debug,r_smart,
|
||||
r_examples,
|
||||
r_smart,r_shared,
|
||||
r_shared,
|
||||
r_install,r_sourceinstall,r_exampleinstall,r_distinstall,
|
||||
r_zipinstall,r_zipsourceinstall,r_zipexampleinstall,r_zipdistinstall,
|
||||
r_clean,r_distclean,r_cleanall,
|
||||
@ -42,9 +42,9 @@ interface
|
||||
|
||||
const
|
||||
rule2str : array[trules] of string=(
|
||||
'all','debug',
|
||||
'all','debug','smart',
|
||||
'examples',
|
||||
'smart','shared',
|
||||
'shared',
|
||||
'install','sourceinstall','exampleinstall','distinstall',
|
||||
'zipinstall','zipsourceinstall','zipexampleinstall','zipdistinstall',
|
||||
'clean','distclean','cleanall',
|
||||
@ -52,9 +52,9 @@ interface
|
||||
);
|
||||
|
||||
rule2sec : array[trules] of tsections=(
|
||||
sec_compile,sec_compile,
|
||||
sec_compile,sec_compile,sec_compile,
|
||||
sec_examples,
|
||||
sec_libs,sec_libs,
|
||||
sec_libs,
|
||||
sec_install,sec_install,sec_install,sec_distinstall,
|
||||
sec_zipinstall,sec_zipinstall,sec_zipinstall,sec_zipinstall,
|
||||
sec_clean,sec_clean,sec_clean,
|
||||
@ -86,6 +86,7 @@ interface
|
||||
procedure AddTargetDirs(const inivar:string);
|
||||
function CheckTargetVariable(const inivar:string):boolean;
|
||||
function CheckVariable(const inivar:string):boolean;
|
||||
procedure OptimizeSections;
|
||||
public
|
||||
constructor Create(AFPCMake:TFPCMake;const AFileName:string);
|
||||
destructor Destroy;override;
|
||||
@ -247,7 +248,7 @@ implementation
|
||||
|
||||
|
||||
{*****************************************************************************
|
||||
TMyMemoryStream
|
||||
TMakefileWriter
|
||||
*****************************************************************************}
|
||||
|
||||
constructor TMakefileWriter.Create(AFPCMake:TFPCMake;const AFileName:string);
|
||||
@ -481,13 +482,15 @@ implementation
|
||||
hs:='';
|
||||
if FHasSection[Rule2Sec[rule]] then
|
||||
hs:=hs+' fpc_'+rule2str[rule];
|
||||
{ include target dirs }
|
||||
if CheckTargetVariable('target_dirs') then
|
||||
{ include target dirs, but not for info and targets that
|
||||
call other targets with a only extra settings }
|
||||
if CheckTargetVariable('target_dirs') and
|
||||
not(rule in [r_info,r_shared,r_smart,r_debug,r_distinstall]) then
|
||||
begin
|
||||
if CheckVariable('default_dir') then
|
||||
hs:=hs+' $(addsuffix _'+rule2str[rule]+',$(DEFAULT_DIR))'
|
||||
else
|
||||
if not(rule in [r_sourceinstall,r_distinstall,r_zipinstall,r_zipsourceinstall]) or
|
||||
if not(rule in [r_sourceinstall,r_zipinstall,r_zipsourceinstall]) or
|
||||
not(CheckVariable('package_name')) then
|
||||
hs:=hs+' $(addsuffix _'+rule2str[rule]+',$(TARGET_DIRS))';
|
||||
end;
|
||||
@ -638,16 +641,66 @@ implementation
|
||||
WritePhony;
|
||||
end;
|
||||
|
||||
|
||||
procedure TMakefileWriter.OptimizeSections;
|
||||
var
|
||||
SkippedSecs :integer;
|
||||
begin
|
||||
{ Turn some sections off, depending if files are
|
||||
provided }
|
||||
if not FInput.IsPackage then
|
||||
begin
|
||||
FHasSection[sec_zipinstall]:=false;
|
||||
FHasSection[sec_distinstall]:=false;
|
||||
end;
|
||||
FHasSection[sec_libs]:=CheckVariable('lib_name');
|
||||
{ Remove unused sections for targets }
|
||||
SkippedSecs:=0;
|
||||
if (not CheckTargetVariable('target_units')) then
|
||||
begin
|
||||
inc(SkippedSecs);
|
||||
FHasSection[sec_units]:=false;
|
||||
end;
|
||||
if (not CheckTargetVariable('target_programs')) then
|
||||
begin
|
||||
inc(SkippedSecs);
|
||||
FHasSection[sec_exes]:=false;
|
||||
end;
|
||||
if (not CheckTargetVariable('target_examples')) then
|
||||
begin
|
||||
inc(SkippedSecs);
|
||||
{ example dirs also requires the fpc_examples target, because
|
||||
it also depends on the all target }
|
||||
if (not CheckTargetVariable('target_exampledirs')) then
|
||||
FHasSection[sec_examples]:=false;
|
||||
end;
|
||||
if (not CheckTargetVariable('target_loaders')) then
|
||||
begin
|
||||
inc(SkippedSecs);
|
||||
FHasSection[sec_loaders]:=false;
|
||||
end;
|
||||
{ if all 4 sections are not available we can skip also the
|
||||
generic compile rules }
|
||||
if SkippedSecs=4 then
|
||||
begin
|
||||
FHasSection[sec_compile]:=false;
|
||||
if (not CheckTargetVariable('install_units')) and
|
||||
(not CheckTargetVariable('install_files')) then
|
||||
FHasSection[sec_install]:=false;
|
||||
if (not CheckTargetVariable('clean_units')) and
|
||||
(not CheckTargetVariable('clean_files')) then
|
||||
FHasSection[sec_clean]:=false;
|
||||
end;
|
||||
end;
|
||||
|
||||
|
||||
procedure TMakefileWriter.WriteGenericMakefile;
|
||||
begin
|
||||
{ Remove unused sections }
|
||||
OptimizeSections;
|
||||
{ Generate Output }
|
||||
with FOutput do
|
||||
begin
|
||||
{ Turn some sections off }
|
||||
if not FInput.IsPackage then
|
||||
begin
|
||||
FHasSection[sec_zipinstall]:=false;
|
||||
FHasSection[sec_distinstall]:=false;
|
||||
end;
|
||||
{ Header }
|
||||
Add('#');
|
||||
Add('# Don''t edit, this file is generated by '+TitleDate);
|
||||
@ -735,22 +788,23 @@ implementation
|
||||
AddIniSection('command_libc');
|
||||
AddIniSection('command_end');
|
||||
{ compile }
|
||||
if CheckTargetVariable('target_loaders') then
|
||||
if FHasSection[sec_loaders] then
|
||||
AddIniSection('loaderrules');
|
||||
if CheckTargetVariable('target_units') then
|
||||
if FHasSection[sec_units] then
|
||||
AddIniSection('unitrules');
|
||||
if CheckTargetVariable('target_programs') then
|
||||
if FHasSection[sec_exes] then
|
||||
AddIniSection('exerules');
|
||||
if CheckTargetVariable('target_rsts') then
|
||||
if FHasSection[sec_rsts] then
|
||||
AddIniSection('rstrules');
|
||||
if CheckTargetVariable('target_examples') or
|
||||
CheckTargetVariable('target_exampledirs') then
|
||||
if FHasSection[sec_examples] then
|
||||
AddIniSection('examplerules');
|
||||
AddIniSection('compilerules');
|
||||
if CheckVariable('lib_name') then
|
||||
if FHasSection[sec_compile] then
|
||||
AddIniSection('compilerules');
|
||||
if FHasSection[sec_libs] then
|
||||
AddIniSection('libraryrules');
|
||||
{ install }
|
||||
AddIniSection('installrules');
|
||||
if FHasSection[sec_install] then
|
||||
AddIniSection('installrules');
|
||||
if FHasSection[sec_distinstall] then
|
||||
AddIniSection('distinstallrules');
|
||||
if FHasSection[sec_zipinstall] then
|
||||
@ -780,7 +834,11 @@ implementation
|
||||
end.
|
||||
{
|
||||
$Log$
|
||||
Revision 1.8 2001-05-30 21:39:17 peter
|
||||
Revision 1.9 2001-06-04 21:42:57 peter
|
||||
* Arguments added
|
||||
* Start of Package.fpc creation
|
||||
|
||||
Revision 1.8 2001/05/30 21:39:17 peter
|
||||
* gecho, gdate fixes
|
||||
* distinstall target rewrite to not install things twice
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user