mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-17 06:59:24 +02:00
* Added the ability to add fpmake as a target in a Makefile.fpc file. This way
there is no special need anymore for complete scripts in the Makefile.fpc to call fpmake. And it is now possible to combine other targets with a fpmake-target. git-svn-id: trunk@31240 -
This commit is contained in:
parent
d014572b8e
commit
a67a35c498
File diff suppressed because it is too large
Load Diff
@ -1282,6 +1282,7 @@ endif
|
|||||||
ifeq ($(OS_SOURCE),openbsd)
|
ifeq ($(OS_SOURCE),openbsd)
|
||||||
override FPCOPT+=-FD$(NEW_BINUTILS_PATH)
|
override FPCOPT+=-FD$(NEW_BINUTILS_PATH)
|
||||||
override FPCMAKEOPT+=-FD$(NEW_BINUTILS_PATH)
|
override FPCMAKEOPT+=-FD$(NEW_BINUTILS_PATH)
|
||||||
|
override FPMAKE_BUILD_OPT+=-FD$(NEW_BINUTILS_PATH)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifndef CROSSBOOTSTRAP
|
ifndef CROSSBOOTSTRAP
|
||||||
@ -1299,6 +1300,7 @@ endif
|
|||||||
ifndef CROSSCOMPILE
|
ifndef CROSSCOMPILE
|
||||||
ifneq ($(BINUTILSPREFIX),)
|
ifneq ($(BINUTILSPREFIX),)
|
||||||
override FPCMAKEOPT+=-XP$(BINUTILSPREFIX)
|
override FPCMAKEOPT+=-XP$(BINUTILSPREFIX)
|
||||||
|
override FPMAKE_BUILD_OPT+=-XP$(BINUTILSPREFIX)
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
@ -1445,6 +1447,11 @@ ifdef OPT
|
|||||||
override FPCOPT+=$(OPT)
|
override FPCOPT+=$(OPT)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
# Override options to compile the fpmake-binary with command-line options provided in FPMAKEBUILDOPT
|
||||||
|
ifdef FPMAKEBUILDOPT
|
||||||
|
override FPMAKE_BUILD_OPT+=$(FPMAKEBUILDOPT)
|
||||||
|
endif
|
||||||
|
|
||||||
# Add defines from FPCOPTDEF to FPCOPT
|
# Add defines from FPCOPTDEF to FPCOPT
|
||||||
ifdef FPCOPTDEF
|
ifdef FPCOPTDEF
|
||||||
override FPCOPT+=$(addprefix -d,$(FPCOPTDEF))
|
override FPCOPT+=$(addprefix -d,$(FPCOPTDEF))
|
||||||
@ -1814,7 +1821,7 @@ fpc_sourceinstall: distclean
|
|||||||
$(MKDIR) $(INSTALL_SOURCEDIR)
|
$(MKDIR) $(INSTALL_SOURCEDIR)
|
||||||
$(COPYTREE) $(BASEDIR)/* $(INSTALL_SOURCEDIR)
|
$(COPYTREE) $(BASEDIR)/* $(INSTALL_SOURCEDIR)
|
||||||
|
|
||||||
fpc_exampleinstall: $(addsuffix _distclean,$(TARGET_EXAMPLEDIRS))
|
fpc_exampleinstall: $(EXAMPLEINSTALLTARGET) $(addsuffix _distclean,$(TARGET_EXAMPLEDIRS))
|
||||||
ifdef HASEXAMPLES
|
ifdef HASEXAMPLES
|
||||||
$(MKDIR) $(INSTALL_EXAMPLEDIR)
|
$(MKDIR) $(INSTALL_EXAMPLEDIR)
|
||||||
endif
|
endif
|
||||||
@ -2036,6 +2043,10 @@ endif
|
|||||||
ifdef DEBUGSYMEXT
|
ifdef DEBUGSYMEXT
|
||||||
-$(DEL) *$(DEBUGSYMEXT)
|
-$(DEL) *$(DEBUGSYMEXT)
|
||||||
endif
|
endif
|
||||||
|
ifdef LOCALFPMAKEBIN
|
||||||
|
-$(DEL) $(LOCALFPMAKEBIN)
|
||||||
|
-$(DEL) $(FPMAKEBINOBJ)
|
||||||
|
endif
|
||||||
|
|
||||||
fpc_distclean: cleanall
|
fpc_distclean: cleanall
|
||||||
|
|
||||||
@ -2262,3 +2273,91 @@ lclinfo:
|
|||||||
@$(ECHO) LCL Unit dir......... $(LCLUNITDIR)
|
@$(ECHO) LCL Unit dir......... $(LCLUNITDIR)
|
||||||
@$(ECHO) LCL Component dir.... $(LCLCOMPONENTDIR)
|
@$(ECHO) LCL Component dir.... $(LCLCOMPONENTDIR)
|
||||||
@$(ECHO)
|
@$(ECHO)
|
||||||
|
|
||||||
|
[fpmakeprerules]
|
||||||
|
#####################################################################
|
||||||
|
# fpmake prerules
|
||||||
|
#####################################################################
|
||||||
|
FPMAKEBIN=fpmake$(SRCEXEEXT)
|
||||||
|
FPMAKEBINOBJ=fpmake$(OEXT)
|
||||||
|
LOCALFPMAKEBIN=.$(PATHSEP)$(FPMAKEBIN)
|
||||||
|
|
||||||
|
# Convert the OS_TARGET and CPU_TARGET options to fpmake's --os and --cpu parameters
|
||||||
|
ifdef OS_TARGET
|
||||||
|
FPC_TARGETOPT+=--os=$(OS_TARGET)
|
||||||
|
endif
|
||||||
|
ifdef CPU_TARGET
|
||||||
|
FPC_TARGETOPT+=--cpu=$(CPU_TARGET)
|
||||||
|
endif
|
||||||
|
|
||||||
|
# Get the location of the bootstrap-fpmkunit units
|
||||||
|
PACKAGEDIR_FPMKUNIT:=$(firstword $(subst /Makefile.fpc,,$(strip $(wildcard $(addsuffix /fpmkunit/Makefile.fpc,$(PACKAGESDIR))))))
|
||||||
|
ifneq ($(PACKAGEDIR_FPMKUNIT),)
|
||||||
|
UNITDIR_FPMAKE_FPMKUNIT=$(PACKAGEDIR_FPMKUNIT)/units_bs/$(SOURCESUFFIX)
|
||||||
|
override COMPILER_FPMAKE_UNITDIR=$(UNITDIR_FPMAKE_FPMKUNIT)
|
||||||
|
FPMKUNIT_SRC=$(PACKAGEDIR_FPMKUNIT)/src/fpmkunit.pp
|
||||||
|
FPMKUNIT_PPU=$(UNITDIR_FPMAKE_FPMKUNIT)/fpmkunit.ppu
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifdef FPMAKE_SKIP_CONFIG
|
||||||
|
override FPMAKE_BUILD_OPT+=$(FPMAKE_SKIP_CONFIG)
|
||||||
|
endif
|
||||||
|
|
||||||
|
[fpmakerules]
|
||||||
|
#####################################################################
|
||||||
|
# fpmake rules
|
||||||
|
#####################################################################
|
||||||
|
.PHONY: fpc_fpmake fpc_fpmake_clean fpc_fpmake_install fpc_fpmake_exampleinstall
|
||||||
|
|
||||||
|
# Do not pass the Makefile's unit and binary target locations. fpmake uses it's own.
|
||||||
|
override FPCOPT:=$(filter-out -FU%,$(FPCOPT))
|
||||||
|
override FPCOPT:=$(filter-out -FE%,$(FPCOPT))
|
||||||
|
# Compose general fpmake-parameters
|
||||||
|
ifdef FPMAKEOPT
|
||||||
|
FPMAKE_OPT+=$(FPMAKEOPT)
|
||||||
|
endif
|
||||||
|
FPMAKE_OPT+=--localunitdir=$(FPCDIR)
|
||||||
|
FPMAKE_OPT+=--globalunitdir=$(FPCDIR)/packages
|
||||||
|
FPMAKE_OPT+=$(FPC_TARGETOPT)
|
||||||
|
FPMAKE_OPT+=$(addprefix -o ,$(FPCOPT))
|
||||||
|
FPMAKE_OPT+=--compiler=$(FPC)
|
||||||
|
FPMAKE_OPT+=-bu
|
||||||
|
|
||||||
|
FPMAKE_INSTALL_OPT+=--unitinstalldir=$(INSTALL_UNITDIR)
|
||||||
|
ifdef UNIXHier
|
||||||
|
FPMAKE_INSTALL_OPT+=--prefix=$(INSTALL_PREFIX)
|
||||||
|
FPMAKE_INSTALL_OPT+=--baseinstalldir=$(INSTALL_LIBDIR)/fpc/$(FPC_VERSION)
|
||||||
|
else
|
||||||
|
FPMAKE_INSTALL_OPT+=--prefix=$(INSTALL_BASEDIR)
|
||||||
|
endif
|
||||||
|
|
||||||
|
override ALLTARGET+=fpc_fpmake
|
||||||
|
override INSTALLTARGET+=fpc_fpmake_install
|
||||||
|
override EXAMPLEINSTALLTARGET+=fpc_fpmake_exampleinstall
|
||||||
|
# If no fpmake exists and (dist)clean is called, do not try to build fpmake, it will
|
||||||
|
# most often fail because the dependencies are cleared.
|
||||||
|
# In case of a clean, simply do nothing
|
||||||
|
ifneq ($(wildcard $(LOCALFPMAKEBIN)),)
|
||||||
|
override CLEANTARGET+=fpc_fpmake_clean
|
||||||
|
endif
|
||||||
|
|
||||||
|
$(FPMKUNIT_PPU): $(FPMKUNIT_SRC)
|
||||||
|
$(MAKE) -C $(PACKAGEDIR_FPMKUNIT) bootstrap $(addprefix OPT=,$(FPMAKE_BUILD_OPT))
|
||||||
|
|
||||||
|
$(FPMAKEBIN): fpmake.pp $(FPMKUNIT_PPU)
|
||||||
|
$(FPCFPMAKE) fpmake.pp $(addprefix -Fu,$(COMPILER_FPMAKE_UNITDIR)) $(FPMAKE_BUILD_OPT)
|
||||||
|
|
||||||
|
fpc_fpmake: $(FPMAKEBIN)
|
||||||
|
$(LOCALFPMAKEBIN) compile $(FPMAKE_OPT)
|
||||||
|
|
||||||
|
fpc_fpmake_clean: $(FPMAKEBIN)
|
||||||
|
$(LOCALFPMAKEBIN) clean $(FPMAKE_OPT)
|
||||||
|
|
||||||
|
fpc_fpmake_install: $(FPMAKEBIN)
|
||||||
|
$(LOCALFPMAKEBIN) install $(FPMAKE_OPT) $(FPMAKE_INSTALL_OPT)
|
||||||
|
|
||||||
|
# This is not completely valid. Exampleinstall should only install the examples, while
|
||||||
|
# fpmake -ie installs everything, including the examples. This also means that on
|
||||||
|
# a distinstall fpmake install wil be called twice.
|
||||||
|
fpc_fpmake_exampleinstall: $(FPMAKEBIN)
|
||||||
|
$(LOCALFPMAKEBIN) install -ie $(FPMAKE_OPT) $(FPMAKE_INSTALL_OPT)
|
||||||
|
@ -1130,6 +1130,9 @@ implementation
|
|||||||
begin
|
begin
|
||||||
ReqList:=TStringList.Create;
|
ReqList:=TStringList.Create;
|
||||||
ReqSec:=TFPCMakeSection(FSections['require']);
|
ReqSec:=TFPCMakeSection(FSections['require']);
|
||||||
|
{ Building fpmake itself always requires the rtl }
|
||||||
|
if HasTargetVariable('target_fpmake') then
|
||||||
|
ReqList.Add('rtl');
|
||||||
if assigned(ReqSec) then
|
if assigned(ReqSec) then
|
||||||
AddReqSec(c,t,ReqSec);
|
AddReqSec(c,t,ReqSec);
|
||||||
GetTargetRequires:=ReqList;
|
GetTargetRequires:=ReqList;
|
||||||
|
@ -25,7 +25,8 @@ interface
|
|||||||
sec_units,sec_exes,sec_loaders,sec_examples,sec_rsts,
|
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_shared,
|
sec_distinstall,sec_zipinstall,sec_clean,sec_shared,
|
||||||
sec_command,sec_exts,sec_dirs,sec_tools,sec_info,sec_makefile
|
sec_command,sec_exts,sec_dirs,sec_tools,sec_info,sec_makefile,
|
||||||
|
sec_fpmake
|
||||||
);
|
);
|
||||||
|
|
||||||
trules=(
|
trules=(
|
||||||
@ -63,6 +64,9 @@ interface
|
|||||||
|
|
||||||
|
|
||||||
type
|
type
|
||||||
|
|
||||||
|
{ TMakefileWriter }
|
||||||
|
|
||||||
TMakefileWriter=class
|
TMakefileWriter=class
|
||||||
private
|
private
|
||||||
FFileName : string;
|
FFileName : string;
|
||||||
@ -693,9 +697,14 @@ implementation
|
|||||||
inc(SkippedSecs);
|
inc(SkippedSecs);
|
||||||
FHasSection[sec_loaders]:=false;
|
FHasSection[sec_loaders]:=false;
|
||||||
end;
|
end;
|
||||||
{ if all 4 sections are not available we can skip also the
|
if (not FInput.HasTargetVariable('target_fpmake')) then
|
||||||
|
begin
|
||||||
|
inc(SkippedSecs);
|
||||||
|
FHasSection[sec_fpmake]:=false;
|
||||||
|
end;
|
||||||
|
{ if all 5 sections are not available we can skip also the
|
||||||
generic compile rules }
|
generic compile rules }
|
||||||
if SkippedSecs=4 then
|
if SkippedSecs=5 then
|
||||||
begin
|
begin
|
||||||
FHasSection[sec_shared]:=false;
|
FHasSection[sec_shared]:=false;
|
||||||
FHasSection[sec_compile]:=false;
|
FHasSection[sec_compile]:=false;
|
||||||
@ -769,6 +778,8 @@ implementation
|
|||||||
{ prerules section }
|
{ prerules section }
|
||||||
if assigned(FInput['prerules']) then
|
if assigned(FInput['prerules']) then
|
||||||
AddStrings(TFPCMakeSection(FInput['prerules']).List);
|
AddStrings(TFPCMakeSection(FInput['prerules']).List);
|
||||||
|
if FHasSection[sec_fpmake] then
|
||||||
|
AddIniSection('fpmakeprerules');
|
||||||
{ Default }
|
{ Default }
|
||||||
AddVariable('default_dir');
|
AddVariable('default_dir');
|
||||||
{ Targets }
|
{ Targets }
|
||||||
@ -780,6 +791,7 @@ implementation
|
|||||||
AddTargetVariable('target_rsts');
|
AddTargetVariable('target_rsts');
|
||||||
AddTargetVariable('target_examples');
|
AddTargetVariable('target_examples');
|
||||||
AddTargetVariable('target_exampledirs');
|
AddTargetVariable('target_exampledirs');
|
||||||
|
AddTargetVariable('target_fpmake');
|
||||||
{ Clean }
|
{ Clean }
|
||||||
AddTargetVariable('clean_units');
|
AddTargetVariable('clean_units');
|
||||||
AddTargetVariable('clean_files');
|
AddTargetVariable('clean_files');
|
||||||
@ -830,6 +842,8 @@ implementation
|
|||||||
AddIniSection('command_libc');
|
AddIniSection('command_libc');
|
||||||
AddIniSection('command_end');
|
AddIniSection('command_end');
|
||||||
{ compile }
|
{ compile }
|
||||||
|
if FHasSection[sec_fpmake] then
|
||||||
|
AddIniSection('fpmakerules');
|
||||||
if FHasSection[sec_loaders] then
|
if FHasSection[sec_loaders] then
|
||||||
AddIniSection('loaderrules');
|
AddIniSection('loaderrules');
|
||||||
if FHasSection[sec_units] then
|
if FHasSection[sec_units] then
|
||||||
|
@ -1 +1 @@
|
|||||||
'2015-05-20 rev 30890'
|
'2015-06-28 rev 31167'
|
||||||
|
Loading…
Reference in New Issue
Block a user