diff --git a/Makefile b/Makefile index 6b5f773a94..fac1d3974f 100644 --- a/Makefile +++ b/Makefile @@ -1052,6 +1052,105 @@ endif ifeq ($(FULL_TARGET),arm-linux) override COMPILER_TARGETDIR+=. endif +ifeq ($(FULL_TARGET),i386-linux) +override COMPILER_UNITTARGETDIR+=. +endif +ifeq ($(FULL_TARGET),i386-go32v2) +override COMPILER_UNITTARGETDIR+=. +endif +ifeq ($(FULL_TARGET),i386-win32) +override COMPILER_UNITTARGETDIR+=. +endif +ifeq ($(FULL_TARGET),i386-os2) +override COMPILER_UNITTARGETDIR+=. +endif +ifeq ($(FULL_TARGET),i386-freebsd) +override COMPILER_UNITTARGETDIR+=. +endif +ifeq ($(FULL_TARGET),i386-beos) +override COMPILER_UNITTARGETDIR+=. +endif +ifeq ($(FULL_TARGET),i386-netbsd) +override COMPILER_UNITTARGETDIR+=. +endif +ifeq ($(FULL_TARGET),i386-solaris) +override COMPILER_UNITTARGETDIR+=. +endif +ifeq ($(FULL_TARGET),i386-qnx) +override COMPILER_UNITTARGETDIR+=. +endif +ifeq ($(FULL_TARGET),i386-netware) +override COMPILER_UNITTARGETDIR+=. +endif +ifeq ($(FULL_TARGET),i386-openbsd) +override COMPILER_UNITTARGETDIR+=. +endif +ifeq ($(FULL_TARGET),i386-wdosx) +override COMPILER_UNITTARGETDIR+=. +endif +ifeq ($(FULL_TARGET),i386-emx) +override COMPILER_UNITTARGETDIR+=. +endif +ifeq ($(FULL_TARGET),i386-watcom) +override COMPILER_UNITTARGETDIR+=. +endif +ifeq ($(FULL_TARGET),i386-netwlibc) +override COMPILER_UNITTARGETDIR+=. +endif +ifeq ($(FULL_TARGET),m68k-linux) +override COMPILER_UNITTARGETDIR+=. +endif +ifeq ($(FULL_TARGET),m68k-freebsd) +override COMPILER_UNITTARGETDIR+=. +endif +ifeq ($(FULL_TARGET),m68k-netbsd) +override COMPILER_UNITTARGETDIR+=. +endif +ifeq ($(FULL_TARGET),m68k-amiga) +override COMPILER_UNITTARGETDIR+=. +endif +ifeq ($(FULL_TARGET),m68k-atari) +override COMPILER_UNITTARGETDIR+=. +endif +ifeq ($(FULL_TARGET),m68k-openbsd) +override COMPILER_UNITTARGETDIR+=. +endif +ifeq ($(FULL_TARGET),m68k-palmos) +override COMPILER_UNITTARGETDIR+=. +endif +ifeq ($(FULL_TARGET),powerpc-linux) +override COMPILER_UNITTARGETDIR+=. +endif +ifeq ($(FULL_TARGET),powerpc-netbsd) +override COMPILER_UNITTARGETDIR+=. +endif +ifeq ($(FULL_TARGET),powerpc-macos) +override COMPILER_UNITTARGETDIR+=. +endif +ifeq ($(FULL_TARGET),powerpc-darwin) +override COMPILER_UNITTARGETDIR+=. +endif +ifeq ($(FULL_TARGET),powerpc-morphos) +override COMPILER_UNITTARGETDIR+=. +endif +ifeq ($(FULL_TARGET),sparc-linux) +override COMPILER_UNITTARGETDIR+=. +endif +ifeq ($(FULL_TARGET),sparc-netbsd) +override COMPILER_UNITTARGETDIR+=. +endif +ifeq ($(FULL_TARGET),sparc-solaris) +override COMPILER_UNITTARGETDIR+=. +endif +ifeq ($(FULL_TARGET),x86_64-linux) +override COMPILER_UNITTARGETDIR+=. +endif +ifeq ($(FULL_TARGET),x86_64-freebsd) +override COMPILER_UNITTARGETDIR+=. +endif +ifeq ($(FULL_TARGET),arm-linux) +override COMPILER_UNITTARGETDIR+=. +endif ifdef REQUIRE_UNITSDIR override UNITSDIR+=$(REQUIRE_UNITSDIR) endif @@ -3783,8 +3882,10 @@ cleanlaz: $(MAKE) -C packager clean $(MAKE) -C designer clean $(MAKE) -C ideintf clean + $(MAKE) -C tools clean clean: cleanlaz cleanide purge: cleanlaz cleanide $(MAKE) -C examples clean $(MAKE) -C tools clean $(MAKE) -C doceditor clean + $(MAKE) -C tools clean diff --git a/Makefile.fpc b/Makefile.fpc index b56ebd7091..260662c6e5 100644 --- a/Makefile.fpc +++ b/Makefile.fpc @@ -17,6 +17,7 @@ exampledirs=examples [compiler] options=-gl +unittargetdir=. unitdir=lcl/units/$(CPU_TARGET)/$(OS_TARGET) \ lcl/units/$(CPU_TARGET)/$(OS_TARGET)/$(LCL_PLATFORM) \ components/units/$(CPU_TARGET)/$(OS_TARGET) \ diff --git a/ide/main.pp b/ide/main.pp index bace12b021..b0d919b293 100644 --- a/ide/main.pp +++ b/ide/main.pp @@ -493,7 +493,7 @@ type // methods for 'new unit' function CreateNewCodeBuffer(Descriptor: TProjectFileDescriptor; - NewOwner: TObject; NewFilename: string; var NewCodeBuffer: TCodeBuffer; + NewFilename: string; var NewCodeBuffer: TCodeBuffer; var NewUnitName: string): TModalResult; function CreateNewForm(NewUnitInfo: TUnitInfo; AncestorType: TPersistentClass; ResourceCode: TCodeBuffer): TModalResult; @@ -3261,7 +3261,7 @@ end; //============================================================================== function TMainIDE.CreateNewCodeBuffer(Descriptor: TProjectFileDescriptor; - NewOwner: TObject; NewFilename: string; + NewFilename: string; var NewCodeBuffer: TCodeBuffer; var NewUnitName: string): TModalResult; begin //debugln('TMainIDE.CreateNewCodeBuffer START NewFilename=',NewFilename,' ',Descriptor.DefaultFilename,' ',Descriptor.ClassName); @@ -11736,6 +11736,9 @@ end. { ============================================================================= $Log$ + Revision 1.880 2005/06/30 11:29:16 mattias + fixed compilation + Revision 1.879 2005/06/30 10:46:13 mattias added new file page to add to package dialog diff --git a/packager/Makefile b/packager/Makefile index 45d68c9fcd..baed18765e 100644 --- a/packager/Makefile +++ b/packager/Makefile @@ -1,10 +1,11 @@ # -# Don't edit, this file is generated by FPCMake Version 1.1 [2004/08/08] +# Don't edit, this file is generated by FPCMake Version 2.0.0 [2005/05/09] # default: all -MAKEFILETARGETS=linux go32v2 win32 os2 freebsd beos netbsd amiga atari sunos qnx netware openbsd wdosx palmos macos darwin emx watcom morphos +MAKEFILETARGETS=i386-linux i386-go32v2 i386-win32 i386-os2 i386-freebsd i386-beos i386-netbsd i386-solaris i386-qnx i386-netware i386-openbsd i386-wdosx i386-emx i386-watcom i386-netwlibc m68k-linux m68k-freebsd m68k-netbsd m68k-amiga m68k-atari m68k-openbsd m68k-palmos powerpc-linux powerpc-netbsd powerpc-macos powerpc-darwin powerpc-morphos sparc-linux sparc-netbsd sparc-solaris x86_64-linux x86_64-freebsd arm-linux BSDs = freebsd netbsd openbsd darwin -UNIXs = linux $(BSDs) sunos qnx +UNIXs = linux $(BSDs) solaris qnx +LIMIT83fs = go32v2 os2 emx watcom FORCE: .PHONY: FORCE override PATH:=$(patsubst %/,%,$(subst \,/,$(PATH))) @@ -102,16 +103,25 @@ ifneq ($(FPCPROG),) FPCPROG:=$(firstword $(FPCPROG)) FPC:=$(shell $(FPCPROG) -PB) ifneq ($(findstring Error,$(FPC)),) -override FPC=ppc386 +override FPC=$(firstword $(strip $(wildcard $(addsuffix /ppc386$(SRCEXEEXT),$(SEARCHPATH))))) endif else -override FPC=ppc386 +override FPC=$(firstword $(strip $(wildcard $(addsuffix /ppc386$(SRCEXEEXT),$(SEARCHPATH))))) endif endif override FPC:=$(subst $(SRCEXEEXT),,$(FPC)) override FPC:=$(subst \,/,$(FPC))$(SRCEXEEXT) -ifndef FPC_VERSION +FOUNDFPC:=$(strip $(wildcard $(FPC))) +ifeq ($(FOUNDFPC),) +FOUNDFPC=$(strip $(wildcard $(addsuffix /$(FPC),$(SEARCHPATH)))) +ifeq ($(FOUNDFPC),) +$(error Compiler $(FPC) not found) +endif +endif +ifndef FPC_COMPILERINFO FPC_COMPILERINFO:=$(shell $(FPC) -iVSPTPSOTO) +endif +ifndef FPC_VERSION FPC_VERSION:=$(word 1,$(FPC_COMPILERINFO)) endif export FPC FPC_VERSION FPC_COMPILERINFO @@ -146,12 +156,19 @@ OS_TARGET:=$(word 5,$(FPC_COMPILERINFO)) endif FULL_TARGET=$(CPU_TARGET)-$(OS_TARGET) FULL_SOURCE=$(CPU_SOURCE)-$(OS_SOURCE) +ifneq ($(findstring $(OS_SOURCE),$(LIMIT83fs)),) +TARGETSUFFIX=$(OS_TARGET) +SOURCESUFFIX=$(OS_SOURCE) +else +TARGETSUFFIX=$(FULL_TARGET) +SOURCESUFFIX=$(FULL_SOURCE) +endif ifneq ($(FULL_TARGET),$(FULL_SOURCE)) CROSSCOMPILE=1 endif ifeq ($(findstring makefile,$(MAKECMDGOALS)),) -ifeq ($(findstring $(OS_TARGET),$(MAKEFILETARGETS)),) -$(error The Makefile doesn't support target $(OS_TARGET), please run fpcmake first) +ifeq ($(findstring $(FULL_TARGET),$(MAKEFILETARGETS)),) +$(error The Makefile doesn't support target $(FULL_TARGET), please run fpcmake first) endif endif ifneq ($(findstring $(OS_TARGET),$(BSDs)),) @@ -160,7 +177,7 @@ endif ifeq ($(OS_TARGET),linux) linuxHier=1 endif -export OS_TARGET OS_SOURCE CPU_TARGET CPU_SOURCE FULL_TARGET FULL_SOURCE CROSSCOMPILE +export OS_TARGET OS_SOURCE CPU_TARGET CPU_SOURCE FULL_TARGET FULL_SOURCE TARGETSUFFIX SOURCESUFFIX CROSSCOMPILE ifdef FPCDIR override FPCDIR:=$(subst \,/,$(FPCDIR)) ifeq ($(wildcard $(addprefix $(FPCDIR)/,rtl units)),) @@ -197,22 +214,120 @@ endif endif endif endif -ifndef CROSSDIR -CROSSDIR:=$(FPCDIR)/cross/$(FULL_TARGET) -endif -ifndef CROSSTARGETDIR -CROSSTARGETDIR=$(CROSSDIR)/$(FULL_TARGET) +ifndef CROSSBINDIR +CROSSBINDIR:=$(wildcard $(FPCDIR)/bin/$(TARGETSUFFIX)) endif +ifndef BINUTILSPREFIX +ifndef CROSSBINDIR ifdef CROSSCOMPILE -UNITSDIR:=$(wildcard $(CROSSTARGETDIR)/units) +BINUTILSPREFIX=$(CPU_TARGET)-$(OS_TARGET)- +endif +endif +endif +UNITSDIR:=$(wildcard $(FPCDIR)/units/$(TARGETSUFFIX)) ifeq ($(UNITSDIR),) UNITSDIR:=$(wildcard $(FPCDIR)/units/$(OS_TARGET)) endif -else -UNITSDIR:=$(wildcard $(FPCDIR)/units/$(OS_TARGET)) -endif PACKAGESDIR:=$(wildcard $(FPCDIR) $(FPCDIR)/packages/base $(FPCDIR)/packages/extra) -override CLEAN_FILES+=$(wildcard ./units/*$(OEXT)) $(wildcard ./units/*$(PPUEXT)) $(wildcard ./units/*$(RSTEXT)) +ifeq ($(FULL_TARGET),i386-linux) +override CLEAN_FILES+=$(wildcard *$(OEXT)) $(wildcard *$(PPUEXT)) $(wildcard *$(RSTEXT))$(wildcard ./units/*$(OEXT)) $(wildcard ./units/*$(PPUEXT)) $(wildcard ./units/*$(RSTEXT))$(wildcard ./units/*$(OEXT)) $(wildcard ./units/*$(PPUEXT)) $(wildcard ./units/*$(RSTEXT)) +endif +ifeq ($(FULL_TARGET),i386-go32v2) +override CLEAN_FILES+=$(wildcard *$(OEXT)) $(wildcard *$(PPUEXT)) $(wildcard *$(RSTEXT))$(wildcard ./units/*$(OEXT)) $(wildcard ./units/*$(PPUEXT)) $(wildcard ./units/*$(RSTEXT))$(wildcard ./units/*$(OEXT)) $(wildcard ./units/*$(PPUEXT)) $(wildcard ./units/*$(RSTEXT)) +endif +ifeq ($(FULL_TARGET),i386-win32) +override CLEAN_FILES+=$(wildcard *$(OEXT)) $(wildcard *$(PPUEXT)) $(wildcard *$(RSTEXT))$(wildcard ./units/*$(OEXT)) $(wildcard ./units/*$(PPUEXT)) $(wildcard ./units/*$(RSTEXT))$(wildcard ./units/*$(OEXT)) $(wildcard ./units/*$(PPUEXT)) $(wildcard ./units/*$(RSTEXT)) +endif +ifeq ($(FULL_TARGET),i386-os2) +override CLEAN_FILES+=$(wildcard *$(OEXT)) $(wildcard *$(PPUEXT)) $(wildcard *$(RSTEXT))$(wildcard ./units/*$(OEXT)) $(wildcard ./units/*$(PPUEXT)) $(wildcard ./units/*$(RSTEXT))$(wildcard ./units/*$(OEXT)) $(wildcard ./units/*$(PPUEXT)) $(wildcard ./units/*$(RSTEXT)) +endif +ifeq ($(FULL_TARGET),i386-freebsd) +override CLEAN_FILES+=$(wildcard *$(OEXT)) $(wildcard *$(PPUEXT)) $(wildcard *$(RSTEXT))$(wildcard ./units/*$(OEXT)) $(wildcard ./units/*$(PPUEXT)) $(wildcard ./units/*$(RSTEXT))$(wildcard ./units/*$(OEXT)) $(wildcard ./units/*$(PPUEXT)) $(wildcard ./units/*$(RSTEXT)) +endif +ifeq ($(FULL_TARGET),i386-beos) +override CLEAN_FILES+=$(wildcard *$(OEXT)) $(wildcard *$(PPUEXT)) $(wildcard *$(RSTEXT))$(wildcard ./units/*$(OEXT)) $(wildcard ./units/*$(PPUEXT)) $(wildcard ./units/*$(RSTEXT))$(wildcard ./units/*$(OEXT)) $(wildcard ./units/*$(PPUEXT)) $(wildcard ./units/*$(RSTEXT)) +endif +ifeq ($(FULL_TARGET),i386-netbsd) +override CLEAN_FILES+=$(wildcard *$(OEXT)) $(wildcard *$(PPUEXT)) $(wildcard *$(RSTEXT))$(wildcard ./units/*$(OEXT)) $(wildcard ./units/*$(PPUEXT)) $(wildcard ./units/*$(RSTEXT))$(wildcard ./units/*$(OEXT)) $(wildcard ./units/*$(PPUEXT)) $(wildcard ./units/*$(RSTEXT)) +endif +ifeq ($(FULL_TARGET),i386-solaris) +override CLEAN_FILES+=$(wildcard *$(OEXT)) $(wildcard *$(PPUEXT)) $(wildcard *$(RSTEXT))$(wildcard ./units/*$(OEXT)) $(wildcard ./units/*$(PPUEXT)) $(wildcard ./units/*$(RSTEXT))$(wildcard ./units/*$(OEXT)) $(wildcard ./units/*$(PPUEXT)) $(wildcard ./units/*$(RSTEXT)) +endif +ifeq ($(FULL_TARGET),i386-qnx) +override CLEAN_FILES+=$(wildcard *$(OEXT)) $(wildcard *$(PPUEXT)) $(wildcard *$(RSTEXT))$(wildcard ./units/*$(OEXT)) $(wildcard ./units/*$(PPUEXT)) $(wildcard ./units/*$(RSTEXT))$(wildcard ./units/*$(OEXT)) $(wildcard ./units/*$(PPUEXT)) $(wildcard ./units/*$(RSTEXT)) +endif +ifeq ($(FULL_TARGET),i386-netware) +override CLEAN_FILES+=$(wildcard *$(OEXT)) $(wildcard *$(PPUEXT)) $(wildcard *$(RSTEXT))$(wildcard ./units/*$(OEXT)) $(wildcard ./units/*$(PPUEXT)) $(wildcard ./units/*$(RSTEXT))$(wildcard ./units/*$(OEXT)) $(wildcard ./units/*$(PPUEXT)) $(wildcard ./units/*$(RSTEXT)) +endif +ifeq ($(FULL_TARGET),i386-openbsd) +override CLEAN_FILES+=$(wildcard *$(OEXT)) $(wildcard *$(PPUEXT)) $(wildcard *$(RSTEXT))$(wildcard ./units/*$(OEXT)) $(wildcard ./units/*$(PPUEXT)) $(wildcard ./units/*$(RSTEXT))$(wildcard ./units/*$(OEXT)) $(wildcard ./units/*$(PPUEXT)) $(wildcard ./units/*$(RSTEXT)) +endif +ifeq ($(FULL_TARGET),i386-wdosx) +override CLEAN_FILES+=$(wildcard *$(OEXT)) $(wildcard *$(PPUEXT)) $(wildcard *$(RSTEXT))$(wildcard ./units/*$(OEXT)) $(wildcard ./units/*$(PPUEXT)) $(wildcard ./units/*$(RSTEXT))$(wildcard ./units/*$(OEXT)) $(wildcard ./units/*$(PPUEXT)) $(wildcard ./units/*$(RSTEXT)) +endif +ifeq ($(FULL_TARGET),i386-emx) +override CLEAN_FILES+=$(wildcard *$(OEXT)) $(wildcard *$(PPUEXT)) $(wildcard *$(RSTEXT))$(wildcard ./units/*$(OEXT)) $(wildcard ./units/*$(PPUEXT)) $(wildcard ./units/*$(RSTEXT))$(wildcard ./units/*$(OEXT)) $(wildcard ./units/*$(PPUEXT)) $(wildcard ./units/*$(RSTEXT)) +endif +ifeq ($(FULL_TARGET),i386-watcom) +override CLEAN_FILES+=$(wildcard *$(OEXT)) $(wildcard *$(PPUEXT)) $(wildcard *$(RSTEXT))$(wildcard ./units/*$(OEXT)) $(wildcard ./units/*$(PPUEXT)) $(wildcard ./units/*$(RSTEXT))$(wildcard ./units/*$(OEXT)) $(wildcard ./units/*$(PPUEXT)) $(wildcard ./units/*$(RSTEXT)) +endif +ifeq ($(FULL_TARGET),i386-netwlibc) +override CLEAN_FILES+=$(wildcard *$(OEXT)) $(wildcard *$(PPUEXT)) $(wildcard *$(RSTEXT))$(wildcard ./units/*$(OEXT)) $(wildcard ./units/*$(PPUEXT)) $(wildcard ./units/*$(RSTEXT))$(wildcard ./units/*$(OEXT)) $(wildcard ./units/*$(PPUEXT)) $(wildcard ./units/*$(RSTEXT)) +endif +ifeq ($(FULL_TARGET),m68k-linux) +override CLEAN_FILES+=$(wildcard *$(OEXT)) $(wildcard *$(PPUEXT)) $(wildcard *$(RSTEXT))$(wildcard ./units/*$(OEXT)) $(wildcard ./units/*$(PPUEXT)) $(wildcard ./units/*$(RSTEXT))$(wildcard ./units/*$(OEXT)) $(wildcard ./units/*$(PPUEXT)) $(wildcard ./units/*$(RSTEXT)) +endif +ifeq ($(FULL_TARGET),m68k-freebsd) +override CLEAN_FILES+=$(wildcard *$(OEXT)) $(wildcard *$(PPUEXT)) $(wildcard *$(RSTEXT))$(wildcard ./units/*$(OEXT)) $(wildcard ./units/*$(PPUEXT)) $(wildcard ./units/*$(RSTEXT))$(wildcard ./units/*$(OEXT)) $(wildcard ./units/*$(PPUEXT)) $(wildcard ./units/*$(RSTEXT)) +endif +ifeq ($(FULL_TARGET),m68k-netbsd) +override CLEAN_FILES+=$(wildcard *$(OEXT)) $(wildcard *$(PPUEXT)) $(wildcard *$(RSTEXT))$(wildcard ./units/*$(OEXT)) $(wildcard ./units/*$(PPUEXT)) $(wildcard ./units/*$(RSTEXT))$(wildcard ./units/*$(OEXT)) $(wildcard ./units/*$(PPUEXT)) $(wildcard ./units/*$(RSTEXT)) +endif +ifeq ($(FULL_TARGET),m68k-amiga) +override CLEAN_FILES+=$(wildcard *$(OEXT)) $(wildcard *$(PPUEXT)) $(wildcard *$(RSTEXT))$(wildcard ./units/*$(OEXT)) $(wildcard ./units/*$(PPUEXT)) $(wildcard ./units/*$(RSTEXT))$(wildcard ./units/*$(OEXT)) $(wildcard ./units/*$(PPUEXT)) $(wildcard ./units/*$(RSTEXT)) +endif +ifeq ($(FULL_TARGET),m68k-atari) +override CLEAN_FILES+=$(wildcard *$(OEXT)) $(wildcard *$(PPUEXT)) $(wildcard *$(RSTEXT))$(wildcard ./units/*$(OEXT)) $(wildcard ./units/*$(PPUEXT)) $(wildcard ./units/*$(RSTEXT))$(wildcard ./units/*$(OEXT)) $(wildcard ./units/*$(PPUEXT)) $(wildcard ./units/*$(RSTEXT)) +endif +ifeq ($(FULL_TARGET),m68k-openbsd) +override CLEAN_FILES+=$(wildcard *$(OEXT)) $(wildcard *$(PPUEXT)) $(wildcard *$(RSTEXT))$(wildcard ./units/*$(OEXT)) $(wildcard ./units/*$(PPUEXT)) $(wildcard ./units/*$(RSTEXT))$(wildcard ./units/*$(OEXT)) $(wildcard ./units/*$(PPUEXT)) $(wildcard ./units/*$(RSTEXT)) +endif +ifeq ($(FULL_TARGET),m68k-palmos) +override CLEAN_FILES+=$(wildcard *$(OEXT)) $(wildcard *$(PPUEXT)) $(wildcard *$(RSTEXT))$(wildcard ./units/*$(OEXT)) $(wildcard ./units/*$(PPUEXT)) $(wildcard ./units/*$(RSTEXT))$(wildcard ./units/*$(OEXT)) $(wildcard ./units/*$(PPUEXT)) $(wildcard ./units/*$(RSTEXT)) +endif +ifeq ($(FULL_TARGET),powerpc-linux) +override CLEAN_FILES+=$(wildcard *$(OEXT)) $(wildcard *$(PPUEXT)) $(wildcard *$(RSTEXT))$(wildcard ./units/*$(OEXT)) $(wildcard ./units/*$(PPUEXT)) $(wildcard ./units/*$(RSTEXT))$(wildcard ./units/*$(OEXT)) $(wildcard ./units/*$(PPUEXT)) $(wildcard ./units/*$(RSTEXT)) +endif +ifeq ($(FULL_TARGET),powerpc-netbsd) +override CLEAN_FILES+=$(wildcard *$(OEXT)) $(wildcard *$(PPUEXT)) $(wildcard *$(RSTEXT))$(wildcard ./units/*$(OEXT)) $(wildcard ./units/*$(PPUEXT)) $(wildcard ./units/*$(RSTEXT))$(wildcard ./units/*$(OEXT)) $(wildcard ./units/*$(PPUEXT)) $(wildcard ./units/*$(RSTEXT)) +endif +ifeq ($(FULL_TARGET),powerpc-macos) +override CLEAN_FILES+=$(wildcard *$(OEXT)) $(wildcard *$(PPUEXT)) $(wildcard *$(RSTEXT))$(wildcard ./units/*$(OEXT)) $(wildcard ./units/*$(PPUEXT)) $(wildcard ./units/*$(RSTEXT))$(wildcard ./units/*$(OEXT)) $(wildcard ./units/*$(PPUEXT)) $(wildcard ./units/*$(RSTEXT)) +endif +ifeq ($(FULL_TARGET),powerpc-darwin) +override CLEAN_FILES+=$(wildcard *$(OEXT)) $(wildcard *$(PPUEXT)) $(wildcard *$(RSTEXT))$(wildcard ./units/*$(OEXT)) $(wildcard ./units/*$(PPUEXT)) $(wildcard ./units/*$(RSTEXT))$(wildcard ./units/*$(OEXT)) $(wildcard ./units/*$(PPUEXT)) $(wildcard ./units/*$(RSTEXT)) +endif +ifeq ($(FULL_TARGET),powerpc-morphos) +override CLEAN_FILES+=$(wildcard *$(OEXT)) $(wildcard *$(PPUEXT)) $(wildcard *$(RSTEXT))$(wildcard ./units/*$(OEXT)) $(wildcard ./units/*$(PPUEXT)) $(wildcard ./units/*$(RSTEXT))$(wildcard ./units/*$(OEXT)) $(wildcard ./units/*$(PPUEXT)) $(wildcard ./units/*$(RSTEXT)) +endif +ifeq ($(FULL_TARGET),sparc-linux) +override CLEAN_FILES+=$(wildcard *$(OEXT)) $(wildcard *$(PPUEXT)) $(wildcard *$(RSTEXT))$(wildcard ./units/*$(OEXT)) $(wildcard ./units/*$(PPUEXT)) $(wildcard ./units/*$(RSTEXT))$(wildcard ./units/*$(OEXT)) $(wildcard ./units/*$(PPUEXT)) $(wildcard ./units/*$(RSTEXT)) +endif +ifeq ($(FULL_TARGET),sparc-netbsd) +override CLEAN_FILES+=$(wildcard *$(OEXT)) $(wildcard *$(PPUEXT)) $(wildcard *$(RSTEXT))$(wildcard ./units/*$(OEXT)) $(wildcard ./units/*$(PPUEXT)) $(wildcard ./units/*$(RSTEXT))$(wildcard ./units/*$(OEXT)) $(wildcard ./units/*$(PPUEXT)) $(wildcard ./units/*$(RSTEXT)) +endif +ifeq ($(FULL_TARGET),sparc-solaris) +override CLEAN_FILES+=$(wildcard *$(OEXT)) $(wildcard *$(PPUEXT)) $(wildcard *$(RSTEXT))$(wildcard ./units/*$(OEXT)) $(wildcard ./units/*$(PPUEXT)) $(wildcard ./units/*$(RSTEXT))$(wildcard ./units/*$(OEXT)) $(wildcard ./units/*$(PPUEXT)) $(wildcard ./units/*$(RSTEXT)) +endif +ifeq ($(FULL_TARGET),x86_64-linux) +override CLEAN_FILES+=$(wildcard *$(OEXT)) $(wildcard *$(PPUEXT)) $(wildcard *$(RSTEXT))$(wildcard ./units/*$(OEXT)) $(wildcard ./units/*$(PPUEXT)) $(wildcard ./units/*$(RSTEXT))$(wildcard ./units/*$(OEXT)) $(wildcard ./units/*$(PPUEXT)) $(wildcard ./units/*$(RSTEXT)) +endif +ifeq ($(FULL_TARGET),x86_64-freebsd) +override CLEAN_FILES+=$(wildcard *$(OEXT)) $(wildcard *$(PPUEXT)) $(wildcard *$(RSTEXT))$(wildcard ./units/*$(OEXT)) $(wildcard ./units/*$(PPUEXT)) $(wildcard ./units/*$(RSTEXT))$(wildcard ./units/*$(OEXT)) $(wildcard ./units/*$(PPUEXT)) $(wildcard ./units/*$(RSTEXT)) +endif +ifeq ($(FULL_TARGET),arm-linux) +override CLEAN_FILES+=$(wildcard *$(OEXT)) $(wildcard *$(PPUEXT)) $(wildcard *$(RSTEXT))$(wildcard ./units/*$(OEXT)) $(wildcard ./units/*$(PPUEXT)) $(wildcard ./units/*$(RSTEXT))$(wildcard ./units/*$(OEXT)) $(wildcard ./units/*$(PPUEXT)) $(wildcard ./units/*$(RSTEXT)) +endif ifdef REQUIRE_UNITSDIR override UNITSDIR+=$(REQUIRE_UNITSDIR) endif @@ -252,6 +367,16 @@ ifndef DIST_DESTDIR DIST_DESTDIR:=$(BASEDIR) endif export DIST_DESTDIR +ifndef COMPILER_UNITTARGETDIR +ifdef PACKAGEDIR_MAIN +COMPILER_UNITTARGETDIR=$(PACKAGEDIR_MAIN)/units/$(TARGETSUFFIX) +else +COMPILER_UNITTARGETDIR=units/$(TARGETSUFFIX) +endif +endif +ifndef COMPILER_TARGETDIR +COMPILER_TARGETDIR=. +endif ifndef INSTALL_BASEDIR ifdef UNIXHier ifdef INSTALL_FPCPACKAGE @@ -265,28 +390,24 @@ endif endif ifndef INSTALL_BINDIR ifdef UNIXHier -ifdef CROSSCOMPILE -INSTALL_BINDIR:=$(INSTALL_BASEDIR)/cross/$(FULL_TARGET)/bin -else INSTALL_BINDIR:=$(INSTALL_PREFIX)/bin -endif -else -ifdef CROSSCOMPILE -INSTALL_BINDIR:=$(INSTALL_BASEDIR)/cross/$(FULL_TARGET)/bin else INSTALL_BINDIR:=$(INSTALL_BASEDIR)/bin -endif ifdef INSTALL_FPCPACKAGE -INSTALL_BINDIR:=$(INSTALL_BINDIR)/$(OS_TARGET) +ifdef CROSSCOMPILE +ifdef CROSSINSTALL +INSTALL_BINDIR:=$(INSTALL_BINDIR)/$(SOURCESUFFIX) +else +INSTALL_BINDIR:=$(INSTALL_BINDIR)/$(TARGETSUFFIX) +endif +else +INSTALL_BINDIR:=$(INSTALL_BINDIR)/$(TARGETSUFFIX) +endif endif endif endif ifndef INSTALL_UNITDIR -ifdef CROSSCOMPILE -INSTALL_UNITDIR:=$(INSTALL_BASEDIR)/cross/$(FULL_TARGET)/units -else -INSTALL_UNITDIR:=$(INSTALL_BASEDIR)/units/$(OS_TARGET) -endif +INSTALL_UNITDIR:=$(INSTALL_BASEDIR)/units/$(TARGETSUFFIX) ifdef INSTALL_FPCPACKAGE ifdef PACKAGE_NAME INSTALL_UNITDIR:=$(INSTALL_UNITDIR)/$(PACKAGE_NAME) @@ -392,9 +513,9 @@ INSTALL_DATADIR=$(INSTALL_BASEDIR) endif ifdef CROSSCOMPILE ifndef CROSSBINDIR -CROSSBINDIR:=$(wildcard $(CROSSTARGETDIR)/bin/$(FULL_SOURCE)) +CROSSBINDIR:=$(wildcard $(CROSSTARGETDIR)/bin/$(SOURCESUFFIX)) ifeq ($(CROSSBINDIR),) -CROSSBINDIR:=$(wildcard $(INSTALL_BASEDIR)/cross/$(FULL_TARGET)/bin/$(FULL_SOURCE)) +CROSSBINDIR:=$(wildcard $(INSTALL_BASEDIR)/cross/$(TARGETSUFFIX)/bin/$(FULL_SOURCE)) endif endif else @@ -412,66 +533,56 @@ STATICLIBEXT=.a SHAREDLIBEXT=.so STATICLIBPREFIX=libp RSTEXT=.rst -FPCMADE=fpcmade ifeq ($(findstring 1.0.,$(FPC_VERSION)),) ifeq ($(OS_TARGET),go32v1) STATICLIBPREFIX= -FPCMADE=fpcmade.v1 -PACKAGESUFFIX=v1 +SHORTSUFFIX=v1 endif ifeq ($(OS_TARGET),go32v2) STATICLIBPREFIX= -FPCMADE=fpcmade.dos -ZIPSUFFIX=go32 +SHORTSUFFIX=dos endif ifeq ($(OS_TARGET),watcom) STATICLIBPREFIX= -FPCMADE=fpcmade.wat -ZIPSUFFIX=watc OEXT=.obj ASMEXT=.asm SHAREDLIBEXT=.dll +SHORTSUFFIX=wat endif ifeq ($(OS_TARGET),linux) BATCHEXT=.sh EXEEXT= HASSHAREDLIB=1 -FPCMADE=fpcmade.lnx -ZIPSUFFIX=linux +SHORTSUFFIX=lnx endif ifeq ($(OS_TARGET),freebsd) BATCHEXT=.sh EXEEXT= HASSHAREDLIB=1 -FPCMADE=fpcmade.freebsd -ZIPSUFFIX=freebsd +SHORTSUFFIX=fbs endif ifeq ($(OS_TARGET),netbsd) BATCHEXT=.sh EXEEXT= HASSHAREDLIB=1 -FPCMADE=fpcmade.netbsd -ZIPSUFFIX=netbsd +SHORTSUFFIX=nbs endif ifeq ($(OS_TARGET),openbsd) BATCHEXT=.sh EXEEXT= HASSHAREDLIB=1 -FPCMADE=fpcmade.openbsd -ZIPSUFFIX=openbsd +SHORTSUFFIX=obs endif ifeq ($(OS_TARGET),win32) SHAREDLIBEXT=.dll -FPCMADE=fpcmade.w32 -ZIPSUFFIX=w32 +SHORTSUFFIX=w32 endif ifeq ($(OS_TARGET),os2) BATCHEXT=.cmd AOUTEXT=.out STATICLIBPREFIX= SHAREDLIBEXT=.dll -FPCMADE=fpcmade.os2 -ZIPSUFFIX=os2 +SHORTSUFFIX=os2 ECHO=echo endif ifeq ($(OS_TARGET),emx) @@ -479,61 +590,59 @@ BATCHEXT=.cmd AOUTEXT=.out STATICLIBPREFIX= SHAREDLIBEXT=.dll -FPCMADE=fpcmade.emx -ZIPSUFFIX=emx +SHORTSUFFIX=emx ECHO=echo endif ifeq ($(OS_TARGET),amiga) EXEEXT= SHAREDLIBEXT=.library -FPCMADE=fpcmade.amg +SHORTSUFFIX=amg endif ifeq ($(OS_TARGET),morphos) EXEEXT= SHAREDLIBEXT=.library -FPCMADE=fpcmade.mos +SHORTSUFFIX=mos endif ifeq ($(OS_TARGET),atari) EXEEXT=.ttp -FPCMADE=fpcmade.ata +SHORTSUFFIX=ata endif ifeq ($(OS_TARGET),beos) BATCHEXT=.sh EXEEXT= -FPCMADE=fpcmade.be -ZIPSUFFIX=be +SHORTSUFFIX=be endif -ifeq ($(OS_TARGET),sunos) +ifeq ($(OS_TARGET),solaris) BATCHEXT=.sh EXEEXT= -FPCMADE=fpcmade.sun -ZIPSUFFIX=sun +SHORTSUFFIX=sun endif ifeq ($(OS_TARGET),qnx) BATCHEXT=.sh EXEEXT= -FPCMADE=fpcmade.qnx -ZIPSUFFIX=qnx +SHORTSUFFIX=qnx endif ifeq ($(OS_TARGET),netware) EXEEXT=.nlm STATICLIBPREFIX= -FPCMADE=fpcmade.nw -ZIPSUFFIX=nw +SHORTSUFFIX=nw +endif +ifeq ($(OS_TARGET),netwlibc) +EXEEXT=.nlm +STATICLIBPREFIX= +SHORTSUFFIX=nwl endif ifeq ($(OS_TARGET),macos) BATCHEXT= EXEEXT= -FPCMADE=fpcmade.macos -ZIPSUFFIX=macos DEBUGSYMEXT=.xcoff +SHORTSUFFIX=mac endif ifeq ($(OS_TARGET),darwin) BATCHEXT=.sh EXEEXT= HASSHAREDLIB=1 -FPCMADE=fpcmade.darwin -ZIPSUFFIX=darwin +SHORTSUFFIX=dwn endif else ifeq ($(OS_TARGET),go32v1) @@ -544,46 +653,39 @@ SMARTEXT=.sl1 STATICLIBEXT=.a1 SHAREDLIBEXT=.so1 STATICLIBPREFIX= -FPCMADE=fpcmade.v1 -PACKAGESUFFIX=v1 +SHORTSUFFIX=v1 endif ifeq ($(OS_TARGET),go32v2) STATICLIBPREFIX= -FPCMADE=fpcmade.dos -ZIPSUFFIX=go32 +SHORTSUFFIX=dos endif ifeq ($(OS_TARGET),watcom) STATICLIBPREFIX= -FPCMADE=fpcmade.dos -ZIPSUFFIX=watcom +SHORTSUFFIX=wat endif ifeq ($(OS_TARGET),linux) BATCHEXT=.sh EXEEXT= HASSHAREDLIB=1 -FPCMADE=fpcmade.lnx -ZIPSUFFIX=linux +SHORTSUFFIX=lnx endif ifeq ($(OS_TARGET),freebsd) BATCHEXT=.sh EXEEXT= HASSHAREDLIB=1 -FPCMADE=fpcmade.freebsd -ZIPSUFFIX=freebsd +SHORTSUFFIX=fbs endif ifeq ($(OS_TARGET),netbsd) BATCHEXT=.sh EXEEXT= HASSHAREDLIB=1 -FPCMADE=fpcmade.netbsd -ZIPSUFFIX=netbsd +SHORTSUFFIX=nbs endif ifeq ($(OS_TARGET),openbsd) BATCHEXT=.sh EXEEXT= HASSHAREDLIB=1 -FPCMADE=fpcmade.openbsd -ZIPSUFFIX=openbsd +SHORTSUFFIX=obs endif ifeq ($(OS_TARGET),win32) PPUEXT=.ppw @@ -592,8 +694,7 @@ ASMEXT=.sw SMARTEXT=.slw STATICLIBEXT=.aw SHAREDLIBEXT=.dll -FPCMADE=fpcmade.w32 -ZIPSUFFIX=w32 +SHORTSUFFIX=w32 endif ifeq ($(OS_TARGET),os2) BATCHEXT=.cmd @@ -605,8 +706,7 @@ SMARTEXT=.sl2 STATICLIBPREFIX= STATICLIBEXT=.ao2 SHAREDLIBEXT=.dll -FPCMADE=fpcmade.os2 -ZIPSUFFIX=emx +SHORTSUFFIX=os2 ECHO=echo endif ifeq ($(OS_TARGET),amiga) @@ -617,7 +717,7 @@ OEXT=.o SMARTEXT=.sl STATICLIBEXT=.a SHAREDLIBEXT=.library -FPCMADE=fpcmade.amg +SHORTSUFFIX=amg endif ifeq ($(OS_TARGET),atari) PPUEXT=.ppu @@ -626,7 +726,7 @@ OEXT=.o SMARTEXT=.sl STATICLIBEXT=.a EXEEXT=.ttp -FPCMADE=fpcmade.ata +SHORTSUFFIX=ata endif ifeq ($(OS_TARGET),beos) BATCHEXT=.sh @@ -636,10 +736,9 @@ OEXT=.o SMARTEXT=.sl STATICLIBEXT=.a EXEEXT= -FPCMADE=fpcmade.be -ZIPSUFFIX=be +SHORTSUFFIX=be endif -ifeq ($(OS_TARGET),sunos) +ifeq ($(OS_TARGET),solaris) BATCHEXT=.sh PPUEXT=.ppu ASMEXT=.s @@ -647,8 +746,7 @@ OEXT=.o SMARTEXT=.sl STATICLIBEXT=.a EXEEXT= -FPCMADE=fpcmade.sun -ZIPSUFFIX=sun +SHORTSUFFIX=sun endif ifeq ($(OS_TARGET),qnx) BATCHEXT=.sh @@ -658,8 +756,7 @@ OEXT=.o SMARTEXT=.sl STATICLIBEXT=.a EXEEXT= -FPCMADE=fpcmade.qnx -ZIPSUFFIX=qnx +SHORTSUFFIX=qnx endif ifeq ($(OS_TARGET),netware) STATICLIBPREFIX= @@ -669,9 +766,19 @@ ASMEXT=.s SMARTEXT=.sl STATICLIBEXT=.a SHAREDLIBEXT=.nlm -FPCMADE=fpcmade.nw -ZIPSUFFIX=nw EXEEXT=.nlm +SHORTSUFFIX=nw +endif +ifeq ($(OS_TARGET),netwlibc) +STATICLIBPREFIX= +PPUEXT=.ppu +OEXT=.o +ASMEXT=.s +SMARTEXT=.sl +STATICLIBEXT=.a +SHAREDLIBEXT=.nlm +EXEEXT=.nlm +SHORTSUFFIX=nwl endif ifeq ($(OS_TARGET),macos) BATCHEXT= @@ -682,7 +789,25 @@ SMARTEXT=.sl STATICLIBEXT=.a EXEEXT= DEBUGSYMEXT=.xcoff -FPCMADE=fpcmade.macos +SHORTSUFFIX=mac +endif +endif +ifneq ($(findstring $(OS_SOURCE),$(LIMIT83fs)),) +FPCMADE=fpcmade.$(SHORTSUFFIX) +ZIPSUFFIX=$(SHORTSUFFIX) +ZIPCROSSPREFIX= +ZIPSOURCESUFFIX=src +ZIPEXAMPLESUFFIX=exm +else +FPCMADE=fpcmade.$(TARGETSUFFIX) +ZIPSOURCESUFFIX=.source +ZIPEXAMPLESUFFIX=.examples +ifdef CROSSCOMPILE +ZIPSUFFIX=.$(SOURCESUFFIX) +ZIPCROSSPREFIX=$(TARGETSUFFIX)- +else +ZIPSUFFIX=.$(TARGETSUFFIX) +ZIPCROSSPREFIX= endif endif ifndef ECHO @@ -690,7 +815,7 @@ ECHO:=$(strip $(wildcard $(addsuffix /gecho$(SRCEXEEXT),$(SEARCHPATH)))) ifeq ($(ECHO),) ECHO:=$(strip $(wildcard $(addsuffix /echo$(SRCEXEEXT),$(SEARCHPATH)))) ifeq ($(ECHO),) -ECHO= __missing_command__ +ECHO= __missing_command_ECHO else ECHO:=$(firstword $(ECHO)) endif @@ -704,7 +829,7 @@ DATE:=$(strip $(wildcard $(addsuffix /gdate$(SRCEXEEXT),$(SEARCHPATH)))) ifeq ($(DATE),) DATE:=$(strip $(wildcard $(addsuffix /date$(SRCEXEEXT),$(SEARCHPATH)))) ifeq ($(DATE),) -DATE= __missing_command__ +DATE= __missing_command_DATE else DATE:=$(firstword $(DATE)) endif @@ -718,7 +843,7 @@ GINSTALL:=$(strip $(wildcard $(addsuffix /ginstall$(SRCEXEEXT),$(SEARCHPATH)))) ifeq ($(GINSTALL),) GINSTALL:=$(strip $(wildcard $(addsuffix /install$(SRCEXEEXT),$(SEARCHPATH)))) ifeq ($(GINSTALL),) -GINSTALL= __missing_command__ +GINSTALL= __missing_command_GINSTALL else GINSTALL:=$(firstword $(GINSTALL)) endif @@ -730,7 +855,7 @@ export GINSTALL ifndef CPPROG CPPROG:=$(strip $(wildcard $(addsuffix /cp$(SRCEXEEXT),$(SEARCHPATH)))) ifeq ($(CPPROG),) -CPPROG= __missing_command__ +CPPROG= __missing_command_CPPROG else CPPROG:=$(firstword $(CPPROG)) endif @@ -739,7 +864,7 @@ export CPPROG ifndef RMPROG RMPROG:=$(strip $(wildcard $(addsuffix /rm$(SRCEXEEXT),$(SEARCHPATH)))) ifeq ($(RMPROG),) -RMPROG= __missing_command__ +RMPROG= __missing_command_RMPROG else RMPROG:=$(firstword $(RMPROG)) endif @@ -748,12 +873,26 @@ export RMPROG ifndef MVPROG MVPROG:=$(strip $(wildcard $(addsuffix /mv$(SRCEXEEXT),$(SEARCHPATH)))) ifeq ($(MVPROG),) -MVPROG= __missing_command__ +MVPROG= __missing_command_MVPROG else MVPROG:=$(firstword $(MVPROG)) endif endif export MVPROG +ifndef MKDIRPROG +MKDIRPROG:=$(strip $(wildcard $(addsuffix /gmkdir$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(MKDIRPROG),) +MKDIRPROG:=$(strip $(wildcard $(addsuffix /mkdir$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(MKDIRPROG),) +MKDIRPROG= __missing_command_MKDIRPROG +else +MKDIRPROG:=$(firstword $(MKDIRPROG)) +endif +else +MKDIRPROG:=$(firstword $(MKDIRPROG)) +endif +endif +export MKDIRPROG ifndef ECHOREDIR ifndef inUnix ECHOREDIR=echo @@ -765,7 +904,10 @@ ifndef COPY COPY:=$(CPPROG) -fp endif ifndef COPYTREE -COPYTREE:=$(CPPROG) -rfp +COPYTREE:=$(CPPROG) -Rfp +endif +ifndef MKDIRTREE +MKDIRTREE:=$(MKDIRPROG) -p endif ifndef MOVE MOVE:=$(MVPROG) -f @@ -797,7 +939,7 @@ export ECHOREDIR COPY COPYTREE MOVE DEL DELTREE INSTALL INSTALLEXE MKDIR ifndef PPUMOVE PPUMOVE:=$(strip $(wildcard $(addsuffix /ppumove$(SRCEXEEXT),$(SEARCHPATH)))) ifeq ($(PPUMOVE),) -PPUMOVE= __missing_command__ +PPUMOVE= __missing_command_PPUMOVE else PPUMOVE:=$(firstword $(PPUMOVE)) endif @@ -806,7 +948,7 @@ export PPUMOVE ifndef FPCMAKE FPCMAKE:=$(strip $(wildcard $(addsuffix /fpcmake$(SRCEXEEXT),$(SEARCHPATH)))) ifeq ($(FPCMAKE),) -FPCMAKE= __missing_command__ +FPCMAKE= __missing_command_FPCMAKE else FPCMAKE:=$(firstword $(FPCMAKE)) endif @@ -815,7 +957,7 @@ export FPCMAKE ifndef ZIPPROG ZIPPROG:=$(strip $(wildcard $(addsuffix /zip$(SRCEXEEXT),$(SEARCHPATH)))) ifeq ($(ZIPPROG),) -ZIPPROG= __missing_command__ +ZIPPROG= __missing_command_ZIPPROG else ZIPPROG:=$(firstword $(ZIPPROG)) endif @@ -824,7 +966,7 @@ export ZIPPROG ifndef TARPROG TARPROG:=$(strip $(wildcard $(addsuffix /tar$(SRCEXEEXT),$(SEARCHPATH)))) ifeq ($(TARPROG),) -TARPROG= __missing_command__ +TARPROG= __missing_command_TARPROG else TARPROG:=$(firstword $(TARPROG)) endif @@ -908,199 +1050,12 @@ export UPXPROG ZIPOPT=-9 ZIPEXT=.zip ifeq ($(USETAR),bz2) -TAROPT=vI +TAROPT=vj TAREXT=.tar.bz2 else TAROPT=vz TAREXT=.tar.gz endif -override REQUIRE_PACKAGES=rtl -ifeq ($(OS_TARGET),linux) -ifeq ($(CPU_TARGET),i386) -REQUIRE_PACKAGES_RTL=1 -endif -endif -ifeq ($(OS_TARGET),linux) -ifeq ($(CPU_TARGET),m68k) -REQUIRE_PACKAGES_RTL=1 -endif -endif -ifeq ($(OS_TARGET),linux) -ifeq ($(CPU_TARGET),powerpc) -REQUIRE_PACKAGES_RTL=1 -endif -endif -ifeq ($(OS_TARGET),linux) -ifeq ($(CPU_TARGET),sparc) -REQUIRE_PACKAGES_RTL=1 -endif -endif -ifeq ($(OS_TARGET),linux) -ifeq ($(CPU_TARGET),x86_64) -REQUIRE_PACKAGES_RTL=1 -endif -endif -ifeq ($(OS_TARGET),linux) -ifeq ($(CPU_TARGET),arm) -REQUIRE_PACKAGES_RTL=1 -endif -endif -ifeq ($(OS_TARGET),go32v2) -ifeq ($(CPU_TARGET),i386) -REQUIRE_PACKAGES_RTL=1 -endif -endif -ifeq ($(OS_TARGET),win32) -ifeq ($(CPU_TARGET),i386) -REQUIRE_PACKAGES_RTL=1 -endif -endif -ifeq ($(OS_TARGET),os2) -ifeq ($(CPU_TARGET),i386) -REQUIRE_PACKAGES_RTL=1 -endif -endif -ifeq ($(OS_TARGET),freebsd) -ifeq ($(CPU_TARGET),i386) -REQUIRE_PACKAGES_RTL=1 -endif -endif -ifeq ($(OS_TARGET),freebsd) -ifeq ($(CPU_TARGET),m68k) -REQUIRE_PACKAGES_RTL=1 -endif -endif -ifeq ($(OS_TARGET),freebsd) -ifeq ($(CPU_TARGET),x86_64) -REQUIRE_PACKAGES_RTL=1 -endif -endif -ifeq ($(OS_TARGET),beos) -ifeq ($(CPU_TARGET),i386) -REQUIRE_PACKAGES_RTL=1 -endif -endif -ifeq ($(OS_TARGET),netbsd) -ifeq ($(CPU_TARGET),i386) -REQUIRE_PACKAGES_RTL=1 -endif -endif -ifeq ($(OS_TARGET),netbsd) -ifeq ($(CPU_TARGET),m68k) -REQUIRE_PACKAGES_RTL=1 -endif -endif -ifeq ($(OS_TARGET),netbsd) -ifeq ($(CPU_TARGET),powerpc) -REQUIRE_PACKAGES_RTL=1 -endif -endif -ifeq ($(OS_TARGET),netbsd) -ifeq ($(CPU_TARGET),sparc) -REQUIRE_PACKAGES_RTL=1 -endif -endif -ifeq ($(OS_TARGET),amiga) -ifeq ($(CPU_TARGET),m68k) -REQUIRE_PACKAGES_RTL=1 -endif -endif -ifeq ($(OS_TARGET),atari) -ifeq ($(CPU_TARGET),m68k) -REQUIRE_PACKAGES_RTL=1 -endif -endif -ifeq ($(OS_TARGET),sunos) -ifeq ($(CPU_TARGET),i386) -REQUIRE_PACKAGES_RTL=1 -endif -endif -ifeq ($(OS_TARGET),sunos) -ifeq ($(CPU_TARGET),sparc) -REQUIRE_PACKAGES_RTL=1 -endif -endif -ifeq ($(OS_TARGET),qnx) -ifeq ($(CPU_TARGET),i386) -REQUIRE_PACKAGES_RTL=1 -endif -endif -ifeq ($(OS_TARGET),netware) -ifeq ($(CPU_TARGET),i386) -REQUIRE_PACKAGES_RTL=1 -endif -endif -ifeq ($(OS_TARGET),openbsd) -ifeq ($(CPU_TARGET),i386) -REQUIRE_PACKAGES_RTL=1 -endif -endif -ifeq ($(OS_TARGET),openbsd) -ifeq ($(CPU_TARGET),m68k) -REQUIRE_PACKAGES_RTL=1 -endif -endif -ifeq ($(OS_TARGET),wdosx) -ifeq ($(CPU_TARGET),i386) -REQUIRE_PACKAGES_RTL=1 -endif -endif -ifeq ($(OS_TARGET),palmos) -ifeq ($(CPU_TARGET),m68k) -REQUIRE_PACKAGES_RTL=1 -endif -endif -ifeq ($(OS_TARGET),macos) -ifeq ($(CPU_TARGET),powerpc) -REQUIRE_PACKAGES_RTL=1 -endif -endif -ifeq ($(OS_TARGET),darwin) -ifeq ($(CPU_TARGET),powerpc) -REQUIRE_PACKAGES_RTL=1 -endif -endif -ifeq ($(OS_TARGET),emx) -ifeq ($(CPU_TARGET),i386) -REQUIRE_PACKAGES_RTL=1 -endif -endif -ifeq ($(OS_TARGET),watcom) -ifeq ($(CPU_TARGET),i386) -REQUIRE_PACKAGES_RTL=1 -endif -endif -ifeq ($(OS_TARGET),morphos) -ifeq ($(CPU_TARGET),powerpc) -REQUIRE_PACKAGES_RTL=1 -endif -endif -ifdef REQUIRE_PACKAGES_RTL -PACKAGEDIR_RTL:=$(firstword $(subst /Makefile.fpc,,$(strip $(wildcard $(addsuffix /rtl/$(OS_TARGET)/Makefile.fpc,$(PACKAGESDIR)))))) -ifneq ($(PACKAGEDIR_RTL),) -ifneq ($(wildcard $(PACKAGEDIR_RTL)/$(OS_TARGET)),) -UNITDIR_RTL=$(PACKAGEDIR_RTL)/$(OS_TARGET) -else -UNITDIR_RTL=$(PACKAGEDIR_RTL) -endif -ifdef CHECKDEPEND -$(PACKAGEDIR_RTL)/$(FPCMADE): - $(MAKE) -C $(PACKAGEDIR_RTL) $(FPCMADE) -override ALLDEPENDENCIES+=$(PACKAGEDIR_RTL)/$(FPCMADE) -endif -else -PACKAGEDIR_RTL= -UNITDIR_RTL:=$(subst /Package.fpc,,$(strip $(wildcard $(addsuffix /rtl/Package.fpc,$(UNITSDIR))))) -ifneq ($(UNITDIR_RTL),) -UNITDIR_RTL:=$(firstword $(UNITDIR_RTL)) -else -UNITDIR_RTL= -endif -endif -ifdef UNITDIR_RTL -override COMPILER_UNITDIR+=$(UNITDIR_RTL) -endif -endif ifndef NOCPUDEF override FPCOPTDEF=$(CPU_TARGET) endif @@ -1244,7 +1199,7 @@ endif ifdef CLEANPPUFILES override CLEANPPULINKFILES:=$(subst $(PPUEXT),$(OEXT),$(CLEANPPUFILES)) $(addprefix $(STATICLIBPREFIX),$(subst $(PPUEXT),$(STATICLIBEXT),$(CLEANPPUFILES))) ifdef DEBUGSYMEXT -override CLEANPPULINKFILES+=$(subst $(PPUEXT),$(DEBUGSYMEXT),$(CLEANPPUFILES)) +override CLEANPPULINKFILES+=$(subst $(PPUEXT),$(DEBUGSYMEXT),$(CLEANPPUFILES)) endif override CLEANPPUFILES:=$(addprefix $(UNITTARGETDIRPREFIX),$(CLEANPPUFILES)) override CLEANPPULINKFILES:=$(wildcard $(addprefix $(UNITTARGETDIRPREFIX),$(CLEANPPULINKFILES))) @@ -1270,17 +1225,28 @@ ifdef LIB_NAME endif -$(DEL) $(FPCMADE) Package.fpc $(PPAS) script.res link.res $(FPCEXTFILE) $(REDIRFILE) -$(DEL) *$(ASMEXT) *_ppas$(BATCHEXT) -fpc_distclean: clean -ifdef COMPILER_UNITTARGETDIR -TARGETDIRCLEAN=fpc_clean -endif -fpc_cleanall: $(CLEANTARGET) $(TARGETDIRCLEAN) +fpc_cleanall: $(CLEANTARGET) ifdef CLEANEXEFILES -$(DEL) $(CLEANEXEFILES) endif +ifdef COMPILER_UNITTARGETDIR +ifdef CLEANPPUFILES + -$(DEL) $(CLEANPPUFILES) +endif +ifneq ($(CLEANPPULINKFILES),) + -$(DEL) $(CLEANPPULINKFILES) +endif +ifdef CLEANRSTFILES + -$(DEL) $(addprefix $(UNITTARGETDIRPREFIX),$(CLEANRSTFILES)) +endif +endif + -$(DELTREE) units -$(DEL) *$(OEXT) *$(PPUEXT) *$(RSTEXT) *$(ASMEXT) *$(STATICLIBEXT) *$(SHAREDLIBEXT) *$(PPLEXT) +ifneq ($(PPUEXT),.ppu) + -$(DEL) *.o *.ppu *.a +endif -$(DELTREE) *$(SMARTEXT) - -$(DEL) $(FPCMADE) Package.fpc $(PPAS) script.res link.res $(FPCEXTFILE) $(REDIRFILE) + -$(DEL) fpcmade.* Package.fpc $(PPAS) script.res link.res $(FPCEXTFILE) $(REDIRFILE) -$(DEL) *_ppas$(BATCHEXT) ifdef AOUTEXT -$(DEL) *$(AOUTEXT) @@ -1288,6 +1254,7 @@ endif ifdef DEBUGSYMEXT -$(DEL) *$(DEBUGSYMEXT) endif +fpc_distclean: cleanall .PHONY: fpc_baseinfo override INFORULES+=fpc_baseinfo fpc_baseinfo: @@ -1306,6 +1273,8 @@ fpc_baseinfo: @$(ECHO) Target OS.... $(OS_TARGET) @$(ECHO) Full Source.. $(FULL_SOURCE) @$(ECHO) Full Target.. $(FULL_TARGET) + @$(ECHO) SourceSuffix. $(SOURCESUFFIX) + @$(ECHO) TargetSuffix. $(TARGETSUFFIX) @$(ECHO) @$(ECHO) == Directory info == @$(ECHO) @@ -1358,8 +1327,11 @@ fpc_baseinfo: @$(ECHO) == Install info == @$(ECHO) @$(ECHO) DateStr.............. $(DATESTR) + @$(ECHO) ZipName.............. $(ZIPNAME) @$(ECHO) ZipPrefix............ $(ZIPPREFIX) + @$(ECHO) ZipCrossPrefix....... $(ZIPCROSSPREFIX) @$(ECHO) ZipSuffix............ $(ZIPSUFFIX) + @$(ECHO) FullZipName.......... $(FULLZIPNAME) @$(ECHO) Install FPC Package.. $(INSTALL_FPCPACKAGE) @$(ECHO) @$(ECHO) Install base dir..... $(INSTALL_BASEDIR) @@ -1394,6 +1366,7 @@ all: debug: smart: release: +units: examples: shared: install: @@ -1406,10 +1379,11 @@ zipexampleinstall: zipdistinstall: clean: fpc_clean distclean: fpc_distclean +cleanall: fpc_cleanall info: fpc_info makefiles: fpc_makefiles -.PHONY: all debug smart release examples shared install sourceinstall exampleinstall distinstall zipinstall zipsourceinstall zipexampleinstall zipdistinstall clean distclean info makefiles +.PHONY: all debug smart release units examples shared install sourceinstall exampleinstall distinstall zipinstall zipsourceinstall zipexampleinstall zipdistinstall clean distclean cleanall info makefiles ifneq ($(wildcard fpcmake.loc),) include fpcmake.loc endif -cleanall: clean +cleanlaz: clean diff --git a/packager/Makefile.fpc b/packager/Makefile.fpc index efd12c3b66..0666ee4d70 100644 --- a/packager/Makefile.fpc +++ b/packager/Makefile.fpc @@ -6,10 +6,11 @@ [target] [clean] -files=$(wildcard ./units/*$(OEXT)) $(wildcard ./units/*$(PPUEXT)) $(wildcard ./units/*$(RSTEXT)) +files=$(wildcard *$(OEXT)) $(wildcard *$(PPUEXT)) $(wildcard *$(RSTEXT))\ + $(wildcard ./units/*$(OEXT)) $(wildcard ./units/*$(PPUEXT)) $(wildcard ./units/*$(RSTEXT))$(wildcard ./units/*$(OEXT)) $(wildcard ./units/*$(PPUEXT)) $(wildcard ./units/*$(RSTEXT)) [rules] -cleanall: clean +cleanlaz: clean # end. diff --git a/packager/addtopackagedlg.pas b/packager/addtopackagedlg.pas index 813b9dc2fd..2b0c35b13c 100644 --- a/packager/addtopackagedlg.pas +++ b/packager/addtopackagedlg.pas @@ -50,7 +50,8 @@ type d2ptNewComponent, d2ptRequiredPkg, d2ptFile, - d2ptFiles + d2ptFiles, + d2ptNewFile ); TAddToPkgResult = class @@ -66,6 +67,7 @@ type UsedUnitname: string; AutoAddLFMFile: boolean; AutoAddLRSFile: boolean; + NewItem: TNewIDEItemTemplate; Next: TAddToPkgResult; procedure Clear; destructor Destroy; override; @@ -84,7 +86,7 @@ type AddFilesPage: TPage; NewComponentPage: TPage; NewDependPage: TPage; - NewUnitPage: TPage; + NewFilePage: TPage; // add unit page AddUnitFilenameLabel: TLabel; AddUnitFilenameEdit: TEdit; @@ -99,11 +101,11 @@ type AddUnitButton: TButton; CancelAddUnitButton: TButton; // new unit page - NewUnitTreeView: TTreeView; - NewUnitDescriptionGroupBox: TGroupBox; - NewUnitHelpLabel: TLabel; - NewUnitOkButton: TButton; - NewUnitCancelButton: TButton; + NewFileTreeView: TTreeView; + NewFileDescriptionGroupBox: TGroupBox; + NewFileHelpLabel: TLabel; + NewFileOkButton: TButton; + NewFileCancelButton: TButton; // new component page AncestorTypeLabel: TLabel; AncestorComboBox: TComboBox; @@ -172,11 +174,11 @@ type procedure NewComponentPageResize(Sender: TObject); procedure NewDependButtonClick(Sender: TObject); procedure NewDependPageResize(Sender: TObject); - procedure NewUnitOkButtonClick(Sender: TObject); - procedure NewUnitPageResize(Sender: TObject); - procedure NewUnitTreeViewClick(Sender: TObject); - procedure NewUnitTreeViewDblClick(Sender: TObject); - procedure NewUnitTreeViewSelectionChanged(Sender: TObject); + procedure NewFileOkButtonClick(Sender: TObject); + procedure NewFilePageResize(Sender: TObject); + procedure NewFileTreeViewClick(Sender: TObject); + procedure NewFileTreeViewDblClick(Sender: TObject); + procedure NewFileTreeViewSelectionChanged(Sender: TObject); private fLastNewComponentAncestorType: string; fLastNewComponentClassName: string; @@ -188,7 +190,7 @@ type procedure SetLazPackage(const AValue: TLazPackage); procedure SetupComponents; procedure SetupAddUnitPage; - procedure SetupNewUnitPage; + procedure SetupNewFilePage; procedure SetupNewComponentPage; procedure SetupAddDependencyPage; procedure SetupAddFilePage; @@ -200,7 +202,7 @@ type procedure UpdateAddUnitInfo; procedure UpdateAddFileInfo; function SwitchRelativeAbsoluteFilename(const Filename: string): string; - procedure FillNewUnitTreeView; + procedure FillNewFileTreeView; public Params: TAddToPkgResult; constructor Create(TheOwner: TComponent); override; @@ -1225,40 +1227,58 @@ begin SetBounds(x+NewDependButton.Width+10,y,80,Height); end; -procedure TAddToPackageDlg.NewUnitOkButtonClick(Sender: TObject); +procedure TAddToPackageDlg.NewFileOkButtonClick(Sender: TObject); +var + ANode: TTreeNode; begin - // TODO + ANode:=NewFileTreeView.Selected; + if (ANode=nil) or (ANode.Data=nil) + or (not (TObject(ANode.Data) is TNewItemProjectFile)) + then begin + MessageDlg(lisNewDlgNoItemSelected, + lisNewDlgPleaseSelectAnItemFirst, mtInformation, [mbOk], 0); + exit; + end; + + Params.Clear; + Params.AddType:=d2ptNewFile; + Params.NewItem:=TNewIDEItemTemplate(ANode.Data); + + ModalResult:=mrOk; end; -procedure TAddToPackageDlg.NewUnitPageResize(Sender: TObject); +procedure TAddToPackageDlg.NewFilePageResize(Sender: TObject); begin - NewUnitTreeView.Width:=NewUnitPage.ClientWidth div 2; + NewFileTreeView.Width:=NewFilePage.ClientWidth div 2; end; -procedure TAddToPackageDlg.NewUnitTreeViewClick(Sender: TObject); +procedure TAddToPackageDlg.NewFileTreeViewClick(Sender: TObject); var Desc: String; ANode: TTreeNode; begin - ANode:=NewUnitTreeView.Selected; + ANode:=NewFileTreeView.Selected; Desc:=''; if (ANode<>nil) and (ANode.Data<>nil) then begin if TObject(ANode.Data) is TNewIDEItemTemplate then Desc:=TNewIDEItemTemplate(ANode.Data).Description; end; - NewUnitHelpLabel.Caption:=Desc; + NewFileHelpLabel.Caption:=Desc; end; -procedure TAddToPackageDlg.NewUnitTreeViewDblClick(Sender: TObject); +procedure TAddToPackageDlg.NewFileTreeViewDblClick(Sender: TObject); begin - NewUnitOkButtonClick(Self); + NewFileOkButtonClick(Self); end; -procedure TAddToPackageDlg.NewUnitTreeViewSelectionChanged(Sender: TObject); +procedure TAddToPackageDlg.NewFileTreeViewSelectionChanged(Sender: TObject); begin - NewUnitOkButton.Enabled:=false; - // TODO and (NewUnitTreeView.Selected<>nil) - // and (TObject(NewUnitTreeView.Selected.Data) is TNewIDEItemTemplate); + {$IFDEF EnableA2PNewUnit} + NewFileOkButton.Enabled:=(NewFileTreeView.Selected<>nil) + and (TObject(NewFileTreeView.Selected.Data) is TNewIDEItemTemplate); + {$ELSE} + NewFileOkButton.Enabled:=false; + {$ENDIF} end; procedure TAddToPackageDlg.SetLazPackage(const AValue: TLazPackage); @@ -1279,7 +1299,7 @@ begin Pages.Add(lisA2PAddUnit); AddUnitPage:=Page[Pages.Count-1]; Pages.Add(lisA2PNewFile); - NewUnitPage:=Page[Pages.Count-1]; + NewFilePage:=Page[Pages.Count-1]; Pages.Add(lisA2PNewComponent); NewComponentPage:=Page[Pages.Count-1]; Pages.Add(lisProjAddNewRequirement); @@ -1299,7 +1319,7 @@ begin AddFilesPage.OnResize:=@AddFilesPageResize; SetupAddUnitPage; - SetupNewUnitPage; + SetupNewFilePage; SetupNewComponentPage; SetupAddDependencyPage; SetupAddFilePage; @@ -1400,66 +1420,66 @@ begin end; end; -procedure TAddToPackageDlg.SetupNewUnitPage; +procedure TAddToPackageDlg.SetupNewFilePage; begin - NewUnitPage.OnResize:=@NewUnitPageResize; + NewFilePage.OnResize:=@NewFilePageResize; - NewUnitTreeView:=TTreeView.Create(Self); - with NewUnitTreeView do begin + NewFileTreeView:=TTreeView.Create(Self); + with NewFileTreeView do begin Name:='NewUnitTreeView'; - Parent:=NewUnitPage; - OnClick:=@NewUnitTreeViewClick; - OnDblClick:=@NewUnitTreeViewDblClick; - OnSelectionChanged:=@NewUnitTreeViewSelectionChanged; + Parent:=NewFilePage; + OnClick:=@NewFileTreeViewClick; + OnDblClick:=@NewFileTreeViewDblClick; + OnSelectionChanged:=@NewFileTreeViewSelectionChanged; end; - NewUnitDescriptionGroupBox:=TGroupBox.Create(Self); - with NewUnitDescriptionGroupBox do begin + NewFileDescriptionGroupBox:=TGroupBox.Create(Self); + with NewFileDescriptionGroupBox do begin Name:='NewUnitDescriptionGroupBox'; Caption:=lisToDoLDescription; - Parent:=NewUnitPage; - AnchorToNeighbour(akLeft,0,NewUnitTreeView); - AnchorParallel(akTop,0,NewUnitPage); - AnchorParallel(akRight,0,NewUnitPage); + Parent:=NewFilePage; + AnchorToNeighbour(akLeft,0,NewFileTreeView); + AnchorParallel(akTop,0,NewFilePage); + AnchorParallel(akRight,0,NewFilePage); end; - NewUnitHelpLabel:=TLabel.Create(Self); - with NewUnitHelpLabel do begin + NewFileHelpLabel:=TLabel.Create(Self); + with NewFileHelpLabel do begin Name:='NewUnitHelpLabel'; Caption:=''; Align:=alClient; WordWrap:=true; - Parent:=NewUnitDescriptionGroupBox; + Parent:=NewFileDescriptionGroupBox; end; - NewUnitOkButton:=TButton.Create(Self); - with NewUnitOkButton do begin + NewFileOkButton:=TButton.Create(Self); + with NewFileOkButton do begin Name:='NewUnitOkButton'; Caption:=lisA2PCreateNewFile; Anchors:=[akLeft,akBottom]; Left:=5; AutoSize:=true; - Parent:=NewUnitPage; - AnchorParallel(akBottom,5,NewUnitPage); - OnClick:=@NewUnitOkButtonClick; + Parent:=NewFilePage; + AnchorParallel(akBottom,5,NewFilePage); + OnClick:=@NewFileOkButtonClick; Enabled:=false; end; - NewUnitTreeView.AnchorToNeighbour(akBottom,5,NewUnitOkButton); - NewUnitDescriptionGroupBox.AnchorToNeighbour(akBottom,5,NewUnitOkButton); + NewFileTreeView.AnchorToNeighbour(akBottom,5,NewFileOkButton); + NewFileDescriptionGroupBox.AnchorToNeighbour(akBottom,5,NewFileOkButton); - NewUnitCancelButton:=TButton.Create(Self); - with NewUnitCancelButton do begin + NewFileCancelButton:=TButton.Create(Self); + with NewFileCancelButton do begin Name:='NewUnitCancelButton'; Caption:=dlgCancel; AutoSize:=true; - Parent:=NewUnitPage; - AnchorParallel(akTop,0,NewUnitOkButton); - AnchorToNeighbour(akLeft,10,NewUnitOkButton); + Parent:=NewFilePage; + AnchorParallel(akTop,0,NewFileOkButton); + AnchorToNeighbour(akLeft,10,NewFileOkButton); ModalResult:=mrCancel; end; - FillNewUnitTreeView; + FillNewFileTreeView; end; procedure TAddToPackageDlg.SetupNewComponentPage; @@ -1875,23 +1895,25 @@ begin Result:=TrimFilename(CreateAbsolutePath(Filename,LazPackage.Directory)); end; -procedure TAddToPackageDlg.FillNewUnitTreeView; +procedure TAddToPackageDlg.FillNewFileTreeView; var NewParentNode: TTreeNode; Category: TNewIDEItemCategory; TemplateID: Integer; Template: TNewIDEItemTemplate; begin - NewUnitTreeView.BeginUpdate; - NewUnitTreeView.Items.Clear; + NewFileTreeView.BeginUpdate; + NewFileTreeView.Items.Clear; Category:=NewIDEItems.FindByName(FileDescGroupName); - NewParentNode:=NewUnitTreeView.Items.AddObject(nil,Category.Name,Category); + NewParentNode:=NewFileTreeView.Items.AddObject(nil,Category.Name,Category); for TemplateID:=0 to Category.Count-1 do begin Template:=Category[TemplateID]; - NewUnitTreeView.Items.AddChildObject(NewParentNode,Template.Name,Template); + if Template.VisibleInNewDialog and (Template is TNewItemProjectFile) then + NewFileTreeView.Items.AddChildObject(NewParentNode,Template.Name, + Template); end; NewParentNode.Expand(true); - NewUnitTreeView.EndUpdate; + NewFileTreeView.EndUpdate; end; constructor TAddToPackageDlg.Create(TheOwner: TComponent); diff --git a/packager/packageeditor.pas b/packager/packageeditor.pas index 7c3a0afcfa..3e575c052f 100644 --- a/packager/packageeditor.pas +++ b/packager/packageeditor.pas @@ -898,10 +898,85 @@ begin end; procedure TPackageEditorForm.AddBitBtnClick(Sender: TObject); + + procedure AddUnit(AddParams: TAddToPkgResult); + var + NewLFMFilename: String; + NewLRSFilename: String; + begin + NewLFMFilename:=''; + NewLRSFilename:=''; + // add lfm file + if AddParams.AutoAddLFMFile then begin + NewLFMFilename:=ChangeFileExt(AddParams.UnitFilename,'.lfm'); + if FileExists(NewLFMFilename) + and (LazPackage.FindPkgFile(NewLFMFilename,false,true)=nil) then + LazPackage.AddFile(NewLFMFilename,'',pftLFM,[],cpNormal) + else + NewLFMFilename:=''; + end; + // add lrs file + if AddParams.AutoAddLRSFile then begin + NewLRSFilename:=ChangeFileExt(AddParams.UnitFilename,'.lrs'); + if FileExists(NewLRSFilename) + and (LazPackage.FindPkgFile(NewLRSFilename,false,true)=nil) then + LazPackage.AddFile(NewLRSFilename,'',pftLRS,[],cpNormal) + else + NewLRSFilename:=''; + end; + ExtendUnitIncPathForNewUnit(AddParams.UnitFilename,NewLRSFilename); + // add unit file + with AddParams do + LazPackage.AddFile(UnitFilename,UnitName,FileType,PkgFileFlags,cpNormal); + PackageEditors.DeleteAmbiguousFiles(LazPackage,AddParams.UnitFilename); + UpdateAll; + end; + + procedure AddVirtualUnit(AddParams: TAddToPkgResult); + begin + with AddParams do + LazPackage.AddFile(UnitFilename,UnitName,FileType,PkgFileFlags,cpNormal); + PackageEditors.DeleteAmbiguousFiles(LazPackage,AddParams.UnitFilename); + UpdateAll; + end; + + procedure AddNewComponent(AddParams: TAddToPkgResult); + begin + ExtendUnitIncPathForNewUnit(AddParams.UnitFilename,''); + // add file + with AddParams do + LazPackage.AddFile(UnitFilename,UnitName,FileType,PkgFileFlags,cpNormal); + // add dependency + if AddParams.Dependency<>nil then begin + PackageGraph.AddDependencyToPackage(LazPackage,AddParams.Dependency); + end; + // open file in editor + PackageEditors.CreateNewFile(Self,AddParams); + UpdateAll; + end; + + procedure AddRequiredPkg(AddParams: TAddToPkgResult); + begin + // add dependency + PackageGraph.AddDependencyToPackage(LazPackage,AddParams.Dependency); + end; + + procedure AddFile(AddParams: TAddToPkgResult); + begin + // add file + with AddParams do + LazPackage.AddFile(UnitFilename,UnitName,FileType,PkgFileFlags,cpNormal); + UpdateAll; + end; + + procedure AddNewFile(AddParams: TAddToPkgResult); + begin + // create new file + // TODO + end; + var AddParams: TAddToPkgResult; - NewLFMFilename: String; - NewLRSFilename: String; OldParams: TAddToPkgResult; begin if LazPackage.ReadOnly then begin @@ -920,72 +995,22 @@ begin case AddParams.AddType of d2ptUnit: - begin - NewLFMFilename:=''; - NewLRSFilename:=''; - // add lfm file - if AddParams.AutoAddLFMFile then begin - NewLFMFilename:=ChangeFileExt(AddParams.UnitFilename,'.lfm'); - if FileExists(NewLFMFilename) - and (LazPackage.FindPkgFile(NewLFMFilename,false,true)=nil) then - LazPackage.AddFile(NewLFMFilename,'',pftLFM,[],cpNormal) - else - NewLFMFilename:=''; - end; - // add lrs file - if AddParams.AutoAddLRSFile then begin - NewLRSFilename:=ChangeFileExt(AddParams.UnitFilename,'.lrs'); - if FileExists(NewLRSFilename) - and (LazPackage.FindPkgFile(NewLRSFilename,false,true)=nil) then - LazPackage.AddFile(NewLRSFilename,'',pftLRS,[],cpNormal) - else - NewLRSFilename:=''; - end; - ExtendUnitIncPathForNewUnit(AddParams.UnitFilename,NewLRSFilename); - // add unit file - with AddParams do - LazPackage.AddFile(UnitFilename,UnitName,FileType,PkgFileFlags,cpNormal); - PackageEditors.DeleteAmbiguousFiles(LazPackage,AddParams.UnitFilename); - UpdateAll; - end; + AddUnit(AddParams); d2ptVirtualUnit: - begin - // add virtual unit file - with AddParams do - LazPackage.AddFile(UnitFilename,UnitName,FileType,PkgFileFlags,cpNormal); - PackageEditors.DeleteAmbiguousFiles(LazPackage,AddParams.UnitFilename); - UpdateAll; - end; + AddVirtualUnit(AddParams); d2ptNewComponent: - begin - ExtendUnitIncPathForNewUnit(AddParams.UnitFilename,''); - // add file - with AddParams do - LazPackage.AddFile(UnitFilename,UnitName,FileType,PkgFileFlags,cpNormal); - // add dependency - if AddParams.Dependency<>nil then begin - PackageGraph.AddDependencyToPackage(LazPackage,AddParams.Dependency); - end; - // open file in editor - PackageEditors.CreateNewFile(Self,AddParams); - UpdateAll; - end; + AddNewComponent(AddParams); d2ptRequiredPkg: - begin - // add dependency - PackageGraph.AddDependencyToPackage(LazPackage,AddParams.Dependency); - end; + AddRequiredPkg(AddParams); d2ptFile: - begin - // add file - with AddParams do - LazPackage.AddFile(UnitFilename,UnitName,FileType,PkgFileFlags,cpNormal); - UpdateAll; - end; + AddFile(AddParams); + + d2ptNewFile: + AddNewFile(AddParams); end; OldParams:=AddParams;