mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-10-27 10:31:41 +01: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
|
default: all
|
||||||
override PATH:=$(subst \,/,$(PATH))
|
override PATH:=$(subst \,/,$(PATH))
|
||||||
@ -186,6 +186,15 @@ LDCONFIG=ldconfig
|
|||||||
else
|
else
|
||||||
LDCONFIG=
|
LDCONFIG=
|
||||||
endif
|
endif
|
||||||
|
ifndef FPCMAKE
|
||||||
|
FPCMAKE:=$(strip $(wildcard $(addsuffix /fpcmake$(SRCEXEEXT),$(SEARCHPATH))))
|
||||||
|
ifeq ($(FPCMAKE),)
|
||||||
|
FPCMAKE=
|
||||||
|
else
|
||||||
|
FPCMAKE:=$(firstword $(FPCMAKE))
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
export FPCMAKE
|
||||||
ifndef PPUMOVE
|
ifndef PPUMOVE
|
||||||
PPUMOVE:=$(strip $(wildcard $(addsuffix /ppumove$(SRCEXEEXT),$(SEARCHPATH))))
|
PPUMOVE:=$(strip $(wildcard $(addsuffix /ppumove$(SRCEXEEXT),$(SEARCHPATH))))
|
||||||
ifeq ($(PPUMOVE),)
|
ifeq ($(PPUMOVE),)
|
||||||
@ -488,6 +497,11 @@ REQUIRE_PACKAGES_RTL=1
|
|||||||
REQUIRE_PACKAGES_PASZLIB=1
|
REQUIRE_PACKAGES_PASZLIB=1
|
||||||
REQUIRE_PACKAGES_FCL=1
|
REQUIRE_PACKAGES_FCL=1
|
||||||
endif
|
endif
|
||||||
|
ifeq ($(OS_TARGET),beos)
|
||||||
|
REQUIRE_PACKAGES_RTL=1
|
||||||
|
REQUIRE_PACKAGES_PASZLIB=1
|
||||||
|
REQUIRE_PACKAGES_FCL=1
|
||||||
|
endif
|
||||||
ifdef REQUIRE_PACKAGES_RTL
|
ifdef REQUIRE_PACKAGES_RTL
|
||||||
PACKAGEDIR_RTL:=$(subst /Makefile.fpc,,$(strip $(wildcard $(addsuffix /rtl/Makefile.fpc,$(PACKAGESDIR)))))
|
PACKAGEDIR_RTL:=$(subst /Makefile.fpc,,$(strip $(wildcard $(addsuffix /rtl/Makefile.fpc,$(PACKAGESDIR)))))
|
||||||
ifneq ($(PACKAGEDIR_RTL),)
|
ifneq ($(PACKAGEDIR_RTL),)
|
||||||
@ -934,9 +948,10 @@ fpc_info:
|
|||||||
@$(ECHO)
|
@$(ECHO)
|
||||||
@$(ECHO) Pwd....... $(PWD)
|
@$(ECHO) Pwd....... $(PWD)
|
||||||
@$(ECHO) Echo...... $(ECHO)
|
@$(ECHO) Echo...... $(ECHO)
|
||||||
|
@$(ECHO) Date...... $(DATE)
|
||||||
|
@$(ECHO) FPCMake... $(FPCMAKE)
|
||||||
@$(ECHO) PPUMove... $(PPUMOVE)
|
@$(ECHO) PPUMove... $(PPUMOVE)
|
||||||
@$(ECHO) PPUFiles.. $(PPUFILES)
|
@$(ECHO) PPUFiles.. $(PPUFILES)
|
||||||
@$(ECHO) Date...... $(DATE)
|
|
||||||
@$(ECHO) Upx....... $(UPXPROG)
|
@$(ECHO) Upx....... $(UPXPROG)
|
||||||
@$(ECHO) Zip....... $(ZIPPROG)
|
@$(ECHO) Zip....... $(ZIPPROG)
|
||||||
@$(ECHO)
|
@$(ECHO)
|
||||||
@ -985,9 +1000,9 @@ endif
|
|||||||
export DATA2INC
|
export DATA2INC
|
||||||
all: fpc_all
|
all: fpc_all
|
||||||
debug: fpc_debug
|
debug: fpc_debug
|
||||||
examples: fpc_examples
|
|
||||||
smart: fpc_smart
|
smart: fpc_smart
|
||||||
shared: fpc_shared
|
examples:
|
||||||
|
shared:
|
||||||
install: fpc_install
|
install: fpc_install
|
||||||
sourceinstall: fpc_sourceinstall
|
sourceinstall: fpc_sourceinstall
|
||||||
exampleinstall: fpc_exampleinstall
|
exampleinstall: fpc_exampleinstall
|
||||||
@ -1000,7 +1015,7 @@ clean: fpc_clean
|
|||||||
distclean: fpc_distclean
|
distclean: fpc_distclean
|
||||||
cleanall: fpc_cleanall
|
cleanall: fpc_cleanall
|
||||||
info: fpc_info
|
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),)
|
ifneq ($(wildcard fpcmake.loc),)
|
||||||
include fpcmake.loc
|
include fpcmake.loc
|
||||||
endif
|
endif
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@ -277,6 +277,17 @@ else
|
|||||||
LDCONFIG=
|
LDCONFIG=
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
# fpcmake
|
||||||
|
ifndef FPCMAKE
|
||||||
|
FPCMAKE:=$(strip $(wildcard $(addsuffix /fpcmake$(SRCEXEEXT),$(SEARCHPATH))))
|
||||||
|
ifeq ($(FPCMAKE),)
|
||||||
|
FPCMAKE=
|
||||||
|
else
|
||||||
|
FPCMAKE:=$(firstword $(FPCMAKE))
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
export FPCMAKE
|
||||||
|
|
||||||
# ppumove
|
# ppumove
|
||||||
ifndef PPUMOVE
|
ifndef PPUMOVE
|
||||||
PPUMOVE:=$(strip $(wildcard $(addsuffix /ppumove$(SRCEXEEXT),$(SEARCHPATH))))
|
PPUMOVE:=$(strip $(wildcard $(addsuffix /ppumove$(SRCEXEEXT),$(SEARCHPATH))))
|
||||||
@ -877,7 +888,7 @@ endif
|
|||||||
# Examples
|
# Examples
|
||||||
#####################################################################
|
#####################################################################
|
||||||
|
|
||||||
.PHONY: fpc_examples fpc_test
|
.PHONY: fpc_examples
|
||||||
|
|
||||||
ifdef TARGET_EXAMPLES
|
ifdef TARGET_EXAMPLES
|
||||||
HASEXAMPLES=1
|
HASEXAMPLES=1
|
||||||
@ -1250,9 +1261,10 @@ fpc_info:
|
|||||||
@$(ECHO)
|
@$(ECHO)
|
||||||
@$(ECHO) Pwd....... $(PWD)
|
@$(ECHO) Pwd....... $(PWD)
|
||||||
@$(ECHO) Echo...... $(ECHO)
|
@$(ECHO) Echo...... $(ECHO)
|
||||||
|
@$(ECHO) Date...... $(DATE)
|
||||||
|
@$(ECHO) FPCMake... $(FPCMAKE)
|
||||||
@$(ECHO) PPUMove... $(PPUMOVE)
|
@$(ECHO) PPUMove... $(PPUMOVE)
|
||||||
@$(ECHO) PPUFiles.. $(PPUFILES)
|
@$(ECHO) PPUFiles.. $(PPUFILES)
|
||||||
@$(ECHO) Date...... $(DATE)
|
|
||||||
@$(ECHO) Upx....... $(UPXPROG)
|
@$(ECHO) Upx....... $(UPXPROG)
|
||||||
@$(ECHO) Zip....... $(ZIPPROG)
|
@$(ECHO) Zip....... $(ZIPPROG)
|
||||||
@$(ECHO)
|
@$(ECHO)
|
||||||
|
|||||||
@ -17,36 +17,80 @@
|
|||||||
program fpcmake;
|
program fpcmake;
|
||||||
|
|
||||||
uses
|
uses
|
||||||
|
getopts,
|
||||||
sysutils,
|
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
|
begin
|
||||||
writeln(s);
|
if VerboseLevel>=lvl then
|
||||||
|
Writeln(s);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
procedure Error(s:string);
|
procedure Error(const s:string);
|
||||||
begin
|
begin
|
||||||
Writeln('Error: ',s);
|
Writeln('Error: ',s);
|
||||||
Halt(1);
|
Halt(1);
|
||||||
end;
|
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
|
var
|
||||||
CurrFPCMake : TFPCMake;
|
CurrFPCMake : TFPCMakeConsole;
|
||||||
CurrMakefile : TMakefileWriter;
|
CurrMakefile : TMakefileWriter;
|
||||||
{$ifdef SUBDIRS}
|
{$ifdef SUBDIRS}
|
||||||
s,Subdirs : string;
|
s,Subdirs : string;
|
||||||
t : ttarget;
|
t : ttarget;
|
||||||
{$endif SUBDIRS}
|
{$endif SUBDIRS}
|
||||||
begin
|
begin
|
||||||
|
Show(V_Default,'Processing '+fn);
|
||||||
CurrFPCMake:=nil;
|
CurrFPCMake:=nil;
|
||||||
// try
|
// try
|
||||||
writeln('Processing ',fn);
|
|
||||||
{ Load Makefile.fpc }
|
{ Load Makefile.fpc }
|
||||||
CurrFPCMake:=TFPCMake.Create(fn);
|
CurrFPCMake:=TFPCMakeConsole.Create(fn);
|
||||||
CurrFPCMake.LoadMakefileFPC;
|
CurrFPCMake.LoadMakefileFPC;
|
||||||
// CurrFPCMake.Print;
|
// CurrFPCMake.Print;
|
||||||
|
|
||||||
@ -59,7 +103,6 @@ program fpcmake;
|
|||||||
{ Write Makefile }
|
{ Write Makefile }
|
||||||
CurrMakefile:=TMakefileWriter.Create(CurrFPCMake,ExtractFilePath(fn)+'Makefile');
|
CurrMakefile:=TMakefileWriter.Create(CurrFPCMake,ExtractFilePath(fn)+'Makefile');
|
||||||
CurrMakefile.WriteGenericMakefile;
|
CurrMakefile.WriteGenericMakefile;
|
||||||
{ Free }
|
|
||||||
CurrMakefile.Free;
|
CurrMakefile.Free;
|
||||||
|
|
||||||
// except
|
// except
|
||||||
@ -84,6 +127,51 @@ program fpcmake;
|
|||||||
|
|
||||||
end;
|
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;
|
procedure UseMakefilefpc;
|
||||||
var
|
var
|
||||||
@ -101,20 +189,73 @@ procedure UseParameters;
|
|||||||
var
|
var
|
||||||
i : integer;
|
i : integer;
|
||||||
begin
|
begin
|
||||||
for i:=1 to ParamCount do
|
for i:=OptInd to ParamCount do
|
||||||
ProcessFile(ParamStr(i));
|
ProcessFile(ParamStr(i));
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
Procedure Usage;
|
||||||
|
{
|
||||||
|
Print usage and exit.
|
||||||
|
}
|
||||||
begin
|
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
|
UseMakefilefpc
|
||||||
else
|
else
|
||||||
UseParameters;
|
UseParameters;
|
||||||
end.
|
end.
|
||||||
{
|
{
|
||||||
$Log$
|
$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
|
* fpcdir detection added
|
||||||
* fixed loading of variables in fpcmake itself
|
* fixed loading of variables in fpcmake itself
|
||||||
|
|
||||||
|
|||||||
@ -61,7 +61,7 @@ interface
|
|||||||
function insert(obj:TDictionaryItem):TDictionaryItem;
|
function insert(obj:TDictionaryItem):TDictionaryItem;
|
||||||
function rename(const olds,News : string):TDictionaryItem;
|
function rename(const olds,News : string):TDictionaryItem;
|
||||||
function search(const s: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;
|
property Items[const s:string]:TDictionaryItem read Search;default;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -119,14 +119,14 @@ constructor TDictionaryItem.Create(const n:string);
|
|||||||
begin
|
begin
|
||||||
left:=nil;
|
left:=nil;
|
||||||
right:=nil;
|
right:=nil;
|
||||||
FSpeedValue:=-1;
|
FSpeedValue:=$ffffffff;
|
||||||
FName:=n;
|
FName:=n;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
procedure TDictionaryItem.Setname(const n:string);
|
procedure TDictionaryItem.Setname(const n:string);
|
||||||
begin
|
begin
|
||||||
if FSpeedValue=-1 then
|
if FSpeedValue=$ffffffff then
|
||||||
FName:=n;
|
FName:=n;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -415,7 +415,7 @@ end;
|
|||||||
|
|
||||||
function tdictionary.rename(const olds,News : string):TDictionaryItem;
|
function tdictionary.rename(const olds,News : string):TDictionaryItem;
|
||||||
var
|
var
|
||||||
spdval : integer;
|
spdval : Cardinal;
|
||||||
lasthp,
|
lasthp,
|
||||||
hp,hp2,hp3 : TDictionaryItem;
|
hp,hp2,hp3 : TDictionaryItem;
|
||||||
begin
|
begin
|
||||||
@ -501,7 +501,7 @@ end;
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
function Tdictionary.speedsearch(const s:string;SpeedValue:integer):TDictionaryItem;
|
function Tdictionary.speedsearch(const s:string;SpeedValue:Cardinal):TDictionaryItem;
|
||||||
var
|
var
|
||||||
NewNode:TDictionaryItem;
|
NewNode:TDictionaryItem;
|
||||||
begin
|
begin
|
||||||
@ -538,7 +538,11 @@ end;
|
|||||||
end.
|
end.
|
||||||
{
|
{
|
||||||
$Log$
|
$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
|
* first commit of new fpcmake
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -116,7 +116,7 @@ interface
|
|||||||
function CopySection(Sec:TFPCMakeSection;Secname:string):TFPCMakeSection;
|
function CopySection(Sec:TFPCMakeSection;Secname:string):TFPCMakeSection;
|
||||||
protected
|
protected
|
||||||
VerboseIdent : string;
|
VerboseIdent : string;
|
||||||
procedure Verbose(lvl:TFPCMakeVerbose;const s:string);
|
procedure Verbose(lvl:TFPCMakeVerbose;const s:string);virtual;
|
||||||
public
|
public
|
||||||
constructor Create(const AFileName:string);
|
constructor Create(const AFileName:string);
|
||||||
constructor CreateFromStream(s:TStream;const AFileName:string);
|
constructor CreateFromStream(s:TStream;const AFileName:string);
|
||||||
@ -1202,7 +1202,11 @@ implementation
|
|||||||
end.
|
end.
|
||||||
{
|
{
|
||||||
$Log$
|
$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
|
* beos target added
|
||||||
|
|
||||||
Revision 1.5 2001/02/22 21:11:24 peter
|
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
|
type
|
||||||
tsections=(sec_none,
|
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_compile,sec_install,
|
||||||
sec_distinstall,sec_zipinstall,sec_clean,sec_libs,
|
sec_distinstall,sec_zipinstall,sec_clean,sec_libs,
|
||||||
sec_command,sec_exts,sec_dirs,sec_tools,sec_info
|
sec_command,sec_exts,sec_dirs,sec_tools,sec_info
|
||||||
);
|
);
|
||||||
|
|
||||||
trules=(
|
trules=(
|
||||||
r_all,r_debug,
|
r_all,r_debug,r_smart,
|
||||||
r_examples,
|
r_examples,
|
||||||
r_smart,r_shared,
|
r_shared,
|
||||||
r_install,r_sourceinstall,r_exampleinstall,r_distinstall,
|
r_install,r_sourceinstall,r_exampleinstall,r_distinstall,
|
||||||
r_zipinstall,r_zipsourceinstall,r_zipexampleinstall,r_zipdistinstall,
|
r_zipinstall,r_zipsourceinstall,r_zipexampleinstall,r_zipdistinstall,
|
||||||
r_clean,r_distclean,r_cleanall,
|
r_clean,r_distclean,r_cleanall,
|
||||||
@ -42,9 +42,9 @@ interface
|
|||||||
|
|
||||||
const
|
const
|
||||||
rule2str : array[trules] of string=(
|
rule2str : array[trules] of string=(
|
||||||
'all','debug',
|
'all','debug','smart',
|
||||||
'examples',
|
'examples',
|
||||||
'smart','shared',
|
'shared',
|
||||||
'install','sourceinstall','exampleinstall','distinstall',
|
'install','sourceinstall','exampleinstall','distinstall',
|
||||||
'zipinstall','zipsourceinstall','zipexampleinstall','zipdistinstall',
|
'zipinstall','zipsourceinstall','zipexampleinstall','zipdistinstall',
|
||||||
'clean','distclean','cleanall',
|
'clean','distclean','cleanall',
|
||||||
@ -52,9 +52,9 @@ interface
|
|||||||
);
|
);
|
||||||
|
|
||||||
rule2sec : array[trules] of tsections=(
|
rule2sec : array[trules] of tsections=(
|
||||||
sec_compile,sec_compile,
|
sec_compile,sec_compile,sec_compile,
|
||||||
sec_examples,
|
sec_examples,
|
||||||
sec_libs,sec_libs,
|
sec_libs,
|
||||||
sec_install,sec_install,sec_install,sec_distinstall,
|
sec_install,sec_install,sec_install,sec_distinstall,
|
||||||
sec_zipinstall,sec_zipinstall,sec_zipinstall,sec_zipinstall,
|
sec_zipinstall,sec_zipinstall,sec_zipinstall,sec_zipinstall,
|
||||||
sec_clean,sec_clean,sec_clean,
|
sec_clean,sec_clean,sec_clean,
|
||||||
@ -86,6 +86,7 @@ interface
|
|||||||
procedure AddTargetDirs(const inivar:string);
|
procedure AddTargetDirs(const inivar:string);
|
||||||
function CheckTargetVariable(const inivar:string):boolean;
|
function CheckTargetVariable(const inivar:string):boolean;
|
||||||
function CheckVariable(const inivar:string):boolean;
|
function CheckVariable(const inivar:string):boolean;
|
||||||
|
procedure OptimizeSections;
|
||||||
public
|
public
|
||||||
constructor Create(AFPCMake:TFPCMake;const AFileName:string);
|
constructor Create(AFPCMake:TFPCMake;const AFileName:string);
|
||||||
destructor Destroy;override;
|
destructor Destroy;override;
|
||||||
@ -247,7 +248,7 @@ implementation
|
|||||||
|
|
||||||
|
|
||||||
{*****************************************************************************
|
{*****************************************************************************
|
||||||
TMyMemoryStream
|
TMakefileWriter
|
||||||
*****************************************************************************}
|
*****************************************************************************}
|
||||||
|
|
||||||
constructor TMakefileWriter.Create(AFPCMake:TFPCMake;const AFileName:string);
|
constructor TMakefileWriter.Create(AFPCMake:TFPCMake;const AFileName:string);
|
||||||
@ -481,13 +482,15 @@ implementation
|
|||||||
hs:='';
|
hs:='';
|
||||||
if FHasSection[Rule2Sec[rule]] then
|
if FHasSection[Rule2Sec[rule]] then
|
||||||
hs:=hs+' fpc_'+rule2str[rule];
|
hs:=hs+' fpc_'+rule2str[rule];
|
||||||
{ include target dirs }
|
{ include target dirs, but not for info and targets that
|
||||||
if CheckTargetVariable('target_dirs') then
|
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
|
begin
|
||||||
if CheckVariable('default_dir') then
|
if CheckVariable('default_dir') then
|
||||||
hs:=hs+' $(addsuffix _'+rule2str[rule]+',$(DEFAULT_DIR))'
|
hs:=hs+' $(addsuffix _'+rule2str[rule]+',$(DEFAULT_DIR))'
|
||||||
else
|
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
|
not(CheckVariable('package_name')) then
|
||||||
hs:=hs+' $(addsuffix _'+rule2str[rule]+',$(TARGET_DIRS))';
|
hs:=hs+' $(addsuffix _'+rule2str[rule]+',$(TARGET_DIRS))';
|
||||||
end;
|
end;
|
||||||
@ -638,16 +641,66 @@ implementation
|
|||||||
WritePhony;
|
WritePhony;
|
||||||
end;
|
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;
|
procedure TMakefileWriter.WriteGenericMakefile;
|
||||||
begin
|
begin
|
||||||
|
{ Remove unused sections }
|
||||||
|
OptimizeSections;
|
||||||
|
{ Generate Output }
|
||||||
with FOutput do
|
with FOutput do
|
||||||
begin
|
begin
|
||||||
{ Turn some sections off }
|
|
||||||
if not FInput.IsPackage then
|
|
||||||
begin
|
|
||||||
FHasSection[sec_zipinstall]:=false;
|
|
||||||
FHasSection[sec_distinstall]:=false;
|
|
||||||
end;
|
|
||||||
{ Header }
|
{ Header }
|
||||||
Add('#');
|
Add('#');
|
||||||
Add('# Don''t edit, this file is generated by '+TitleDate);
|
Add('# Don''t edit, this file is generated by '+TitleDate);
|
||||||
@ -735,22 +788,23 @@ implementation
|
|||||||
AddIniSection('command_libc');
|
AddIniSection('command_libc');
|
||||||
AddIniSection('command_end');
|
AddIniSection('command_end');
|
||||||
{ compile }
|
{ compile }
|
||||||
if CheckTargetVariable('target_loaders') then
|
if FHasSection[sec_loaders] then
|
||||||
AddIniSection('loaderrules');
|
AddIniSection('loaderrules');
|
||||||
if CheckTargetVariable('target_units') then
|
if FHasSection[sec_units] then
|
||||||
AddIniSection('unitrules');
|
AddIniSection('unitrules');
|
||||||
if CheckTargetVariable('target_programs') then
|
if FHasSection[sec_exes] then
|
||||||
AddIniSection('exerules');
|
AddIniSection('exerules');
|
||||||
if CheckTargetVariable('target_rsts') then
|
if FHasSection[sec_rsts] then
|
||||||
AddIniSection('rstrules');
|
AddIniSection('rstrules');
|
||||||
if CheckTargetVariable('target_examples') or
|
if FHasSection[sec_examples] then
|
||||||
CheckTargetVariable('target_exampledirs') then
|
|
||||||
AddIniSection('examplerules');
|
AddIniSection('examplerules');
|
||||||
AddIniSection('compilerules');
|
if FHasSection[sec_compile] then
|
||||||
if CheckVariable('lib_name') then
|
AddIniSection('compilerules');
|
||||||
|
if FHasSection[sec_libs] then
|
||||||
AddIniSection('libraryrules');
|
AddIniSection('libraryrules');
|
||||||
{ install }
|
{ install }
|
||||||
AddIniSection('installrules');
|
if FHasSection[sec_install] then
|
||||||
|
AddIniSection('installrules');
|
||||||
if FHasSection[sec_distinstall] then
|
if FHasSection[sec_distinstall] then
|
||||||
AddIniSection('distinstallrules');
|
AddIniSection('distinstallrules');
|
||||||
if FHasSection[sec_zipinstall] then
|
if FHasSection[sec_zipinstall] then
|
||||||
@ -780,7 +834,11 @@ implementation
|
|||||||
end.
|
end.
|
||||||
{
|
{
|
||||||
$Log$
|
$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
|
* gecho, gdate fixes
|
||||||
* distinstall target rewrite to not install things twice
|
* distinstall target rewrite to not install things twice
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user