diff options
Diffstat (limited to 'packages/gtk2/examples')
58 files changed, 26430 insertions, 0 deletions
diff --git a/packages/gtk2/examples/Makefile b/packages/gtk2/examples/Makefile new file mode 100644 index 0000000000..eb356ab765 --- /dev/null +++ b/packages/gtk2/examples/Makefile @@ -0,0 +1,2646 @@ +# +# Don't edit, this file is generated by FPCMake Version 2.0.0 [2008/01/26] +# +default: all +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-darwin i386-emx i386-watcom i386-netwlibc i386-wince i386-embedded i386-symbian m68k-linux m68k-freebsd m68k-netbsd m68k-amiga m68k-atari m68k-openbsd m68k-palmos m68k-embedded powerpc-linux powerpc-netbsd powerpc-amiga powerpc-macos powerpc-darwin powerpc-morphos powerpc-embedded sparc-linux sparc-netbsd sparc-solaris sparc-embedded x86_64-linux x86_64-freebsd x86_64-darwin x86_64-win64 x86_64-embedded arm-linux arm-palmos arm-wince arm-gba arm-nds arm-embedded arm-symbian powerpc64-linux powerpc64-darwin powerpc64-embedded +BSDs = freebsd netbsd openbsd darwin +UNIXs = linux $(BSDs) solaris qnx +LIMIT83fs = go32v2 os2 emx watcom +OSNeedsComspecToRunBatch = go32v2 watcom +FORCE: +.PHONY: FORCE +override PATH:=$(patsubst %/,%,$(subst \,/,$(PATH))) +ifneq ($(findstring darwin,$(OSTYPE)),) +inUnix=1 #darwin +SEARCHPATH:=$(filter-out .,$(subst :, ,$(PATH))) +else +ifeq ($(findstring ;,$(PATH)),) +inUnix=1 +SEARCHPATH:=$(filter-out .,$(subst :, ,$(PATH))) +else +SEARCHPATH:=$(subst ;, ,$(PATH)) +endif +endif +SEARCHPATH+=$(patsubst %/,%,$(subst \,/,$(dir $(MAKE)))) +PWD:=$(strip $(wildcard $(addsuffix /pwd.exe,$(SEARCHPATH)))) +ifeq ($(PWD),) +PWD:=$(strip $(wildcard $(addsuffix /pwd,$(SEARCHPATH)))) +ifeq ($(PWD),) +$(error You need the GNU utils package to use this Makefile) +else +PWD:=$(firstword $(PWD)) +SRCEXEEXT= +endif +else +PWD:=$(firstword $(PWD)) +SRCEXEEXT=.exe +endif +ifndef inUnix +ifeq ($(OS),Windows_NT) +inWinNT=1 +else +ifdef OS2_SHELL +inOS2=1 +endif +endif +else +ifneq ($(findstring cygdrive,$(PATH)),) +inCygWin=1 +endif +endif +ifdef inUnix +SRCBATCHEXT=.sh +else +ifdef inOS2 +SRCBATCHEXT=.cmd +else +SRCBATCHEXT=.bat +endif +endif +ifdef COMSPEC +ifneq ($(findstring $(OS_SOURCE),$(OSNeedsComspecToRunBatch)),) +RUNBATCH=$(COMSPEC) /C +endif +endif +ifdef inUnix +PATHSEP=/ +else +PATHSEP:=$(subst /,\,/) +ifdef inCygWin +PATHSEP=/ +endif +endif +ifdef PWD +BASEDIR:=$(subst \,/,$(shell $(PWD))) +ifdef inCygWin +ifneq ($(findstring /cygdrive/,$(BASEDIR)),) +BASENODIR:=$(patsubst /cygdrive%,%,$(BASEDIR)) +BASEDRIVE:=$(firstword $(subst /, ,$(BASENODIR))) +BASEDIR:=$(subst /cygdrive/$(BASEDRIVE)/,$(BASEDRIVE):/,$(BASEDIR)) +endif +endif +else +BASEDIR=. +endif +ifdef inOS2 +ifndef ECHO +ECHO:=$(strip $(wildcard $(addsuffix /gecho$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(ECHO),) +ECHO:=$(strip $(wildcard $(addsuffix /echo$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(ECHO),) +ECHO=echo +else +ECHO:=$(firstword $(ECHO)) +endif +else +ECHO:=$(firstword $(ECHO)) +endif +endif +export ECHO +endif +override DEFAULT_FPCDIR=../../.. +ifndef FPC +ifdef PP +FPC=$(PP) +endif +endif +ifndef FPC +FPCPROG:=$(strip $(wildcard $(addsuffix /fpc$(SRCEXEEXT),$(SEARCHPATH)))) +ifneq ($(FPCPROG),) +FPCPROG:=$(firstword $(FPCPROG)) +ifneq ($(CPU_TARGET),) +FPC:=$(shell $(FPCPROG) -P$(CPU_TARGET) -PB) +else +FPC:=$(shell $(FPCPROG) -PB) +endif +ifneq ($(findstring Error,$(FPC)),) +override FPC=$(firstword $(strip $(wildcard $(addsuffix /ppc386$(SRCEXEEXT),$(SEARCHPATH))))) +endif +else +override FPC=$(firstword $(strip $(wildcard $(addsuffix /ppc386$(SRCEXEEXT),$(SEARCHPATH))))) +endif +endif +override FPC:=$(subst $(SRCEXEEXT),,$(FPC)) +override FPC:=$(subst \,/,$(FPC))$(SRCEXEEXT) +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 +unexport CHECKDEPEND ALLDEPENDENCIES +ifndef CPU_TARGET +ifdef CPU_TARGET_DEFAULT +CPU_TARGET=$(CPU_TARGET_DEFAULT) +endif +endif +ifndef OS_TARGET +ifdef OS_TARGET_DEFAULT +OS_TARGET=$(OS_TARGET_DEFAULT) +endif +endif +ifneq ($(words $(FPC_COMPILERINFO)),5) +FPC_COMPILERINFO+=$(shell $(FPC) -iSP) +FPC_COMPILERINFO+=$(shell $(FPC) -iTP) +FPC_COMPILERINFO+=$(shell $(FPC) -iSO) +FPC_COMPILERINFO+=$(shell $(FPC) -iTO) +endif +ifndef CPU_SOURCE +CPU_SOURCE:=$(word 2,$(FPC_COMPILERINFO)) +endif +ifndef CPU_TARGET +CPU_TARGET:=$(word 3,$(FPC_COMPILERINFO)) +endif +ifndef OS_SOURCE +OS_SOURCE:=$(word 4,$(FPC_COMPILERINFO)) +endif +ifndef OS_TARGET +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 $(FULL_TARGET),$(MAKEFILETARGETS)),) +$(error The Makefile doesn't support target $(FULL_TARGET), please run fpcmake first) +endif +endif +ifneq ($(findstring $(OS_TARGET),$(BSDs)),) +BSDhier=1 +endif +ifeq ($(OS_TARGET),linux) +linuxHier=1 +endif +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)),) +override FPCDIR=wrong +endif +else +override FPCDIR=wrong +endif +ifdef DEFAULT_FPCDIR +ifeq ($(FPCDIR),wrong) +override FPCDIR:=$(subst \,/,$(DEFAULT_FPCDIR)) +ifeq ($(wildcard $(addprefix $(FPCDIR)/,rtl units)),) +override FPCDIR=wrong +endif +endif +endif +ifeq ($(FPCDIR),wrong) +ifdef inUnix +override FPCDIR=/usr/local/lib/fpc/$(FPC_VERSION) +ifeq ($(wildcard $(FPCDIR)/units),) +override FPCDIR=/usr/lib/fpc/$(FPC_VERSION) +endif +else +override FPCDIR:=$(subst /$(FPC),,$(firstword $(strip $(wildcard $(addsuffix /$(FPC),$(SEARCHPATH)))))) +override FPCDIR:=$(FPCDIR)/.. +ifeq ($(wildcard $(addprefix $(FPCDIR)/,rtl units)),) +override FPCDIR:=$(FPCDIR)/.. +ifeq ($(wildcard $(addprefix $(FPCDIR)/,rtl units)),) +override FPCDIR:=$(BASEDIR) +ifeq ($(wildcard $(addprefix $(FPCDIR)/,rtl units)),) +override FPCDIR=c:/pp +endif +endif +endif +endif +endif +ifndef CROSSBINDIR +CROSSBINDIR:=$(wildcard $(FPCDIR)/bin/$(TARGETSUFFIX)) +endif +ifndef BINUTILSPREFIX +ifndef CROSSBINDIR +ifdef CROSSCOMPILE +BINUTILSPREFIX=$(CPU_TARGET)-$(OS_TARGET)- +endif +endif +endif +UNITSDIR:=$(wildcard $(FPCDIR)/units/$(TARGETSUFFIX)) +ifeq ($(UNITSDIR),) +UNITSDIR:=$(wildcard $(FPCDIR)/units/$(OS_TARGET)) +endif +PACKAGESDIR:=$(wildcard $(FPCDIR) $(FPCDIR)/packages $(FPCDIR)/packages/base $(FPCDIR)/packages/extra) +ifeq ($(FULL_TARGET),i386-linux) +override TARGET_DIRS+=helloworld helloworld2 gtk_demo gettingstarted plugins scribble_simple gtkglext +endif +ifeq ($(FULL_TARGET),i386-go32v2) +override TARGET_DIRS+=helloworld helloworld2 gtk_demo gettingstarted plugins scribble_simple gtkglext +endif +ifeq ($(FULL_TARGET),i386-win32) +override TARGET_DIRS+=helloworld helloworld2 gtk_demo gettingstarted plugins scribble_simple gtkglext +endif +ifeq ($(FULL_TARGET),i386-os2) +override TARGET_DIRS+=helloworld helloworld2 gtk_demo gettingstarted plugins scribble_simple gtkglext +endif +ifeq ($(FULL_TARGET),i386-freebsd) +override TARGET_DIRS+=helloworld helloworld2 gtk_demo gettingstarted plugins scribble_simple gtkglext +endif +ifeq ($(FULL_TARGET),i386-beos) +override TARGET_DIRS+=helloworld helloworld2 gtk_demo gettingstarted plugins scribble_simple gtkglext +endif +ifeq ($(FULL_TARGET),i386-netbsd) +override TARGET_DIRS+=helloworld helloworld2 gtk_demo gettingstarted plugins scribble_simple gtkglext +endif +ifeq ($(FULL_TARGET),i386-solaris) +override TARGET_DIRS+=helloworld helloworld2 gtk_demo gettingstarted plugins scribble_simple gtkglext +endif +ifeq ($(FULL_TARGET),i386-qnx) +override TARGET_DIRS+=helloworld helloworld2 gtk_demo gettingstarted plugins scribble_simple gtkglext +endif +ifeq ($(FULL_TARGET),i386-netware) +override TARGET_DIRS+=helloworld helloworld2 gtk_demo gettingstarted plugins scribble_simple gtkglext +endif +ifeq ($(FULL_TARGET),i386-openbsd) +override TARGET_DIRS+=helloworld helloworld2 gtk_demo gettingstarted plugins scribble_simple gtkglext +endif +ifeq ($(FULL_TARGET),i386-wdosx) +override TARGET_DIRS+=helloworld helloworld2 gtk_demo gettingstarted plugins scribble_simple gtkglext +endif +ifeq ($(FULL_TARGET),i386-darwin) +override TARGET_DIRS+=helloworld helloworld2 gtk_demo gettingstarted plugins scribble_simple gtkglext +endif +ifeq ($(FULL_TARGET),i386-emx) +override TARGET_DIRS+=helloworld helloworld2 gtk_demo gettingstarted plugins scribble_simple gtkglext +endif +ifeq ($(FULL_TARGET),i386-watcom) +override TARGET_DIRS+=helloworld helloworld2 gtk_demo gettingstarted plugins scribble_simple gtkglext +endif +ifeq ($(FULL_TARGET),i386-netwlibc) +override TARGET_DIRS+=helloworld helloworld2 gtk_demo gettingstarted plugins scribble_simple gtkglext +endif +ifeq ($(FULL_TARGET),i386-wince) +override TARGET_DIRS+=helloworld helloworld2 gtk_demo gettingstarted plugins scribble_simple gtkglext +endif +ifeq ($(FULL_TARGET),i386-embedded) +override TARGET_DIRS+=helloworld helloworld2 gtk_demo gettingstarted plugins scribble_simple gtkglext +endif +ifeq ($(FULL_TARGET),i386-symbian) +override TARGET_DIRS+=helloworld helloworld2 gtk_demo gettingstarted plugins scribble_simple gtkglext +endif +ifeq ($(FULL_TARGET),m68k-linux) +override TARGET_DIRS+=helloworld helloworld2 gtk_demo gettingstarted plugins scribble_simple gtkglext +endif +ifeq ($(FULL_TARGET),m68k-freebsd) +override TARGET_DIRS+=helloworld helloworld2 gtk_demo gettingstarted plugins scribble_simple gtkglext +endif +ifeq ($(FULL_TARGET),m68k-netbsd) +override TARGET_DIRS+=helloworld helloworld2 gtk_demo gettingstarted plugins scribble_simple gtkglext +endif +ifeq ($(FULL_TARGET),m68k-amiga) +override TARGET_DIRS+=helloworld helloworld2 gtk_demo gettingstarted plugins scribble_simple gtkglext +endif +ifeq ($(FULL_TARGET),m68k-atari) +override TARGET_DIRS+=helloworld helloworld2 gtk_demo gettingstarted plugins scribble_simple gtkglext +endif +ifeq ($(FULL_TARGET),m68k-openbsd) +override TARGET_DIRS+=helloworld helloworld2 gtk_demo gettingstarted plugins scribble_simple gtkglext +endif +ifeq ($(FULL_TARGET),m68k-palmos) +override TARGET_DIRS+=helloworld helloworld2 gtk_demo gettingstarted plugins scribble_simple gtkglext +endif +ifeq ($(FULL_TARGET),m68k-embedded) +override TARGET_DIRS+=helloworld helloworld2 gtk_demo gettingstarted plugins scribble_simple gtkglext +endif +ifeq ($(FULL_TARGET),powerpc-linux) +override TARGET_DIRS+=helloworld helloworld2 gtk_demo gettingstarted plugins scribble_simple gtkglext +endif +ifeq ($(FULL_TARGET),powerpc-netbsd) +override TARGET_DIRS+=helloworld helloworld2 gtk_demo gettingstarted plugins scribble_simple gtkglext +endif +ifeq ($(FULL_TARGET),powerpc-amiga) +override TARGET_DIRS+=helloworld helloworld2 gtk_demo gettingstarted plugins scribble_simple gtkglext +endif +ifeq ($(FULL_TARGET),powerpc-macos) +override TARGET_DIRS+=helloworld helloworld2 gtk_demo gettingstarted plugins scribble_simple gtkglext +endif +ifeq ($(FULL_TARGET),powerpc-darwin) +override TARGET_DIRS+=helloworld helloworld2 gtk_demo gettingstarted plugins scribble_simple gtkglext +endif +ifeq ($(FULL_TARGET),powerpc-morphos) +override TARGET_DIRS+=helloworld helloworld2 gtk_demo gettingstarted plugins scribble_simple gtkglext +endif +ifeq ($(FULL_TARGET),powerpc-embedded) +override TARGET_DIRS+=helloworld helloworld2 gtk_demo gettingstarted plugins scribble_simple gtkglext +endif +ifeq ($(FULL_TARGET),sparc-linux) +override TARGET_DIRS+=helloworld helloworld2 gtk_demo gettingstarted plugins scribble_simple gtkglext +endif +ifeq ($(FULL_TARGET),sparc-netbsd) +override TARGET_DIRS+=helloworld helloworld2 gtk_demo gettingstarted plugins scribble_simple gtkglext +endif +ifeq ($(FULL_TARGET),sparc-solaris) +override TARGET_DIRS+=helloworld helloworld2 gtk_demo gettingstarted plugins scribble_simple gtkglext +endif +ifeq ($(FULL_TARGET),sparc-embedded) +override TARGET_DIRS+=helloworld helloworld2 gtk_demo gettingstarted plugins scribble_simple gtkglext +endif +ifeq ($(FULL_TARGET),x86_64-linux) +override TARGET_DIRS+=helloworld helloworld2 gtk_demo gettingstarted plugins scribble_simple gtkglext +endif +ifeq ($(FULL_TARGET),x86_64-freebsd) +override TARGET_DIRS+=helloworld helloworld2 gtk_demo gettingstarted plugins scribble_simple gtkglext +endif +ifeq ($(FULL_TARGET),x86_64-darwin) +override TARGET_DIRS+=helloworld helloworld2 gtk_demo gettingstarted plugins scribble_simple gtkglext +endif +ifeq ($(FULL_TARGET),x86_64-win64) +override TARGET_DIRS+=helloworld helloworld2 gtk_demo gettingstarted plugins scribble_simple gtkglext +endif +ifeq ($(FULL_TARGET),x86_64-embedded) +override TARGET_DIRS+=helloworld helloworld2 gtk_demo gettingstarted plugins scribble_simple gtkglext +endif +ifeq ($(FULL_TARGET),arm-linux) +override TARGET_DIRS+=helloworld helloworld2 gtk_demo gettingstarted plugins scribble_simple gtkglext +endif +ifeq ($(FULL_TARGET),arm-palmos) +override TARGET_DIRS+=helloworld helloworld2 gtk_demo gettingstarted plugins scribble_simple gtkglext +endif +ifeq ($(FULL_TARGET),arm-wince) +override TARGET_DIRS+=helloworld helloworld2 gtk_demo gettingstarted plugins scribble_simple gtkglext +endif +ifeq ($(FULL_TARGET),arm-gba) +override TARGET_DIRS+=helloworld helloworld2 gtk_demo gettingstarted plugins scribble_simple gtkglext +endif +ifeq ($(FULL_TARGET),arm-nds) +override TARGET_DIRS+=helloworld helloworld2 gtk_demo gettingstarted plugins scribble_simple gtkglext +endif +ifeq ($(FULL_TARGET),arm-embedded) +override TARGET_DIRS+=helloworld helloworld2 gtk_demo gettingstarted plugins scribble_simple gtkglext +endif +ifeq ($(FULL_TARGET),arm-symbian) +override TARGET_DIRS+=helloworld helloworld2 gtk_demo gettingstarted plugins scribble_simple gtkglext +endif +ifeq ($(FULL_TARGET),powerpc64-linux) +override TARGET_DIRS+=helloworld helloworld2 gtk_demo gettingstarted plugins scribble_simple gtkglext +endif +ifeq ($(FULL_TARGET),powerpc64-darwin) +override TARGET_DIRS+=helloworld helloworld2 gtk_demo gettingstarted plugins scribble_simple gtkglext +endif +ifeq ($(FULL_TARGET),powerpc64-embedded) +override TARGET_DIRS+=helloworld helloworld2 gtk_demo gettingstarted plugins scribble_simple gtkglext +endif +override INSTALL_FPCPACKAGE=y +ifdef REQUIRE_UNITSDIR +override UNITSDIR+=$(REQUIRE_UNITSDIR) +endif +ifdef REQUIRE_PACKAGESDIR +override PACKAGESDIR+=$(REQUIRE_PACKAGESDIR) +endif +ifdef ZIPINSTALL +ifneq ($(findstring $(OS_TARGET),$(UNIXs)),) +UNIXHier=1 +endif +else +ifneq ($(findstring $(OS_SOURCE),$(UNIXs)),) +UNIXHier=1 +endif +endif +ifndef INSTALL_PREFIX +ifdef PREFIX +INSTALL_PREFIX=$(PREFIX) +endif +endif +ifndef INSTALL_PREFIX +ifdef UNIXHier +INSTALL_PREFIX=/usr/local +else +ifdef INSTALL_FPCPACKAGE +INSTALL_BASEDIR:=/pp +else +INSTALL_BASEDIR:=/$(PACKAGE_NAME) +endif +endif +endif +export INSTALL_PREFIX +ifdef INSTALL_FPCSUBDIR +export INSTALL_FPCSUBDIR +endif +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 +INSTALL_BASEDIR:=$(INSTALL_PREFIX)/lib/fpc/$(FPC_VERSION) +else +INSTALL_BASEDIR:=$(INSTALL_PREFIX)/lib/$(PACKAGE_NAME) +endif +else +INSTALL_BASEDIR:=$(INSTALL_PREFIX) +endif +endif +ifndef INSTALL_BINDIR +ifdef UNIXHier +INSTALL_BINDIR:=$(INSTALL_PREFIX)/bin +else +INSTALL_BINDIR:=$(INSTALL_BASEDIR)/bin +ifdef INSTALL_FPCPACKAGE +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 +INSTALL_UNITDIR:=$(INSTALL_BASEDIR)/units/$(TARGETSUFFIX) +ifdef INSTALL_FPCPACKAGE +ifdef PACKAGE_NAME +INSTALL_UNITDIR:=$(INSTALL_UNITDIR)/$(PACKAGE_NAME) +endif +endif +endif +ifndef INSTALL_LIBDIR +ifdef UNIXHier +INSTALL_LIBDIR:=$(INSTALL_PREFIX)/lib +else +INSTALL_LIBDIR:=$(INSTALL_UNITDIR) +endif +endif +ifndef INSTALL_SOURCEDIR +ifdef UNIXHier +ifdef BSDhier +SRCPREFIXDIR=share/src +else +ifdef linuxHier +SRCPREFIXDIR=share/src +else +SRCPREFIXDIR=src +endif +endif +ifdef INSTALL_FPCPACKAGE +ifdef INSTALL_FPCSUBDIR +INSTALL_SOURCEDIR:=$(INSTALL_PREFIX)/$(SRCPREFIXDIR)/fpc-$(FPC_VERSION)/$(INSTALL_FPCSUBDIR)/$(PACKAGE_NAME) +else +INSTALL_SOURCEDIR:=$(INSTALL_PREFIX)/$(SRCPREFIXDIR)/fpc-$(FPC_VERSION)/$(PACKAGE_NAME) +endif +else +INSTALL_SOURCEDIR:=$(INSTALL_PREFIX)/$(SRCPREFIXDIR)/$(PACKAGE_NAME)-$(PACKAGE_VERSION) +endif +else +ifdef INSTALL_FPCPACKAGE +ifdef INSTALL_FPCSUBDIR +INSTALL_SOURCEDIR:=$(INSTALL_BASEDIR)/source/$(INSTALL_FPCSUBDIR)/$(PACKAGE_NAME) +else +INSTALL_SOURCEDIR:=$(INSTALL_BASEDIR)/source/$(PACKAGE_NAME) +endif +else +INSTALL_SOURCEDIR:=$(INSTALL_BASEDIR)/source +endif +endif +endif +ifndef INSTALL_DOCDIR +ifdef UNIXHier +ifdef BSDhier +DOCPREFIXDIR=share/doc +else +ifdef linuxHier +DOCPREFIXDIR=share/doc +else +DOCPREFIXDIR=doc +endif +endif +ifdef INSTALL_FPCPACKAGE +INSTALL_DOCDIR:=$(INSTALL_PREFIX)/$(DOCPREFIXDIR)/fpc-$(FPC_VERSION)/$(PACKAGE_NAME) +else +INSTALL_DOCDIR:=$(INSTALL_PREFIX)/$(DOCPREFIXDIR)/$(PACKAGE_NAME)-$(PACKAGE_VERSION) +endif +else +ifdef INSTALL_FPCPACKAGE +INSTALL_DOCDIR:=$(INSTALL_BASEDIR)/doc/$(PACKAGE_NAME) +else +INSTALL_DOCDIR:=$(INSTALL_BASEDIR)/doc +endif +endif +endif +ifndef INSTALL_EXAMPLEDIR +ifdef UNIXHier +ifdef INSTALL_FPCPACKAGE +ifdef BSDhier +INSTALL_EXAMPLEDIR:=$(INSTALL_PREFIX)/share/examples/fpc-$(FPC_VERSION)/$(PACKAGE_NAME) +else +ifdef linuxHier +INSTALL_EXAMPLEDIR:=$(INSTALL_DOCDIR)/examples +else +INSTALL_EXAMPLEDIR:=$(INSTALL_PREFIX)/doc/fpc-$(FPC_VERSION)/examples/$(PACKAGE_NAME) +endif +endif +else +ifdef BSDhier +INSTALL_EXAMPLEDIR:=$(INSTALL_PREFIX)/share/examples/$(PACKAGE_NAME)-$(PACKAGE_VERSION) +else +ifdef linuxHier +INSTALL_EXAMPLEDIR:=$(INSTALL_DOCDIR)/examples/$(PACKAGE_NAME)-$(PACKAGE_VERSION) +else +INSTALL_EXAMPLEDIR:=$(INSTALL_PREFIX)/doc/$(PACKAGE_NAME)-$(PACKAGE_VERSION) +endif +endif +endif +else +ifdef INSTALL_FPCPACKAGE +INSTALL_EXAMPLEDIR:=$(INSTALL_BASEDIR)/examples/$(PACKAGE_NAME) +else +INSTALL_EXAMPLEDIR:=$(INSTALL_BASEDIR)/examples +endif +endif +endif +ifndef INSTALL_DATADIR +INSTALL_DATADIR=$(INSTALL_BASEDIR) +endif +ifndef INSTALL_SHAREDDIR +INSTALL_SHAREDDIR=$(INSTALL_PREFIX)/lib +endif +ifdef CROSSCOMPILE +ifndef CROSSBINDIR +CROSSBINDIR:=$(wildcard $(CROSSTARGETDIR)/bin/$(SOURCESUFFIX)) +ifeq ($(CROSSBINDIR),) +CROSSBINDIR:=$(wildcard $(INSTALL_BASEDIR)/cross/$(TARGETSUFFIX)/bin/$(FULL_SOURCE)) +endif +endif +else +CROSSBINDIR= +endif +ifeq ($(OS_SOURCE),linux) +ifndef GCCLIBDIR +ifeq ($(CPU_TARGET),i386) +ifneq ($(findstring x86_64,$(shell uname -a)),) +ifeq ($(BINUTILSPREFIX),) +GCCLIBDIR:=$(shell dirname `gcc -m32 -print-libgcc-file-name`) +endif +endif +endif +ifeq ($(CPU_TARGET),powerpc64) +ifeq ($(BINUTILSPREFIX),) +GCCLIBDIR:=$(shell dirname `gcc -m64 -print-libgcc-file-name`) +endif +endif +endif +ifndef GCCLIBDIR +CROSSGCC=$(strip $(wildcard $(addsuffix /$(BINUTILSPREFIX)gcc$(SRCEXEEXT),$(SEARCHPATH)))) +ifneq ($(CROSSGCC),) +GCCLIBDIR:=$(shell dirname `$(CROSSGCC) -print-libgcc-file-name`) +endif +endif +ifndef OTHERLIBDIR +OTHERLIBDIR:=$(shell grep -v "^\#" /etc/ld.so.conf | awk '{ ORS=" "; print $1 }') +endif +endif +ifdef inUnix +ifeq ($(OS_SOURCE),netbsd) +OTHERLIBDIR+=/usr/pkg/lib +endif +export GCCLIBDIR OTHERLIB +endif +BATCHEXT=.bat +LOADEREXT=.as +EXEEXT=.exe +PPLEXT=.ppl +PPUEXT=.ppu +OEXT=.o +ASMEXT=.s +SMARTEXT=.sl +STATICLIBEXT=.a +SHAREDLIBEXT=.so +SHAREDLIBPREFIX=libfp +STATICLIBPREFIX=libp +IMPORTLIBPREFIX=libimp +RSTEXT=.rst +ifeq ($(findstring 1.0.,$(FPC_VERSION)),) +ifeq ($(OS_TARGET),go32v1) +STATICLIBPREFIX= +SHORTSUFFIX=v1 +endif +ifeq ($(OS_TARGET),go32v2) +STATICLIBPREFIX= +SHORTSUFFIX=dos +endif +ifeq ($(OS_TARGET),watcom) +STATICLIBPREFIX= +OEXT=.obj +ASMEXT=.asm +SHAREDLIBEXT=.dll +SHORTSUFFIX=wat +endif +ifeq ($(OS_TARGET),linux) +BATCHEXT=.sh +EXEEXT= +HASSHAREDLIB=1 +SHORTSUFFIX=lnx +endif +ifeq ($(OS_TARGET),freebsd) +BATCHEXT=.sh +EXEEXT= +HASSHAREDLIB=1 +SHORTSUFFIX=fbs +endif +ifeq ($(OS_TARGET),netbsd) +BATCHEXT=.sh +EXEEXT= +HASSHAREDLIB=1 +SHORTSUFFIX=nbs +endif +ifeq ($(OS_TARGET),openbsd) +BATCHEXT=.sh +EXEEXT= +HASSHAREDLIB=1 +SHORTSUFFIX=obs +endif +ifeq ($(OS_TARGET),win32) +SHAREDLIBEXT=.dll +SHORTSUFFIX=w32 +endif +ifeq ($(OS_TARGET),os2) +BATCHEXT=.cmd +AOUTEXT=.out +STATICLIBPREFIX= +SHAREDLIBEXT=.dll +SHORTSUFFIX=os2 +ECHO=echo +endif +ifeq ($(OS_TARGET),emx) +BATCHEXT=.cmd +AOUTEXT=.out +STATICLIBPREFIX= +SHAREDLIBEXT=.dll +SHORTSUFFIX=emx +ECHO=echo +endif +ifeq ($(OS_TARGET),amiga) +EXEEXT= +SHAREDLIBEXT=.library +SHORTSUFFIX=amg +endif +ifeq ($(OS_TARGET),morphos) +EXEEXT= +SHAREDLIBEXT=.library +SHORTSUFFIX=mos +endif +ifeq ($(OS_TARGET),atari) +EXEEXT=.ttp +SHORTSUFFIX=ata +endif +ifeq ($(OS_TARGET),beos) +BATCHEXT=.sh +EXEEXT= +SHORTSUFFIX=be +endif +ifeq ($(OS_TARGET),solaris) +BATCHEXT=.sh +EXEEXT= +SHORTSUFFIX=sun +endif +ifeq ($(OS_TARGET),qnx) +BATCHEXT=.sh +EXEEXT= +SHORTSUFFIX=qnx +endif +ifeq ($(OS_TARGET),netware) +EXEEXT=.nlm +STATICLIBPREFIX= +SHORTSUFFIX=nw +endif +ifeq ($(OS_TARGET),netwlibc) +EXEEXT=.nlm +STATICLIBPREFIX= +SHORTSUFFIX=nwl +endif +ifeq ($(OS_TARGET),macos) +BATCHEXT= +EXEEXT= +DEBUGSYMEXT=.xcoff +SHORTSUFFIX=mac +endif +ifeq ($(OS_TARGET),darwin) +BATCHEXT=.sh +EXEEXT= +HASSHAREDLIB=1 +SHORTSUFFIX=dwn +endif +ifeq ($(OS_TARGET),gba) +EXEEXT=.gba +SHAREDLIBEXT=.so +SHORTSUFFIX=gba +endif +ifeq ($(OS_TARGET),symbian) +SHAREDLIBEXT=.dll +SHORTSUFFIX=symbian +endif +else +ifeq ($(OS_TARGET),go32v1) +PPUEXT=.pp1 +OEXT=.o1 +ASMEXT=.s1 +SMARTEXT=.sl1 +STATICLIBEXT=.a1 +SHAREDLIBEXT=.so1 +STATICLIBPREFIX= +SHORTSUFFIX=v1 +endif +ifeq ($(OS_TARGET),go32v2) +STATICLIBPREFIX= +SHORTSUFFIX=dos +endif +ifeq ($(OS_TARGET),watcom) +STATICLIBPREFIX= +SHORTSUFFIX=wat +endif +ifeq ($(OS_TARGET),linux) +BATCHEXT=.sh +EXEEXT= +HASSHAREDLIB=1 +SHORTSUFFIX=lnx +endif +ifeq ($(OS_TARGET),freebsd) +BATCHEXT=.sh +EXEEXT= +HASSHAREDLIB=1 +SHORTSUFFIX=fbs +endif +ifeq ($(OS_TARGET),netbsd) +BATCHEXT=.sh +EXEEXT= +HASSHAREDLIB=1 +SHORTSUFFIX=nbs +endif +ifeq ($(OS_TARGET),openbsd) +BATCHEXT=.sh +EXEEXT= +HASSHAREDLIB=1 +SHORTSUFFIX=obs +endif +ifeq ($(OS_TARGET),win32) +PPUEXT=.ppw +OEXT=.ow +ASMEXT=.sw +SMARTEXT=.slw +STATICLIBEXT=.aw +SHAREDLIBEXT=.dll +SHORTSUFFIX=w32 +endif +ifeq ($(OS_TARGET),os2) +BATCHEXT=.cmd +PPUEXT=.ppo +ASMEXT=.so2 +OEXT=.oo2 +AOUTEXT=.out +SMARTEXT=.sl2 +STATICLIBPREFIX= +STATICLIBEXT=.ao2 +SHAREDLIBEXT=.dll +SHORTSUFFIX=os2 +ECHO=echo +endif +ifeq ($(OS_TARGET),amiga) +EXEEXT= +PPUEXT=.ppu +ASMEXT=.s +OEXT=.o +SMARTEXT=.sl +STATICLIBEXT=.a +SHAREDLIBEXT=.library +SHORTSUFFIX=amg +endif +ifeq ($(OS_TARGET),atari) +PPUEXT=.ppu +ASMEXT=.s +OEXT=.o +SMARTEXT=.sl +STATICLIBEXT=.a +EXEEXT=.ttp +SHORTSUFFIX=ata +endif +ifeq ($(OS_TARGET),beos) +BATCHEXT=.sh +PPUEXT=.ppu +ASMEXT=.s +OEXT=.o +SMARTEXT=.sl +STATICLIBEXT=.a +EXEEXT= +SHORTSUFFIX=be +endif +ifeq ($(OS_TARGET),solaris) +BATCHEXT=.sh +PPUEXT=.ppu +ASMEXT=.s +OEXT=.o +SMARTEXT=.sl +STATICLIBEXT=.a +EXEEXT= +SHORTSUFFIX=sun +endif +ifeq ($(OS_TARGET),qnx) +BATCHEXT=.sh +PPUEXT=.ppu +ASMEXT=.s +OEXT=.o +SMARTEXT=.sl +STATICLIBEXT=.a +EXEEXT= +SHORTSUFFIX=qnx +endif +ifeq ($(OS_TARGET),netware) +STATICLIBPREFIX= +PPUEXT=.ppu +OEXT=.o +ASMEXT=.s +SMARTEXT=.sl +STATICLIBEXT=.a +SHAREDLIBEXT=.nlm +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= +PPUEXT=.ppu +ASMEXT=.s +OEXT=.o +SMARTEXT=.sl +STATICLIBEXT=.a +EXEEXT= +DEBUGSYMEXT=.xcoff +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 +ECHO:=$(strip $(wildcard $(addsuffix /gecho$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(ECHO),) +ECHO:=$(strip $(wildcard $(addsuffix /echo$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(ECHO),) +ECHO= __missing_command_ECHO +else +ECHO:=$(firstword $(ECHO)) +endif +else +ECHO:=$(firstword $(ECHO)) +endif +endif +export ECHO +ifndef DATE +DATE:=$(strip $(wildcard $(addsuffix /gdate$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(DATE),) +DATE:=$(strip $(wildcard $(addsuffix /date$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(DATE),) +DATE= __missing_command_DATE +else +DATE:=$(firstword $(DATE)) +endif +else +DATE:=$(firstword $(DATE)) +endif +endif +export DATE +ifndef GINSTALL +GINSTALL:=$(strip $(wildcard $(addsuffix /ginstall$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(GINSTALL),) +GINSTALL:=$(strip $(wildcard $(addsuffix /install$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(GINSTALL),) +GINSTALL= __missing_command_GINSTALL +else +GINSTALL:=$(firstword $(GINSTALL)) +endif +else +GINSTALL:=$(firstword $(GINSTALL)) +endif +endif +export GINSTALL +ifndef CPPROG +CPPROG:=$(strip $(wildcard $(addsuffix /cp$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(CPPROG),) +CPPROG= __missing_command_CPPROG +else +CPPROG:=$(firstword $(CPPROG)) +endif +endif +export CPPROG +ifndef RMPROG +RMPROG:=$(strip $(wildcard $(addsuffix /rm$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(RMPROG),) +RMPROG= __missing_command_RMPROG +else +RMPROG:=$(firstword $(RMPROG)) +endif +endif +export RMPROG +ifndef MVPROG +MVPROG:=$(strip $(wildcard $(addsuffix /mv$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(MVPROG),) +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 +else +ECHOREDIR=$(ECHO) +endif +endif +ifndef COPY +COPY:=$(CPPROG) -fp +endif +ifndef COPYTREE +COPYTREE:=$(CPPROG) -Rfp +endif +ifndef MKDIRTREE +MKDIRTREE:=$(MKDIRPROG) -p +endif +ifndef MOVE +MOVE:=$(MVPROG) -f +endif +ifndef DEL +DEL:=$(RMPROG) -f +endif +ifndef DELTREE +DELTREE:=$(RMPROG) -rf +endif +ifndef INSTALL +ifdef inUnix +INSTALL:=$(GINSTALL) -c -m 644 +else +INSTALL:=$(COPY) +endif +endif +ifndef INSTALLEXE +ifdef inUnix +INSTALLEXE:=$(GINSTALL) -c -m 755 +else +INSTALLEXE:=$(COPY) +endif +endif +ifndef MKDIR +MKDIR:=$(GINSTALL) -m 755 -d +endif +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 +else +PPUMOVE:=$(firstword $(PPUMOVE)) +endif +endif +export PPUMOVE +ifndef FPCMAKE +FPCMAKE:=$(strip $(wildcard $(addsuffix /fpcmake$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(FPCMAKE),) +FPCMAKE= __missing_command_FPCMAKE +else +FPCMAKE:=$(firstword $(FPCMAKE)) +endif +endif +export FPCMAKE +ifndef ZIPPROG +ZIPPROG:=$(strip $(wildcard $(addsuffix /zip$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(ZIPPROG),) +ZIPPROG= __missing_command_ZIPPROG +else +ZIPPROG:=$(firstword $(ZIPPROG)) +endif +endif +export ZIPPROG +ifndef TARPROG +TARPROG:=$(strip $(wildcard $(addsuffix /gtar$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(TARPROG),) +TARPROG:=$(strip $(wildcard $(addsuffix /tar$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(TARPROG),) +TARPROG= __missing_command_TARPROG +else +TARPROG:=$(firstword $(TARPROG)) +endif +else +TARPROG:=$(firstword $(TARPROG)) +endif +endif +export TARPROG +ASNAME=$(BINUTILSPREFIX)as +LDNAME=$(BINUTILSPREFIX)ld +ARNAME=$(BINUTILSPREFIX)ar +RCNAME=$(BINUTILSPREFIX)rc +ifneq ($(findstring 1.0.,$(FPC_VERSION)),) +ifeq ($(OS_TARGET),win32) +ifeq ($(CROSSBINDIR),) +ASNAME=asw +LDNAME=ldw +ARNAME=arw +endif +endif +endif +ifndef ASPROG +ifdef CROSSBINDIR +ASPROG=$(CROSSBINDIR)/$(ASNAME)$(SRCEXEEXT) +else +ASPROG=$(ASNAME) +endif +endif +ifndef LDPROG +ifdef CROSSBINDIR +LDPROG=$(CROSSBINDIR)/$(LDNAME)$(SRCEXEEXT) +else +LDPROG=$(LDNAME) +endif +endif +ifndef RCPROG +ifdef CROSSBINDIR +RCPROG=$(CROSSBINDIR)/$(RCNAME)$(SRCEXEEXT) +else +RCPROG=$(RCNAME) +endif +endif +ifndef ARPROG +ifdef CROSSBINDIR +ARPROG=$(CROSSBINDIR)/$(ARNAME)$(SRCEXEEXT) +else +ARPROG=$(ARNAME) +endif +endif +AS=$(ASPROG) +LD=$(LDPROG) +RC=$(RCPROG) +AR=$(ARPROG) +PPAS=ppas$(SRCBATCHEXT) +ifdef inUnix +LDCONFIG=ldconfig +else +LDCONFIG= +endif +ifdef DATE +DATESTR:=$(shell $(DATE) +%Y%m%d) +else +DATESTR= +endif +ifndef UPXPROG +ifeq ($(OS_TARGET),go32v2) +UPXPROG:=1 +endif +ifeq ($(OS_TARGET),win32) +UPXPROG:=1 +endif +ifdef UPXPROG +UPXPROG:=$(strip $(wildcard $(addsuffix /upx$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(UPXPROG),) +UPXPROG= +else +UPXPROG:=$(firstword $(UPXPROG)) +endif +else +UPXPROG= +endif +endif +export UPXPROG +ZIPOPT=-9 +ZIPEXT=.zip +ifeq ($(USETAR),bz2) +TAROPT=vj +TAREXT=.tar.bz2 +else +TAROPT=vz +TAREXT=.tar.gz +endif +override REQUIRE_PACKAGES=gtk2 +ifeq ($(FULL_TARGET),i386-linux) +REQUIRE_PACKAGES_X11=1 +REQUIRE_PACKAGES_GTK2=1 +REQUIRE_PACKAGES_OPENGL=1 +endif +ifeq ($(FULL_TARGET),i386-go32v2) +REQUIRE_PACKAGES_GTK2=1 +REQUIRE_PACKAGES_OPENGL=1 +endif +ifeq ($(FULL_TARGET),i386-win32) +REQUIRE_PACKAGES_GTK2=1 +REQUIRE_PACKAGES_OPENGL=1 +endif +ifeq ($(FULL_TARGET),i386-os2) +REQUIRE_PACKAGES_GTK2=1 +REQUIRE_PACKAGES_OPENGL=1 +endif +ifeq ($(FULL_TARGET),i386-freebsd) +REQUIRE_PACKAGES_X11=1 +REQUIRE_PACKAGES_GTK2=1 +REQUIRE_PACKAGES_OPENGL=1 +endif +ifeq ($(FULL_TARGET),i386-beos) +REQUIRE_PACKAGES_GTK2=1 +REQUIRE_PACKAGES_OPENGL=1 +endif +ifeq ($(FULL_TARGET),i386-netbsd) +REQUIRE_PACKAGES_X11=1 +REQUIRE_PACKAGES_GTK2=1 +REQUIRE_PACKAGES_OPENGL=1 +endif +ifeq ($(FULL_TARGET),i386-solaris) +REQUIRE_PACKAGES_X11=1 +REQUIRE_PACKAGES_GTK2=1 +REQUIRE_PACKAGES_OPENGL=1 +endif +ifeq ($(FULL_TARGET),i386-qnx) +REQUIRE_PACKAGES_GTK2=1 +REQUIRE_PACKAGES_OPENGL=1 +endif +ifeq ($(FULL_TARGET),i386-netware) +REQUIRE_PACKAGES_GTK2=1 +REQUIRE_PACKAGES_OPENGL=1 +endif +ifeq ($(FULL_TARGET),i386-openbsd) +REQUIRE_PACKAGES_X11=1 +REQUIRE_PACKAGES_GTK2=1 +REQUIRE_PACKAGES_OPENGL=1 +endif +ifeq ($(FULL_TARGET),i386-wdosx) +REQUIRE_PACKAGES_GTK2=1 +REQUIRE_PACKAGES_OPENGL=1 +endif +ifeq ($(FULL_TARGET),i386-darwin) +REQUIRE_PACKAGES_X11=1 +REQUIRE_PACKAGES_GTK2=1 +REQUIRE_PACKAGES_OPENGL=1 +endif +ifeq ($(FULL_TARGET),i386-emx) +REQUIRE_PACKAGES_GTK2=1 +REQUIRE_PACKAGES_OPENGL=1 +endif +ifeq ($(FULL_TARGET),i386-watcom) +REQUIRE_PACKAGES_GTK2=1 +REQUIRE_PACKAGES_OPENGL=1 +endif +ifeq ($(FULL_TARGET),i386-netwlibc) +REQUIRE_PACKAGES_GTK2=1 +REQUIRE_PACKAGES_OPENGL=1 +endif +ifeq ($(FULL_TARGET),i386-wince) +REQUIRE_PACKAGES_GTK2=1 +REQUIRE_PACKAGES_OPENGL=1 +endif +ifeq ($(FULL_TARGET),i386-embedded) +REQUIRE_PACKAGES_GTK2=1 +REQUIRE_PACKAGES_OPENGL=1 +endif +ifeq ($(FULL_TARGET),i386-symbian) +REQUIRE_PACKAGES_GTK2=1 +REQUIRE_PACKAGES_OPENGL=1 +endif +ifeq ($(FULL_TARGET),m68k-linux) +REQUIRE_PACKAGES_X11=1 +REQUIRE_PACKAGES_GTK2=1 +REQUIRE_PACKAGES_OPENGL=1 +endif +ifeq ($(FULL_TARGET),m68k-freebsd) +REQUIRE_PACKAGES_X11=1 +REQUIRE_PACKAGES_GTK2=1 +REQUIRE_PACKAGES_OPENGL=1 +endif +ifeq ($(FULL_TARGET),m68k-netbsd) +REQUIRE_PACKAGES_X11=1 +REQUIRE_PACKAGES_GTK2=1 +REQUIRE_PACKAGES_OPENGL=1 +endif +ifeq ($(FULL_TARGET),m68k-amiga) +REQUIRE_PACKAGES_GTK2=1 +REQUIRE_PACKAGES_OPENGL=1 +endif +ifeq ($(FULL_TARGET),m68k-atari) +REQUIRE_PACKAGES_GTK2=1 +REQUIRE_PACKAGES_OPENGL=1 +endif +ifeq ($(FULL_TARGET),m68k-openbsd) +REQUIRE_PACKAGES_X11=1 +REQUIRE_PACKAGES_GTK2=1 +REQUIRE_PACKAGES_OPENGL=1 +endif +ifeq ($(FULL_TARGET),m68k-palmos) +REQUIRE_PACKAGES_GTK2=1 +REQUIRE_PACKAGES_OPENGL=1 +endif +ifeq ($(FULL_TARGET),m68k-embedded) +REQUIRE_PACKAGES_GTK2=1 +REQUIRE_PACKAGES_OPENGL=1 +endif +ifeq ($(FULL_TARGET),powerpc-linux) +REQUIRE_PACKAGES_X11=1 +REQUIRE_PACKAGES_GTK2=1 +REQUIRE_PACKAGES_OPENGL=1 +endif +ifeq ($(FULL_TARGET),powerpc-netbsd) +REQUIRE_PACKAGES_X11=1 +REQUIRE_PACKAGES_GTK2=1 +REQUIRE_PACKAGES_OPENGL=1 +endif +ifeq ($(FULL_TARGET),powerpc-amiga) +REQUIRE_PACKAGES_GTK2=1 +REQUIRE_PACKAGES_OPENGL=1 +endif +ifeq ($(FULL_TARGET),powerpc-macos) +REQUIRE_PACKAGES_GTK2=1 +REQUIRE_PACKAGES_OPENGL=1 +endif +ifeq ($(FULL_TARGET),powerpc-darwin) +REQUIRE_PACKAGES_X11=1 +REQUIRE_PACKAGES_GTK2=1 +REQUIRE_PACKAGES_OPENGL=1 +endif +ifeq ($(FULL_TARGET),powerpc-morphos) +REQUIRE_PACKAGES_GTK2=1 +REQUIRE_PACKAGES_OPENGL=1 +endif +ifeq ($(FULL_TARGET),powerpc-embedded) +REQUIRE_PACKAGES_GTK2=1 +REQUIRE_PACKAGES_OPENGL=1 +endif +ifeq ($(FULL_TARGET),sparc-linux) +REQUIRE_PACKAGES_X11=1 +REQUIRE_PACKAGES_GTK2=1 +REQUIRE_PACKAGES_OPENGL=1 +endif +ifeq ($(FULL_TARGET),sparc-netbsd) +REQUIRE_PACKAGES_X11=1 +REQUIRE_PACKAGES_GTK2=1 +REQUIRE_PACKAGES_OPENGL=1 +endif +ifeq ($(FULL_TARGET),sparc-solaris) +REQUIRE_PACKAGES_X11=1 +REQUIRE_PACKAGES_GTK2=1 +REQUIRE_PACKAGES_OPENGL=1 +endif +ifeq ($(FULL_TARGET),sparc-embedded) +REQUIRE_PACKAGES_GTK2=1 +REQUIRE_PACKAGES_OPENGL=1 +endif +ifeq ($(FULL_TARGET),x86_64-linux) +REQUIRE_PACKAGES_X11=1 +REQUIRE_PACKAGES_GTK2=1 +REQUIRE_PACKAGES_OPENGL=1 +endif +ifeq ($(FULL_TARGET),x86_64-freebsd) +REQUIRE_PACKAGES_X11=1 +REQUIRE_PACKAGES_GTK2=1 +REQUIRE_PACKAGES_OPENGL=1 +endif +ifeq ($(FULL_TARGET),x86_64-darwin) +REQUIRE_PACKAGES_X11=1 +REQUIRE_PACKAGES_GTK2=1 +REQUIRE_PACKAGES_OPENGL=1 +endif +ifeq ($(FULL_TARGET),x86_64-win64) +REQUIRE_PACKAGES_GTK2=1 +REQUIRE_PACKAGES_OPENGL=1 +endif +ifeq ($(FULL_TARGET),x86_64-embedded) +REQUIRE_PACKAGES_GTK2=1 +REQUIRE_PACKAGES_OPENGL=1 +endif +ifeq ($(FULL_TARGET),arm-linux) +REQUIRE_PACKAGES_X11=1 +REQUIRE_PACKAGES_GTK2=1 +REQUIRE_PACKAGES_OPENGL=1 +endif +ifeq ($(FULL_TARGET),arm-palmos) +REQUIRE_PACKAGES_GTK2=1 +REQUIRE_PACKAGES_OPENGL=1 +endif +ifeq ($(FULL_TARGET),arm-wince) +REQUIRE_PACKAGES_GTK2=1 +REQUIRE_PACKAGES_OPENGL=1 +endif +ifeq ($(FULL_TARGET),arm-gba) +REQUIRE_PACKAGES_GTK2=1 +REQUIRE_PACKAGES_OPENGL=1 +endif +ifeq ($(FULL_TARGET),arm-nds) +REQUIRE_PACKAGES_GTK2=1 +REQUIRE_PACKAGES_OPENGL=1 +endif +ifeq ($(FULL_TARGET),arm-embedded) +REQUIRE_PACKAGES_GTK2=1 +REQUIRE_PACKAGES_OPENGL=1 +endif +ifeq ($(FULL_TARGET),arm-symbian) +REQUIRE_PACKAGES_GTK2=1 +REQUIRE_PACKAGES_OPENGL=1 +endif +ifeq ($(FULL_TARGET),powerpc64-linux) +REQUIRE_PACKAGES_X11=1 +REQUIRE_PACKAGES_GTK2=1 +REQUIRE_PACKAGES_OPENGL=1 +endif +ifeq ($(FULL_TARGET),powerpc64-darwin) +REQUIRE_PACKAGES_X11=1 +REQUIRE_PACKAGES_GTK2=1 +REQUIRE_PACKAGES_OPENGL=1 +endif +ifeq ($(FULL_TARGET),powerpc64-embedded) +REQUIRE_PACKAGES_GTK2=1 +REQUIRE_PACKAGES_OPENGL=1 +endif +ifdef REQUIRE_PACKAGES_X11 +PACKAGEDIR_X11:=$(firstword $(subst /Makefile.fpc,,$(strip $(wildcard $(addsuffix /x11/Makefile.fpc,$(PACKAGESDIR)))))) +ifneq ($(PACKAGEDIR_X11),) +ifneq ($(wildcard $(PACKAGEDIR_X11)/units/$(TARGETSUFFIX)),) +UNITDIR_X11=$(PACKAGEDIR_X11)/units/$(TARGETSUFFIX) +else +UNITDIR_X11=$(PACKAGEDIR_X11) +endif +ifdef CHECKDEPEND +$(PACKAGEDIR_X11)/$(FPCMADE): + $(MAKE) -C $(PACKAGEDIR_X11) $(FPCMADE) +override ALLDEPENDENCIES+=$(PACKAGEDIR_X11)/$(FPCMADE) +endif +else +PACKAGEDIR_X11= +UNITDIR_X11:=$(subst /Package.fpc,,$(strip $(wildcard $(addsuffix /x11/Package.fpc,$(UNITSDIR))))) +ifneq ($(UNITDIR_X11),) +UNITDIR_X11:=$(firstword $(UNITDIR_X11)) +else +UNITDIR_X11= +endif +endif +ifdef UNITDIR_X11 +override COMPILER_UNITDIR+=$(UNITDIR_X11) +endif +endif +ifdef REQUIRE_PACKAGES_GTK2 +PACKAGEDIR_GTK2:=$(firstword $(subst /Makefile.fpc,,$(strip $(wildcard $(addsuffix /gtk2/Makefile.fpc,$(PACKAGESDIR)))))) +ifneq ($(PACKAGEDIR_GTK2),) +ifneq ($(wildcard $(PACKAGEDIR_GTK2)/units/$(TARGETSUFFIX)),) +UNITDIR_GTK2=$(PACKAGEDIR_GTK2)/units/$(TARGETSUFFIX) +else +UNITDIR_GTK2=$(PACKAGEDIR_GTK2) +endif +ifdef CHECKDEPEND +$(PACKAGEDIR_GTK2)/$(FPCMADE): + $(MAKE) -C $(PACKAGEDIR_GTK2) $(FPCMADE) +override ALLDEPENDENCIES+=$(PACKAGEDIR_GTK2)/$(FPCMADE) +endif +else +PACKAGEDIR_GTK2= +UNITDIR_GTK2:=$(subst /Package.fpc,,$(strip $(wildcard $(addsuffix /gtk2/Package.fpc,$(UNITSDIR))))) +ifneq ($(UNITDIR_GTK2),) +UNITDIR_GTK2:=$(firstword $(UNITDIR_GTK2)) +else +UNITDIR_GTK2= +endif +endif +ifdef UNITDIR_GTK2 +override COMPILER_UNITDIR+=$(UNITDIR_GTK2) +endif +endif +ifdef REQUIRE_PACKAGES_OPENGL +PACKAGEDIR_OPENGL:=$(firstword $(subst /Makefile.fpc,,$(strip $(wildcard $(addsuffix /opengl/Makefile.fpc,$(PACKAGESDIR)))))) +ifneq ($(PACKAGEDIR_OPENGL),) +ifneq ($(wildcard $(PACKAGEDIR_OPENGL)/units/$(TARGETSUFFIX)),) +UNITDIR_OPENGL=$(PACKAGEDIR_OPENGL)/units/$(TARGETSUFFIX) +else +UNITDIR_OPENGL=$(PACKAGEDIR_OPENGL) +endif +ifdef CHECKDEPEND +$(PACKAGEDIR_OPENGL)/$(FPCMADE): + $(MAKE) -C $(PACKAGEDIR_OPENGL) $(FPCMADE) +override ALLDEPENDENCIES+=$(PACKAGEDIR_OPENGL)/$(FPCMADE) +endif +else +PACKAGEDIR_OPENGL= +UNITDIR_OPENGL:=$(subst /Package.fpc,,$(strip $(wildcard $(addsuffix /opengl/Package.fpc,$(UNITSDIR))))) +ifneq ($(UNITDIR_OPENGL),) +UNITDIR_OPENGL:=$(firstword $(UNITDIR_OPENGL)) +else +UNITDIR_OPENGL= +endif +endif +ifdef UNITDIR_OPENGL +override COMPILER_UNITDIR+=$(UNITDIR_OPENGL) +endif +endif +ifndef NOCPUDEF +override FPCOPTDEF=$(CPU_TARGET) +endif +ifneq ($(OS_TARGET),$(OS_SOURCE)) +override FPCOPT+=-T$(OS_TARGET) +endif +ifneq ($(CPU_TARGET),$(CPU_SOURCE)) +override FPCOPT+=-P$(CPU_TARGET) +endif +ifeq ($(OS_SOURCE),openbsd) +override FPCOPT+=-FD$(NEW_BINUTILS_PATH) +endif +ifndef CROSSBOOTSTRAP +ifneq ($(BINUTILSPREFIX),) +override FPCOPT+=-XP$(BINUTILSPREFIX) +endif +ifneq ($(BINUTILSPREFIX),) +override FPCOPT+=-Xr$(RLINKPATH) +endif +endif +ifdef UNITDIR +override FPCOPT+=$(addprefix -Fu,$(UNITDIR)) +endif +ifdef LIBDIR +override FPCOPT+=$(addprefix -Fl,$(LIBDIR)) +endif +ifdef OBJDIR +override FPCOPT+=$(addprefix -Fo,$(OBJDIR)) +endif +ifdef INCDIR +override FPCOPT+=$(addprefix -Fi,$(INCDIR)) +endif +ifdef LINKSMART +override FPCOPT+=-XX +endif +ifdef CREATESMART +override FPCOPT+=-CX +endif +ifdef DEBUG +override FPCOPT+=-gl +override FPCOPTDEF+=DEBUG +endif +ifdef RELEASE +ifneq ($(findstring 2.0.,$(FPC_VERSION)),) +ifeq ($(CPU_TARGET),i386) +FPCCPUOPT:=-OG2p3 +endif +ifeq ($(CPU_TARGET),powerpc) +FPCCPUOPT:=-O1r +endif +else +FPCCPUOPT:=-O2 +endif +override FPCOPT+=-Ur -Xs $(FPCCPUOPT) -n +override FPCOPTDEF+=RELEASE +endif +ifdef STRIP +override FPCOPT+=-Xs +endif +ifdef OPTIMIZE +override FPCOPT+=-O2 +endif +ifdef VERBOSE +override FPCOPT+=-vwni +endif +ifdef COMPILER_OPTIONS +override FPCOPT+=$(COMPILER_OPTIONS) +endif +ifdef COMPILER_UNITDIR +override FPCOPT+=$(addprefix -Fu,$(COMPILER_UNITDIR)) +endif +ifdef COMPILER_LIBRARYDIR +override FPCOPT+=$(addprefix -Fl,$(COMPILER_LIBRARYDIR)) +endif +ifdef COMPILER_OBJECTDIR +override FPCOPT+=$(addprefix -Fo,$(COMPILER_OBJECTDIR)) +endif +ifdef COMPILER_INCLUDEDIR +override FPCOPT+=$(addprefix -Fi,$(COMPILER_INCLUDEDIR)) +endif +ifdef CROSSBINDIR +override FPCOPT+=-FD$(CROSSBINDIR) +endif +ifdef COMPILER_TARGETDIR +override FPCOPT+=-FE$(COMPILER_TARGETDIR) +ifeq ($(COMPILER_TARGETDIR),.) +override TARGETDIRPREFIX= +else +override TARGETDIRPREFIX=$(COMPILER_TARGETDIR)/ +endif +endif +ifdef COMPILER_UNITTARGETDIR +override FPCOPT+=-FU$(COMPILER_UNITTARGETDIR) +ifeq ($(COMPILER_UNITTARGETDIR),.) +override UNITTARGETDIRPREFIX= +else +override UNITTARGETDIRPREFIX=$(COMPILER_UNITTARGETDIR)/ +endif +else +ifdef COMPILER_TARGETDIR +override COMPILER_UNITTARGETDIR=$(COMPILER_TARGETDIR) +override UNITTARGETDIRPREFIX=$(TARGETDIRPREFIX) +endif +endif +ifdef CREATESHARED +override FPCOPT+=-Cg +ifeq ($(CPU_TARGET),i386) +override FPCOPT+=-Aas +endif +endif +ifeq ($(findstring 2.0.,$(FPC_VERSION)),) +ifeq ($(OS_TARGET),linux) +ifeq ($(CPU_TARGET),x86_64) +override FPCOPT+=-Cg +endif +endif +endif +ifdef LINKSHARED +endif +ifdef GCCLIBDIR +override FPCOPT+=-Fl$(GCCLIBDIR) +endif +ifdef OTHERLIBDIR +override FPCOPT+=$(addprefix -Fl,$(OTHERLIBDIR)) +endif +ifdef OPT +override FPCOPT+=$(OPT) +endif +ifdef FPCOPTDEF +override FPCOPT+=$(addprefix -d,$(FPCOPTDEF)) +endif +ifdef CFGFILE +override FPCOPT+=@$(CFGFILE) +endif +ifdef USEENV +override FPCEXTCMD:=$(FPCOPT) +override FPCOPT:=!FPCEXTCMD +export FPCEXTCMD +endif +override AFULL_TARGET=$(CPU_TARGET)-$(OS_TARGET) +override AFULL_SOURCE=$(CPU_SOURCE)-$(OS_SOURCE) +ifneq ($(AFULL_TARGET),$(AFULL_SOURCE)) +override ACROSSCOMPILE=1 +endif +ifdef ACROSSCOMPILE +override FPCOPT+=$(CROSSOPT) +endif +override COMPILER:=$(FPC) $(FPCOPT) +ifeq (,$(findstring -s ,$(COMPILER))) +EXECPPAS= +else +ifeq ($(FULL_SOURCE),$(FULL_TARGET)) +ifdef RUNBATCH +EXECPPAS:=@$(RUNBATCH) $(PPAS) +else +EXECPPAS:=@$(PPAS) +endif +endif +endif +ifdef TARGET_RSTS +override RSTFILES=$(addsuffix $(RSTEXT),$(TARGET_RSTS)) +override CLEANRSTFILES+=$(RSTFILES) +endif +.PHONY: fpc_clean fpc_cleanall fpc_distclean +ifdef EXEFILES +override CLEANEXEFILES:=$(addprefix $(TARGETDIRPREFIX),$(CLEANEXEFILES)) +endif +ifdef CLEAN_UNITS +override CLEANPPUFILES+=$(addsuffix $(PPUEXT),$(CLEAN_UNITS)) +endif +ifdef CLEANPPUFILES +override CLEANPPULINKFILES:=$(subst $(PPUEXT),$(OEXT),$(CLEANPPUFILES)) $(addprefix $(STATICLIBPREFIX),$(subst $(PPUEXT),$(STATICLIBEXT),$(CLEANPPUFILES))) $(addprefix $(IMPORTLIBPREFIX),$(subst $(PPUEXT),$(STATICLIBEXT),$(CLEANPPUFILES))) +ifdef DEBUGSYMEXT +override CLEANPPULINKFILES+=$(subst $(PPUEXT),$(DEBUGSYMEXT),$(CLEANPPUFILES)) +endif +override CLEANPPUFILES:=$(addprefix $(UNITTARGETDIRPREFIX),$(CLEANPPUFILES)) +override CLEANPPULINKFILES:=$(wildcard $(addprefix $(UNITTARGETDIRPREFIX),$(CLEANPPULINKFILES))) +endif +fpc_clean: $(CLEANTARGET) +ifdef CLEANEXEFILES + -$(DEL) $(CLEANEXEFILES) +endif +ifdef CLEANPPUFILES + -$(DEL) $(CLEANPPUFILES) +endif +ifneq ($(CLEANPPULINKFILES),) + -$(DEL) $(CLEANPPULINKFILES) +endif +ifdef CLEANRSTFILES + -$(DEL) $(addprefix $(UNITTARGETDIRPREFIX),$(CLEANRSTFILES)) +endif +ifdef CLEAN_FILES + -$(DEL) $(CLEAN_FILES) +endif +ifdef LIB_NAME + -$(DEL) $(LIB_NAME) $(LIB_FULLNAME) +endif + -$(DEL) $(FPCMADE) Package.fpc $(PPAS) script.res link.res $(FPCEXTFILE) $(REDIRFILE) + -$(DEL) *$(ASMEXT) *_ppas$(BATCHEXT) +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) *_ppas$(BATCHEXT) +ifdef AOUTEXT + -$(DEL) *$(AOUTEXT) +endif +ifdef DEBUGSYMEXT + -$(DEL) *$(DEBUGSYMEXT) +endif +fpc_distclean: cleanall +.PHONY: fpc_baseinfo +override INFORULES+=fpc_baseinfo +fpc_baseinfo: + @$(ECHO) + @$(ECHO) == Package info == + @$(ECHO) Package Name..... $(PACKAGE_NAME) + @$(ECHO) Package Version.. $(PACKAGE_VERSION) + @$(ECHO) + @$(ECHO) == Configuration info == + @$(ECHO) + @$(ECHO) FPC.......... $(FPC) + @$(ECHO) FPC Version.. $(FPC_VERSION) + @$(ECHO) Source CPU... $(CPU_SOURCE) + @$(ECHO) Target CPU... $(CPU_TARGET) + @$(ECHO) Source OS.... $(OS_SOURCE) + @$(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) + @$(ECHO) Required pkgs... $(REQUIRE_PACKAGES) + @$(ECHO) + @$(ECHO) Basedir......... $(BASEDIR) + @$(ECHO) FPCDir.......... $(FPCDIR) + @$(ECHO) CrossBinDir..... $(CROSSBINDIR) + @$(ECHO) UnitsDir........ $(UNITSDIR) + @$(ECHO) PackagesDir..... $(PACKAGESDIR) + @$(ECHO) + @$(ECHO) GCC library..... $(GCCLIBDIR) + @$(ECHO) Other library... $(OTHERLIBDIR) + @$(ECHO) + @$(ECHO) == Tools info == + @$(ECHO) + @$(ECHO) As........ $(AS) + @$(ECHO) Ld........ $(LD) + @$(ECHO) Ar........ $(AR) + @$(ECHO) Rc........ $(RC) + @$(ECHO) + @$(ECHO) Mv........ $(MVPROG) + @$(ECHO) Cp........ $(CPPROG) + @$(ECHO) Rm........ $(RMPROG) + @$(ECHO) GInstall.. $(GINSTALL) + @$(ECHO) Echo...... $(ECHO) + @$(ECHO) Shell..... $(SHELL) + @$(ECHO) Date...... $(DATE) + @$(ECHO) FPCMake... $(FPCMAKE) + @$(ECHO) PPUMove... $(PPUMOVE) + @$(ECHO) Upx....... $(UPXPROG) + @$(ECHO) Zip....... $(ZIPPROG) + @$(ECHO) + @$(ECHO) == Object info == + @$(ECHO) + @$(ECHO) Target Loaders........ $(TARGET_LOADERS) + @$(ECHO) Target Units.......... $(TARGET_UNITS) + @$(ECHO) Target Implicit Units. $(TARGET_IMPLICITUNITS) + @$(ECHO) Target Programs....... $(TARGET_PROGRAMS) + @$(ECHO) Target Dirs........... $(TARGET_DIRS) + @$(ECHO) Target Examples....... $(TARGET_EXAMPLES) + @$(ECHO) Target ExampleDirs.... $(TARGET_EXAMPLEDIRS) + @$(ECHO) + @$(ECHO) Clean Units......... $(CLEAN_UNITS) + @$(ECHO) Clean Files......... $(CLEAN_FILES) + @$(ECHO) + @$(ECHO) Install Units....... $(INSTALL_UNITS) + @$(ECHO) Install Files....... $(INSTALL_FILES) + @$(ECHO) + @$(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) + @$(ECHO) Install binary dir... $(INSTALL_BINDIR) + @$(ECHO) Install library dir.. $(INSTALL_LIBDIR) + @$(ECHO) Install units dir.... $(INSTALL_UNITDIR) + @$(ECHO) Install source dir... $(INSTALL_SOURCEDIR) + @$(ECHO) Install doc dir...... $(INSTALL_DOCDIR) + @$(ECHO) Install example dir.. $(INSTALL_EXAMPLEDIR) + @$(ECHO) Install data dir..... $(INSTALL_DATADIR) + @$(ECHO) + @$(ECHO) Dist destination dir. $(DIST_DESTDIR) + @$(ECHO) Dist zip name........ $(DIST_ZIPNAME) + @$(ECHO) +.PHONY: fpc_info +fpc_info: $(INFORULES) +.PHONY: fpc_makefile fpc_makefiles fpc_makefile_sub1 fpc_makefile_sub2 \ + fpc_makefile_dirs +fpc_makefile: + $(FPCMAKE) -w -T$(OS_TARGET) Makefile.fpc +fpc_makefile_sub1: +ifdef TARGET_DIRS + $(FPCMAKE) -w -T$(OS_TARGET) $(addsuffix /Makefile.fpc,$(TARGET_DIRS)) +endif +ifdef TARGET_EXAMPLEDIRS + $(FPCMAKE) -w -T$(OS_TARGET) $(addsuffix /Makefile.fpc,$(TARGET_EXAMPLEDIRS)) +endif +fpc_makefile_sub2: $(addsuffix _makefile_dirs,$(TARGET_DIRS) $(TARGET_EXAMPLEDIRS)) +fpc_makefile_dirs: fpc_makefile_sub1 fpc_makefile_sub2 +fpc_makefiles: fpc_makefile fpc_makefile_dirs +ifeq ($(FULL_TARGET),i386-linux) +TARGET_DIRS_HELLOWORLD=1 +TARGET_DIRS_HELLOWORLD2=1 +TARGET_DIRS_GTK_DEMO=1 +TARGET_DIRS_GETTINGSTARTED=1 +TARGET_DIRS_PLUGINS=1 +TARGET_DIRS_SCRIBBLE_SIMPLE=1 +TARGET_DIRS_GTKGLEXT=1 +endif +ifeq ($(FULL_TARGET),i386-go32v2) +TARGET_DIRS_HELLOWORLD=1 +TARGET_DIRS_HELLOWORLD2=1 +TARGET_DIRS_GTK_DEMO=1 +TARGET_DIRS_GETTINGSTARTED=1 +TARGET_DIRS_PLUGINS=1 +TARGET_DIRS_SCRIBBLE_SIMPLE=1 +TARGET_DIRS_GTKGLEXT=1 +endif +ifeq ($(FULL_TARGET),i386-win32) +TARGET_DIRS_HELLOWORLD=1 +TARGET_DIRS_HELLOWORLD2=1 +TARGET_DIRS_GTK_DEMO=1 +TARGET_DIRS_GETTINGSTARTED=1 +TARGET_DIRS_PLUGINS=1 +TARGET_DIRS_SCRIBBLE_SIMPLE=1 +TARGET_DIRS_GTKGLEXT=1 +endif +ifeq ($(FULL_TARGET),i386-os2) +TARGET_DIRS_HELLOWORLD=1 +TARGET_DIRS_HELLOWORLD2=1 +TARGET_DIRS_GTK_DEMO=1 +TARGET_DIRS_GETTINGSTARTED=1 +TARGET_DIRS_PLUGINS=1 +TARGET_DIRS_SCRIBBLE_SIMPLE=1 +TARGET_DIRS_GTKGLEXT=1 +endif +ifeq ($(FULL_TARGET),i386-freebsd) +TARGET_DIRS_HELLOWORLD=1 +TARGET_DIRS_HELLOWORLD2=1 +TARGET_DIRS_GTK_DEMO=1 +TARGET_DIRS_GETTINGSTARTED=1 +TARGET_DIRS_PLUGINS=1 +TARGET_DIRS_SCRIBBLE_SIMPLE=1 +TARGET_DIRS_GTKGLEXT=1 +endif +ifeq ($(FULL_TARGET),i386-beos) +TARGET_DIRS_HELLOWORLD=1 +TARGET_DIRS_HELLOWORLD2=1 +TARGET_DIRS_GTK_DEMO=1 +TARGET_DIRS_GETTINGSTARTED=1 +TARGET_DIRS_PLUGINS=1 +TARGET_DIRS_SCRIBBLE_SIMPLE=1 +TARGET_DIRS_GTKGLEXT=1 +endif +ifeq ($(FULL_TARGET),i386-netbsd) +TARGET_DIRS_HELLOWORLD=1 +TARGET_DIRS_HELLOWORLD2=1 +TARGET_DIRS_GTK_DEMO=1 +TARGET_DIRS_GETTINGSTARTED=1 +TARGET_DIRS_PLUGINS=1 +TARGET_DIRS_SCRIBBLE_SIMPLE=1 +TARGET_DIRS_GTKGLEXT=1 +endif +ifeq ($(FULL_TARGET),i386-solaris) +TARGET_DIRS_HELLOWORLD=1 +TARGET_DIRS_HELLOWORLD2=1 +TARGET_DIRS_GTK_DEMO=1 +TARGET_DIRS_GETTINGSTARTED=1 +TARGET_DIRS_PLUGINS=1 +TARGET_DIRS_SCRIBBLE_SIMPLE=1 +TARGET_DIRS_GTKGLEXT=1 +endif +ifeq ($(FULL_TARGET),i386-qnx) +TARGET_DIRS_HELLOWORLD=1 +TARGET_DIRS_HELLOWORLD2=1 +TARGET_DIRS_GTK_DEMO=1 +TARGET_DIRS_GETTINGSTARTED=1 +TARGET_DIRS_PLUGINS=1 +TARGET_DIRS_SCRIBBLE_SIMPLE=1 +TARGET_DIRS_GTKGLEXT=1 +endif +ifeq ($(FULL_TARGET),i386-netware) +TARGET_DIRS_HELLOWORLD=1 +TARGET_DIRS_HELLOWORLD2=1 +TARGET_DIRS_GTK_DEMO=1 +TARGET_DIRS_GETTINGSTARTED=1 +TARGET_DIRS_PLUGINS=1 +TARGET_DIRS_SCRIBBLE_SIMPLE=1 +TARGET_DIRS_GTKGLEXT=1 +endif +ifeq ($(FULL_TARGET),i386-openbsd) +TARGET_DIRS_HELLOWORLD=1 +TARGET_DIRS_HELLOWORLD2=1 +TARGET_DIRS_GTK_DEMO=1 +TARGET_DIRS_GETTINGSTARTED=1 +TARGET_DIRS_PLUGINS=1 +TARGET_DIRS_SCRIBBLE_SIMPLE=1 +TARGET_DIRS_GTKGLEXT=1 +endif +ifeq ($(FULL_TARGET),i386-wdosx) +TARGET_DIRS_HELLOWORLD=1 +TARGET_DIRS_HELLOWORLD2=1 +TARGET_DIRS_GTK_DEMO=1 +TARGET_DIRS_GETTINGSTARTED=1 +TARGET_DIRS_PLUGINS=1 +TARGET_DIRS_SCRIBBLE_SIMPLE=1 +TARGET_DIRS_GTKGLEXT=1 +endif +ifeq ($(FULL_TARGET),i386-darwin) +TARGET_DIRS_HELLOWORLD=1 +TARGET_DIRS_HELLOWORLD2=1 +TARGET_DIRS_GTK_DEMO=1 +TARGET_DIRS_GETTINGSTARTED=1 +TARGET_DIRS_PLUGINS=1 +TARGET_DIRS_SCRIBBLE_SIMPLE=1 +TARGET_DIRS_GTKGLEXT=1 +endif +ifeq ($(FULL_TARGET),i386-emx) +TARGET_DIRS_HELLOWORLD=1 +TARGET_DIRS_HELLOWORLD2=1 +TARGET_DIRS_GTK_DEMO=1 +TARGET_DIRS_GETTINGSTARTED=1 +TARGET_DIRS_PLUGINS=1 +TARGET_DIRS_SCRIBBLE_SIMPLE=1 +TARGET_DIRS_GTKGLEXT=1 +endif +ifeq ($(FULL_TARGET),i386-watcom) +TARGET_DIRS_HELLOWORLD=1 +TARGET_DIRS_HELLOWORLD2=1 +TARGET_DIRS_GTK_DEMO=1 +TARGET_DIRS_GETTINGSTARTED=1 +TARGET_DIRS_PLUGINS=1 +TARGET_DIRS_SCRIBBLE_SIMPLE=1 +TARGET_DIRS_GTKGLEXT=1 +endif +ifeq ($(FULL_TARGET),i386-netwlibc) +TARGET_DIRS_HELLOWORLD=1 +TARGET_DIRS_HELLOWORLD2=1 +TARGET_DIRS_GTK_DEMO=1 +TARGET_DIRS_GETTINGSTARTED=1 +TARGET_DIRS_PLUGINS=1 +TARGET_DIRS_SCRIBBLE_SIMPLE=1 +TARGET_DIRS_GTKGLEXT=1 +endif +ifeq ($(FULL_TARGET),i386-wince) +TARGET_DIRS_HELLOWORLD=1 +TARGET_DIRS_HELLOWORLD2=1 +TARGET_DIRS_GTK_DEMO=1 +TARGET_DIRS_GETTINGSTARTED=1 +TARGET_DIRS_PLUGINS=1 +TARGET_DIRS_SCRIBBLE_SIMPLE=1 +TARGET_DIRS_GTKGLEXT=1 +endif +ifeq ($(FULL_TARGET),i386-embedded) +TARGET_DIRS_HELLOWORLD=1 +TARGET_DIRS_HELLOWORLD2=1 +TARGET_DIRS_GTK_DEMO=1 +TARGET_DIRS_GETTINGSTARTED=1 +TARGET_DIRS_PLUGINS=1 +TARGET_DIRS_SCRIBBLE_SIMPLE=1 +TARGET_DIRS_GTKGLEXT=1 +endif +ifeq ($(FULL_TARGET),i386-symbian) +TARGET_DIRS_HELLOWORLD=1 +TARGET_DIRS_HELLOWORLD2=1 +TARGET_DIRS_GTK_DEMO=1 +TARGET_DIRS_GETTINGSTARTED=1 +TARGET_DIRS_PLUGINS=1 +TARGET_DIRS_SCRIBBLE_SIMPLE=1 +TARGET_DIRS_GTKGLEXT=1 +endif +ifeq ($(FULL_TARGET),m68k-linux) +TARGET_DIRS_HELLOWORLD=1 +TARGET_DIRS_HELLOWORLD2=1 +TARGET_DIRS_GTK_DEMO=1 +TARGET_DIRS_GETTINGSTARTED=1 +TARGET_DIRS_PLUGINS=1 +TARGET_DIRS_SCRIBBLE_SIMPLE=1 +TARGET_DIRS_GTKGLEXT=1 +endif +ifeq ($(FULL_TARGET),m68k-freebsd) +TARGET_DIRS_HELLOWORLD=1 +TARGET_DIRS_HELLOWORLD2=1 +TARGET_DIRS_GTK_DEMO=1 +TARGET_DIRS_GETTINGSTARTED=1 +TARGET_DIRS_PLUGINS=1 +TARGET_DIRS_SCRIBBLE_SIMPLE=1 +TARGET_DIRS_GTKGLEXT=1 +endif +ifeq ($(FULL_TARGET),m68k-netbsd) +TARGET_DIRS_HELLOWORLD=1 +TARGET_DIRS_HELLOWORLD2=1 +TARGET_DIRS_GTK_DEMO=1 +TARGET_DIRS_GETTINGSTARTED=1 +TARGET_DIRS_PLUGINS=1 +TARGET_DIRS_SCRIBBLE_SIMPLE=1 +TARGET_DIRS_GTKGLEXT=1 +endif +ifeq ($(FULL_TARGET),m68k-amiga) +TARGET_DIRS_HELLOWORLD=1 +TARGET_DIRS_HELLOWORLD2=1 +TARGET_DIRS_GTK_DEMO=1 +TARGET_DIRS_GETTINGSTARTED=1 +TARGET_DIRS_PLUGINS=1 +TARGET_DIRS_SCRIBBLE_SIMPLE=1 +TARGET_DIRS_GTKGLEXT=1 +endif +ifeq ($(FULL_TARGET),m68k-atari) +TARGET_DIRS_HELLOWORLD=1 +TARGET_DIRS_HELLOWORLD2=1 +TARGET_DIRS_GTK_DEMO=1 +TARGET_DIRS_GETTINGSTARTED=1 +TARGET_DIRS_PLUGINS=1 +TARGET_DIRS_SCRIBBLE_SIMPLE=1 +TARGET_DIRS_GTKGLEXT=1 +endif +ifeq ($(FULL_TARGET),m68k-openbsd) +TARGET_DIRS_HELLOWORLD=1 +TARGET_DIRS_HELLOWORLD2=1 +TARGET_DIRS_GTK_DEMO=1 +TARGET_DIRS_GETTINGSTARTED=1 +TARGET_DIRS_PLUGINS=1 +TARGET_DIRS_SCRIBBLE_SIMPLE=1 +TARGET_DIRS_GTKGLEXT=1 +endif +ifeq ($(FULL_TARGET),m68k-palmos) +TARGET_DIRS_HELLOWORLD=1 +TARGET_DIRS_HELLOWORLD2=1 +TARGET_DIRS_GTK_DEMO=1 +TARGET_DIRS_GETTINGSTARTED=1 +TARGET_DIRS_PLUGINS=1 +TARGET_DIRS_SCRIBBLE_SIMPLE=1 +TARGET_DIRS_GTKGLEXT=1 +endif +ifeq ($(FULL_TARGET),m68k-embedded) +TARGET_DIRS_HELLOWORLD=1 +TARGET_DIRS_HELLOWORLD2=1 +TARGET_DIRS_GTK_DEMO=1 +TARGET_DIRS_GETTINGSTARTED=1 +TARGET_DIRS_PLUGINS=1 +TARGET_DIRS_SCRIBBLE_SIMPLE=1 +TARGET_DIRS_GTKGLEXT=1 +endif +ifeq ($(FULL_TARGET),powerpc-linux) +TARGET_DIRS_HELLOWORLD=1 +TARGET_DIRS_HELLOWORLD2=1 +TARGET_DIRS_GTK_DEMO=1 +TARGET_DIRS_GETTINGSTARTED=1 +TARGET_DIRS_PLUGINS=1 +TARGET_DIRS_SCRIBBLE_SIMPLE=1 +TARGET_DIRS_GTKGLEXT=1 +endif +ifeq ($(FULL_TARGET),powerpc-netbsd) +TARGET_DIRS_HELLOWORLD=1 +TARGET_DIRS_HELLOWORLD2=1 +TARGET_DIRS_GTK_DEMO=1 +TARGET_DIRS_GETTINGSTARTED=1 +TARGET_DIRS_PLUGINS=1 +TARGET_DIRS_SCRIBBLE_SIMPLE=1 +TARGET_DIRS_GTKGLEXT=1 +endif +ifeq ($(FULL_TARGET),powerpc-amiga) +TARGET_DIRS_HELLOWORLD=1 +TARGET_DIRS_HELLOWORLD2=1 +TARGET_DIRS_GTK_DEMO=1 +TARGET_DIRS_GETTINGSTARTED=1 +TARGET_DIRS_PLUGINS=1 +TARGET_DIRS_SCRIBBLE_SIMPLE=1 +TARGET_DIRS_GTKGLEXT=1 +endif +ifeq ($(FULL_TARGET),powerpc-macos) +TARGET_DIRS_HELLOWORLD=1 +TARGET_DIRS_HELLOWORLD2=1 +TARGET_DIRS_GTK_DEMO=1 +TARGET_DIRS_GETTINGSTARTED=1 +TARGET_DIRS_PLUGINS=1 +TARGET_DIRS_SCRIBBLE_SIMPLE=1 +TARGET_DIRS_GTKGLEXT=1 +endif +ifeq ($(FULL_TARGET),powerpc-darwin) +TARGET_DIRS_HELLOWORLD=1 +TARGET_DIRS_HELLOWORLD2=1 +TARGET_DIRS_GTK_DEMO=1 +TARGET_DIRS_GETTINGSTARTED=1 +TARGET_DIRS_PLUGINS=1 +TARGET_DIRS_SCRIBBLE_SIMPLE=1 +TARGET_DIRS_GTKGLEXT=1 +endif +ifeq ($(FULL_TARGET),powerpc-morphos) +TARGET_DIRS_HELLOWORLD=1 +TARGET_DIRS_HELLOWORLD2=1 +TARGET_DIRS_GTK_DEMO=1 +TARGET_DIRS_GETTINGSTARTED=1 +TARGET_DIRS_PLUGINS=1 +TARGET_DIRS_SCRIBBLE_SIMPLE=1 +TARGET_DIRS_GTKGLEXT=1 +endif +ifeq ($(FULL_TARGET),powerpc-embedded) +TARGET_DIRS_HELLOWORLD=1 +TARGET_DIRS_HELLOWORLD2=1 +TARGET_DIRS_GTK_DEMO=1 +TARGET_DIRS_GETTINGSTARTED=1 +TARGET_DIRS_PLUGINS=1 +TARGET_DIRS_SCRIBBLE_SIMPLE=1 +TARGET_DIRS_GTKGLEXT=1 +endif +ifeq ($(FULL_TARGET),sparc-linux) +TARGET_DIRS_HELLOWORLD=1 +TARGET_DIRS_HELLOWORLD2=1 +TARGET_DIRS_GTK_DEMO=1 +TARGET_DIRS_GETTINGSTARTED=1 +TARGET_DIRS_PLUGINS=1 +TARGET_DIRS_SCRIBBLE_SIMPLE=1 +TARGET_DIRS_GTKGLEXT=1 +endif +ifeq ($(FULL_TARGET),sparc-netbsd) +TARGET_DIRS_HELLOWORLD=1 +TARGET_DIRS_HELLOWORLD2=1 +TARGET_DIRS_GTK_DEMO=1 +TARGET_DIRS_GETTINGSTARTED=1 +TARGET_DIRS_PLUGINS=1 +TARGET_DIRS_SCRIBBLE_SIMPLE=1 +TARGET_DIRS_GTKGLEXT=1 +endif +ifeq ($(FULL_TARGET),sparc-solaris) +TARGET_DIRS_HELLOWORLD=1 +TARGET_DIRS_HELLOWORLD2=1 +TARGET_DIRS_GTK_DEMO=1 +TARGET_DIRS_GETTINGSTARTED=1 +TARGET_DIRS_PLUGINS=1 +TARGET_DIRS_SCRIBBLE_SIMPLE=1 +TARGET_DIRS_GTKGLEXT=1 +endif +ifeq ($(FULL_TARGET),sparc-embedded) +TARGET_DIRS_HELLOWORLD=1 +TARGET_DIRS_HELLOWORLD2=1 +TARGET_DIRS_GTK_DEMO=1 +TARGET_DIRS_GETTINGSTARTED=1 +TARGET_DIRS_PLUGINS=1 +TARGET_DIRS_SCRIBBLE_SIMPLE=1 +TARGET_DIRS_GTKGLEXT=1 +endif +ifeq ($(FULL_TARGET),x86_64-linux) +TARGET_DIRS_HELLOWORLD=1 +TARGET_DIRS_HELLOWORLD2=1 +TARGET_DIRS_GTK_DEMO=1 +TARGET_DIRS_GETTINGSTARTED=1 +TARGET_DIRS_PLUGINS=1 +TARGET_DIRS_SCRIBBLE_SIMPLE=1 +TARGET_DIRS_GTKGLEXT=1 +endif +ifeq ($(FULL_TARGET),x86_64-freebsd) +TARGET_DIRS_HELLOWORLD=1 +TARGET_DIRS_HELLOWORLD2=1 +TARGET_DIRS_GTK_DEMO=1 +TARGET_DIRS_GETTINGSTARTED=1 +TARGET_DIRS_PLUGINS=1 +TARGET_DIRS_SCRIBBLE_SIMPLE=1 +TARGET_DIRS_GTKGLEXT=1 +endif +ifeq ($(FULL_TARGET),x86_64-darwin) +TARGET_DIRS_HELLOWORLD=1 +TARGET_DIRS_HELLOWORLD2=1 +TARGET_DIRS_GTK_DEMO=1 +TARGET_DIRS_GETTINGSTARTED=1 +TARGET_DIRS_PLUGINS=1 +TARGET_DIRS_SCRIBBLE_SIMPLE=1 +TARGET_DIRS_GTKGLEXT=1 +endif +ifeq ($(FULL_TARGET),x86_64-win64) +TARGET_DIRS_HELLOWORLD=1 +TARGET_DIRS_HELLOWORLD2=1 +TARGET_DIRS_GTK_DEMO=1 +TARGET_DIRS_GETTINGSTARTED=1 +TARGET_DIRS_PLUGINS=1 +TARGET_DIRS_SCRIBBLE_SIMPLE=1 +TARGET_DIRS_GTKGLEXT=1 +endif +ifeq ($(FULL_TARGET),x86_64-embedded) +TARGET_DIRS_HELLOWORLD=1 +TARGET_DIRS_HELLOWORLD2=1 +TARGET_DIRS_GTK_DEMO=1 +TARGET_DIRS_GETTINGSTARTED=1 +TARGET_DIRS_PLUGINS=1 +TARGET_DIRS_SCRIBBLE_SIMPLE=1 +TARGET_DIRS_GTKGLEXT=1 +endif +ifeq ($(FULL_TARGET),arm-linux) +TARGET_DIRS_HELLOWORLD=1 +TARGET_DIRS_HELLOWORLD2=1 +TARGET_DIRS_GTK_DEMO=1 +TARGET_DIRS_GETTINGSTARTED=1 +TARGET_DIRS_PLUGINS=1 +TARGET_DIRS_SCRIBBLE_SIMPLE=1 +TARGET_DIRS_GTKGLEXT=1 +endif +ifeq ($(FULL_TARGET),arm-palmos) +TARGET_DIRS_HELLOWORLD=1 +TARGET_DIRS_HELLOWORLD2=1 +TARGET_DIRS_GTK_DEMO=1 +TARGET_DIRS_GETTINGSTARTED=1 +TARGET_DIRS_PLUGINS=1 +TARGET_DIRS_SCRIBBLE_SIMPLE=1 +TARGET_DIRS_GTKGLEXT=1 +endif +ifeq ($(FULL_TARGET),arm-wince) +TARGET_DIRS_HELLOWORLD=1 +TARGET_DIRS_HELLOWORLD2=1 +TARGET_DIRS_GTK_DEMO=1 +TARGET_DIRS_GETTINGSTARTED=1 +TARGET_DIRS_PLUGINS=1 +TARGET_DIRS_SCRIBBLE_SIMPLE=1 +TARGET_DIRS_GTKGLEXT=1 +endif +ifeq ($(FULL_TARGET),arm-gba) +TARGET_DIRS_HELLOWORLD=1 +TARGET_DIRS_HELLOWORLD2=1 +TARGET_DIRS_GTK_DEMO=1 +TARGET_DIRS_GETTINGSTARTED=1 +TARGET_DIRS_PLUGINS=1 +TARGET_DIRS_SCRIBBLE_SIMPLE=1 +TARGET_DIRS_GTKGLEXT=1 +endif +ifeq ($(FULL_TARGET),arm-nds) +TARGET_DIRS_HELLOWORLD=1 +TARGET_DIRS_HELLOWORLD2=1 +TARGET_DIRS_GTK_DEMO=1 +TARGET_DIRS_GETTINGSTARTED=1 +TARGET_DIRS_PLUGINS=1 +TARGET_DIRS_SCRIBBLE_SIMPLE=1 +TARGET_DIRS_GTKGLEXT=1 +endif +ifeq ($(FULL_TARGET),arm-embedded) +TARGET_DIRS_HELLOWORLD=1 +TARGET_DIRS_HELLOWORLD2=1 +TARGET_DIRS_GTK_DEMO=1 +TARGET_DIRS_GETTINGSTARTED=1 +TARGET_DIRS_PLUGINS=1 +TARGET_DIRS_SCRIBBLE_SIMPLE=1 +TARGET_DIRS_GTKGLEXT=1 +endif +ifeq ($(FULL_TARGET),arm-symbian) +TARGET_DIRS_HELLOWORLD=1 +TARGET_DIRS_HELLOWORLD2=1 +TARGET_DIRS_GTK_DEMO=1 +TARGET_DIRS_GETTINGSTARTED=1 +TARGET_DIRS_PLUGINS=1 +TARGET_DIRS_SCRIBBLE_SIMPLE=1 +TARGET_DIRS_GTKGLEXT=1 +endif +ifeq ($(FULL_TARGET),powerpc64-linux) +TARGET_DIRS_HELLOWORLD=1 +TARGET_DIRS_HELLOWORLD2=1 +TARGET_DIRS_GTK_DEMO=1 +TARGET_DIRS_GETTINGSTARTED=1 +TARGET_DIRS_PLUGINS=1 +TARGET_DIRS_SCRIBBLE_SIMPLE=1 +TARGET_DIRS_GTKGLEXT=1 +endif +ifeq ($(FULL_TARGET),powerpc64-darwin) +TARGET_DIRS_HELLOWORLD=1 +TARGET_DIRS_HELLOWORLD2=1 +TARGET_DIRS_GTK_DEMO=1 +TARGET_DIRS_GETTINGSTARTED=1 +TARGET_DIRS_PLUGINS=1 +TARGET_DIRS_SCRIBBLE_SIMPLE=1 +TARGET_DIRS_GTKGLEXT=1 +endif +ifeq ($(FULL_TARGET),powerpc64-embedded) +TARGET_DIRS_HELLOWORLD=1 +TARGET_DIRS_HELLOWORLD2=1 +TARGET_DIRS_GTK_DEMO=1 +TARGET_DIRS_GETTINGSTARTED=1 +TARGET_DIRS_PLUGINS=1 +TARGET_DIRS_SCRIBBLE_SIMPLE=1 +TARGET_DIRS_GTKGLEXT=1 +endif +ifdef TARGET_DIRS_HELLOWORLD +helloworld_all: + $(MAKE) -C helloworld all +helloworld_debug: + $(MAKE) -C helloworld debug +helloworld_smart: + $(MAKE) -C helloworld smart +helloworld_release: + $(MAKE) -C helloworld release +helloworld_units: + $(MAKE) -C helloworld units +helloworld_examples: + $(MAKE) -C helloworld examples +helloworld_shared: + $(MAKE) -C helloworld shared +helloworld_install: + $(MAKE) -C helloworld install +helloworld_sourceinstall: + $(MAKE) -C helloworld sourceinstall +helloworld_exampleinstall: + $(MAKE) -C helloworld exampleinstall +helloworld_distinstall: + $(MAKE) -C helloworld distinstall +helloworld_zipinstall: + $(MAKE) -C helloworld zipinstall +helloworld_zipsourceinstall: + $(MAKE) -C helloworld zipsourceinstall +helloworld_zipexampleinstall: + $(MAKE) -C helloworld zipexampleinstall +helloworld_zipdistinstall: + $(MAKE) -C helloworld zipdistinstall +helloworld_clean: + $(MAKE) -C helloworld clean +helloworld_distclean: + $(MAKE) -C helloworld distclean +helloworld_cleanall: + $(MAKE) -C helloworld cleanall +helloworld_info: + $(MAKE) -C helloworld info +helloworld_makefiles: + $(MAKE) -C helloworld makefiles +helloworld: + $(MAKE) -C helloworld all +.PHONY: helloworld_all helloworld_debug helloworld_smart helloworld_release helloworld_units helloworld_examples helloworld_shared helloworld_install helloworld_sourceinstall helloworld_exampleinstall helloworld_distinstall helloworld_zipinstall helloworld_zipsourceinstall helloworld_zipexampleinstall helloworld_zipdistinstall helloworld_clean helloworld_distclean helloworld_cleanall helloworld_info helloworld_makefiles helloworld +endif +ifdef TARGET_DIRS_HELLOWORLD2 +helloworld2_all: + $(MAKE) -C helloworld2 all +helloworld2_debug: + $(MAKE) -C helloworld2 debug +helloworld2_smart: + $(MAKE) -C helloworld2 smart +helloworld2_release: + $(MAKE) -C helloworld2 release +helloworld2_units: + $(MAKE) -C helloworld2 units +helloworld2_examples: + $(MAKE) -C helloworld2 examples +helloworld2_shared: + $(MAKE) -C helloworld2 shared +helloworld2_install: + $(MAKE) -C helloworld2 install +helloworld2_sourceinstall: + $(MAKE) -C helloworld2 sourceinstall +helloworld2_exampleinstall: + $(MAKE) -C helloworld2 exampleinstall +helloworld2_distinstall: + $(MAKE) -C helloworld2 distinstall +helloworld2_zipinstall: + $(MAKE) -C helloworld2 zipinstall +helloworld2_zipsourceinstall: + $(MAKE) -C helloworld2 zipsourceinstall +helloworld2_zipexampleinstall: + $(MAKE) -C helloworld2 zipexampleinstall +helloworld2_zipdistinstall: + $(MAKE) -C helloworld2 zipdistinstall +helloworld2_clean: + $(MAKE) -C helloworld2 clean +helloworld2_distclean: + $(MAKE) -C helloworld2 distclean +helloworld2_cleanall: + $(MAKE) -C helloworld2 cleanall +helloworld2_info: + $(MAKE) -C helloworld2 info +helloworld2_makefiles: + $(MAKE) -C helloworld2 makefiles +helloworld2: + $(MAKE) -C helloworld2 all +.PHONY: helloworld2_all helloworld2_debug helloworld2_smart helloworld2_release helloworld2_units helloworld2_examples helloworld2_shared helloworld2_install helloworld2_sourceinstall helloworld2_exampleinstall helloworld2_distinstall helloworld2_zipinstall helloworld2_zipsourceinstall helloworld2_zipexampleinstall helloworld2_zipdistinstall helloworld2_clean helloworld2_distclean helloworld2_cleanall helloworld2_info helloworld2_makefiles helloworld2 +endif +ifdef TARGET_DIRS_GTK_DEMO +gtk_demo_all: + $(MAKE) -C gtk_demo all +gtk_demo_debug: + $(MAKE) -C gtk_demo debug +gtk_demo_smart: + $(MAKE) -C gtk_demo smart +gtk_demo_release: + $(MAKE) -C gtk_demo release +gtk_demo_units: + $(MAKE) -C gtk_demo units +gtk_demo_examples: + $(MAKE) -C gtk_demo examples +gtk_demo_shared: + $(MAKE) -C gtk_demo shared +gtk_demo_install: + $(MAKE) -C gtk_demo install +gtk_demo_sourceinstall: + $(MAKE) -C gtk_demo sourceinstall +gtk_demo_exampleinstall: + $(MAKE) -C gtk_demo exampleinstall +gtk_demo_distinstall: + $(MAKE) -C gtk_demo distinstall +gtk_demo_zipinstall: + $(MAKE) -C gtk_demo zipinstall +gtk_demo_zipsourceinstall: + $(MAKE) -C gtk_demo zipsourceinstall +gtk_demo_zipexampleinstall: + $(MAKE) -C gtk_demo zipexampleinstall +gtk_demo_zipdistinstall: + $(MAKE) -C gtk_demo zipdistinstall +gtk_demo_clean: + $(MAKE) -C gtk_demo clean +gtk_demo_distclean: + $(MAKE) -C gtk_demo distclean +gtk_demo_cleanall: + $(MAKE) -C gtk_demo cleanall +gtk_demo_info: + $(MAKE) -C gtk_demo info +gtk_demo_makefiles: + $(MAKE) -C gtk_demo makefiles +gtk_demo: + $(MAKE) -C gtk_demo all +.PHONY: gtk_demo_all gtk_demo_debug gtk_demo_smart gtk_demo_release gtk_demo_units gtk_demo_examples gtk_demo_shared gtk_demo_install gtk_demo_sourceinstall gtk_demo_exampleinstall gtk_demo_distinstall gtk_demo_zipinstall gtk_demo_zipsourceinstall gtk_demo_zipexampleinstall gtk_demo_zipdistinstall gtk_demo_clean gtk_demo_distclean gtk_demo_cleanall gtk_demo_info gtk_demo_makefiles gtk_demo +endif +ifdef TARGET_DIRS_GETTINGSTARTED +gettingstarted_all: + $(MAKE) -C gettingstarted all +gettingstarted_debug: + $(MAKE) -C gettingstarted debug +gettingstarted_smart: + $(MAKE) -C gettingstarted smart +gettingstarted_release: + $(MAKE) -C gettingstarted release +gettingstarted_units: + $(MAKE) -C gettingstarted units +gettingstarted_examples: + $(MAKE) -C gettingstarted examples +gettingstarted_shared: + $(MAKE) -C gettingstarted shared +gettingstarted_install: + $(MAKE) -C gettingstarted install +gettingstarted_sourceinstall: + $(MAKE) -C gettingstarted sourceinstall +gettingstarted_exampleinstall: + $(MAKE) -C gettingstarted exampleinstall +gettingstarted_distinstall: + $(MAKE) -C gettingstarted distinstall +gettingstarted_zipinstall: + $(MAKE) -C gettingstarted zipinstall +gettingstarted_zipsourceinstall: + $(MAKE) -C gettingstarted zipsourceinstall +gettingstarted_zipexampleinstall: + $(MAKE) -C gettingstarted zipexampleinstall +gettingstarted_zipdistinstall: + $(MAKE) -C gettingstarted zipdistinstall +gettingstarted_clean: + $(MAKE) -C gettingstarted clean +gettingstarted_distclean: + $(MAKE) -C gettingstarted distclean +gettingstarted_cleanall: + $(MAKE) -C gettingstarted cleanall +gettingstarted_info: + $(MAKE) -C gettingstarted info +gettingstarted_makefiles: + $(MAKE) -C gettingstarted makefiles +gettingstarted: + $(MAKE) -C gettingstarted all +.PHONY: gettingstarted_all gettingstarted_debug gettingstarted_smart gettingstarted_release gettingstarted_units gettingstarted_examples gettingstarted_shared gettingstarted_install gettingstarted_sourceinstall gettingstarted_exampleinstall gettingstarted_distinstall gettingstarted_zipinstall gettingstarted_zipsourceinstall gettingstarted_zipexampleinstall gettingstarted_zipdistinstall gettingstarted_clean gettingstarted_distclean gettingstarted_cleanall gettingstarted_info gettingstarted_makefiles gettingstarted +endif +ifdef TARGET_DIRS_PLUGINS +plugins_all: + $(MAKE) -C plugins all +plugins_debug: + $(MAKE) -C plugins debug +plugins_smart: + $(MAKE) -C plugins smart +plugins_release: + $(MAKE) -C plugins release +plugins_units: + $(MAKE) -C plugins units +plugins_examples: + $(MAKE) -C plugins examples +plugins_shared: + $(MAKE) -C plugins shared +plugins_install: + $(MAKE) -C plugins install +plugins_sourceinstall: + $(MAKE) -C plugins sourceinstall +plugins_exampleinstall: + $(MAKE) -C plugins exampleinstall +plugins_distinstall: + $(MAKE) -C plugins distinstall +plugins_zipinstall: + $(MAKE) -C plugins zipinstall +plugins_zipsourceinstall: + $(MAKE) -C plugins zipsourceinstall +plugins_zipexampleinstall: + $(MAKE) -C plugins zipexampleinstall +plugins_zipdistinstall: + $(MAKE) -C plugins zipdistinstall +plugins_clean: + $(MAKE) -C plugins clean +plugins_distclean: + $(MAKE) -C plugins distclean +plugins_cleanall: + $(MAKE) -C plugins cleanall +plugins_info: + $(MAKE) -C plugins info +plugins_makefiles: + $(MAKE) -C plugins makefiles +plugins: + $(MAKE) -C plugins all +.PHONY: plugins_all plugins_debug plugins_smart plugins_release plugins_units plugins_examples plugins_shared plugins_install plugins_sourceinstall plugins_exampleinstall plugins_distinstall plugins_zipinstall plugins_zipsourceinstall plugins_zipexampleinstall plugins_zipdistinstall plugins_clean plugins_distclean plugins_cleanall plugins_info plugins_makefiles plugins +endif +ifdef TARGET_DIRS_SCRIBBLE_SIMPLE +scribble_simple_all: + $(MAKE) -C scribble_simple all +scribble_simple_debug: + $(MAKE) -C scribble_simple debug +scribble_simple_smart: + $(MAKE) -C scribble_simple smart +scribble_simple_release: + $(MAKE) -C scribble_simple release +scribble_simple_units: + $(MAKE) -C scribble_simple units +scribble_simple_examples: + $(MAKE) -C scribble_simple examples +scribble_simple_shared: + $(MAKE) -C scribble_simple shared +scribble_simple_install: + $(MAKE) -C scribble_simple install +scribble_simple_sourceinstall: + $(MAKE) -C scribble_simple sourceinstall +scribble_simple_exampleinstall: + $(MAKE) -C scribble_simple exampleinstall +scribble_simple_distinstall: + $(MAKE) -C scribble_simple distinstall +scribble_simple_zipinstall: + $(MAKE) -C scribble_simple zipinstall +scribble_simple_zipsourceinstall: + $(MAKE) -C scribble_simple zipsourceinstall +scribble_simple_zipexampleinstall: + $(MAKE) -C scribble_simple zipexampleinstall +scribble_simple_zipdistinstall: + $(MAKE) -C scribble_simple zipdistinstall +scribble_simple_clean: + $(MAKE) -C scribble_simple clean +scribble_simple_distclean: + $(MAKE) -C scribble_simple distclean +scribble_simple_cleanall: + $(MAKE) -C scribble_simple cleanall +scribble_simple_info: + $(MAKE) -C scribble_simple info +scribble_simple_makefiles: + $(MAKE) -C scribble_simple makefiles +scribble_simple: + $(MAKE) -C scribble_simple all +.PHONY: scribble_simple_all scribble_simple_debug scribble_simple_smart scribble_simple_release scribble_simple_units scribble_simple_examples scribble_simple_shared scribble_simple_install scribble_simple_sourceinstall scribble_simple_exampleinstall scribble_simple_distinstall scribble_simple_zipinstall scribble_simple_zipsourceinstall scribble_simple_zipexampleinstall scribble_simple_zipdistinstall scribble_simple_clean scribble_simple_distclean scribble_simple_cleanall scribble_simple_info scribble_simple_makefiles scribble_simple +endif +ifdef TARGET_DIRS_GTKGLEXT +gtkglext_all: + $(MAKE) -C gtkglext all +gtkglext_debug: + $(MAKE) -C gtkglext debug +gtkglext_smart: + $(MAKE) -C gtkglext smart +gtkglext_release: + $(MAKE) -C gtkglext release +gtkglext_units: + $(MAKE) -C gtkglext units +gtkglext_examples: + $(MAKE) -C gtkglext examples +gtkglext_shared: + $(MAKE) -C gtkglext shared +gtkglext_install: + $(MAKE) -C gtkglext install +gtkglext_sourceinstall: + $(MAKE) -C gtkglext sourceinstall +gtkglext_exampleinstall: + $(MAKE) -C gtkglext exampleinstall +gtkglext_distinstall: + $(MAKE) -C gtkglext distinstall +gtkglext_zipinstall: + $(MAKE) -C gtkglext zipinstall +gtkglext_zipsourceinstall: + $(MAKE) -C gtkglext zipsourceinstall +gtkglext_zipexampleinstall: + $(MAKE) -C gtkglext zipexampleinstall +gtkglext_zipdistinstall: + $(MAKE) -C gtkglext zipdistinstall +gtkglext_clean: + $(MAKE) -C gtkglext clean +gtkglext_distclean: + $(MAKE) -C gtkglext distclean +gtkglext_cleanall: + $(MAKE) -C gtkglext cleanall +gtkglext_info: + $(MAKE) -C gtkglext info +gtkglext_makefiles: + $(MAKE) -C gtkglext makefiles +gtkglext: + $(MAKE) -C gtkglext all +.PHONY: gtkglext_all gtkglext_debug gtkglext_smart gtkglext_release gtkglext_units gtkglext_examples gtkglext_shared gtkglext_install gtkglext_sourceinstall gtkglext_exampleinstall gtkglext_distinstall gtkglext_zipinstall gtkglext_zipsourceinstall gtkglext_zipexampleinstall gtkglext_zipdistinstall gtkglext_clean gtkglext_distclean gtkglext_cleanall gtkglext_info gtkglext_makefiles gtkglext +endif +all: $(addsuffix _all,$(TARGET_DIRS)) +debug: $(addsuffix _debug,$(TARGET_DIRS)) +smart: $(addsuffix _smart,$(TARGET_DIRS)) +release: $(addsuffix _release,$(TARGET_DIRS)) +units: $(addsuffix _units,$(TARGET_DIRS)) +examples: $(addsuffix _examples,$(TARGET_DIRS)) +shared: $(addsuffix _shared,$(TARGET_DIRS)) +install: $(addsuffix _install,$(TARGET_DIRS)) +sourceinstall: $(addsuffix _sourceinstall,$(TARGET_DIRS)) +exampleinstall: $(addsuffix _exampleinstall,$(TARGET_DIRS)) +distinstall: $(addsuffix _distinstall,$(TARGET_DIRS)) +zipinstall: $(addsuffix _zipinstall,$(TARGET_DIRS)) +zipsourceinstall: $(addsuffix _zipsourceinstall,$(TARGET_DIRS)) +zipexampleinstall: $(addsuffix _zipexampleinstall,$(TARGET_DIRS)) +zipdistinstall: $(addsuffix _zipdistinstall,$(TARGET_DIRS)) +clean: $(addsuffix _clean,$(TARGET_DIRS)) +distclean: $(addsuffix _distclean,$(TARGET_DIRS)) +cleanall: $(addsuffix _cleanall,$(TARGET_DIRS)) +info: fpc_info +makefiles: fpc_makefiles $(addsuffix _makefiles,$(TARGET_DIRS)) +.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 +.NOTPARALLEL: diff --git a/packages/gtk2/examples/Makefile.fpc b/packages/gtk2/examples/Makefile.fpc new file mode 100644 index 0000000000..d914d46184 --- /dev/null +++ b/packages/gtk2/examples/Makefile.fpc @@ -0,0 +1,19 @@ +# +# Makefile.fpc for Free Pascal GTK 2.x.y Examples +# + +[target] +dirs=helloworld helloworld2 gtk_demo gettingstarted plugins scribble_simple gtkglext +#filechooser - doesn't work yet + +[require] +packages=gtk2 + +[install] +fpcpackage=y + +[default] +fpcdir=../../.. + +[rules] +.NOTPARALLEL: diff --git a/packages/gtk2/examples/filechooser/Makefile b/packages/gtk2/examples/filechooser/Makefile new file mode 100644 index 0000000000..f3eb484bc8 --- /dev/null +++ b/packages/gtk2/examples/filechooser/Makefile @@ -0,0 +1,2015 @@ +# +# Don't edit, this file is generated by FPCMake Version 2.0.0 [2008/01/26] +# +default: all +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-darwin i386-emx i386-watcom i386-netwlibc i386-wince i386-embedded i386-symbian m68k-linux m68k-freebsd m68k-netbsd m68k-amiga m68k-atari m68k-openbsd m68k-palmos m68k-embedded powerpc-linux powerpc-netbsd powerpc-amiga powerpc-macos powerpc-darwin powerpc-morphos powerpc-embedded sparc-linux sparc-netbsd sparc-solaris sparc-embedded x86_64-linux x86_64-freebsd x86_64-darwin x86_64-win64 x86_64-embedded arm-linux arm-palmos arm-wince arm-gba arm-nds arm-embedded arm-symbian powerpc64-linux powerpc64-darwin powerpc64-embedded +BSDs = freebsd netbsd openbsd darwin +UNIXs = linux $(BSDs) solaris qnx +LIMIT83fs = go32v2 os2 emx watcom +OSNeedsComspecToRunBatch = go32v2 watcom +FORCE: +.PHONY: FORCE +override PATH:=$(patsubst %/,%,$(subst \,/,$(PATH))) +ifneq ($(findstring darwin,$(OSTYPE)),) +inUnix=1 #darwin +SEARCHPATH:=$(filter-out .,$(subst :, ,$(PATH))) +else +ifeq ($(findstring ;,$(PATH)),) +inUnix=1 +SEARCHPATH:=$(filter-out .,$(subst :, ,$(PATH))) +else +SEARCHPATH:=$(subst ;, ,$(PATH)) +endif +endif +SEARCHPATH+=$(patsubst %/,%,$(subst \,/,$(dir $(MAKE)))) +PWD:=$(strip $(wildcard $(addsuffix /pwd.exe,$(SEARCHPATH)))) +ifeq ($(PWD),) +PWD:=$(strip $(wildcard $(addsuffix /pwd,$(SEARCHPATH)))) +ifeq ($(PWD),) +$(error You need the GNU utils package to use this Makefile) +else +PWD:=$(firstword $(PWD)) +SRCEXEEXT= +endif +else +PWD:=$(firstword $(PWD)) +SRCEXEEXT=.exe +endif +ifndef inUnix +ifeq ($(OS),Windows_NT) +inWinNT=1 +else +ifdef OS2_SHELL +inOS2=1 +endif +endif +else +ifneq ($(findstring cygdrive,$(PATH)),) +inCygWin=1 +endif +endif +ifdef inUnix +SRCBATCHEXT=.sh +else +ifdef inOS2 +SRCBATCHEXT=.cmd +else +SRCBATCHEXT=.bat +endif +endif +ifdef COMSPEC +ifneq ($(findstring $(OS_SOURCE),$(OSNeedsComspecToRunBatch)),) +RUNBATCH=$(COMSPEC) /C +endif +endif +ifdef inUnix +PATHSEP=/ +else +PATHSEP:=$(subst /,\,/) +ifdef inCygWin +PATHSEP=/ +endif +endif +ifdef PWD +BASEDIR:=$(subst \,/,$(shell $(PWD))) +ifdef inCygWin +ifneq ($(findstring /cygdrive/,$(BASEDIR)),) +BASENODIR:=$(patsubst /cygdrive%,%,$(BASEDIR)) +BASEDRIVE:=$(firstword $(subst /, ,$(BASENODIR))) +BASEDIR:=$(subst /cygdrive/$(BASEDRIVE)/,$(BASEDRIVE):/,$(BASEDIR)) +endif +endif +else +BASEDIR=. +endif +ifdef inOS2 +ifndef ECHO +ECHO:=$(strip $(wildcard $(addsuffix /gecho$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(ECHO),) +ECHO:=$(strip $(wildcard $(addsuffix /echo$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(ECHO),) +ECHO=echo +else +ECHO:=$(firstword $(ECHO)) +endif +else +ECHO:=$(firstword $(ECHO)) +endif +endif +export ECHO +endif +override DEFAULT_FPCDIR=../../../.. +ifndef FPC +ifdef PP +FPC=$(PP) +endif +endif +ifndef FPC +FPCPROG:=$(strip $(wildcard $(addsuffix /fpc$(SRCEXEEXT),$(SEARCHPATH)))) +ifneq ($(FPCPROG),) +FPCPROG:=$(firstword $(FPCPROG)) +ifneq ($(CPU_TARGET),) +FPC:=$(shell $(FPCPROG) -P$(CPU_TARGET) -PB) +else +FPC:=$(shell $(FPCPROG) -PB) +endif +ifneq ($(findstring Error,$(FPC)),) +override FPC=$(firstword $(strip $(wildcard $(addsuffix /ppc386$(SRCEXEEXT),$(SEARCHPATH))))) +endif +else +override FPC=$(firstword $(strip $(wildcard $(addsuffix /ppc386$(SRCEXEEXT),$(SEARCHPATH))))) +endif +endif +override FPC:=$(subst $(SRCEXEEXT),,$(FPC)) +override FPC:=$(subst \,/,$(FPC))$(SRCEXEEXT) +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 +unexport CHECKDEPEND ALLDEPENDENCIES +ifndef CPU_TARGET +ifdef CPU_TARGET_DEFAULT +CPU_TARGET=$(CPU_TARGET_DEFAULT) +endif +endif +ifndef OS_TARGET +ifdef OS_TARGET_DEFAULT +OS_TARGET=$(OS_TARGET_DEFAULT) +endif +endif +ifneq ($(words $(FPC_COMPILERINFO)),5) +FPC_COMPILERINFO+=$(shell $(FPC) -iSP) +FPC_COMPILERINFO+=$(shell $(FPC) -iTP) +FPC_COMPILERINFO+=$(shell $(FPC) -iSO) +FPC_COMPILERINFO+=$(shell $(FPC) -iTO) +endif +ifndef CPU_SOURCE +CPU_SOURCE:=$(word 2,$(FPC_COMPILERINFO)) +endif +ifndef CPU_TARGET +CPU_TARGET:=$(word 3,$(FPC_COMPILERINFO)) +endif +ifndef OS_SOURCE +OS_SOURCE:=$(word 4,$(FPC_COMPILERINFO)) +endif +ifndef OS_TARGET +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 $(FULL_TARGET),$(MAKEFILETARGETS)),) +$(error The Makefile doesn't support target $(FULL_TARGET), please run fpcmake first) +endif +endif +ifneq ($(findstring $(OS_TARGET),$(BSDs)),) +BSDhier=1 +endif +ifeq ($(OS_TARGET),linux) +linuxHier=1 +endif +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)),) +override FPCDIR=wrong +endif +else +override FPCDIR=wrong +endif +ifdef DEFAULT_FPCDIR +ifeq ($(FPCDIR),wrong) +override FPCDIR:=$(subst \,/,$(DEFAULT_FPCDIR)) +ifeq ($(wildcard $(addprefix $(FPCDIR)/,rtl units)),) +override FPCDIR=wrong +endif +endif +endif +ifeq ($(FPCDIR),wrong) +ifdef inUnix +override FPCDIR=/usr/local/lib/fpc/$(FPC_VERSION) +ifeq ($(wildcard $(FPCDIR)/units),) +override FPCDIR=/usr/lib/fpc/$(FPC_VERSION) +endif +else +override FPCDIR:=$(subst /$(FPC),,$(firstword $(strip $(wildcard $(addsuffix /$(FPC),$(SEARCHPATH)))))) +override FPCDIR:=$(FPCDIR)/.. +ifeq ($(wildcard $(addprefix $(FPCDIR)/,rtl units)),) +override FPCDIR:=$(FPCDIR)/.. +ifeq ($(wildcard $(addprefix $(FPCDIR)/,rtl units)),) +override FPCDIR:=$(BASEDIR) +ifeq ($(wildcard $(addprefix $(FPCDIR)/,rtl units)),) +override FPCDIR=c:/pp +endif +endif +endif +endif +endif +ifndef CROSSBINDIR +CROSSBINDIR:=$(wildcard $(FPCDIR)/bin/$(TARGETSUFFIX)) +endif +ifndef BINUTILSPREFIX +ifndef CROSSBINDIR +ifdef CROSSCOMPILE +BINUTILSPREFIX=$(CPU_TARGET)-$(OS_TARGET)- +endif +endif +endif +UNITSDIR:=$(wildcard $(FPCDIR)/units/$(TARGETSUFFIX)) +ifeq ($(UNITSDIR),) +UNITSDIR:=$(wildcard $(FPCDIR)/units/$(OS_TARGET)) +endif +PACKAGESDIR:=$(wildcard $(FPCDIR) $(FPCDIR)/packages $(FPCDIR)/packages/base $(FPCDIR)/packages/extra) +ifeq ($(FULL_TARGET),i386-linux) +override TARGET_PROGRAMS+=simple glade +endif +ifeq ($(FULL_TARGET),i386-go32v2) +override TARGET_PROGRAMS+=simple glade +endif +ifeq ($(FULL_TARGET),i386-win32) +override TARGET_PROGRAMS+=simple glade +endif +ifeq ($(FULL_TARGET),i386-os2) +override TARGET_PROGRAMS+=simple glade +endif +ifeq ($(FULL_TARGET),i386-freebsd) +override TARGET_PROGRAMS+=simple glade +endif +ifeq ($(FULL_TARGET),i386-beos) +override TARGET_PROGRAMS+=simple glade +endif +ifeq ($(FULL_TARGET),i386-netbsd) +override TARGET_PROGRAMS+=simple glade +endif +ifeq ($(FULL_TARGET),i386-solaris) +override TARGET_PROGRAMS+=simple glade +endif +ifeq ($(FULL_TARGET),i386-qnx) +override TARGET_PROGRAMS+=simple glade +endif +ifeq ($(FULL_TARGET),i386-netware) +override TARGET_PROGRAMS+=simple glade +endif +ifeq ($(FULL_TARGET),i386-openbsd) +override TARGET_PROGRAMS+=simple glade +endif +ifeq ($(FULL_TARGET),i386-wdosx) +override TARGET_PROGRAMS+=simple glade +endif +ifeq ($(FULL_TARGET),i386-darwin) +override TARGET_PROGRAMS+=simple glade +endif +ifeq ($(FULL_TARGET),i386-emx) +override TARGET_PROGRAMS+=simple glade +endif +ifeq ($(FULL_TARGET),i386-watcom) +override TARGET_PROGRAMS+=simple glade +endif +ifeq ($(FULL_TARGET),i386-netwlibc) +override TARGET_PROGRAMS+=simple glade +endif +ifeq ($(FULL_TARGET),i386-wince) +override TARGET_PROGRAMS+=simple glade +endif +ifeq ($(FULL_TARGET),i386-embedded) +override TARGET_PROGRAMS+=simple glade +endif +ifeq ($(FULL_TARGET),i386-symbian) +override TARGET_PROGRAMS+=simple glade +endif +ifeq ($(FULL_TARGET),m68k-linux) +override TARGET_PROGRAMS+=simple glade +endif +ifeq ($(FULL_TARGET),m68k-freebsd) +override TARGET_PROGRAMS+=simple glade +endif +ifeq ($(FULL_TARGET),m68k-netbsd) +override TARGET_PROGRAMS+=simple glade +endif +ifeq ($(FULL_TARGET),m68k-amiga) +override TARGET_PROGRAMS+=simple glade +endif +ifeq ($(FULL_TARGET),m68k-atari) +override TARGET_PROGRAMS+=simple glade +endif +ifeq ($(FULL_TARGET),m68k-openbsd) +override TARGET_PROGRAMS+=simple glade +endif +ifeq ($(FULL_TARGET),m68k-palmos) +override TARGET_PROGRAMS+=simple glade +endif +ifeq ($(FULL_TARGET),m68k-embedded) +override TARGET_PROGRAMS+=simple glade +endif +ifeq ($(FULL_TARGET),powerpc-linux) +override TARGET_PROGRAMS+=simple glade +endif +ifeq ($(FULL_TARGET),powerpc-netbsd) +override TARGET_PROGRAMS+=simple glade +endif +ifeq ($(FULL_TARGET),powerpc-amiga) +override TARGET_PROGRAMS+=simple glade +endif +ifeq ($(FULL_TARGET),powerpc-macos) +override TARGET_PROGRAMS+=simple glade +endif +ifeq ($(FULL_TARGET),powerpc-darwin) +override TARGET_PROGRAMS+=simple glade +endif +ifeq ($(FULL_TARGET),powerpc-morphos) +override TARGET_PROGRAMS+=simple glade +endif +ifeq ($(FULL_TARGET),powerpc-embedded) +override TARGET_PROGRAMS+=simple glade +endif +ifeq ($(FULL_TARGET),sparc-linux) +override TARGET_PROGRAMS+=simple glade +endif +ifeq ($(FULL_TARGET),sparc-netbsd) +override TARGET_PROGRAMS+=simple glade +endif +ifeq ($(FULL_TARGET),sparc-solaris) +override TARGET_PROGRAMS+=simple glade +endif +ifeq ($(FULL_TARGET),sparc-embedded) +override TARGET_PROGRAMS+=simple glade +endif +ifeq ($(FULL_TARGET),x86_64-linux) +override TARGET_PROGRAMS+=simple glade +endif +ifeq ($(FULL_TARGET),x86_64-freebsd) +override TARGET_PROGRAMS+=simple glade +endif +ifeq ($(FULL_TARGET),x86_64-darwin) +override TARGET_PROGRAMS+=simple glade +endif +ifeq ($(FULL_TARGET),x86_64-win64) +override TARGET_PROGRAMS+=simple glade +endif +ifeq ($(FULL_TARGET),x86_64-embedded) +override TARGET_PROGRAMS+=simple glade +endif +ifeq ($(FULL_TARGET),arm-linux) +override TARGET_PROGRAMS+=simple glade +endif +ifeq ($(FULL_TARGET),arm-palmos) +override TARGET_PROGRAMS+=simple glade +endif +ifeq ($(FULL_TARGET),arm-wince) +override TARGET_PROGRAMS+=simple glade +endif +ifeq ($(FULL_TARGET),arm-gba) +override TARGET_PROGRAMS+=simple glade +endif +ifeq ($(FULL_TARGET),arm-nds) +override TARGET_PROGRAMS+=simple glade +endif +ifeq ($(FULL_TARGET),arm-embedded) +override TARGET_PROGRAMS+=simple glade +endif +ifeq ($(FULL_TARGET),arm-symbian) +override TARGET_PROGRAMS+=simple glade +endif +ifeq ($(FULL_TARGET),powerpc64-linux) +override TARGET_PROGRAMS+=simple glade +endif +ifeq ($(FULL_TARGET),powerpc64-darwin) +override TARGET_PROGRAMS+=simple glade +endif +ifeq ($(FULL_TARGET),powerpc64-embedded) +override TARGET_PROGRAMS+=simple glade +endif +override INSTALL_FPCPACKAGE=y +ifdef REQUIRE_UNITSDIR +override UNITSDIR+=$(REQUIRE_UNITSDIR) +endif +ifdef REQUIRE_PACKAGESDIR +override PACKAGESDIR+=$(REQUIRE_PACKAGESDIR) +endif +ifdef ZIPINSTALL +ifneq ($(findstring $(OS_TARGET),$(UNIXs)),) +UNIXHier=1 +endif +else +ifneq ($(findstring $(OS_SOURCE),$(UNIXs)),) +UNIXHier=1 +endif +endif +ifndef INSTALL_PREFIX +ifdef PREFIX +INSTALL_PREFIX=$(PREFIX) +endif +endif +ifndef INSTALL_PREFIX +ifdef UNIXHier +INSTALL_PREFIX=/usr/local +else +ifdef INSTALL_FPCPACKAGE +INSTALL_BASEDIR:=/pp +else +INSTALL_BASEDIR:=/$(PACKAGE_NAME) +endif +endif +endif +export INSTALL_PREFIX +ifdef INSTALL_FPCSUBDIR +export INSTALL_FPCSUBDIR +endif +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 +INSTALL_BASEDIR:=$(INSTALL_PREFIX)/lib/fpc/$(FPC_VERSION) +else +INSTALL_BASEDIR:=$(INSTALL_PREFIX)/lib/$(PACKAGE_NAME) +endif +else +INSTALL_BASEDIR:=$(INSTALL_PREFIX) +endif +endif +ifndef INSTALL_BINDIR +ifdef UNIXHier +INSTALL_BINDIR:=$(INSTALL_PREFIX)/bin +else +INSTALL_BINDIR:=$(INSTALL_BASEDIR)/bin +ifdef INSTALL_FPCPACKAGE +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 +INSTALL_UNITDIR:=$(INSTALL_BASEDIR)/units/$(TARGETSUFFIX) +ifdef INSTALL_FPCPACKAGE +ifdef PACKAGE_NAME +INSTALL_UNITDIR:=$(INSTALL_UNITDIR)/$(PACKAGE_NAME) +endif +endif +endif +ifndef INSTALL_LIBDIR +ifdef UNIXHier +INSTALL_LIBDIR:=$(INSTALL_PREFIX)/lib +else +INSTALL_LIBDIR:=$(INSTALL_UNITDIR) +endif +endif +ifndef INSTALL_SOURCEDIR +ifdef UNIXHier +ifdef BSDhier +SRCPREFIXDIR=share/src +else +ifdef linuxHier +SRCPREFIXDIR=share/src +else +SRCPREFIXDIR=src +endif +endif +ifdef INSTALL_FPCPACKAGE +ifdef INSTALL_FPCSUBDIR +INSTALL_SOURCEDIR:=$(INSTALL_PREFIX)/$(SRCPREFIXDIR)/fpc-$(FPC_VERSION)/$(INSTALL_FPCSUBDIR)/$(PACKAGE_NAME) +else +INSTALL_SOURCEDIR:=$(INSTALL_PREFIX)/$(SRCPREFIXDIR)/fpc-$(FPC_VERSION)/$(PACKAGE_NAME) +endif +else +INSTALL_SOURCEDIR:=$(INSTALL_PREFIX)/$(SRCPREFIXDIR)/$(PACKAGE_NAME)-$(PACKAGE_VERSION) +endif +else +ifdef INSTALL_FPCPACKAGE +ifdef INSTALL_FPCSUBDIR +INSTALL_SOURCEDIR:=$(INSTALL_BASEDIR)/source/$(INSTALL_FPCSUBDIR)/$(PACKAGE_NAME) +else +INSTALL_SOURCEDIR:=$(INSTALL_BASEDIR)/source/$(PACKAGE_NAME) +endif +else +INSTALL_SOURCEDIR:=$(INSTALL_BASEDIR)/source +endif +endif +endif +ifndef INSTALL_DOCDIR +ifdef UNIXHier +ifdef BSDhier +DOCPREFIXDIR=share/doc +else +ifdef linuxHier +DOCPREFIXDIR=share/doc +else +DOCPREFIXDIR=doc +endif +endif +ifdef INSTALL_FPCPACKAGE +INSTALL_DOCDIR:=$(INSTALL_PREFIX)/$(DOCPREFIXDIR)/fpc-$(FPC_VERSION)/$(PACKAGE_NAME) +else +INSTALL_DOCDIR:=$(INSTALL_PREFIX)/$(DOCPREFIXDIR)/$(PACKAGE_NAME)-$(PACKAGE_VERSION) +endif +else +ifdef INSTALL_FPCPACKAGE +INSTALL_DOCDIR:=$(INSTALL_BASEDIR)/doc/$(PACKAGE_NAME) +else +INSTALL_DOCDIR:=$(INSTALL_BASEDIR)/doc +endif +endif +endif +ifndef INSTALL_EXAMPLEDIR +ifdef UNIXHier +ifdef INSTALL_FPCPACKAGE +ifdef BSDhier +INSTALL_EXAMPLEDIR:=$(INSTALL_PREFIX)/share/examples/fpc-$(FPC_VERSION)/$(PACKAGE_NAME) +else +ifdef linuxHier +INSTALL_EXAMPLEDIR:=$(INSTALL_DOCDIR)/examples +else +INSTALL_EXAMPLEDIR:=$(INSTALL_PREFIX)/doc/fpc-$(FPC_VERSION)/examples/$(PACKAGE_NAME) +endif +endif +else +ifdef BSDhier +INSTALL_EXAMPLEDIR:=$(INSTALL_PREFIX)/share/examples/$(PACKAGE_NAME)-$(PACKAGE_VERSION) +else +ifdef linuxHier +INSTALL_EXAMPLEDIR:=$(INSTALL_DOCDIR)/examples/$(PACKAGE_NAME)-$(PACKAGE_VERSION) +else +INSTALL_EXAMPLEDIR:=$(INSTALL_PREFIX)/doc/$(PACKAGE_NAME)-$(PACKAGE_VERSION) +endif +endif +endif +else +ifdef INSTALL_FPCPACKAGE +INSTALL_EXAMPLEDIR:=$(INSTALL_BASEDIR)/examples/$(PACKAGE_NAME) +else +INSTALL_EXAMPLEDIR:=$(INSTALL_BASEDIR)/examples +endif +endif +endif +ifndef INSTALL_DATADIR +INSTALL_DATADIR=$(INSTALL_BASEDIR) +endif +ifndef INSTALL_SHAREDDIR +INSTALL_SHAREDDIR=$(INSTALL_PREFIX)/lib +endif +ifdef CROSSCOMPILE +ifndef CROSSBINDIR +CROSSBINDIR:=$(wildcard $(CROSSTARGETDIR)/bin/$(SOURCESUFFIX)) +ifeq ($(CROSSBINDIR),) +CROSSBINDIR:=$(wildcard $(INSTALL_BASEDIR)/cross/$(TARGETSUFFIX)/bin/$(FULL_SOURCE)) +endif +endif +else +CROSSBINDIR= +endif +ifeq ($(OS_SOURCE),linux) +ifndef GCCLIBDIR +ifeq ($(CPU_TARGET),i386) +ifneq ($(findstring x86_64,$(shell uname -a)),) +ifeq ($(BINUTILSPREFIX),) +GCCLIBDIR:=$(shell dirname `gcc -m32 -print-libgcc-file-name`) +endif +endif +endif +ifeq ($(CPU_TARGET),powerpc64) +ifeq ($(BINUTILSPREFIX),) +GCCLIBDIR:=$(shell dirname `gcc -m64 -print-libgcc-file-name`) +endif +endif +endif +ifndef GCCLIBDIR +CROSSGCC=$(strip $(wildcard $(addsuffix /$(BINUTILSPREFIX)gcc$(SRCEXEEXT),$(SEARCHPATH)))) +ifneq ($(CROSSGCC),) +GCCLIBDIR:=$(shell dirname `$(CROSSGCC) -print-libgcc-file-name`) +endif +endif +ifndef OTHERLIBDIR +OTHERLIBDIR:=$(shell grep -v "^\#" /etc/ld.so.conf | awk '{ ORS=" "; print $1 }') +endif +endif +ifdef inUnix +ifeq ($(OS_SOURCE),netbsd) +OTHERLIBDIR+=/usr/pkg/lib +endif +export GCCLIBDIR OTHERLIB +endif +BATCHEXT=.bat +LOADEREXT=.as +EXEEXT=.exe +PPLEXT=.ppl +PPUEXT=.ppu +OEXT=.o +ASMEXT=.s +SMARTEXT=.sl +STATICLIBEXT=.a +SHAREDLIBEXT=.so +SHAREDLIBPREFIX=libfp +STATICLIBPREFIX=libp +IMPORTLIBPREFIX=libimp +RSTEXT=.rst +ifeq ($(findstring 1.0.,$(FPC_VERSION)),) +ifeq ($(OS_TARGET),go32v1) +STATICLIBPREFIX= +SHORTSUFFIX=v1 +endif +ifeq ($(OS_TARGET),go32v2) +STATICLIBPREFIX= +SHORTSUFFIX=dos +endif +ifeq ($(OS_TARGET),watcom) +STATICLIBPREFIX= +OEXT=.obj +ASMEXT=.asm +SHAREDLIBEXT=.dll +SHORTSUFFIX=wat +endif +ifeq ($(OS_TARGET),linux) +BATCHEXT=.sh +EXEEXT= +HASSHAREDLIB=1 +SHORTSUFFIX=lnx +endif +ifeq ($(OS_TARGET),freebsd) +BATCHEXT=.sh +EXEEXT= +HASSHAREDLIB=1 +SHORTSUFFIX=fbs +endif +ifeq ($(OS_TARGET),netbsd) +BATCHEXT=.sh +EXEEXT= +HASSHAREDLIB=1 +SHORTSUFFIX=nbs +endif +ifeq ($(OS_TARGET),openbsd) +BATCHEXT=.sh +EXEEXT= +HASSHAREDLIB=1 +SHORTSUFFIX=obs +endif +ifeq ($(OS_TARGET),win32) +SHAREDLIBEXT=.dll +SHORTSUFFIX=w32 +endif +ifeq ($(OS_TARGET),os2) +BATCHEXT=.cmd +AOUTEXT=.out +STATICLIBPREFIX= +SHAREDLIBEXT=.dll +SHORTSUFFIX=os2 +ECHO=echo +endif +ifeq ($(OS_TARGET),emx) +BATCHEXT=.cmd +AOUTEXT=.out +STATICLIBPREFIX= +SHAREDLIBEXT=.dll +SHORTSUFFIX=emx +ECHO=echo +endif +ifeq ($(OS_TARGET),amiga) +EXEEXT= +SHAREDLIBEXT=.library +SHORTSUFFIX=amg +endif +ifeq ($(OS_TARGET),morphos) +EXEEXT= +SHAREDLIBEXT=.library +SHORTSUFFIX=mos +endif +ifeq ($(OS_TARGET),atari) +EXEEXT=.ttp +SHORTSUFFIX=ata +endif +ifeq ($(OS_TARGET),beos) +BATCHEXT=.sh +EXEEXT= +SHORTSUFFIX=be +endif +ifeq ($(OS_TARGET),solaris) +BATCHEXT=.sh +EXEEXT= +SHORTSUFFIX=sun +endif +ifeq ($(OS_TARGET),qnx) +BATCHEXT=.sh +EXEEXT= +SHORTSUFFIX=qnx +endif +ifeq ($(OS_TARGET),netware) +EXEEXT=.nlm +STATICLIBPREFIX= +SHORTSUFFIX=nw +endif +ifeq ($(OS_TARGET),netwlibc) +EXEEXT=.nlm +STATICLIBPREFIX= +SHORTSUFFIX=nwl +endif +ifeq ($(OS_TARGET),macos) +BATCHEXT= +EXEEXT= +DEBUGSYMEXT=.xcoff +SHORTSUFFIX=mac +endif +ifeq ($(OS_TARGET),darwin) +BATCHEXT=.sh +EXEEXT= +HASSHAREDLIB=1 +SHORTSUFFIX=dwn +endif +ifeq ($(OS_TARGET),gba) +EXEEXT=.gba +SHAREDLIBEXT=.so +SHORTSUFFIX=gba +endif +ifeq ($(OS_TARGET),symbian) +SHAREDLIBEXT=.dll +SHORTSUFFIX=symbian +endif +else +ifeq ($(OS_TARGET),go32v1) +PPUEXT=.pp1 +OEXT=.o1 +ASMEXT=.s1 +SMARTEXT=.sl1 +STATICLIBEXT=.a1 +SHAREDLIBEXT=.so1 +STATICLIBPREFIX= +SHORTSUFFIX=v1 +endif +ifeq ($(OS_TARGET),go32v2) +STATICLIBPREFIX= +SHORTSUFFIX=dos +endif +ifeq ($(OS_TARGET),watcom) +STATICLIBPREFIX= +SHORTSUFFIX=wat +endif +ifeq ($(OS_TARGET),linux) +BATCHEXT=.sh +EXEEXT= +HASSHAREDLIB=1 +SHORTSUFFIX=lnx +endif +ifeq ($(OS_TARGET),freebsd) +BATCHEXT=.sh +EXEEXT= +HASSHAREDLIB=1 +SHORTSUFFIX=fbs +endif +ifeq ($(OS_TARGET),netbsd) +BATCHEXT=.sh +EXEEXT= +HASSHAREDLIB=1 +SHORTSUFFIX=nbs +endif +ifeq ($(OS_TARGET),openbsd) +BATCHEXT=.sh +EXEEXT= +HASSHAREDLIB=1 +SHORTSUFFIX=obs +endif +ifeq ($(OS_TARGET),win32) +PPUEXT=.ppw +OEXT=.ow +ASMEXT=.sw +SMARTEXT=.slw +STATICLIBEXT=.aw +SHAREDLIBEXT=.dll +SHORTSUFFIX=w32 +endif +ifeq ($(OS_TARGET),os2) +BATCHEXT=.cmd +PPUEXT=.ppo +ASMEXT=.so2 +OEXT=.oo2 +AOUTEXT=.out +SMARTEXT=.sl2 +STATICLIBPREFIX= +STATICLIBEXT=.ao2 +SHAREDLIBEXT=.dll +SHORTSUFFIX=os2 +ECHO=echo +endif +ifeq ($(OS_TARGET),amiga) +EXEEXT= +PPUEXT=.ppu +ASMEXT=.s +OEXT=.o +SMARTEXT=.sl +STATICLIBEXT=.a +SHAREDLIBEXT=.library +SHORTSUFFIX=amg +endif +ifeq ($(OS_TARGET),atari) +PPUEXT=.ppu +ASMEXT=.s +OEXT=.o +SMARTEXT=.sl +STATICLIBEXT=.a +EXEEXT=.ttp +SHORTSUFFIX=ata +endif +ifeq ($(OS_TARGET),beos) +BATCHEXT=.sh +PPUEXT=.ppu +ASMEXT=.s +OEXT=.o +SMARTEXT=.sl +STATICLIBEXT=.a +EXEEXT= +SHORTSUFFIX=be +endif +ifeq ($(OS_TARGET),solaris) +BATCHEXT=.sh +PPUEXT=.ppu +ASMEXT=.s +OEXT=.o +SMARTEXT=.sl +STATICLIBEXT=.a +EXEEXT= +SHORTSUFFIX=sun +endif +ifeq ($(OS_TARGET),qnx) +BATCHEXT=.sh +PPUEXT=.ppu +ASMEXT=.s +OEXT=.o +SMARTEXT=.sl +STATICLIBEXT=.a +EXEEXT= +SHORTSUFFIX=qnx +endif +ifeq ($(OS_TARGET),netware) +STATICLIBPREFIX= +PPUEXT=.ppu +OEXT=.o +ASMEXT=.s +SMARTEXT=.sl +STATICLIBEXT=.a +SHAREDLIBEXT=.nlm +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= +PPUEXT=.ppu +ASMEXT=.s +OEXT=.o +SMARTEXT=.sl +STATICLIBEXT=.a +EXEEXT= +DEBUGSYMEXT=.xcoff +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 +ECHO:=$(strip $(wildcard $(addsuffix /gecho$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(ECHO),) +ECHO:=$(strip $(wildcard $(addsuffix /echo$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(ECHO),) +ECHO= __missing_command_ECHO +else +ECHO:=$(firstword $(ECHO)) +endif +else +ECHO:=$(firstword $(ECHO)) +endif +endif +export ECHO +ifndef DATE +DATE:=$(strip $(wildcard $(addsuffix /gdate$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(DATE),) +DATE:=$(strip $(wildcard $(addsuffix /date$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(DATE),) +DATE= __missing_command_DATE +else +DATE:=$(firstword $(DATE)) +endif +else +DATE:=$(firstword $(DATE)) +endif +endif +export DATE +ifndef GINSTALL +GINSTALL:=$(strip $(wildcard $(addsuffix /ginstall$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(GINSTALL),) +GINSTALL:=$(strip $(wildcard $(addsuffix /install$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(GINSTALL),) +GINSTALL= __missing_command_GINSTALL +else +GINSTALL:=$(firstword $(GINSTALL)) +endif +else +GINSTALL:=$(firstword $(GINSTALL)) +endif +endif +export GINSTALL +ifndef CPPROG +CPPROG:=$(strip $(wildcard $(addsuffix /cp$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(CPPROG),) +CPPROG= __missing_command_CPPROG +else +CPPROG:=$(firstword $(CPPROG)) +endif +endif +export CPPROG +ifndef RMPROG +RMPROG:=$(strip $(wildcard $(addsuffix /rm$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(RMPROG),) +RMPROG= __missing_command_RMPROG +else +RMPROG:=$(firstword $(RMPROG)) +endif +endif +export RMPROG +ifndef MVPROG +MVPROG:=$(strip $(wildcard $(addsuffix /mv$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(MVPROG),) +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 +else +ECHOREDIR=$(ECHO) +endif +endif +ifndef COPY +COPY:=$(CPPROG) -fp +endif +ifndef COPYTREE +COPYTREE:=$(CPPROG) -Rfp +endif +ifndef MKDIRTREE +MKDIRTREE:=$(MKDIRPROG) -p +endif +ifndef MOVE +MOVE:=$(MVPROG) -f +endif +ifndef DEL +DEL:=$(RMPROG) -f +endif +ifndef DELTREE +DELTREE:=$(RMPROG) -rf +endif +ifndef INSTALL +ifdef inUnix +INSTALL:=$(GINSTALL) -c -m 644 +else +INSTALL:=$(COPY) +endif +endif +ifndef INSTALLEXE +ifdef inUnix +INSTALLEXE:=$(GINSTALL) -c -m 755 +else +INSTALLEXE:=$(COPY) +endif +endif +ifndef MKDIR +MKDIR:=$(GINSTALL) -m 755 -d +endif +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 +else +PPUMOVE:=$(firstword $(PPUMOVE)) +endif +endif +export PPUMOVE +ifndef FPCMAKE +FPCMAKE:=$(strip $(wildcard $(addsuffix /fpcmake$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(FPCMAKE),) +FPCMAKE= __missing_command_FPCMAKE +else +FPCMAKE:=$(firstword $(FPCMAKE)) +endif +endif +export FPCMAKE +ifndef ZIPPROG +ZIPPROG:=$(strip $(wildcard $(addsuffix /zip$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(ZIPPROG),) +ZIPPROG= __missing_command_ZIPPROG +else +ZIPPROG:=$(firstword $(ZIPPROG)) +endif +endif +export ZIPPROG +ifndef TARPROG +TARPROG:=$(strip $(wildcard $(addsuffix /gtar$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(TARPROG),) +TARPROG:=$(strip $(wildcard $(addsuffix /tar$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(TARPROG),) +TARPROG= __missing_command_TARPROG +else +TARPROG:=$(firstword $(TARPROG)) +endif +else +TARPROG:=$(firstword $(TARPROG)) +endif +endif +export TARPROG +ASNAME=$(BINUTILSPREFIX)as +LDNAME=$(BINUTILSPREFIX)ld +ARNAME=$(BINUTILSPREFIX)ar +RCNAME=$(BINUTILSPREFIX)rc +ifneq ($(findstring 1.0.,$(FPC_VERSION)),) +ifeq ($(OS_TARGET),win32) +ifeq ($(CROSSBINDIR),) +ASNAME=asw +LDNAME=ldw +ARNAME=arw +endif +endif +endif +ifndef ASPROG +ifdef CROSSBINDIR +ASPROG=$(CROSSBINDIR)/$(ASNAME)$(SRCEXEEXT) +else +ASPROG=$(ASNAME) +endif +endif +ifndef LDPROG +ifdef CROSSBINDIR +LDPROG=$(CROSSBINDIR)/$(LDNAME)$(SRCEXEEXT) +else +LDPROG=$(LDNAME) +endif +endif +ifndef RCPROG +ifdef CROSSBINDIR +RCPROG=$(CROSSBINDIR)/$(RCNAME)$(SRCEXEEXT) +else +RCPROG=$(RCNAME) +endif +endif +ifndef ARPROG +ifdef CROSSBINDIR +ARPROG=$(CROSSBINDIR)/$(ARNAME)$(SRCEXEEXT) +else +ARPROG=$(ARNAME) +endif +endif +AS=$(ASPROG) +LD=$(LDPROG) +RC=$(RCPROG) +AR=$(ARPROG) +PPAS=ppas$(SRCBATCHEXT) +ifdef inUnix +LDCONFIG=ldconfig +else +LDCONFIG= +endif +ifdef DATE +DATESTR:=$(shell $(DATE) +%Y%m%d) +else +DATESTR= +endif +ifndef UPXPROG +ifeq ($(OS_TARGET),go32v2) +UPXPROG:=1 +endif +ifeq ($(OS_TARGET),win32) +UPXPROG:=1 +endif +ifdef UPXPROG +UPXPROG:=$(strip $(wildcard $(addsuffix /upx$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(UPXPROG),) +UPXPROG= +else +UPXPROG:=$(firstword $(UPXPROG)) +endif +else +UPXPROG= +endif +endif +export UPXPROG +ZIPOPT=-9 +ZIPEXT=.zip +ifeq ($(USETAR),bz2) +TAROPT=vj +TAREXT=.tar.bz2 +else +TAROPT=vz +TAREXT=.tar.gz +endif +override REQUIRE_PACKAGES=rtl gtk2 +ifeq ($(FULL_TARGET),i386-linux) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_X11=1 +REQUIRE_PACKAGES_GTK2=1 +endif +ifeq ($(FULL_TARGET),i386-go32v2) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_GTK2=1 +endif +ifeq ($(FULL_TARGET),i386-win32) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_GTK2=1 +endif +ifeq ($(FULL_TARGET),i386-os2) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_GTK2=1 +endif +ifeq ($(FULL_TARGET),i386-freebsd) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_X11=1 +REQUIRE_PACKAGES_GTK2=1 +endif +ifeq ($(FULL_TARGET),i386-beos) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_GTK2=1 +endif +ifeq ($(FULL_TARGET),i386-netbsd) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_X11=1 +REQUIRE_PACKAGES_GTK2=1 +endif +ifeq ($(FULL_TARGET),i386-solaris) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_X11=1 +REQUIRE_PACKAGES_GTK2=1 +endif +ifeq ($(FULL_TARGET),i386-qnx) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_GTK2=1 +endif +ifeq ($(FULL_TARGET),i386-netware) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_GTK2=1 +endif +ifeq ($(FULL_TARGET),i386-openbsd) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_X11=1 +REQUIRE_PACKAGES_GTK2=1 +endif +ifeq ($(FULL_TARGET),i386-wdosx) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_GTK2=1 +endif +ifeq ($(FULL_TARGET),i386-darwin) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_X11=1 +REQUIRE_PACKAGES_GTK2=1 +endif +ifeq ($(FULL_TARGET),i386-emx) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_GTK2=1 +endif +ifeq ($(FULL_TARGET),i386-watcom) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_GTK2=1 +endif +ifeq ($(FULL_TARGET),i386-netwlibc) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_GTK2=1 +endif +ifeq ($(FULL_TARGET),i386-wince) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_GTK2=1 +endif +ifeq ($(FULL_TARGET),i386-embedded) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_GTK2=1 +endif +ifeq ($(FULL_TARGET),i386-symbian) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_GTK2=1 +endif +ifeq ($(FULL_TARGET),m68k-linux) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_X11=1 +REQUIRE_PACKAGES_GTK2=1 +endif +ifeq ($(FULL_TARGET),m68k-freebsd) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_X11=1 +REQUIRE_PACKAGES_GTK2=1 +endif +ifeq ($(FULL_TARGET),m68k-netbsd) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_X11=1 +REQUIRE_PACKAGES_GTK2=1 +endif +ifeq ($(FULL_TARGET),m68k-amiga) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_GTK2=1 +endif +ifeq ($(FULL_TARGET),m68k-atari) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_GTK2=1 +endif +ifeq ($(FULL_TARGET),m68k-openbsd) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_X11=1 +REQUIRE_PACKAGES_GTK2=1 +endif +ifeq ($(FULL_TARGET),m68k-palmos) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_GTK2=1 +endif +ifeq ($(FULL_TARGET),m68k-embedded) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_GTK2=1 +endif +ifeq ($(FULL_TARGET),powerpc-linux) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_X11=1 +REQUIRE_PACKAGES_GTK2=1 +endif +ifeq ($(FULL_TARGET),powerpc-netbsd) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_X11=1 +REQUIRE_PACKAGES_GTK2=1 +endif +ifeq ($(FULL_TARGET),powerpc-amiga) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_GTK2=1 +endif +ifeq ($(FULL_TARGET),powerpc-macos) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_GTK2=1 +endif +ifeq ($(FULL_TARGET),powerpc-darwin) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_X11=1 +REQUIRE_PACKAGES_GTK2=1 +endif +ifeq ($(FULL_TARGET),powerpc-morphos) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_GTK2=1 +endif +ifeq ($(FULL_TARGET),powerpc-embedded) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_GTK2=1 +endif +ifeq ($(FULL_TARGET),sparc-linux) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_X11=1 +REQUIRE_PACKAGES_GTK2=1 +endif +ifeq ($(FULL_TARGET),sparc-netbsd) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_X11=1 +REQUIRE_PACKAGES_GTK2=1 +endif +ifeq ($(FULL_TARGET),sparc-solaris) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_X11=1 +REQUIRE_PACKAGES_GTK2=1 +endif +ifeq ($(FULL_TARGET),sparc-embedded) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_GTK2=1 +endif +ifeq ($(FULL_TARGET),x86_64-linux) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_X11=1 +REQUIRE_PACKAGES_GTK2=1 +endif +ifeq ($(FULL_TARGET),x86_64-freebsd) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_X11=1 +REQUIRE_PACKAGES_GTK2=1 +endif +ifeq ($(FULL_TARGET),x86_64-darwin) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_X11=1 +REQUIRE_PACKAGES_GTK2=1 +endif +ifeq ($(FULL_TARGET),x86_64-win64) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_GTK2=1 +endif +ifeq ($(FULL_TARGET),x86_64-embedded) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_GTK2=1 +endif +ifeq ($(FULL_TARGET),arm-linux) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_X11=1 +REQUIRE_PACKAGES_GTK2=1 +endif +ifeq ($(FULL_TARGET),arm-palmos) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_GTK2=1 +endif +ifeq ($(FULL_TARGET),arm-wince) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_GTK2=1 +endif +ifeq ($(FULL_TARGET),arm-gba) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_GTK2=1 +endif +ifeq ($(FULL_TARGET),arm-nds) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_GTK2=1 +endif +ifeq ($(FULL_TARGET),arm-embedded) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_GTK2=1 +endif +ifeq ($(FULL_TARGET),arm-symbian) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_GTK2=1 +endif +ifeq ($(FULL_TARGET),powerpc64-linux) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_X11=1 +REQUIRE_PACKAGES_GTK2=1 +endif +ifeq ($(FULL_TARGET),powerpc64-darwin) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_X11=1 +REQUIRE_PACKAGES_GTK2=1 +endif +ifeq ($(FULL_TARGET),powerpc64-embedded) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_GTK2=1 +endif +ifdef REQUIRE_PACKAGES_RTL +PACKAGEDIR_RTL:=$(firstword $(subst /Makefile.fpc,,$(strip $(wildcard $(addsuffix /rtl/Makefile.fpc,$(PACKAGESDIR)))))) +ifneq ($(PACKAGEDIR_RTL),) +ifneq ($(wildcard $(PACKAGEDIR_RTL)/units/$(TARGETSUFFIX)),) +UNITDIR_RTL=$(PACKAGEDIR_RTL)/units/$(TARGETSUFFIX) +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 +ifdef REQUIRE_PACKAGES_X11 +PACKAGEDIR_X11:=$(firstword $(subst /Makefile.fpc,,$(strip $(wildcard $(addsuffix /x11/Makefile.fpc,$(PACKAGESDIR)))))) +ifneq ($(PACKAGEDIR_X11),) +ifneq ($(wildcard $(PACKAGEDIR_X11)/units/$(TARGETSUFFIX)),) +UNITDIR_X11=$(PACKAGEDIR_X11)/units/$(TARGETSUFFIX) +else +UNITDIR_X11=$(PACKAGEDIR_X11) +endif +ifdef CHECKDEPEND +$(PACKAGEDIR_X11)/$(FPCMADE): + $(MAKE) -C $(PACKAGEDIR_X11) $(FPCMADE) +override ALLDEPENDENCIES+=$(PACKAGEDIR_X11)/$(FPCMADE) +endif +else +PACKAGEDIR_X11= +UNITDIR_X11:=$(subst /Package.fpc,,$(strip $(wildcard $(addsuffix /x11/Package.fpc,$(UNITSDIR))))) +ifneq ($(UNITDIR_X11),) +UNITDIR_X11:=$(firstword $(UNITDIR_X11)) +else +UNITDIR_X11= +endif +endif +ifdef UNITDIR_X11 +override COMPILER_UNITDIR+=$(UNITDIR_X11) +endif +endif +ifdef REQUIRE_PACKAGES_GTK2 +PACKAGEDIR_GTK2:=$(firstword $(subst /Makefile.fpc,,$(strip $(wildcard $(addsuffix /gtk2/Makefile.fpc,$(PACKAGESDIR)))))) +ifneq ($(PACKAGEDIR_GTK2),) +ifneq ($(wildcard $(PACKAGEDIR_GTK2)/units/$(TARGETSUFFIX)),) +UNITDIR_GTK2=$(PACKAGEDIR_GTK2)/units/$(TARGETSUFFIX) +else +UNITDIR_GTK2=$(PACKAGEDIR_GTK2) +endif +ifdef CHECKDEPEND +$(PACKAGEDIR_GTK2)/$(FPCMADE): + $(MAKE) -C $(PACKAGEDIR_GTK2) $(FPCMADE) +override ALLDEPENDENCIES+=$(PACKAGEDIR_GTK2)/$(FPCMADE) +endif +else +PACKAGEDIR_GTK2= +UNITDIR_GTK2:=$(subst /Package.fpc,,$(strip $(wildcard $(addsuffix /gtk2/Package.fpc,$(UNITSDIR))))) +ifneq ($(UNITDIR_GTK2),) +UNITDIR_GTK2:=$(firstword $(UNITDIR_GTK2)) +else +UNITDIR_GTK2= +endif +endif +ifdef UNITDIR_GTK2 +override COMPILER_UNITDIR+=$(UNITDIR_GTK2) +endif +endif +ifndef NOCPUDEF +override FPCOPTDEF=$(CPU_TARGET) +endif +ifneq ($(OS_TARGET),$(OS_SOURCE)) +override FPCOPT+=-T$(OS_TARGET) +endif +ifneq ($(CPU_TARGET),$(CPU_SOURCE)) +override FPCOPT+=-P$(CPU_TARGET) +endif +ifeq ($(OS_SOURCE),openbsd) +override FPCOPT+=-FD$(NEW_BINUTILS_PATH) +endif +ifndef CROSSBOOTSTRAP +ifneq ($(BINUTILSPREFIX),) +override FPCOPT+=-XP$(BINUTILSPREFIX) +endif +ifneq ($(BINUTILSPREFIX),) +override FPCOPT+=-Xr$(RLINKPATH) +endif +endif +ifdef UNITDIR +override FPCOPT+=$(addprefix -Fu,$(UNITDIR)) +endif +ifdef LIBDIR +override FPCOPT+=$(addprefix -Fl,$(LIBDIR)) +endif +ifdef OBJDIR +override FPCOPT+=$(addprefix -Fo,$(OBJDIR)) +endif +ifdef INCDIR +override FPCOPT+=$(addprefix -Fi,$(INCDIR)) +endif +ifdef LINKSMART +override FPCOPT+=-XX +endif +ifdef CREATESMART +override FPCOPT+=-CX +endif +ifdef DEBUG +override FPCOPT+=-gl +override FPCOPTDEF+=DEBUG +endif +ifdef RELEASE +ifneq ($(findstring 2.0.,$(FPC_VERSION)),) +ifeq ($(CPU_TARGET),i386) +FPCCPUOPT:=-OG2p3 +endif +ifeq ($(CPU_TARGET),powerpc) +FPCCPUOPT:=-O1r +endif +else +FPCCPUOPT:=-O2 +endif +override FPCOPT+=-Ur -Xs $(FPCCPUOPT) -n +override FPCOPTDEF+=RELEASE +endif +ifdef STRIP +override FPCOPT+=-Xs +endif +ifdef OPTIMIZE +override FPCOPT+=-O2 +endif +ifdef VERBOSE +override FPCOPT+=-vwni +endif +ifdef COMPILER_OPTIONS +override FPCOPT+=$(COMPILER_OPTIONS) +endif +ifdef COMPILER_UNITDIR +override FPCOPT+=$(addprefix -Fu,$(COMPILER_UNITDIR)) +endif +ifdef COMPILER_LIBRARYDIR +override FPCOPT+=$(addprefix -Fl,$(COMPILER_LIBRARYDIR)) +endif +ifdef COMPILER_OBJECTDIR +override FPCOPT+=$(addprefix -Fo,$(COMPILER_OBJECTDIR)) +endif +ifdef COMPILER_INCLUDEDIR +override FPCOPT+=$(addprefix -Fi,$(COMPILER_INCLUDEDIR)) +endif +ifdef CROSSBINDIR +override FPCOPT+=-FD$(CROSSBINDIR) +endif +ifdef COMPILER_TARGETDIR +override FPCOPT+=-FE$(COMPILER_TARGETDIR) +ifeq ($(COMPILER_TARGETDIR),.) +override TARGETDIRPREFIX= +else +override TARGETDIRPREFIX=$(COMPILER_TARGETDIR)/ +endif +endif +ifdef COMPILER_UNITTARGETDIR +override FPCOPT+=-FU$(COMPILER_UNITTARGETDIR) +ifeq ($(COMPILER_UNITTARGETDIR),.) +override UNITTARGETDIRPREFIX= +else +override UNITTARGETDIRPREFIX=$(COMPILER_UNITTARGETDIR)/ +endif +else +ifdef COMPILER_TARGETDIR +override COMPILER_UNITTARGETDIR=$(COMPILER_TARGETDIR) +override UNITTARGETDIRPREFIX=$(TARGETDIRPREFIX) +endif +endif +ifdef CREATESHARED +override FPCOPT+=-Cg +ifeq ($(CPU_TARGET),i386) +override FPCOPT+=-Aas +endif +endif +ifeq ($(findstring 2.0.,$(FPC_VERSION)),) +ifeq ($(OS_TARGET),linux) +ifeq ($(CPU_TARGET),x86_64) +override FPCOPT+=-Cg +endif +endif +endif +ifdef LINKSHARED +endif +ifdef GCCLIBDIR +override FPCOPT+=-Fl$(GCCLIBDIR) +endif +ifdef OTHERLIBDIR +override FPCOPT+=$(addprefix -Fl,$(OTHERLIBDIR)) +endif +ifdef OPT +override FPCOPT+=$(OPT) +endif +ifdef FPCOPTDEF +override FPCOPT+=$(addprefix -d,$(FPCOPTDEF)) +endif +ifdef CFGFILE +override FPCOPT+=@$(CFGFILE) +endif +ifdef USEENV +override FPCEXTCMD:=$(FPCOPT) +override FPCOPT:=!FPCEXTCMD +export FPCEXTCMD +endif +override AFULL_TARGET=$(CPU_TARGET)-$(OS_TARGET) +override AFULL_SOURCE=$(CPU_SOURCE)-$(OS_SOURCE) +ifneq ($(AFULL_TARGET),$(AFULL_SOURCE)) +override ACROSSCOMPILE=1 +endif +ifdef ACROSSCOMPILE +override FPCOPT+=$(CROSSOPT) +endif +override COMPILER:=$(FPC) $(FPCOPT) +ifeq (,$(findstring -s ,$(COMPILER))) +EXECPPAS= +else +ifeq ($(FULL_SOURCE),$(FULL_TARGET)) +ifdef RUNBATCH +EXECPPAS:=@$(RUNBATCH) $(PPAS) +else +EXECPPAS:=@$(PPAS) +endif +endif +endif +.PHONY: fpc_exes +ifndef CROSSINSTALL +ifneq ($(TARGET_PROGRAMS),) +override EXEFILES=$(addsuffix $(EXEEXT),$(TARGET_PROGRAMS)) +override EXEOFILES:=$(addsuffix $(OEXT),$(TARGET_PROGRAMS)) $(addprefix $(STATICLIBPREFIX),$(addsuffix $(STATICLIBEXT),$(TARGET_PROGRAMS))) $(addprefix $(IMPORTLIBPREFIX),$(addsuffix $(STATICLIBEXT),$(TARGET_PROGRAMS))) +override ALLTARGET+=fpc_exes +override INSTALLEXEFILES+=$(EXEFILES) +override CLEANEXEFILES+=$(EXEFILES) $(EXEOFILES) +ifeq ($(OS_TARGET),os2) +override CLEANEXEFILES+=$(addsuffix $(AOUTEXT),$(TARGET_PROGRAMS)) +endif +ifeq ($(OS_TARGET),emx) +override CLEANEXEFILES+=$(addsuffix $(AOUTEXT),$(TARGET_PROGRAMS)) +endif +endif +endif +fpc_exes: $(COMPILER_TARGETDIR) $(COMPILER_UNITTARGETDIR) $(EXEFILES) +ifdef TARGET_RSTS +override RSTFILES=$(addsuffix $(RSTEXT),$(TARGET_RSTS)) +override CLEANRSTFILES+=$(RSTFILES) +endif +.PHONY: fpc_all fpc_smart fpc_debug fpc_release fpc_shared +$(FPCMADE): $(ALLDEPENDENCIES) $(ALLTARGET) + @$(ECHOREDIR) Compiled > $(FPCMADE) +fpc_all: $(FPCMADE) +fpc_smart: + $(MAKE) all LINKSMART=1 CREATESMART=1 +fpc_debug: + $(MAKE) all DEBUG=1 +fpc_release: + $(MAKE) all RELEASE=1 +.SUFFIXES: $(EXEEXT) $(PPUEXT) $(OEXT) .pas .lpr .dpr .pp .rc .res +$(COMPILER_UNITTARGETDIR): + $(MKDIRTREE) $(COMPILER_UNITTARGETDIR) +$(COMPILER_TARGETDIR): + $(MKDIRTREE) $(COMPILER_TARGETDIR) +%$(PPUEXT): %.pp + $(COMPILER) $< + $(EXECPPAS) +%$(PPUEXT): %.pas + $(COMPILER) $< + $(EXECPPAS) +%$(EXEEXT): %.pp + $(COMPILER) $< + $(EXECPPAS) +%$(EXEEXT): %.pas + $(COMPILER) $< + $(EXECPPAS) +%$(EXEEXT): %.lpr + $(COMPILER) $< + $(EXECPPAS) +%$(EXEEXT): %.dpr + $(COMPILER) $< + $(EXECPPAS) +%.res: %.rc + windres -i $< -o $@ +vpath %.pp $(COMPILER_SOURCEDIR) $(COMPILER_INCLUDEDIR) +vpath %.pas $(COMPILER_SOURCEDIR) $(COMPILER_INCLUDEDIR) +vpath %.lpr $(COMPILER_SOURCEDIR) $(COMPILER_INCLUDEDIR) +vpath %.dpr $(COMPILER_SOURCEDIR) $(COMPILER_INCLUDEDIR) +vpath %.inc $(COMPILER_INCLUDEDIR) +vpath %$(OEXT) $(COMPILER_UNITTARGETDIR) +vpath %$(PPUEXT) $(COMPILER_UNITTARGETDIR) +.PHONY: fpc_shared +override INSTALLTARGET+=fpc_shared_install +ifndef SHARED_LIBVERSION +SHARED_LIBVERSION=$(FPC_VERSION) +endif +ifndef SHARED_LIBNAME +SHARED_LIBNAME=$(PACKAGE_NAME) +endif +ifndef SHARED_FULLNAME +SHARED_FULLNAME=$(SHAREDLIBPREFIX)$(SHARED_LIBNAME)-$(SHARED_LIBVERSION)$(SHAREDLIBEXT) +endif +ifndef SHARED_LIBUNITS +SHARED_LIBUNITS:=$(TARGET_UNITS) $(TARGET_IMPLICITUNITS) +override SHARED_LIBUNITS:=$(filter-out $(INSTALL_BUILDUNIT),$(SHARED_LIBUNITS)) +endif +fpc_shared: +ifdef HASSHAREDLIB + $(MAKE) all CREATESHARED=1 LINKSHARED=1 CREATESMART=1 +ifneq ($(SHARED_BUILD),n) + $(PPUMOVE) -q $(SHARED_LIBUNITS) -i$(COMPILER_UNITTARGETDIR) -o$(SHARED_FULLNAME) -d$(COMPILER_UNITTARGETDIR) +endif +else + @$(ECHO) Shared Libraries not supported +endif +fpc_shared_install: +ifneq ($(SHARED_BUILD),n) +ifneq ($(SHARED_LIBUNITS),) +ifneq ($(wildcard $(COMPILER_UNITTARGETDIR)/$(SHARED_FULLNAME)),) + $(INSTALL) $(COMPILER_UNITTARGETDIR)/$(SHARED_FULLNAME) $(INSTALL_SHAREDDIR) +endif +endif +endif +.PHONY: fpc_install fpc_sourceinstall fpc_exampleinstall +ifdef INSTALL_UNITS +override INSTALLPPUFILES+=$(addsuffix $(PPUEXT),$(INSTALL_UNITS)) +endif +ifdef INSTALL_BUILDUNIT +override INSTALLPPUFILES:=$(filter-out $(INSTALL_BUILDUNIT)$(PPUEXT),$(INSTALLPPUFILES)) +endif +ifdef INSTALLPPUFILES +override INSTALLPPULINKFILES:=$(subst $(PPUEXT),$(OEXT),$(INSTALLPPUFILES)) $(addprefix $(STATICLIBPREFIX),$(subst $(PPUEXT),$(STATICLIBEXT),$(INSTALLPPUFILES))) $(addprefix $(IMPORTLIBPREFIX),$(subst $(PPUEXT),$(STATICLIBEXT),$(INSTALLPPUFILES))) +ifneq ($(UNITTARGETDIRPREFIX),) +override INSTALLPPUFILES:=$(addprefix $(UNITTARGETDIRPREFIX),$(notdir $(INSTALLPPUFILES))) +override INSTALLPPULINKFILES:=$(wildcard $(addprefix $(UNITTARGETDIRPREFIX),$(notdir $(INSTALLPPULINKFILES)))) +endif +override INSTALL_CREATEPACKAGEFPC=1 +endif +ifdef INSTALLEXEFILES +ifneq ($(TARGETDIRPREFIX),) +override INSTALLEXEFILES:=$(addprefix $(TARGETDIRPREFIX),$(notdir $(INSTALLEXEFILES))) +endif +endif +fpc_install: all $(INSTALLTARGET) +ifdef INSTALLEXEFILES + $(MKDIR) $(INSTALL_BINDIR) +ifdef UPXPROG + -$(UPXPROG) $(INSTALLEXEFILES) +endif + $(INSTALLEXE) $(INSTALLEXEFILES) $(INSTALL_BINDIR) +endif +ifdef INSTALL_CREATEPACKAGEFPC +ifdef FPCMAKE +ifdef PACKAGE_VERSION +ifneq ($(wildcard Makefile.fpc),) + $(FPCMAKE) -p -T$(CPU_TARGET)-$(OS_TARGET) Makefile.fpc + $(MKDIR) $(INSTALL_UNITDIR) + $(INSTALL) Package.fpc $(INSTALL_UNITDIR) +endif +endif +endif +endif +ifdef INSTALLPPUFILES + $(MKDIR) $(INSTALL_UNITDIR) + $(INSTALL) $(INSTALLPPUFILES) $(INSTALL_UNITDIR) +ifneq ($(INSTALLPPULINKFILES),) + $(INSTALL) $(INSTALLPPULINKFILES) $(INSTALL_UNITDIR) +endif +ifneq ($(wildcard $(LIB_FULLNAME)),) + $(MKDIR) $(INSTALL_LIBDIR) + $(INSTALL) $(LIB_FULLNAME) $(INSTALL_LIBDIR) +ifdef inUnix + ln -sf $(LIB_FULLNAME) $(INSTALL_LIBDIR)/$(LIB_NAME) +endif +endif +endif +ifdef INSTALL_FILES + $(MKDIR) $(INSTALL_DATADIR) + $(INSTALL) $(INSTALL_FILES) $(INSTALL_DATADIR) +endif +fpc_sourceinstall: distclean + $(MKDIR) $(INSTALL_SOURCEDIR) + $(COPYTREE) $(BASEDIR)/* $(INSTALL_SOURCEDIR) +fpc_exampleinstall: $(addsuffix _distclean,$(TARGET_EXAMPLEDIRS)) +ifdef HASEXAMPLES + $(MKDIR) $(INSTALL_EXAMPLEDIR) +endif +ifdef EXAMPLESOURCEFILES + $(COPY) $(EXAMPLESOURCEFILES) $(INSTALL_EXAMPLEDIR) +endif +ifdef TARGET_EXAMPLEDIRS + $(COPYTREE) $(addsuffix /*,$(TARGET_EXAMPLEDIRS)) $(INSTALL_EXAMPLEDIR) +endif +.PHONY: fpc_clean fpc_cleanall fpc_distclean +ifdef EXEFILES +override CLEANEXEFILES:=$(addprefix $(TARGETDIRPREFIX),$(CLEANEXEFILES)) +endif +ifdef CLEAN_UNITS +override CLEANPPUFILES+=$(addsuffix $(PPUEXT),$(CLEAN_UNITS)) +endif +ifdef CLEANPPUFILES +override CLEANPPULINKFILES:=$(subst $(PPUEXT),$(OEXT),$(CLEANPPUFILES)) $(addprefix $(STATICLIBPREFIX),$(subst $(PPUEXT),$(STATICLIBEXT),$(CLEANPPUFILES))) $(addprefix $(IMPORTLIBPREFIX),$(subst $(PPUEXT),$(STATICLIBEXT),$(CLEANPPUFILES))) +ifdef DEBUGSYMEXT +override CLEANPPULINKFILES+=$(subst $(PPUEXT),$(DEBUGSYMEXT),$(CLEANPPUFILES)) +endif +override CLEANPPUFILES:=$(addprefix $(UNITTARGETDIRPREFIX),$(CLEANPPUFILES)) +override CLEANPPULINKFILES:=$(wildcard $(addprefix $(UNITTARGETDIRPREFIX),$(CLEANPPULINKFILES))) +endif +fpc_clean: $(CLEANTARGET) +ifdef CLEANEXEFILES + -$(DEL) $(CLEANEXEFILES) +endif +ifdef CLEANPPUFILES + -$(DEL) $(CLEANPPUFILES) +endif +ifneq ($(CLEANPPULINKFILES),) + -$(DEL) $(CLEANPPULINKFILES) +endif +ifdef CLEANRSTFILES + -$(DEL) $(addprefix $(UNITTARGETDIRPREFIX),$(CLEANRSTFILES)) +endif +ifdef CLEAN_FILES + -$(DEL) $(CLEAN_FILES) +endif +ifdef LIB_NAME + -$(DEL) $(LIB_NAME) $(LIB_FULLNAME) +endif + -$(DEL) $(FPCMADE) Package.fpc $(PPAS) script.res link.res $(FPCEXTFILE) $(REDIRFILE) + -$(DEL) *$(ASMEXT) *_ppas$(BATCHEXT) +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) *_ppas$(BATCHEXT) +ifdef AOUTEXT + -$(DEL) *$(AOUTEXT) +endif +ifdef DEBUGSYMEXT + -$(DEL) *$(DEBUGSYMEXT) +endif +fpc_distclean: cleanall +.PHONY: fpc_baseinfo +override INFORULES+=fpc_baseinfo +fpc_baseinfo: + @$(ECHO) + @$(ECHO) == Package info == + @$(ECHO) Package Name..... $(PACKAGE_NAME) + @$(ECHO) Package Version.. $(PACKAGE_VERSION) + @$(ECHO) + @$(ECHO) == Configuration info == + @$(ECHO) + @$(ECHO) FPC.......... $(FPC) + @$(ECHO) FPC Version.. $(FPC_VERSION) + @$(ECHO) Source CPU... $(CPU_SOURCE) + @$(ECHO) Target CPU... $(CPU_TARGET) + @$(ECHO) Source OS.... $(OS_SOURCE) + @$(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) + @$(ECHO) Required pkgs... $(REQUIRE_PACKAGES) + @$(ECHO) + @$(ECHO) Basedir......... $(BASEDIR) + @$(ECHO) FPCDir.......... $(FPCDIR) + @$(ECHO) CrossBinDir..... $(CROSSBINDIR) + @$(ECHO) UnitsDir........ $(UNITSDIR) + @$(ECHO) PackagesDir..... $(PACKAGESDIR) + @$(ECHO) + @$(ECHO) GCC library..... $(GCCLIBDIR) + @$(ECHO) Other library... $(OTHERLIBDIR) + @$(ECHO) + @$(ECHO) == Tools info == + @$(ECHO) + @$(ECHO) As........ $(AS) + @$(ECHO) Ld........ $(LD) + @$(ECHO) Ar........ $(AR) + @$(ECHO) Rc........ $(RC) + @$(ECHO) + @$(ECHO) Mv........ $(MVPROG) + @$(ECHO) Cp........ $(CPPROG) + @$(ECHO) Rm........ $(RMPROG) + @$(ECHO) GInstall.. $(GINSTALL) + @$(ECHO) Echo...... $(ECHO) + @$(ECHO) Shell..... $(SHELL) + @$(ECHO) Date...... $(DATE) + @$(ECHO) FPCMake... $(FPCMAKE) + @$(ECHO) PPUMove... $(PPUMOVE) + @$(ECHO) Upx....... $(UPXPROG) + @$(ECHO) Zip....... $(ZIPPROG) + @$(ECHO) + @$(ECHO) == Object info == + @$(ECHO) + @$(ECHO) Target Loaders........ $(TARGET_LOADERS) + @$(ECHO) Target Units.......... $(TARGET_UNITS) + @$(ECHO) Target Implicit Units. $(TARGET_IMPLICITUNITS) + @$(ECHO) Target Programs....... $(TARGET_PROGRAMS) + @$(ECHO) Target Dirs........... $(TARGET_DIRS) + @$(ECHO) Target Examples....... $(TARGET_EXAMPLES) + @$(ECHO) Target ExampleDirs.... $(TARGET_EXAMPLEDIRS) + @$(ECHO) + @$(ECHO) Clean Units......... $(CLEAN_UNITS) + @$(ECHO) Clean Files......... $(CLEAN_FILES) + @$(ECHO) + @$(ECHO) Install Units....... $(INSTALL_UNITS) + @$(ECHO) Install Files....... $(INSTALL_FILES) + @$(ECHO) + @$(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) + @$(ECHO) Install binary dir... $(INSTALL_BINDIR) + @$(ECHO) Install library dir.. $(INSTALL_LIBDIR) + @$(ECHO) Install units dir.... $(INSTALL_UNITDIR) + @$(ECHO) Install source dir... $(INSTALL_SOURCEDIR) + @$(ECHO) Install doc dir...... $(INSTALL_DOCDIR) + @$(ECHO) Install example dir.. $(INSTALL_EXAMPLEDIR) + @$(ECHO) Install data dir..... $(INSTALL_DATADIR) + @$(ECHO) + @$(ECHO) Dist destination dir. $(DIST_DESTDIR) + @$(ECHO) Dist zip name........ $(DIST_ZIPNAME) + @$(ECHO) +.PHONY: fpc_info +fpc_info: $(INFORULES) +.PHONY: fpc_makefile fpc_makefiles fpc_makefile_sub1 fpc_makefile_sub2 \ + fpc_makefile_dirs +fpc_makefile: + $(FPCMAKE) -w -T$(OS_TARGET) Makefile.fpc +fpc_makefile_sub1: +ifdef TARGET_DIRS + $(FPCMAKE) -w -T$(OS_TARGET) $(addsuffix /Makefile.fpc,$(TARGET_DIRS)) +endif +ifdef TARGET_EXAMPLEDIRS + $(FPCMAKE) -w -T$(OS_TARGET) $(addsuffix /Makefile.fpc,$(TARGET_EXAMPLEDIRS)) +endif +fpc_makefile_sub2: $(addsuffix _makefile_dirs,$(TARGET_DIRS) $(TARGET_EXAMPLEDIRS)) +fpc_makefile_dirs: fpc_makefile_sub1 fpc_makefile_sub2 +fpc_makefiles: fpc_makefile fpc_makefile_dirs +all: fpc_all +debug: fpc_debug +smart: fpc_smart +release: fpc_release +units: fpc_units +examples: +shared: fpc_shared +install: fpc_install +sourceinstall: fpc_sourceinstall +exampleinstall: fpc_exampleinstall +distinstall: +zipinstall: +zipsourceinstall: +zipexampleinstall: +zipdistinstall: +clean: fpc_clean +distclean: fpc_distclean +cleanall: fpc_cleanall +info: fpc_info +makefiles: fpc_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 +.NOTPARALLEL: diff --git a/packages/gtk2/examples/filechooser/Makefile.fpc b/packages/gtk2/examples/filechooser/Makefile.fpc new file mode 100644 index 0000000000..9c4f701645 --- /dev/null +++ b/packages/gtk2/examples/filechooser/Makefile.fpc @@ -0,0 +1,18 @@ +# +# Makefile.fpc for Free Pascal GTK 2.x.y Examples +# + +[target] +programs=simple glade + +[require] +packages=gtk2 + +[install] +fpcpackage=y + +[default] +fpcdir=../../../.. + +[rules] +.NOTPARALLEL: diff --git a/packages/gtk2/examples/filechooser/beipiel.glade b/packages/gtk2/examples/filechooser/beipiel.glade new file mode 100644 index 0000000000..bf400bf93d --- /dev/null +++ b/packages/gtk2/examples/filechooser/beipiel.glade @@ -0,0 +1,106 @@ +<?xml version="1.0" standalone="no"?> <!--*- mode: xml -*--> +<!DOCTYPE glade-interface SYSTEM "http://glade.gnome.org/glade-2.0.dtd"> + +<glade-interface> +<requires lib="gnome"/> + +<widget class="GtkWindow" id="MainWindow"> + <property name="visible">True</property> + <property name="title" translatable="yes">FileChooser and Glade2 example</property> + <property name="type">GTK_WINDOW_TOPLEVEL</property> + <property name="window_position">GTK_WIN_POS_NONE</property> + <property name="modal">False</property> + <property name="resizable">True</property> + <property name="destroy_with_parent">False</property> + + <child> + <widget class="GtkVBox" id="vbox1"> + <property name="visible">True</property> + <property name="homogeneous">False</property> + <property name="spacing">6</property> + + <child> + <widget class="GtkLabel" id="label1"> + <property name="visible">True</property> + <property name="label" translatable="yes">Hello! What do you want to do today?</property> + <property name="use_underline">False</property> + <property name="use_markup">False</property> + <property name="justify">GTK_JUSTIFY_LEFT</property> + <property name="wrap">False</property> + <property name="selectable">False</property> + <property name="xalign">0.5</property> + <property name="yalign">0.5</property> + <property name="xpad">0</property> + <property name="ypad">0</property> + </widget> + <packing> + <property name="padding">10</property> + <property name="expand">False</property> + <property name="fill">False</property> + </packing> + </child> + + <child> + <widget class="GtkCalendar" id="calendar1"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="display_options">GTK_CALENDAR_SHOW_HEADING|GTK_CALENDAR_SHOW_DAY_NAMES</property> + </widget> + <packing> + <property name="padding">0</property> + <property name="expand">True</property> + <property name="fill">True</property> + </packing> + </child> + + <child> + <widget class="GtkHButtonBox" id="hbuttonbox1"> + <property name="visible">True</property> + <property name="layout_style">GTK_BUTTONBOX_SPREAD</property> + <property name="spacing">3</property> + + <child> + <widget class="GtkButton" id="exit"> + <property name="visible">True</property> + <property name="can_default">True</property> + <property name="can_focus">True</property> + <property name="label">gtk-quit</property> + <property name="use_stock">True</property> + <property name="relief">GTK_RELIEF_NORMAL</property> + </widget> + </child> + + <child> + <widget class="GtkButton" id="open"> + <property name="visible">True</property> + <property name="can_default">True</property> + <property name="can_focus">True</property> + <property name="label">gtk-open</property> + <property name="use_stock">True</property> + <property name="relief">GTK_RELIEF_NORMAL</property> + </widget> + </child> + </widget> + <packing> + <property name="padding">0</property> + <property name="expand">True</property> + <property name="fill">True</property> + </packing> + </child> + + <child> + <widget class="GtkStatusbar" id="statusbar1"> + <property name="visible">True</property> + <property name="has_resize_grip">True</property> + </widget> + <packing> + <property name="padding">0</property> + <property name="expand">False</property> + <property name="fill">False</property> + </packing> + </child> + </widget> + </child> +</widget> + +</glade-interface> diff --git a/packages/gtk2/examples/filechooser/glade.pas b/packages/gtk2/examples/filechooser/glade.pas new file mode 100644 index 0000000000..77258b7d5c --- /dev/null +++ b/packages/gtk2/examples/filechooser/glade.pas @@ -0,0 +1,164 @@ +program glade_test; +{$mode objfpc} {$H+} + +{$IFDEF GTK2_0}{$FATAL this demo needs gtk 2.4}{$ENDIF} +{$IFDEF GTK2_2}{$FATAL this demo needs gtk 2.4}{$ENDIF} + +uses + cmem, { because of: ... ld.so: dl-minimal.c: 134: realloc: Assertion `ptr == alloc_last_block' failed! } + Glib2, Gdk2, Gtk2, LibGlade2; + +procedure open_callback (widget : PGtkWidget; + data : gpointer); cdecl; forward; + + +function delete_event (widget: PGtkWidget; + event : PGdkEvent; + data : gpointer): gboolean;cdecl; forward; + + +procedure show_glade_file (filename : Pgchar); +var + xml : PGladeXML; + fatal_mask : TGLogLevelFlags; + toplevel : PGtkWidget; + open : PGtkWidget; + exit : PGtkWidget; + +begin + fatal_mask := g_log_set_always_fatal (G_LOG_FATAL_MASK); + + g_log_set_always_fatal (fatal_mask or G_LOG_LEVEL_WARNING or G_LOG_LEVEL_CRITICAL); + + if filename <> NULL then begin + { read the glade xml file } + xml := glade_xml_new (filename, NULL, NULL); + + { get the pointers to the widgets } + + toplevel := glade_xml_get_widget (xml, 'MainWindow'); + + exit := glade_xml_get_widget (xml, 'exit'); + open := glade_xml_get_widget (xml, 'open'); + + { If the widgets where found in the xml code... } + + { ... connect the signals to the buttons } + if open <> NULL then + g_signal_connect (G_OBJECT (open), 'clicked', + G_CALLBACK (@open_callback), toplevel); + + if exit <> NULL then + g_signal_connect (G_OBJECT (exit), 'clicked', + G_CALLBACK (@delete_event), NULL); + + { and show them all } + + if toplevel <> NULL then + gtk_widget_show_all (toplevel); + + g_object_unref (G_OBJECT (xml)); + + end; { filename } +end; + + +procedure open_callback (widget : PGtkWidget; + data : gpointer); cdecl; +var + dialog : PGtkWidget; + window : PGtkWindow; + action : gint; + filename : Pgchar; + filter : PGtkFileFilter; + +begin + { Get a pointer to the main window } + window := GTK_WINDOW (data); + + { create the filechooser dialog } + dialog := gtk_file_chooser_dialog_new ('Open Glade XML', + window, + GTK_FILE_CHOOSER_ACTION_OPEN, + GTK_STOCK_OPEN, [GTK_RESPONSE_ACCEPT, + GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, + NULL]); + + filter := gtk_file_filter_new; { creates a new GtkFileFilter } + + gtk_file_filter_add_pattern (filter, '*.glade'); { and allow only *.glade files } + + { We now use this filter to display only *.glade files in the filechooser } + + gtk_file_chooser_add_filter ( GTK_FILE_CHOOSER(dialog), filter); + + if gtk_dialog_run (GTK_DIALOG (dialog)) = GTK_RESPONSE_ACCEPT then + begin + { get selected file } + filename := gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (dialog)); + + { and do something with it } + show_glade_file (filename); + + g_free (filename); + end; + + gtk_widget_destroy (dialog); +end; + + + + +function delete_event (widget: PGtkWidget; + event : PGdkEvent; + data : gpointer): gboolean;cdecl; +begin + gtk_main_quit; + delete_event := FALSE; +end; + + +var + window, + button, + box1 : PGtkWidget; (* GtkWidget is the storage type for widgets *) + +begin + + gtk_init (@argc, @argv); + + window := gtk_window_new (GTK_WINDOW_TOPLEVEL); + + gtk_window_set_title (GTK_WINDOW (window), 'GtkFileChooser and LibGlade Demo'); + + g_signal_connect (G_OBJECT (window), 'delete_event', + G_CALLBACK (@delete_event), NULL); + + + gtk_container_set_border_width (GTK_CONTAINER (window), 10); + + box1 := gtk_hbox_new (FALSE, 0); + + (* Put the box into the main window. *) + gtk_container_add (GTK_CONTAINER (window), box1); + + button := gtk_button_new_from_stock (GTK_STOCK_OPEN); + + + g_signal_connect (G_OBJECT (button), 'clicked', + G_CALLBACK (@open_callback), window); + + gtk_box_pack_start (GTK_BOX(box1), button, TRUE, TRUE, 10); + + (* Always remember this step, this tells GTK that our preparation for + * this button is complete, and it can now be displayed. *) + gtk_widget_show (button); + + + gtk_widget_show (box1); + + gtk_widget_show (window); + + + gtk_main (); +end. diff --git a/packages/gtk2/examples/filechooser/simple.pas b/packages/gtk2/examples/filechooser/simple.pas new file mode 100644 index 0000000000..8a6c770109 --- /dev/null +++ b/packages/gtk2/examples/filechooser/simple.pas @@ -0,0 +1,166 @@ +program simple_filechooser; + +(* basing upon helloworld2 example*) +{$mode objfpc} {$H+} + +{$IFDEF GTK2_0}{$FATAL this demo needs gtk 2.4}{$ENDIF} +{$IFDEF GTK2_2}{$FATAL this demo needs gtk 2.4}{$ENDIF} + +uses + Glib2, Gdk2, Gtk2; + +const + ACTION_OPEN = 1; + ACTION_SAVE = 2; + + MAIN_WINDOW_KEY = 'main_window'; { uses with g_object_(get/set)_data as key } + + +(* File dialog-callback. *) +procedure dialog_callback (widget : PGtkWidget; + data : gpointer); cdecl; +var + dialog : PGtkWidget; + window : PGtkWindow; + action : gint; + filename : Pgchar; + +begin + { Get a pointer to the main window } + window := g_object_get_data (G_OBJECT(widget), MAIN_WINDOW_KEY); + + action := gint (data); + + case action of + ACTION_OPEN: + begin + dialog := gtk_file_chooser_dialog_new ('Open File', + window, + GTK_FILE_CHOOSER_ACTION_OPEN, + GTK_STOCK_OPEN, [GTK_RESPONSE_ACCEPT, + GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, + NULL]); + + end; { ACTION_OPEN} + ACTION_SAVE: + begin + dialog := gtk_file_chooser_dialog_new ('Save File', + window, + GTK_FILE_CHOOSER_ACTION_SAVE, + GTK_STOCK_SAVE, [GTK_RESPONSE_ACCEPT, + GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, + NULL]); + + end; { ACTION_SAVE } + else begin + { This should never happen } + g_print ('Something is wrong here!!!.'#13#10); + g_print ('No dialog created.'#13#10); + {writeln crashes on my system running linux --- check why } + exit; + end; + end; { case } + + + if gtk_dialog_run (GTK_DIALOG (dialog)) = GTK_RESPONSE_ACCEPT then + begin + filename := gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (dialog)); + g_print ('Filename %s selected.'#13#10, [filename]); + // writeln ('File ', filename, ' selected.'); + // ToDO: + // writeln crashes... check why + + g_free (filename); + end; + + gtk_widget_destroy (dialog); +end; + + + + +(* another callback *) +function delete_event (widget: PGtkWidget; + event : PGdkEvent; + data : gpointer): gboolean;cdecl; +begin + gtk_main_quit; + delete_event := FALSE; +end; + + +var + window, + button, + box1 : PGtkWidget; (* GtkWidget is the storage type for widgets *) + +begin + + (* This is called in all GTK applications. Arguments are parsed + * from the command line and are returned to the application. *) + + gtk_init (@argc, @argv); + + (* Create a new window *) + window := gtk_window_new (GTK_WINDOW_TOPLEVEL); + + (* This is a new call, which just sets the title of our + * new window to "Hello Buttons!" *) + gtk_window_set_title (GTK_WINDOW (window), 'GtkFileChooser Demo'); + + (* Here we just set a handler for delete_event that immediately + * exits GTK. *) + g_signal_connect (G_OBJECT (window), 'delete_event', + G_CALLBACK (@delete_event), NULL); + + (* Sets the border width of the window. *) + gtk_container_set_border_width (GTK_CONTAINER (window), 10); + + (* We create a box to pack widgets into. This is described in detail + * in the "packing" section. The box is not really visible, it + * is just used as a tool to arrange widgets. *) + box1 := gtk_hbox_new (FALSE, 0); + + (* Put the box into the main window. *) + gtk_container_add (GTK_CONTAINER (window), box1); + + + button := gtk_button_new_with_label ('Open'); + + (* Now when the button is clicked, we call the "callback" function + * with a pointer to the main window as its argument *) + g_object_set_data (G_OBJECT(button), MAIN_WINDOW_KEY, window); + + g_signal_connect (G_OBJECT (button), 'clicked', + G_CALLBACK (@dialog_callback), pointer(ACTION_OPEN)); + + (* Instead of gtk_container_add, we pack this button into the invisible + * box, which has been packed into the window. *) + gtk_box_pack_start (GTK_BOX(box1), button, TRUE, TRUE, 0); + + (* Always remember this step, this tells GTK that our preparation for + * this button is complete, and it can now be displayed. *) + gtk_widget_show (button); + + (* Do these same steps again to create a second button *) + button := gtk_button_new_with_label ('Save'); + + g_object_set_data (G_OBJECT(button), MAIN_WINDOW_KEY, window); + + g_signal_connect (G_OBJECT (button), 'clicked', + G_CALLBACK (@dialog_callback), pointer(ACTION_SAVE)); + + gtk_box_pack_start(GTK_BOX (box1), button, TRUE, TRUE, 0); + + (* The order in which we show the buttons is not really important, but I + * recommend showing the window last, so it all pops up at once. *) + gtk_widget_show (button); + + gtk_widget_show (box1); + + gtk_widget_show (window); + + + (* Rest in gtk_main and wait for the fun to begin! *) + gtk_main (); +end. diff --git a/packages/gtk2/examples/gettingstarted/Makefile b/packages/gtk2/examples/gettingstarted/Makefile new file mode 100644 index 0000000000..8cc8c45c60 --- /dev/null +++ b/packages/gtk2/examples/gettingstarted/Makefile @@ -0,0 +1,2015 @@ +# +# Don't edit, this file is generated by FPCMake Version 2.0.0 [2008/01/26] +# +default: all +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-darwin i386-emx i386-watcom i386-netwlibc i386-wince i386-embedded i386-symbian m68k-linux m68k-freebsd m68k-netbsd m68k-amiga m68k-atari m68k-openbsd m68k-palmos m68k-embedded powerpc-linux powerpc-netbsd powerpc-amiga powerpc-macos powerpc-darwin powerpc-morphos powerpc-embedded sparc-linux sparc-netbsd sparc-solaris sparc-embedded x86_64-linux x86_64-freebsd x86_64-darwin x86_64-win64 x86_64-embedded arm-linux arm-palmos arm-wince arm-gba arm-nds arm-embedded arm-symbian powerpc64-linux powerpc64-darwin powerpc64-embedded +BSDs = freebsd netbsd openbsd darwin +UNIXs = linux $(BSDs) solaris qnx +LIMIT83fs = go32v2 os2 emx watcom +OSNeedsComspecToRunBatch = go32v2 watcom +FORCE: +.PHONY: FORCE +override PATH:=$(patsubst %/,%,$(subst \,/,$(PATH))) +ifneq ($(findstring darwin,$(OSTYPE)),) +inUnix=1 #darwin +SEARCHPATH:=$(filter-out .,$(subst :, ,$(PATH))) +else +ifeq ($(findstring ;,$(PATH)),) +inUnix=1 +SEARCHPATH:=$(filter-out .,$(subst :, ,$(PATH))) +else +SEARCHPATH:=$(subst ;, ,$(PATH)) +endif +endif +SEARCHPATH+=$(patsubst %/,%,$(subst \,/,$(dir $(MAKE)))) +PWD:=$(strip $(wildcard $(addsuffix /pwd.exe,$(SEARCHPATH)))) +ifeq ($(PWD),) +PWD:=$(strip $(wildcard $(addsuffix /pwd,$(SEARCHPATH)))) +ifeq ($(PWD),) +$(error You need the GNU utils package to use this Makefile) +else +PWD:=$(firstword $(PWD)) +SRCEXEEXT= +endif +else +PWD:=$(firstword $(PWD)) +SRCEXEEXT=.exe +endif +ifndef inUnix +ifeq ($(OS),Windows_NT) +inWinNT=1 +else +ifdef OS2_SHELL +inOS2=1 +endif +endif +else +ifneq ($(findstring cygdrive,$(PATH)),) +inCygWin=1 +endif +endif +ifdef inUnix +SRCBATCHEXT=.sh +else +ifdef inOS2 +SRCBATCHEXT=.cmd +else +SRCBATCHEXT=.bat +endif +endif +ifdef COMSPEC +ifneq ($(findstring $(OS_SOURCE),$(OSNeedsComspecToRunBatch)),) +RUNBATCH=$(COMSPEC) /C +endif +endif +ifdef inUnix +PATHSEP=/ +else +PATHSEP:=$(subst /,\,/) +ifdef inCygWin +PATHSEP=/ +endif +endif +ifdef PWD +BASEDIR:=$(subst \,/,$(shell $(PWD))) +ifdef inCygWin +ifneq ($(findstring /cygdrive/,$(BASEDIR)),) +BASENODIR:=$(patsubst /cygdrive%,%,$(BASEDIR)) +BASEDRIVE:=$(firstword $(subst /, ,$(BASENODIR))) +BASEDIR:=$(subst /cygdrive/$(BASEDRIVE)/,$(BASEDRIVE):/,$(BASEDIR)) +endif +endif +else +BASEDIR=. +endif +ifdef inOS2 +ifndef ECHO +ECHO:=$(strip $(wildcard $(addsuffix /gecho$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(ECHO),) +ECHO:=$(strip $(wildcard $(addsuffix /echo$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(ECHO),) +ECHO=echo +else +ECHO:=$(firstword $(ECHO)) +endif +else +ECHO:=$(firstword $(ECHO)) +endif +endif +export ECHO +endif +override DEFAULT_FPCDIR=../../../.. +ifndef FPC +ifdef PP +FPC=$(PP) +endif +endif +ifndef FPC +FPCPROG:=$(strip $(wildcard $(addsuffix /fpc$(SRCEXEEXT),$(SEARCHPATH)))) +ifneq ($(FPCPROG),) +FPCPROG:=$(firstword $(FPCPROG)) +ifneq ($(CPU_TARGET),) +FPC:=$(shell $(FPCPROG) -P$(CPU_TARGET) -PB) +else +FPC:=$(shell $(FPCPROG) -PB) +endif +ifneq ($(findstring Error,$(FPC)),) +override FPC=$(firstword $(strip $(wildcard $(addsuffix /ppc386$(SRCEXEEXT),$(SEARCHPATH))))) +endif +else +override FPC=$(firstword $(strip $(wildcard $(addsuffix /ppc386$(SRCEXEEXT),$(SEARCHPATH))))) +endif +endif +override FPC:=$(subst $(SRCEXEEXT),,$(FPC)) +override FPC:=$(subst \,/,$(FPC))$(SRCEXEEXT) +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 +unexport CHECKDEPEND ALLDEPENDENCIES +ifndef CPU_TARGET +ifdef CPU_TARGET_DEFAULT +CPU_TARGET=$(CPU_TARGET_DEFAULT) +endif +endif +ifndef OS_TARGET +ifdef OS_TARGET_DEFAULT +OS_TARGET=$(OS_TARGET_DEFAULT) +endif +endif +ifneq ($(words $(FPC_COMPILERINFO)),5) +FPC_COMPILERINFO+=$(shell $(FPC) -iSP) +FPC_COMPILERINFO+=$(shell $(FPC) -iTP) +FPC_COMPILERINFO+=$(shell $(FPC) -iSO) +FPC_COMPILERINFO+=$(shell $(FPC) -iTO) +endif +ifndef CPU_SOURCE +CPU_SOURCE:=$(word 2,$(FPC_COMPILERINFO)) +endif +ifndef CPU_TARGET +CPU_TARGET:=$(word 3,$(FPC_COMPILERINFO)) +endif +ifndef OS_SOURCE +OS_SOURCE:=$(word 4,$(FPC_COMPILERINFO)) +endif +ifndef OS_TARGET +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 $(FULL_TARGET),$(MAKEFILETARGETS)),) +$(error The Makefile doesn't support target $(FULL_TARGET), please run fpcmake first) +endif +endif +ifneq ($(findstring $(OS_TARGET),$(BSDs)),) +BSDhier=1 +endif +ifeq ($(OS_TARGET),linux) +linuxHier=1 +endif +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)),) +override FPCDIR=wrong +endif +else +override FPCDIR=wrong +endif +ifdef DEFAULT_FPCDIR +ifeq ($(FPCDIR),wrong) +override FPCDIR:=$(subst \,/,$(DEFAULT_FPCDIR)) +ifeq ($(wildcard $(addprefix $(FPCDIR)/,rtl units)),) +override FPCDIR=wrong +endif +endif +endif +ifeq ($(FPCDIR),wrong) +ifdef inUnix +override FPCDIR=/usr/local/lib/fpc/$(FPC_VERSION) +ifeq ($(wildcard $(FPCDIR)/units),) +override FPCDIR=/usr/lib/fpc/$(FPC_VERSION) +endif +else +override FPCDIR:=$(subst /$(FPC),,$(firstword $(strip $(wildcard $(addsuffix /$(FPC),$(SEARCHPATH)))))) +override FPCDIR:=$(FPCDIR)/.. +ifeq ($(wildcard $(addprefix $(FPCDIR)/,rtl units)),) +override FPCDIR:=$(FPCDIR)/.. +ifeq ($(wildcard $(addprefix $(FPCDIR)/,rtl units)),) +override FPCDIR:=$(BASEDIR) +ifeq ($(wildcard $(addprefix $(FPCDIR)/,rtl units)),) +override FPCDIR=c:/pp +endif +endif +endif +endif +endif +ifndef CROSSBINDIR +CROSSBINDIR:=$(wildcard $(FPCDIR)/bin/$(TARGETSUFFIX)) +endif +ifndef BINUTILSPREFIX +ifndef CROSSBINDIR +ifdef CROSSCOMPILE +BINUTILSPREFIX=$(CPU_TARGET)-$(OS_TARGET)- +endif +endif +endif +UNITSDIR:=$(wildcard $(FPCDIR)/units/$(TARGETSUFFIX)) +ifeq ($(UNITSDIR),) +UNITSDIR:=$(wildcard $(FPCDIR)/units/$(OS_TARGET)) +endif +PACKAGESDIR:=$(wildcard $(FPCDIR) $(FPCDIR)/packages $(FPCDIR)/packages/base $(FPCDIR)/packages/extra) +ifeq ($(FULL_TARGET),i386-linux) +override TARGET_PROGRAMS+=gettingstarted +endif +ifeq ($(FULL_TARGET),i386-go32v2) +override TARGET_PROGRAMS+=gettingstarted +endif +ifeq ($(FULL_TARGET),i386-win32) +override TARGET_PROGRAMS+=gettingstarted +endif +ifeq ($(FULL_TARGET),i386-os2) +override TARGET_PROGRAMS+=gettingstarted +endif +ifeq ($(FULL_TARGET),i386-freebsd) +override TARGET_PROGRAMS+=gettingstarted +endif +ifeq ($(FULL_TARGET),i386-beos) +override TARGET_PROGRAMS+=gettingstarted +endif +ifeq ($(FULL_TARGET),i386-netbsd) +override TARGET_PROGRAMS+=gettingstarted +endif +ifeq ($(FULL_TARGET),i386-solaris) +override TARGET_PROGRAMS+=gettingstarted +endif +ifeq ($(FULL_TARGET),i386-qnx) +override TARGET_PROGRAMS+=gettingstarted +endif +ifeq ($(FULL_TARGET),i386-netware) +override TARGET_PROGRAMS+=gettingstarted +endif +ifeq ($(FULL_TARGET),i386-openbsd) +override TARGET_PROGRAMS+=gettingstarted +endif +ifeq ($(FULL_TARGET),i386-wdosx) +override TARGET_PROGRAMS+=gettingstarted +endif +ifeq ($(FULL_TARGET),i386-darwin) +override TARGET_PROGRAMS+=gettingstarted +endif +ifeq ($(FULL_TARGET),i386-emx) +override TARGET_PROGRAMS+=gettingstarted +endif +ifeq ($(FULL_TARGET),i386-watcom) +override TARGET_PROGRAMS+=gettingstarted +endif +ifeq ($(FULL_TARGET),i386-netwlibc) +override TARGET_PROGRAMS+=gettingstarted +endif +ifeq ($(FULL_TARGET),i386-wince) +override TARGET_PROGRAMS+=gettingstarted +endif +ifeq ($(FULL_TARGET),i386-embedded) +override TARGET_PROGRAMS+=gettingstarted +endif +ifeq ($(FULL_TARGET),i386-symbian) +override TARGET_PROGRAMS+=gettingstarted +endif +ifeq ($(FULL_TARGET),m68k-linux) +override TARGET_PROGRAMS+=gettingstarted +endif +ifeq ($(FULL_TARGET),m68k-freebsd) +override TARGET_PROGRAMS+=gettingstarted +endif +ifeq ($(FULL_TARGET),m68k-netbsd) +override TARGET_PROGRAMS+=gettingstarted +endif +ifeq ($(FULL_TARGET),m68k-amiga) +override TARGET_PROGRAMS+=gettingstarted +endif +ifeq ($(FULL_TARGET),m68k-atari) +override TARGET_PROGRAMS+=gettingstarted +endif +ifeq ($(FULL_TARGET),m68k-openbsd) +override TARGET_PROGRAMS+=gettingstarted +endif +ifeq ($(FULL_TARGET),m68k-palmos) +override TARGET_PROGRAMS+=gettingstarted +endif +ifeq ($(FULL_TARGET),m68k-embedded) +override TARGET_PROGRAMS+=gettingstarted +endif +ifeq ($(FULL_TARGET),powerpc-linux) +override TARGET_PROGRAMS+=gettingstarted +endif +ifeq ($(FULL_TARGET),powerpc-netbsd) +override TARGET_PROGRAMS+=gettingstarted +endif +ifeq ($(FULL_TARGET),powerpc-amiga) +override TARGET_PROGRAMS+=gettingstarted +endif +ifeq ($(FULL_TARGET),powerpc-macos) +override TARGET_PROGRAMS+=gettingstarted +endif +ifeq ($(FULL_TARGET),powerpc-darwin) +override TARGET_PROGRAMS+=gettingstarted +endif +ifeq ($(FULL_TARGET),powerpc-morphos) +override TARGET_PROGRAMS+=gettingstarted +endif +ifeq ($(FULL_TARGET),powerpc-embedded) +override TARGET_PROGRAMS+=gettingstarted +endif +ifeq ($(FULL_TARGET),sparc-linux) +override TARGET_PROGRAMS+=gettingstarted +endif +ifeq ($(FULL_TARGET),sparc-netbsd) +override TARGET_PROGRAMS+=gettingstarted +endif +ifeq ($(FULL_TARGET),sparc-solaris) +override TARGET_PROGRAMS+=gettingstarted +endif +ifeq ($(FULL_TARGET),sparc-embedded) +override TARGET_PROGRAMS+=gettingstarted +endif +ifeq ($(FULL_TARGET),x86_64-linux) +override TARGET_PROGRAMS+=gettingstarted +endif +ifeq ($(FULL_TARGET),x86_64-freebsd) +override TARGET_PROGRAMS+=gettingstarted +endif +ifeq ($(FULL_TARGET),x86_64-darwin) +override TARGET_PROGRAMS+=gettingstarted +endif +ifeq ($(FULL_TARGET),x86_64-win64) +override TARGET_PROGRAMS+=gettingstarted +endif +ifeq ($(FULL_TARGET),x86_64-embedded) +override TARGET_PROGRAMS+=gettingstarted +endif +ifeq ($(FULL_TARGET),arm-linux) +override TARGET_PROGRAMS+=gettingstarted +endif +ifeq ($(FULL_TARGET),arm-palmos) +override TARGET_PROGRAMS+=gettingstarted +endif +ifeq ($(FULL_TARGET),arm-wince) +override TARGET_PROGRAMS+=gettingstarted +endif +ifeq ($(FULL_TARGET),arm-gba) +override TARGET_PROGRAMS+=gettingstarted +endif +ifeq ($(FULL_TARGET),arm-nds) +override TARGET_PROGRAMS+=gettingstarted +endif +ifeq ($(FULL_TARGET),arm-embedded) +override TARGET_PROGRAMS+=gettingstarted +endif +ifeq ($(FULL_TARGET),arm-symbian) +override TARGET_PROGRAMS+=gettingstarted +endif +ifeq ($(FULL_TARGET),powerpc64-linux) +override TARGET_PROGRAMS+=gettingstarted +endif +ifeq ($(FULL_TARGET),powerpc64-darwin) +override TARGET_PROGRAMS+=gettingstarted +endif +ifeq ($(FULL_TARGET),powerpc64-embedded) +override TARGET_PROGRAMS+=gettingstarted +endif +override INSTALL_FPCPACKAGE=y +ifdef REQUIRE_UNITSDIR +override UNITSDIR+=$(REQUIRE_UNITSDIR) +endif +ifdef REQUIRE_PACKAGESDIR +override PACKAGESDIR+=$(REQUIRE_PACKAGESDIR) +endif +ifdef ZIPINSTALL +ifneq ($(findstring $(OS_TARGET),$(UNIXs)),) +UNIXHier=1 +endif +else +ifneq ($(findstring $(OS_SOURCE),$(UNIXs)),) +UNIXHier=1 +endif +endif +ifndef INSTALL_PREFIX +ifdef PREFIX +INSTALL_PREFIX=$(PREFIX) +endif +endif +ifndef INSTALL_PREFIX +ifdef UNIXHier +INSTALL_PREFIX=/usr/local +else +ifdef INSTALL_FPCPACKAGE +INSTALL_BASEDIR:=/pp +else +INSTALL_BASEDIR:=/$(PACKAGE_NAME) +endif +endif +endif +export INSTALL_PREFIX +ifdef INSTALL_FPCSUBDIR +export INSTALL_FPCSUBDIR +endif +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 +INSTALL_BASEDIR:=$(INSTALL_PREFIX)/lib/fpc/$(FPC_VERSION) +else +INSTALL_BASEDIR:=$(INSTALL_PREFIX)/lib/$(PACKAGE_NAME) +endif +else +INSTALL_BASEDIR:=$(INSTALL_PREFIX) +endif +endif +ifndef INSTALL_BINDIR +ifdef UNIXHier +INSTALL_BINDIR:=$(INSTALL_PREFIX)/bin +else +INSTALL_BINDIR:=$(INSTALL_BASEDIR)/bin +ifdef INSTALL_FPCPACKAGE +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 +INSTALL_UNITDIR:=$(INSTALL_BASEDIR)/units/$(TARGETSUFFIX) +ifdef INSTALL_FPCPACKAGE +ifdef PACKAGE_NAME +INSTALL_UNITDIR:=$(INSTALL_UNITDIR)/$(PACKAGE_NAME) +endif +endif +endif +ifndef INSTALL_LIBDIR +ifdef UNIXHier +INSTALL_LIBDIR:=$(INSTALL_PREFIX)/lib +else +INSTALL_LIBDIR:=$(INSTALL_UNITDIR) +endif +endif +ifndef INSTALL_SOURCEDIR +ifdef UNIXHier +ifdef BSDhier +SRCPREFIXDIR=share/src +else +ifdef linuxHier +SRCPREFIXDIR=share/src +else +SRCPREFIXDIR=src +endif +endif +ifdef INSTALL_FPCPACKAGE +ifdef INSTALL_FPCSUBDIR +INSTALL_SOURCEDIR:=$(INSTALL_PREFIX)/$(SRCPREFIXDIR)/fpc-$(FPC_VERSION)/$(INSTALL_FPCSUBDIR)/$(PACKAGE_NAME) +else +INSTALL_SOURCEDIR:=$(INSTALL_PREFIX)/$(SRCPREFIXDIR)/fpc-$(FPC_VERSION)/$(PACKAGE_NAME) +endif +else +INSTALL_SOURCEDIR:=$(INSTALL_PREFIX)/$(SRCPREFIXDIR)/$(PACKAGE_NAME)-$(PACKAGE_VERSION) +endif +else +ifdef INSTALL_FPCPACKAGE +ifdef INSTALL_FPCSUBDIR +INSTALL_SOURCEDIR:=$(INSTALL_BASEDIR)/source/$(INSTALL_FPCSUBDIR)/$(PACKAGE_NAME) +else +INSTALL_SOURCEDIR:=$(INSTALL_BASEDIR)/source/$(PACKAGE_NAME) +endif +else +INSTALL_SOURCEDIR:=$(INSTALL_BASEDIR)/source +endif +endif +endif +ifndef INSTALL_DOCDIR +ifdef UNIXHier +ifdef BSDhier +DOCPREFIXDIR=share/doc +else +ifdef linuxHier +DOCPREFIXDIR=share/doc +else +DOCPREFIXDIR=doc +endif +endif +ifdef INSTALL_FPCPACKAGE +INSTALL_DOCDIR:=$(INSTALL_PREFIX)/$(DOCPREFIXDIR)/fpc-$(FPC_VERSION)/$(PACKAGE_NAME) +else +INSTALL_DOCDIR:=$(INSTALL_PREFIX)/$(DOCPREFIXDIR)/$(PACKAGE_NAME)-$(PACKAGE_VERSION) +endif +else +ifdef INSTALL_FPCPACKAGE +INSTALL_DOCDIR:=$(INSTALL_BASEDIR)/doc/$(PACKAGE_NAME) +else +INSTALL_DOCDIR:=$(INSTALL_BASEDIR)/doc +endif +endif +endif +ifndef INSTALL_EXAMPLEDIR +ifdef UNIXHier +ifdef INSTALL_FPCPACKAGE +ifdef BSDhier +INSTALL_EXAMPLEDIR:=$(INSTALL_PREFIX)/share/examples/fpc-$(FPC_VERSION)/$(PACKAGE_NAME) +else +ifdef linuxHier +INSTALL_EXAMPLEDIR:=$(INSTALL_DOCDIR)/examples +else +INSTALL_EXAMPLEDIR:=$(INSTALL_PREFIX)/doc/fpc-$(FPC_VERSION)/examples/$(PACKAGE_NAME) +endif +endif +else +ifdef BSDhier +INSTALL_EXAMPLEDIR:=$(INSTALL_PREFIX)/share/examples/$(PACKAGE_NAME)-$(PACKAGE_VERSION) +else +ifdef linuxHier +INSTALL_EXAMPLEDIR:=$(INSTALL_DOCDIR)/examples/$(PACKAGE_NAME)-$(PACKAGE_VERSION) +else +INSTALL_EXAMPLEDIR:=$(INSTALL_PREFIX)/doc/$(PACKAGE_NAME)-$(PACKAGE_VERSION) +endif +endif +endif +else +ifdef INSTALL_FPCPACKAGE +INSTALL_EXAMPLEDIR:=$(INSTALL_BASEDIR)/examples/$(PACKAGE_NAME) +else +INSTALL_EXAMPLEDIR:=$(INSTALL_BASEDIR)/examples +endif +endif +endif +ifndef INSTALL_DATADIR +INSTALL_DATADIR=$(INSTALL_BASEDIR) +endif +ifndef INSTALL_SHAREDDIR +INSTALL_SHAREDDIR=$(INSTALL_PREFIX)/lib +endif +ifdef CROSSCOMPILE +ifndef CROSSBINDIR +CROSSBINDIR:=$(wildcard $(CROSSTARGETDIR)/bin/$(SOURCESUFFIX)) +ifeq ($(CROSSBINDIR),) +CROSSBINDIR:=$(wildcard $(INSTALL_BASEDIR)/cross/$(TARGETSUFFIX)/bin/$(FULL_SOURCE)) +endif +endif +else +CROSSBINDIR= +endif +ifeq ($(OS_SOURCE),linux) +ifndef GCCLIBDIR +ifeq ($(CPU_TARGET),i386) +ifneq ($(findstring x86_64,$(shell uname -a)),) +ifeq ($(BINUTILSPREFIX),) +GCCLIBDIR:=$(shell dirname `gcc -m32 -print-libgcc-file-name`) +endif +endif +endif +ifeq ($(CPU_TARGET),powerpc64) +ifeq ($(BINUTILSPREFIX),) +GCCLIBDIR:=$(shell dirname `gcc -m64 -print-libgcc-file-name`) +endif +endif +endif +ifndef GCCLIBDIR +CROSSGCC=$(strip $(wildcard $(addsuffix /$(BINUTILSPREFIX)gcc$(SRCEXEEXT),$(SEARCHPATH)))) +ifneq ($(CROSSGCC),) +GCCLIBDIR:=$(shell dirname `$(CROSSGCC) -print-libgcc-file-name`) +endif +endif +ifndef OTHERLIBDIR +OTHERLIBDIR:=$(shell grep -v "^\#" /etc/ld.so.conf | awk '{ ORS=" "; print $1 }') +endif +endif +ifdef inUnix +ifeq ($(OS_SOURCE),netbsd) +OTHERLIBDIR+=/usr/pkg/lib +endif +export GCCLIBDIR OTHERLIB +endif +BATCHEXT=.bat +LOADEREXT=.as +EXEEXT=.exe +PPLEXT=.ppl +PPUEXT=.ppu +OEXT=.o +ASMEXT=.s +SMARTEXT=.sl +STATICLIBEXT=.a +SHAREDLIBEXT=.so +SHAREDLIBPREFIX=libfp +STATICLIBPREFIX=libp +IMPORTLIBPREFIX=libimp +RSTEXT=.rst +ifeq ($(findstring 1.0.,$(FPC_VERSION)),) +ifeq ($(OS_TARGET),go32v1) +STATICLIBPREFIX= +SHORTSUFFIX=v1 +endif +ifeq ($(OS_TARGET),go32v2) +STATICLIBPREFIX= +SHORTSUFFIX=dos +endif +ifeq ($(OS_TARGET),watcom) +STATICLIBPREFIX= +OEXT=.obj +ASMEXT=.asm +SHAREDLIBEXT=.dll +SHORTSUFFIX=wat +endif +ifeq ($(OS_TARGET),linux) +BATCHEXT=.sh +EXEEXT= +HASSHAREDLIB=1 +SHORTSUFFIX=lnx +endif +ifeq ($(OS_TARGET),freebsd) +BATCHEXT=.sh +EXEEXT= +HASSHAREDLIB=1 +SHORTSUFFIX=fbs +endif +ifeq ($(OS_TARGET),netbsd) +BATCHEXT=.sh +EXEEXT= +HASSHAREDLIB=1 +SHORTSUFFIX=nbs +endif +ifeq ($(OS_TARGET),openbsd) +BATCHEXT=.sh +EXEEXT= +HASSHAREDLIB=1 +SHORTSUFFIX=obs +endif +ifeq ($(OS_TARGET),win32) +SHAREDLIBEXT=.dll +SHORTSUFFIX=w32 +endif +ifeq ($(OS_TARGET),os2) +BATCHEXT=.cmd +AOUTEXT=.out +STATICLIBPREFIX= +SHAREDLIBEXT=.dll +SHORTSUFFIX=os2 +ECHO=echo +endif +ifeq ($(OS_TARGET),emx) +BATCHEXT=.cmd +AOUTEXT=.out +STATICLIBPREFIX= +SHAREDLIBEXT=.dll +SHORTSUFFIX=emx +ECHO=echo +endif +ifeq ($(OS_TARGET),amiga) +EXEEXT= +SHAREDLIBEXT=.library +SHORTSUFFIX=amg +endif +ifeq ($(OS_TARGET),morphos) +EXEEXT= +SHAREDLIBEXT=.library +SHORTSUFFIX=mos +endif +ifeq ($(OS_TARGET),atari) +EXEEXT=.ttp +SHORTSUFFIX=ata +endif +ifeq ($(OS_TARGET),beos) +BATCHEXT=.sh +EXEEXT= +SHORTSUFFIX=be +endif +ifeq ($(OS_TARGET),solaris) +BATCHEXT=.sh +EXEEXT= +SHORTSUFFIX=sun +endif +ifeq ($(OS_TARGET),qnx) +BATCHEXT=.sh +EXEEXT= +SHORTSUFFIX=qnx +endif +ifeq ($(OS_TARGET),netware) +EXEEXT=.nlm +STATICLIBPREFIX= +SHORTSUFFIX=nw +endif +ifeq ($(OS_TARGET),netwlibc) +EXEEXT=.nlm +STATICLIBPREFIX= +SHORTSUFFIX=nwl +endif +ifeq ($(OS_TARGET),macos) +BATCHEXT= +EXEEXT= +DEBUGSYMEXT=.xcoff +SHORTSUFFIX=mac +endif +ifeq ($(OS_TARGET),darwin) +BATCHEXT=.sh +EXEEXT= +HASSHAREDLIB=1 +SHORTSUFFIX=dwn +endif +ifeq ($(OS_TARGET),gba) +EXEEXT=.gba +SHAREDLIBEXT=.so +SHORTSUFFIX=gba +endif +ifeq ($(OS_TARGET),symbian) +SHAREDLIBEXT=.dll +SHORTSUFFIX=symbian +endif +else +ifeq ($(OS_TARGET),go32v1) +PPUEXT=.pp1 +OEXT=.o1 +ASMEXT=.s1 +SMARTEXT=.sl1 +STATICLIBEXT=.a1 +SHAREDLIBEXT=.so1 +STATICLIBPREFIX= +SHORTSUFFIX=v1 +endif +ifeq ($(OS_TARGET),go32v2) +STATICLIBPREFIX= +SHORTSUFFIX=dos +endif +ifeq ($(OS_TARGET),watcom) +STATICLIBPREFIX= +SHORTSUFFIX=wat +endif +ifeq ($(OS_TARGET),linux) +BATCHEXT=.sh +EXEEXT= +HASSHAREDLIB=1 +SHORTSUFFIX=lnx +endif +ifeq ($(OS_TARGET),freebsd) +BATCHEXT=.sh +EXEEXT= +HASSHAREDLIB=1 +SHORTSUFFIX=fbs +endif +ifeq ($(OS_TARGET),netbsd) +BATCHEXT=.sh +EXEEXT= +HASSHAREDLIB=1 +SHORTSUFFIX=nbs +endif +ifeq ($(OS_TARGET),openbsd) +BATCHEXT=.sh +EXEEXT= +HASSHAREDLIB=1 +SHORTSUFFIX=obs +endif +ifeq ($(OS_TARGET),win32) +PPUEXT=.ppw +OEXT=.ow +ASMEXT=.sw +SMARTEXT=.slw +STATICLIBEXT=.aw +SHAREDLIBEXT=.dll +SHORTSUFFIX=w32 +endif +ifeq ($(OS_TARGET),os2) +BATCHEXT=.cmd +PPUEXT=.ppo +ASMEXT=.so2 +OEXT=.oo2 +AOUTEXT=.out +SMARTEXT=.sl2 +STATICLIBPREFIX= +STATICLIBEXT=.ao2 +SHAREDLIBEXT=.dll +SHORTSUFFIX=os2 +ECHO=echo +endif +ifeq ($(OS_TARGET),amiga) +EXEEXT= +PPUEXT=.ppu +ASMEXT=.s +OEXT=.o +SMARTEXT=.sl +STATICLIBEXT=.a +SHAREDLIBEXT=.library +SHORTSUFFIX=amg +endif +ifeq ($(OS_TARGET),atari) +PPUEXT=.ppu +ASMEXT=.s +OEXT=.o +SMARTEXT=.sl +STATICLIBEXT=.a +EXEEXT=.ttp +SHORTSUFFIX=ata +endif +ifeq ($(OS_TARGET),beos) +BATCHEXT=.sh +PPUEXT=.ppu +ASMEXT=.s +OEXT=.o +SMARTEXT=.sl +STATICLIBEXT=.a +EXEEXT= +SHORTSUFFIX=be +endif +ifeq ($(OS_TARGET),solaris) +BATCHEXT=.sh +PPUEXT=.ppu +ASMEXT=.s +OEXT=.o +SMARTEXT=.sl +STATICLIBEXT=.a +EXEEXT= +SHORTSUFFIX=sun +endif +ifeq ($(OS_TARGET),qnx) +BATCHEXT=.sh +PPUEXT=.ppu +ASMEXT=.s +OEXT=.o +SMARTEXT=.sl +STATICLIBEXT=.a +EXEEXT= +SHORTSUFFIX=qnx +endif +ifeq ($(OS_TARGET),netware) +STATICLIBPREFIX= +PPUEXT=.ppu +OEXT=.o +ASMEXT=.s +SMARTEXT=.sl +STATICLIBEXT=.a +SHAREDLIBEXT=.nlm +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= +PPUEXT=.ppu +ASMEXT=.s +OEXT=.o +SMARTEXT=.sl +STATICLIBEXT=.a +EXEEXT= +DEBUGSYMEXT=.xcoff +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 +ECHO:=$(strip $(wildcard $(addsuffix /gecho$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(ECHO),) +ECHO:=$(strip $(wildcard $(addsuffix /echo$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(ECHO),) +ECHO= __missing_command_ECHO +else +ECHO:=$(firstword $(ECHO)) +endif +else +ECHO:=$(firstword $(ECHO)) +endif +endif +export ECHO +ifndef DATE +DATE:=$(strip $(wildcard $(addsuffix /gdate$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(DATE),) +DATE:=$(strip $(wildcard $(addsuffix /date$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(DATE),) +DATE= __missing_command_DATE +else +DATE:=$(firstword $(DATE)) +endif +else +DATE:=$(firstword $(DATE)) +endif +endif +export DATE +ifndef GINSTALL +GINSTALL:=$(strip $(wildcard $(addsuffix /ginstall$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(GINSTALL),) +GINSTALL:=$(strip $(wildcard $(addsuffix /install$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(GINSTALL),) +GINSTALL= __missing_command_GINSTALL +else +GINSTALL:=$(firstword $(GINSTALL)) +endif +else +GINSTALL:=$(firstword $(GINSTALL)) +endif +endif +export GINSTALL +ifndef CPPROG +CPPROG:=$(strip $(wildcard $(addsuffix /cp$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(CPPROG),) +CPPROG= __missing_command_CPPROG +else +CPPROG:=$(firstword $(CPPROG)) +endif +endif +export CPPROG +ifndef RMPROG +RMPROG:=$(strip $(wildcard $(addsuffix /rm$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(RMPROG),) +RMPROG= __missing_command_RMPROG +else +RMPROG:=$(firstword $(RMPROG)) +endif +endif +export RMPROG +ifndef MVPROG +MVPROG:=$(strip $(wildcard $(addsuffix /mv$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(MVPROG),) +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 +else +ECHOREDIR=$(ECHO) +endif +endif +ifndef COPY +COPY:=$(CPPROG) -fp +endif +ifndef COPYTREE +COPYTREE:=$(CPPROG) -Rfp +endif +ifndef MKDIRTREE +MKDIRTREE:=$(MKDIRPROG) -p +endif +ifndef MOVE +MOVE:=$(MVPROG) -f +endif +ifndef DEL +DEL:=$(RMPROG) -f +endif +ifndef DELTREE +DELTREE:=$(RMPROG) -rf +endif +ifndef INSTALL +ifdef inUnix +INSTALL:=$(GINSTALL) -c -m 644 +else +INSTALL:=$(COPY) +endif +endif +ifndef INSTALLEXE +ifdef inUnix +INSTALLEXE:=$(GINSTALL) -c -m 755 +else +INSTALLEXE:=$(COPY) +endif +endif +ifndef MKDIR +MKDIR:=$(GINSTALL) -m 755 -d +endif +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 +else +PPUMOVE:=$(firstword $(PPUMOVE)) +endif +endif +export PPUMOVE +ifndef FPCMAKE +FPCMAKE:=$(strip $(wildcard $(addsuffix /fpcmake$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(FPCMAKE),) +FPCMAKE= __missing_command_FPCMAKE +else +FPCMAKE:=$(firstword $(FPCMAKE)) +endif +endif +export FPCMAKE +ifndef ZIPPROG +ZIPPROG:=$(strip $(wildcard $(addsuffix /zip$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(ZIPPROG),) +ZIPPROG= __missing_command_ZIPPROG +else +ZIPPROG:=$(firstword $(ZIPPROG)) +endif +endif +export ZIPPROG +ifndef TARPROG +TARPROG:=$(strip $(wildcard $(addsuffix /gtar$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(TARPROG),) +TARPROG:=$(strip $(wildcard $(addsuffix /tar$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(TARPROG),) +TARPROG= __missing_command_TARPROG +else +TARPROG:=$(firstword $(TARPROG)) +endif +else +TARPROG:=$(firstword $(TARPROG)) +endif +endif +export TARPROG +ASNAME=$(BINUTILSPREFIX)as +LDNAME=$(BINUTILSPREFIX)ld +ARNAME=$(BINUTILSPREFIX)ar +RCNAME=$(BINUTILSPREFIX)rc +ifneq ($(findstring 1.0.,$(FPC_VERSION)),) +ifeq ($(OS_TARGET),win32) +ifeq ($(CROSSBINDIR),) +ASNAME=asw +LDNAME=ldw +ARNAME=arw +endif +endif +endif +ifndef ASPROG +ifdef CROSSBINDIR +ASPROG=$(CROSSBINDIR)/$(ASNAME)$(SRCEXEEXT) +else +ASPROG=$(ASNAME) +endif +endif +ifndef LDPROG +ifdef CROSSBINDIR +LDPROG=$(CROSSBINDIR)/$(LDNAME)$(SRCEXEEXT) +else +LDPROG=$(LDNAME) +endif +endif +ifndef RCPROG +ifdef CROSSBINDIR +RCPROG=$(CROSSBINDIR)/$(RCNAME)$(SRCEXEEXT) +else +RCPROG=$(RCNAME) +endif +endif +ifndef ARPROG +ifdef CROSSBINDIR +ARPROG=$(CROSSBINDIR)/$(ARNAME)$(SRCEXEEXT) +else +ARPROG=$(ARNAME) +endif +endif +AS=$(ASPROG) +LD=$(LDPROG) +RC=$(RCPROG) +AR=$(ARPROG) +PPAS=ppas$(SRCBATCHEXT) +ifdef inUnix +LDCONFIG=ldconfig +else +LDCONFIG= +endif +ifdef DATE +DATESTR:=$(shell $(DATE) +%Y%m%d) +else +DATESTR= +endif +ifndef UPXPROG +ifeq ($(OS_TARGET),go32v2) +UPXPROG:=1 +endif +ifeq ($(OS_TARGET),win32) +UPXPROG:=1 +endif +ifdef UPXPROG +UPXPROG:=$(strip $(wildcard $(addsuffix /upx$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(UPXPROG),) +UPXPROG= +else +UPXPROG:=$(firstword $(UPXPROG)) +endif +else +UPXPROG= +endif +endif +export UPXPROG +ZIPOPT=-9 +ZIPEXT=.zip +ifeq ($(USETAR),bz2) +TAROPT=vj +TAREXT=.tar.bz2 +else +TAROPT=vz +TAREXT=.tar.gz +endif +override REQUIRE_PACKAGES=rtl gtk2 +ifeq ($(FULL_TARGET),i386-linux) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_X11=1 +REQUIRE_PACKAGES_GTK2=1 +endif +ifeq ($(FULL_TARGET),i386-go32v2) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_GTK2=1 +endif +ifeq ($(FULL_TARGET),i386-win32) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_GTK2=1 +endif +ifeq ($(FULL_TARGET),i386-os2) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_GTK2=1 +endif +ifeq ($(FULL_TARGET),i386-freebsd) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_X11=1 +REQUIRE_PACKAGES_GTK2=1 +endif +ifeq ($(FULL_TARGET),i386-beos) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_GTK2=1 +endif +ifeq ($(FULL_TARGET),i386-netbsd) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_X11=1 +REQUIRE_PACKAGES_GTK2=1 +endif +ifeq ($(FULL_TARGET),i386-solaris) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_X11=1 +REQUIRE_PACKAGES_GTK2=1 +endif +ifeq ($(FULL_TARGET),i386-qnx) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_GTK2=1 +endif +ifeq ($(FULL_TARGET),i386-netware) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_GTK2=1 +endif +ifeq ($(FULL_TARGET),i386-openbsd) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_X11=1 +REQUIRE_PACKAGES_GTK2=1 +endif +ifeq ($(FULL_TARGET),i386-wdosx) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_GTK2=1 +endif +ifeq ($(FULL_TARGET),i386-darwin) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_X11=1 +REQUIRE_PACKAGES_GTK2=1 +endif +ifeq ($(FULL_TARGET),i386-emx) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_GTK2=1 +endif +ifeq ($(FULL_TARGET),i386-watcom) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_GTK2=1 +endif +ifeq ($(FULL_TARGET),i386-netwlibc) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_GTK2=1 +endif +ifeq ($(FULL_TARGET),i386-wince) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_GTK2=1 +endif +ifeq ($(FULL_TARGET),i386-embedded) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_GTK2=1 +endif +ifeq ($(FULL_TARGET),i386-symbian) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_GTK2=1 +endif +ifeq ($(FULL_TARGET),m68k-linux) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_X11=1 +REQUIRE_PACKAGES_GTK2=1 +endif +ifeq ($(FULL_TARGET),m68k-freebsd) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_X11=1 +REQUIRE_PACKAGES_GTK2=1 +endif +ifeq ($(FULL_TARGET),m68k-netbsd) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_X11=1 +REQUIRE_PACKAGES_GTK2=1 +endif +ifeq ($(FULL_TARGET),m68k-amiga) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_GTK2=1 +endif +ifeq ($(FULL_TARGET),m68k-atari) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_GTK2=1 +endif +ifeq ($(FULL_TARGET),m68k-openbsd) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_X11=1 +REQUIRE_PACKAGES_GTK2=1 +endif +ifeq ($(FULL_TARGET),m68k-palmos) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_GTK2=1 +endif +ifeq ($(FULL_TARGET),m68k-embedded) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_GTK2=1 +endif +ifeq ($(FULL_TARGET),powerpc-linux) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_X11=1 +REQUIRE_PACKAGES_GTK2=1 +endif +ifeq ($(FULL_TARGET),powerpc-netbsd) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_X11=1 +REQUIRE_PACKAGES_GTK2=1 +endif +ifeq ($(FULL_TARGET),powerpc-amiga) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_GTK2=1 +endif +ifeq ($(FULL_TARGET),powerpc-macos) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_GTK2=1 +endif +ifeq ($(FULL_TARGET),powerpc-darwin) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_X11=1 +REQUIRE_PACKAGES_GTK2=1 +endif +ifeq ($(FULL_TARGET),powerpc-morphos) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_GTK2=1 +endif +ifeq ($(FULL_TARGET),powerpc-embedded) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_GTK2=1 +endif +ifeq ($(FULL_TARGET),sparc-linux) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_X11=1 +REQUIRE_PACKAGES_GTK2=1 +endif +ifeq ($(FULL_TARGET),sparc-netbsd) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_X11=1 +REQUIRE_PACKAGES_GTK2=1 +endif +ifeq ($(FULL_TARGET),sparc-solaris) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_X11=1 +REQUIRE_PACKAGES_GTK2=1 +endif +ifeq ($(FULL_TARGET),sparc-embedded) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_GTK2=1 +endif +ifeq ($(FULL_TARGET),x86_64-linux) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_X11=1 +REQUIRE_PACKAGES_GTK2=1 +endif +ifeq ($(FULL_TARGET),x86_64-freebsd) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_X11=1 +REQUIRE_PACKAGES_GTK2=1 +endif +ifeq ($(FULL_TARGET),x86_64-darwin) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_X11=1 +REQUIRE_PACKAGES_GTK2=1 +endif +ifeq ($(FULL_TARGET),x86_64-win64) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_GTK2=1 +endif +ifeq ($(FULL_TARGET),x86_64-embedded) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_GTK2=1 +endif +ifeq ($(FULL_TARGET),arm-linux) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_X11=1 +REQUIRE_PACKAGES_GTK2=1 +endif +ifeq ($(FULL_TARGET),arm-palmos) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_GTK2=1 +endif +ifeq ($(FULL_TARGET),arm-wince) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_GTK2=1 +endif +ifeq ($(FULL_TARGET),arm-gba) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_GTK2=1 +endif +ifeq ($(FULL_TARGET),arm-nds) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_GTK2=1 +endif +ifeq ($(FULL_TARGET),arm-embedded) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_GTK2=1 +endif +ifeq ($(FULL_TARGET),arm-symbian) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_GTK2=1 +endif +ifeq ($(FULL_TARGET),powerpc64-linux) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_X11=1 +REQUIRE_PACKAGES_GTK2=1 +endif +ifeq ($(FULL_TARGET),powerpc64-darwin) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_X11=1 +REQUIRE_PACKAGES_GTK2=1 +endif +ifeq ($(FULL_TARGET),powerpc64-embedded) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_GTK2=1 +endif +ifdef REQUIRE_PACKAGES_RTL +PACKAGEDIR_RTL:=$(firstword $(subst /Makefile.fpc,,$(strip $(wildcard $(addsuffix /rtl/Makefile.fpc,$(PACKAGESDIR)))))) +ifneq ($(PACKAGEDIR_RTL),) +ifneq ($(wildcard $(PACKAGEDIR_RTL)/units/$(TARGETSUFFIX)),) +UNITDIR_RTL=$(PACKAGEDIR_RTL)/units/$(TARGETSUFFIX) +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 +ifdef REQUIRE_PACKAGES_X11 +PACKAGEDIR_X11:=$(firstword $(subst /Makefile.fpc,,$(strip $(wildcard $(addsuffix /x11/Makefile.fpc,$(PACKAGESDIR)))))) +ifneq ($(PACKAGEDIR_X11),) +ifneq ($(wildcard $(PACKAGEDIR_X11)/units/$(TARGETSUFFIX)),) +UNITDIR_X11=$(PACKAGEDIR_X11)/units/$(TARGETSUFFIX) +else +UNITDIR_X11=$(PACKAGEDIR_X11) +endif +ifdef CHECKDEPEND +$(PACKAGEDIR_X11)/$(FPCMADE): + $(MAKE) -C $(PACKAGEDIR_X11) $(FPCMADE) +override ALLDEPENDENCIES+=$(PACKAGEDIR_X11)/$(FPCMADE) +endif +else +PACKAGEDIR_X11= +UNITDIR_X11:=$(subst /Package.fpc,,$(strip $(wildcard $(addsuffix /x11/Package.fpc,$(UNITSDIR))))) +ifneq ($(UNITDIR_X11),) +UNITDIR_X11:=$(firstword $(UNITDIR_X11)) +else +UNITDIR_X11= +endif +endif +ifdef UNITDIR_X11 +override COMPILER_UNITDIR+=$(UNITDIR_X11) +endif +endif +ifdef REQUIRE_PACKAGES_GTK2 +PACKAGEDIR_GTK2:=$(firstword $(subst /Makefile.fpc,,$(strip $(wildcard $(addsuffix /gtk2/Makefile.fpc,$(PACKAGESDIR)))))) +ifneq ($(PACKAGEDIR_GTK2),) +ifneq ($(wildcard $(PACKAGEDIR_GTK2)/units/$(TARGETSUFFIX)),) +UNITDIR_GTK2=$(PACKAGEDIR_GTK2)/units/$(TARGETSUFFIX) +else +UNITDIR_GTK2=$(PACKAGEDIR_GTK2) +endif +ifdef CHECKDEPEND +$(PACKAGEDIR_GTK2)/$(FPCMADE): + $(MAKE) -C $(PACKAGEDIR_GTK2) $(FPCMADE) +override ALLDEPENDENCIES+=$(PACKAGEDIR_GTK2)/$(FPCMADE) +endif +else +PACKAGEDIR_GTK2= +UNITDIR_GTK2:=$(subst /Package.fpc,,$(strip $(wildcard $(addsuffix /gtk2/Package.fpc,$(UNITSDIR))))) +ifneq ($(UNITDIR_GTK2),) +UNITDIR_GTK2:=$(firstword $(UNITDIR_GTK2)) +else +UNITDIR_GTK2= +endif +endif +ifdef UNITDIR_GTK2 +override COMPILER_UNITDIR+=$(UNITDIR_GTK2) +endif +endif +ifndef NOCPUDEF +override FPCOPTDEF=$(CPU_TARGET) +endif +ifneq ($(OS_TARGET),$(OS_SOURCE)) +override FPCOPT+=-T$(OS_TARGET) +endif +ifneq ($(CPU_TARGET),$(CPU_SOURCE)) +override FPCOPT+=-P$(CPU_TARGET) +endif +ifeq ($(OS_SOURCE),openbsd) +override FPCOPT+=-FD$(NEW_BINUTILS_PATH) +endif +ifndef CROSSBOOTSTRAP +ifneq ($(BINUTILSPREFIX),) +override FPCOPT+=-XP$(BINUTILSPREFIX) +endif +ifneq ($(BINUTILSPREFIX),) +override FPCOPT+=-Xr$(RLINKPATH) +endif +endif +ifdef UNITDIR +override FPCOPT+=$(addprefix -Fu,$(UNITDIR)) +endif +ifdef LIBDIR +override FPCOPT+=$(addprefix -Fl,$(LIBDIR)) +endif +ifdef OBJDIR +override FPCOPT+=$(addprefix -Fo,$(OBJDIR)) +endif +ifdef INCDIR +override FPCOPT+=$(addprefix -Fi,$(INCDIR)) +endif +ifdef LINKSMART +override FPCOPT+=-XX +endif +ifdef CREATESMART +override FPCOPT+=-CX +endif +ifdef DEBUG +override FPCOPT+=-gl +override FPCOPTDEF+=DEBUG +endif +ifdef RELEASE +ifneq ($(findstring 2.0.,$(FPC_VERSION)),) +ifeq ($(CPU_TARGET),i386) +FPCCPUOPT:=-OG2p3 +endif +ifeq ($(CPU_TARGET),powerpc) +FPCCPUOPT:=-O1r +endif +else +FPCCPUOPT:=-O2 +endif +override FPCOPT+=-Ur -Xs $(FPCCPUOPT) -n +override FPCOPTDEF+=RELEASE +endif +ifdef STRIP +override FPCOPT+=-Xs +endif +ifdef OPTIMIZE +override FPCOPT+=-O2 +endif +ifdef VERBOSE +override FPCOPT+=-vwni +endif +ifdef COMPILER_OPTIONS +override FPCOPT+=$(COMPILER_OPTIONS) +endif +ifdef COMPILER_UNITDIR +override FPCOPT+=$(addprefix -Fu,$(COMPILER_UNITDIR)) +endif +ifdef COMPILER_LIBRARYDIR +override FPCOPT+=$(addprefix -Fl,$(COMPILER_LIBRARYDIR)) +endif +ifdef COMPILER_OBJECTDIR +override FPCOPT+=$(addprefix -Fo,$(COMPILER_OBJECTDIR)) +endif +ifdef COMPILER_INCLUDEDIR +override FPCOPT+=$(addprefix -Fi,$(COMPILER_INCLUDEDIR)) +endif +ifdef CROSSBINDIR +override FPCOPT+=-FD$(CROSSBINDIR) +endif +ifdef COMPILER_TARGETDIR +override FPCOPT+=-FE$(COMPILER_TARGETDIR) +ifeq ($(COMPILER_TARGETDIR),.) +override TARGETDIRPREFIX= +else +override TARGETDIRPREFIX=$(COMPILER_TARGETDIR)/ +endif +endif +ifdef COMPILER_UNITTARGETDIR +override FPCOPT+=-FU$(COMPILER_UNITTARGETDIR) +ifeq ($(COMPILER_UNITTARGETDIR),.) +override UNITTARGETDIRPREFIX= +else +override UNITTARGETDIRPREFIX=$(COMPILER_UNITTARGETDIR)/ +endif +else +ifdef COMPILER_TARGETDIR +override COMPILER_UNITTARGETDIR=$(COMPILER_TARGETDIR) +override UNITTARGETDIRPREFIX=$(TARGETDIRPREFIX) +endif +endif +ifdef CREATESHARED +override FPCOPT+=-Cg +ifeq ($(CPU_TARGET),i386) +override FPCOPT+=-Aas +endif +endif +ifeq ($(findstring 2.0.,$(FPC_VERSION)),) +ifeq ($(OS_TARGET),linux) +ifeq ($(CPU_TARGET),x86_64) +override FPCOPT+=-Cg +endif +endif +endif +ifdef LINKSHARED +endif +ifdef GCCLIBDIR +override FPCOPT+=-Fl$(GCCLIBDIR) +endif +ifdef OTHERLIBDIR +override FPCOPT+=$(addprefix -Fl,$(OTHERLIBDIR)) +endif +ifdef OPT +override FPCOPT+=$(OPT) +endif +ifdef FPCOPTDEF +override FPCOPT+=$(addprefix -d,$(FPCOPTDEF)) +endif +ifdef CFGFILE +override FPCOPT+=@$(CFGFILE) +endif +ifdef USEENV +override FPCEXTCMD:=$(FPCOPT) +override FPCOPT:=!FPCEXTCMD +export FPCEXTCMD +endif +override AFULL_TARGET=$(CPU_TARGET)-$(OS_TARGET) +override AFULL_SOURCE=$(CPU_SOURCE)-$(OS_SOURCE) +ifneq ($(AFULL_TARGET),$(AFULL_SOURCE)) +override ACROSSCOMPILE=1 +endif +ifdef ACROSSCOMPILE +override FPCOPT+=$(CROSSOPT) +endif +override COMPILER:=$(FPC) $(FPCOPT) +ifeq (,$(findstring -s ,$(COMPILER))) +EXECPPAS= +else +ifeq ($(FULL_SOURCE),$(FULL_TARGET)) +ifdef RUNBATCH +EXECPPAS:=@$(RUNBATCH) $(PPAS) +else +EXECPPAS:=@$(PPAS) +endif +endif +endif +.PHONY: fpc_exes +ifndef CROSSINSTALL +ifneq ($(TARGET_PROGRAMS),) +override EXEFILES=$(addsuffix $(EXEEXT),$(TARGET_PROGRAMS)) +override EXEOFILES:=$(addsuffix $(OEXT),$(TARGET_PROGRAMS)) $(addprefix $(STATICLIBPREFIX),$(addsuffix $(STATICLIBEXT),$(TARGET_PROGRAMS))) $(addprefix $(IMPORTLIBPREFIX),$(addsuffix $(STATICLIBEXT),$(TARGET_PROGRAMS))) +override ALLTARGET+=fpc_exes +override INSTALLEXEFILES+=$(EXEFILES) +override CLEANEXEFILES+=$(EXEFILES) $(EXEOFILES) +ifeq ($(OS_TARGET),os2) +override CLEANEXEFILES+=$(addsuffix $(AOUTEXT),$(TARGET_PROGRAMS)) +endif +ifeq ($(OS_TARGET),emx) +override CLEANEXEFILES+=$(addsuffix $(AOUTEXT),$(TARGET_PROGRAMS)) +endif +endif +endif +fpc_exes: $(COMPILER_TARGETDIR) $(COMPILER_UNITTARGETDIR) $(EXEFILES) +ifdef TARGET_RSTS +override RSTFILES=$(addsuffix $(RSTEXT),$(TARGET_RSTS)) +override CLEANRSTFILES+=$(RSTFILES) +endif +.PHONY: fpc_all fpc_smart fpc_debug fpc_release fpc_shared +$(FPCMADE): $(ALLDEPENDENCIES) $(ALLTARGET) + @$(ECHOREDIR) Compiled > $(FPCMADE) +fpc_all: $(FPCMADE) +fpc_smart: + $(MAKE) all LINKSMART=1 CREATESMART=1 +fpc_debug: + $(MAKE) all DEBUG=1 +fpc_release: + $(MAKE) all RELEASE=1 +.SUFFIXES: $(EXEEXT) $(PPUEXT) $(OEXT) .pas .lpr .dpr .pp .rc .res +$(COMPILER_UNITTARGETDIR): + $(MKDIRTREE) $(COMPILER_UNITTARGETDIR) +$(COMPILER_TARGETDIR): + $(MKDIRTREE) $(COMPILER_TARGETDIR) +%$(PPUEXT): %.pp + $(COMPILER) $< + $(EXECPPAS) +%$(PPUEXT): %.pas + $(COMPILER) $< + $(EXECPPAS) +%$(EXEEXT): %.pp + $(COMPILER) $< + $(EXECPPAS) +%$(EXEEXT): %.pas + $(COMPILER) $< + $(EXECPPAS) +%$(EXEEXT): %.lpr + $(COMPILER) $< + $(EXECPPAS) +%$(EXEEXT): %.dpr + $(COMPILER) $< + $(EXECPPAS) +%.res: %.rc + windres -i $< -o $@ +vpath %.pp $(COMPILER_SOURCEDIR) $(COMPILER_INCLUDEDIR) +vpath %.pas $(COMPILER_SOURCEDIR) $(COMPILER_INCLUDEDIR) +vpath %.lpr $(COMPILER_SOURCEDIR) $(COMPILER_INCLUDEDIR) +vpath %.dpr $(COMPILER_SOURCEDIR) $(COMPILER_INCLUDEDIR) +vpath %.inc $(COMPILER_INCLUDEDIR) +vpath %$(OEXT) $(COMPILER_UNITTARGETDIR) +vpath %$(PPUEXT) $(COMPILER_UNITTARGETDIR) +.PHONY: fpc_shared +override INSTALLTARGET+=fpc_shared_install +ifndef SHARED_LIBVERSION +SHARED_LIBVERSION=$(FPC_VERSION) +endif +ifndef SHARED_LIBNAME +SHARED_LIBNAME=$(PACKAGE_NAME) +endif +ifndef SHARED_FULLNAME +SHARED_FULLNAME=$(SHAREDLIBPREFIX)$(SHARED_LIBNAME)-$(SHARED_LIBVERSION)$(SHAREDLIBEXT) +endif +ifndef SHARED_LIBUNITS +SHARED_LIBUNITS:=$(TARGET_UNITS) $(TARGET_IMPLICITUNITS) +override SHARED_LIBUNITS:=$(filter-out $(INSTALL_BUILDUNIT),$(SHARED_LIBUNITS)) +endif +fpc_shared: +ifdef HASSHAREDLIB + $(MAKE) all CREATESHARED=1 LINKSHARED=1 CREATESMART=1 +ifneq ($(SHARED_BUILD),n) + $(PPUMOVE) -q $(SHARED_LIBUNITS) -i$(COMPILER_UNITTARGETDIR) -o$(SHARED_FULLNAME) -d$(COMPILER_UNITTARGETDIR) +endif +else + @$(ECHO) Shared Libraries not supported +endif +fpc_shared_install: +ifneq ($(SHARED_BUILD),n) +ifneq ($(SHARED_LIBUNITS),) +ifneq ($(wildcard $(COMPILER_UNITTARGETDIR)/$(SHARED_FULLNAME)),) + $(INSTALL) $(COMPILER_UNITTARGETDIR)/$(SHARED_FULLNAME) $(INSTALL_SHAREDDIR) +endif +endif +endif +.PHONY: fpc_install fpc_sourceinstall fpc_exampleinstall +ifdef INSTALL_UNITS +override INSTALLPPUFILES+=$(addsuffix $(PPUEXT),$(INSTALL_UNITS)) +endif +ifdef INSTALL_BUILDUNIT +override INSTALLPPUFILES:=$(filter-out $(INSTALL_BUILDUNIT)$(PPUEXT),$(INSTALLPPUFILES)) +endif +ifdef INSTALLPPUFILES +override INSTALLPPULINKFILES:=$(subst $(PPUEXT),$(OEXT),$(INSTALLPPUFILES)) $(addprefix $(STATICLIBPREFIX),$(subst $(PPUEXT),$(STATICLIBEXT),$(INSTALLPPUFILES))) $(addprefix $(IMPORTLIBPREFIX),$(subst $(PPUEXT),$(STATICLIBEXT),$(INSTALLPPUFILES))) +ifneq ($(UNITTARGETDIRPREFIX),) +override INSTALLPPUFILES:=$(addprefix $(UNITTARGETDIRPREFIX),$(notdir $(INSTALLPPUFILES))) +override INSTALLPPULINKFILES:=$(wildcard $(addprefix $(UNITTARGETDIRPREFIX),$(notdir $(INSTALLPPULINKFILES)))) +endif +override INSTALL_CREATEPACKAGEFPC=1 +endif +ifdef INSTALLEXEFILES +ifneq ($(TARGETDIRPREFIX),) +override INSTALLEXEFILES:=$(addprefix $(TARGETDIRPREFIX),$(notdir $(INSTALLEXEFILES))) +endif +endif +fpc_install: all $(INSTALLTARGET) +ifdef INSTALLEXEFILES + $(MKDIR) $(INSTALL_BINDIR) +ifdef UPXPROG + -$(UPXPROG) $(INSTALLEXEFILES) +endif + $(INSTALLEXE) $(INSTALLEXEFILES) $(INSTALL_BINDIR) +endif +ifdef INSTALL_CREATEPACKAGEFPC +ifdef FPCMAKE +ifdef PACKAGE_VERSION +ifneq ($(wildcard Makefile.fpc),) + $(FPCMAKE) -p -T$(CPU_TARGET)-$(OS_TARGET) Makefile.fpc + $(MKDIR) $(INSTALL_UNITDIR) + $(INSTALL) Package.fpc $(INSTALL_UNITDIR) +endif +endif +endif +endif +ifdef INSTALLPPUFILES + $(MKDIR) $(INSTALL_UNITDIR) + $(INSTALL) $(INSTALLPPUFILES) $(INSTALL_UNITDIR) +ifneq ($(INSTALLPPULINKFILES),) + $(INSTALL) $(INSTALLPPULINKFILES) $(INSTALL_UNITDIR) +endif +ifneq ($(wildcard $(LIB_FULLNAME)),) + $(MKDIR) $(INSTALL_LIBDIR) + $(INSTALL) $(LIB_FULLNAME) $(INSTALL_LIBDIR) +ifdef inUnix + ln -sf $(LIB_FULLNAME) $(INSTALL_LIBDIR)/$(LIB_NAME) +endif +endif +endif +ifdef INSTALL_FILES + $(MKDIR) $(INSTALL_DATADIR) + $(INSTALL) $(INSTALL_FILES) $(INSTALL_DATADIR) +endif +fpc_sourceinstall: distclean + $(MKDIR) $(INSTALL_SOURCEDIR) + $(COPYTREE) $(BASEDIR)/* $(INSTALL_SOURCEDIR) +fpc_exampleinstall: $(addsuffix _distclean,$(TARGET_EXAMPLEDIRS)) +ifdef HASEXAMPLES + $(MKDIR) $(INSTALL_EXAMPLEDIR) +endif +ifdef EXAMPLESOURCEFILES + $(COPY) $(EXAMPLESOURCEFILES) $(INSTALL_EXAMPLEDIR) +endif +ifdef TARGET_EXAMPLEDIRS + $(COPYTREE) $(addsuffix /*,$(TARGET_EXAMPLEDIRS)) $(INSTALL_EXAMPLEDIR) +endif +.PHONY: fpc_clean fpc_cleanall fpc_distclean +ifdef EXEFILES +override CLEANEXEFILES:=$(addprefix $(TARGETDIRPREFIX),$(CLEANEXEFILES)) +endif +ifdef CLEAN_UNITS +override CLEANPPUFILES+=$(addsuffix $(PPUEXT),$(CLEAN_UNITS)) +endif +ifdef CLEANPPUFILES +override CLEANPPULINKFILES:=$(subst $(PPUEXT),$(OEXT),$(CLEANPPUFILES)) $(addprefix $(STATICLIBPREFIX),$(subst $(PPUEXT),$(STATICLIBEXT),$(CLEANPPUFILES))) $(addprefix $(IMPORTLIBPREFIX),$(subst $(PPUEXT),$(STATICLIBEXT),$(CLEANPPUFILES))) +ifdef DEBUGSYMEXT +override CLEANPPULINKFILES+=$(subst $(PPUEXT),$(DEBUGSYMEXT),$(CLEANPPUFILES)) +endif +override CLEANPPUFILES:=$(addprefix $(UNITTARGETDIRPREFIX),$(CLEANPPUFILES)) +override CLEANPPULINKFILES:=$(wildcard $(addprefix $(UNITTARGETDIRPREFIX),$(CLEANPPULINKFILES))) +endif +fpc_clean: $(CLEANTARGET) +ifdef CLEANEXEFILES + -$(DEL) $(CLEANEXEFILES) +endif +ifdef CLEANPPUFILES + -$(DEL) $(CLEANPPUFILES) +endif +ifneq ($(CLEANPPULINKFILES),) + -$(DEL) $(CLEANPPULINKFILES) +endif +ifdef CLEANRSTFILES + -$(DEL) $(addprefix $(UNITTARGETDIRPREFIX),$(CLEANRSTFILES)) +endif +ifdef CLEAN_FILES + -$(DEL) $(CLEAN_FILES) +endif +ifdef LIB_NAME + -$(DEL) $(LIB_NAME) $(LIB_FULLNAME) +endif + -$(DEL) $(FPCMADE) Package.fpc $(PPAS) script.res link.res $(FPCEXTFILE) $(REDIRFILE) + -$(DEL) *$(ASMEXT) *_ppas$(BATCHEXT) +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) *_ppas$(BATCHEXT) +ifdef AOUTEXT + -$(DEL) *$(AOUTEXT) +endif +ifdef DEBUGSYMEXT + -$(DEL) *$(DEBUGSYMEXT) +endif +fpc_distclean: cleanall +.PHONY: fpc_baseinfo +override INFORULES+=fpc_baseinfo +fpc_baseinfo: + @$(ECHO) + @$(ECHO) == Package info == + @$(ECHO) Package Name..... $(PACKAGE_NAME) + @$(ECHO) Package Version.. $(PACKAGE_VERSION) + @$(ECHO) + @$(ECHO) == Configuration info == + @$(ECHO) + @$(ECHO) FPC.......... $(FPC) + @$(ECHO) FPC Version.. $(FPC_VERSION) + @$(ECHO) Source CPU... $(CPU_SOURCE) + @$(ECHO) Target CPU... $(CPU_TARGET) + @$(ECHO) Source OS.... $(OS_SOURCE) + @$(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) + @$(ECHO) Required pkgs... $(REQUIRE_PACKAGES) + @$(ECHO) + @$(ECHO) Basedir......... $(BASEDIR) + @$(ECHO) FPCDir.......... $(FPCDIR) + @$(ECHO) CrossBinDir..... $(CROSSBINDIR) + @$(ECHO) UnitsDir........ $(UNITSDIR) + @$(ECHO) PackagesDir..... $(PACKAGESDIR) + @$(ECHO) + @$(ECHO) GCC library..... $(GCCLIBDIR) + @$(ECHO) Other library... $(OTHERLIBDIR) + @$(ECHO) + @$(ECHO) == Tools info == + @$(ECHO) + @$(ECHO) As........ $(AS) + @$(ECHO) Ld........ $(LD) + @$(ECHO) Ar........ $(AR) + @$(ECHO) Rc........ $(RC) + @$(ECHO) + @$(ECHO) Mv........ $(MVPROG) + @$(ECHO) Cp........ $(CPPROG) + @$(ECHO) Rm........ $(RMPROG) + @$(ECHO) GInstall.. $(GINSTALL) + @$(ECHO) Echo...... $(ECHO) + @$(ECHO) Shell..... $(SHELL) + @$(ECHO) Date...... $(DATE) + @$(ECHO) FPCMake... $(FPCMAKE) + @$(ECHO) PPUMove... $(PPUMOVE) + @$(ECHO) Upx....... $(UPXPROG) + @$(ECHO) Zip....... $(ZIPPROG) + @$(ECHO) + @$(ECHO) == Object info == + @$(ECHO) + @$(ECHO) Target Loaders........ $(TARGET_LOADERS) + @$(ECHO) Target Units.......... $(TARGET_UNITS) + @$(ECHO) Target Implicit Units. $(TARGET_IMPLICITUNITS) + @$(ECHO) Target Programs....... $(TARGET_PROGRAMS) + @$(ECHO) Target Dirs........... $(TARGET_DIRS) + @$(ECHO) Target Examples....... $(TARGET_EXAMPLES) + @$(ECHO) Target ExampleDirs.... $(TARGET_EXAMPLEDIRS) + @$(ECHO) + @$(ECHO) Clean Units......... $(CLEAN_UNITS) + @$(ECHO) Clean Files......... $(CLEAN_FILES) + @$(ECHO) + @$(ECHO) Install Units....... $(INSTALL_UNITS) + @$(ECHO) Install Files....... $(INSTALL_FILES) + @$(ECHO) + @$(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) + @$(ECHO) Install binary dir... $(INSTALL_BINDIR) + @$(ECHO) Install library dir.. $(INSTALL_LIBDIR) + @$(ECHO) Install units dir.... $(INSTALL_UNITDIR) + @$(ECHO) Install source dir... $(INSTALL_SOURCEDIR) + @$(ECHO) Install doc dir...... $(INSTALL_DOCDIR) + @$(ECHO) Install example dir.. $(INSTALL_EXAMPLEDIR) + @$(ECHO) Install data dir..... $(INSTALL_DATADIR) + @$(ECHO) + @$(ECHO) Dist destination dir. $(DIST_DESTDIR) + @$(ECHO) Dist zip name........ $(DIST_ZIPNAME) + @$(ECHO) +.PHONY: fpc_info +fpc_info: $(INFORULES) +.PHONY: fpc_makefile fpc_makefiles fpc_makefile_sub1 fpc_makefile_sub2 \ + fpc_makefile_dirs +fpc_makefile: + $(FPCMAKE) -w -T$(OS_TARGET) Makefile.fpc +fpc_makefile_sub1: +ifdef TARGET_DIRS + $(FPCMAKE) -w -T$(OS_TARGET) $(addsuffix /Makefile.fpc,$(TARGET_DIRS)) +endif +ifdef TARGET_EXAMPLEDIRS + $(FPCMAKE) -w -T$(OS_TARGET) $(addsuffix /Makefile.fpc,$(TARGET_EXAMPLEDIRS)) +endif +fpc_makefile_sub2: $(addsuffix _makefile_dirs,$(TARGET_DIRS) $(TARGET_EXAMPLEDIRS)) +fpc_makefile_dirs: fpc_makefile_sub1 fpc_makefile_sub2 +fpc_makefiles: fpc_makefile fpc_makefile_dirs +all: fpc_all +debug: fpc_debug +smart: fpc_smart +release: fpc_release +units: fpc_units +examples: +shared: fpc_shared +install: fpc_install +sourceinstall: fpc_sourceinstall +exampleinstall: fpc_exampleinstall +distinstall: +zipinstall: +zipsourceinstall: +zipexampleinstall: +zipdistinstall: +clean: fpc_clean +distclean: fpc_distclean +cleanall: fpc_cleanall +info: fpc_info +makefiles: fpc_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 +.NOTPARALLEL: diff --git a/packages/gtk2/examples/gettingstarted/Makefile.fpc b/packages/gtk2/examples/gettingstarted/Makefile.fpc new file mode 100644 index 0000000000..99d18a9004 --- /dev/null +++ b/packages/gtk2/examples/gettingstarted/Makefile.fpc @@ -0,0 +1,18 @@ +# +# Makefile.fpc for Free Pascal GTK 2.x.y Examples +# + +[target] +programs=gettingstarted + +[require] +packages=gtk2 + +[install] +fpcpackage=y + +[default] +fpcdir=../../../.. + +[rules] +.NOTPARALLEL: diff --git a/packages/gtk2/examples/gettingstarted/gettingstarted.pas b/packages/gtk2/examples/gettingstarted/gettingstarted.pas new file mode 100644 index 0000000000..4c4aac1c15 --- /dev/null +++ b/packages/gtk2/examples/gettingstarted/gettingstarted.pas @@ -0,0 +1,18 @@ +program GettingStarted; + +{$mode objfpc}{$H+} + +uses + GTK2; + +var + MainWindow: PGtkWidget; + +begin + gtk_init (@argc, @argv); + + MainWindow := gtk_window_new (GTK_WINDOW_TOPLEVEL); + gtk_widget_show (MainWindow); + + gtk_main; +end. diff --git a/packages/gtk2/examples/gtk_demo/Makefile b/packages/gtk2/examples/gtk_demo/Makefile new file mode 100644 index 0000000000..bf63b8e5b8 --- /dev/null +++ b/packages/gtk2/examples/gtk_demo/Makefile @@ -0,0 +1,2015 @@ +# +# Don't edit, this file is generated by FPCMake Version 2.0.0 [2008/01/26] +# +default: all +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-darwin i386-emx i386-watcom i386-netwlibc i386-wince i386-embedded i386-symbian m68k-linux m68k-freebsd m68k-netbsd m68k-amiga m68k-atari m68k-openbsd m68k-palmos m68k-embedded powerpc-linux powerpc-netbsd powerpc-amiga powerpc-macos powerpc-darwin powerpc-morphos powerpc-embedded sparc-linux sparc-netbsd sparc-solaris sparc-embedded x86_64-linux x86_64-freebsd x86_64-darwin x86_64-win64 x86_64-embedded arm-linux arm-palmos arm-wince arm-gba arm-nds arm-embedded arm-symbian powerpc64-linux powerpc64-darwin powerpc64-embedded +BSDs = freebsd netbsd openbsd darwin +UNIXs = linux $(BSDs) solaris qnx +LIMIT83fs = go32v2 os2 emx watcom +OSNeedsComspecToRunBatch = go32v2 watcom +FORCE: +.PHONY: FORCE +override PATH:=$(patsubst %/,%,$(subst \,/,$(PATH))) +ifneq ($(findstring darwin,$(OSTYPE)),) +inUnix=1 #darwin +SEARCHPATH:=$(filter-out .,$(subst :, ,$(PATH))) +else +ifeq ($(findstring ;,$(PATH)),) +inUnix=1 +SEARCHPATH:=$(filter-out .,$(subst :, ,$(PATH))) +else +SEARCHPATH:=$(subst ;, ,$(PATH)) +endif +endif +SEARCHPATH+=$(patsubst %/,%,$(subst \,/,$(dir $(MAKE)))) +PWD:=$(strip $(wildcard $(addsuffix /pwd.exe,$(SEARCHPATH)))) +ifeq ($(PWD),) +PWD:=$(strip $(wildcard $(addsuffix /pwd,$(SEARCHPATH)))) +ifeq ($(PWD),) +$(error You need the GNU utils package to use this Makefile) +else +PWD:=$(firstword $(PWD)) +SRCEXEEXT= +endif +else +PWD:=$(firstword $(PWD)) +SRCEXEEXT=.exe +endif +ifndef inUnix +ifeq ($(OS),Windows_NT) +inWinNT=1 +else +ifdef OS2_SHELL +inOS2=1 +endif +endif +else +ifneq ($(findstring cygdrive,$(PATH)),) +inCygWin=1 +endif +endif +ifdef inUnix +SRCBATCHEXT=.sh +else +ifdef inOS2 +SRCBATCHEXT=.cmd +else +SRCBATCHEXT=.bat +endif +endif +ifdef COMSPEC +ifneq ($(findstring $(OS_SOURCE),$(OSNeedsComspecToRunBatch)),) +RUNBATCH=$(COMSPEC) /C +endif +endif +ifdef inUnix +PATHSEP=/ +else +PATHSEP:=$(subst /,\,/) +ifdef inCygWin +PATHSEP=/ +endif +endif +ifdef PWD +BASEDIR:=$(subst \,/,$(shell $(PWD))) +ifdef inCygWin +ifneq ($(findstring /cygdrive/,$(BASEDIR)),) +BASENODIR:=$(patsubst /cygdrive%,%,$(BASEDIR)) +BASEDRIVE:=$(firstword $(subst /, ,$(BASENODIR))) +BASEDIR:=$(subst /cygdrive/$(BASEDRIVE)/,$(BASEDRIVE):/,$(BASEDIR)) +endif +endif +else +BASEDIR=. +endif +ifdef inOS2 +ifndef ECHO +ECHO:=$(strip $(wildcard $(addsuffix /gecho$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(ECHO),) +ECHO:=$(strip $(wildcard $(addsuffix /echo$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(ECHO),) +ECHO=echo +else +ECHO:=$(firstword $(ECHO)) +endif +else +ECHO:=$(firstword $(ECHO)) +endif +endif +export ECHO +endif +override DEFAULT_FPCDIR=../../../.. +ifndef FPC +ifdef PP +FPC=$(PP) +endif +endif +ifndef FPC +FPCPROG:=$(strip $(wildcard $(addsuffix /fpc$(SRCEXEEXT),$(SEARCHPATH)))) +ifneq ($(FPCPROG),) +FPCPROG:=$(firstword $(FPCPROG)) +ifneq ($(CPU_TARGET),) +FPC:=$(shell $(FPCPROG) -P$(CPU_TARGET) -PB) +else +FPC:=$(shell $(FPCPROG) -PB) +endif +ifneq ($(findstring Error,$(FPC)),) +override FPC=$(firstword $(strip $(wildcard $(addsuffix /ppc386$(SRCEXEEXT),$(SEARCHPATH))))) +endif +else +override FPC=$(firstword $(strip $(wildcard $(addsuffix /ppc386$(SRCEXEEXT),$(SEARCHPATH))))) +endif +endif +override FPC:=$(subst $(SRCEXEEXT),,$(FPC)) +override FPC:=$(subst \,/,$(FPC))$(SRCEXEEXT) +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 +unexport CHECKDEPEND ALLDEPENDENCIES +ifndef CPU_TARGET +ifdef CPU_TARGET_DEFAULT +CPU_TARGET=$(CPU_TARGET_DEFAULT) +endif +endif +ifndef OS_TARGET +ifdef OS_TARGET_DEFAULT +OS_TARGET=$(OS_TARGET_DEFAULT) +endif +endif +ifneq ($(words $(FPC_COMPILERINFO)),5) +FPC_COMPILERINFO+=$(shell $(FPC) -iSP) +FPC_COMPILERINFO+=$(shell $(FPC) -iTP) +FPC_COMPILERINFO+=$(shell $(FPC) -iSO) +FPC_COMPILERINFO+=$(shell $(FPC) -iTO) +endif +ifndef CPU_SOURCE +CPU_SOURCE:=$(word 2,$(FPC_COMPILERINFO)) +endif +ifndef CPU_TARGET +CPU_TARGET:=$(word 3,$(FPC_COMPILERINFO)) +endif +ifndef OS_SOURCE +OS_SOURCE:=$(word 4,$(FPC_COMPILERINFO)) +endif +ifndef OS_TARGET +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 $(FULL_TARGET),$(MAKEFILETARGETS)),) +$(error The Makefile doesn't support target $(FULL_TARGET), please run fpcmake first) +endif +endif +ifneq ($(findstring $(OS_TARGET),$(BSDs)),) +BSDhier=1 +endif +ifeq ($(OS_TARGET),linux) +linuxHier=1 +endif +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)),) +override FPCDIR=wrong +endif +else +override FPCDIR=wrong +endif +ifdef DEFAULT_FPCDIR +ifeq ($(FPCDIR),wrong) +override FPCDIR:=$(subst \,/,$(DEFAULT_FPCDIR)) +ifeq ($(wildcard $(addprefix $(FPCDIR)/,rtl units)),) +override FPCDIR=wrong +endif +endif +endif +ifeq ($(FPCDIR),wrong) +ifdef inUnix +override FPCDIR=/usr/local/lib/fpc/$(FPC_VERSION) +ifeq ($(wildcard $(FPCDIR)/units),) +override FPCDIR=/usr/lib/fpc/$(FPC_VERSION) +endif +else +override FPCDIR:=$(subst /$(FPC),,$(firstword $(strip $(wildcard $(addsuffix /$(FPC),$(SEARCHPATH)))))) +override FPCDIR:=$(FPCDIR)/.. +ifeq ($(wildcard $(addprefix $(FPCDIR)/,rtl units)),) +override FPCDIR:=$(FPCDIR)/.. +ifeq ($(wildcard $(addprefix $(FPCDIR)/,rtl units)),) +override FPCDIR:=$(BASEDIR) +ifeq ($(wildcard $(addprefix $(FPCDIR)/,rtl units)),) +override FPCDIR=c:/pp +endif +endif +endif +endif +endif +ifndef CROSSBINDIR +CROSSBINDIR:=$(wildcard $(FPCDIR)/bin/$(TARGETSUFFIX)) +endif +ifndef BINUTILSPREFIX +ifndef CROSSBINDIR +ifdef CROSSCOMPILE +BINUTILSPREFIX=$(CPU_TARGET)-$(OS_TARGET)- +endif +endif +endif +UNITSDIR:=$(wildcard $(FPCDIR)/units/$(TARGETSUFFIX)) +ifeq ($(UNITSDIR),) +UNITSDIR:=$(wildcard $(FPCDIR)/units/$(OS_TARGET)) +endif +PACKAGESDIR:=$(wildcard $(FPCDIR) $(FPCDIR)/packages $(FPCDIR)/packages/base $(FPCDIR)/packages/extra) +ifeq ($(FULL_TARGET),i386-linux) +override TARGET_PROGRAMS+=gtk_demo +endif +ifeq ($(FULL_TARGET),i386-go32v2) +override TARGET_PROGRAMS+=gtk_demo +endif +ifeq ($(FULL_TARGET),i386-win32) +override TARGET_PROGRAMS+=gtk_demo +endif +ifeq ($(FULL_TARGET),i386-os2) +override TARGET_PROGRAMS+=gtk_demo +endif +ifeq ($(FULL_TARGET),i386-freebsd) +override TARGET_PROGRAMS+=gtk_demo +endif +ifeq ($(FULL_TARGET),i386-beos) +override TARGET_PROGRAMS+=gtk_demo +endif +ifeq ($(FULL_TARGET),i386-netbsd) +override TARGET_PROGRAMS+=gtk_demo +endif +ifeq ($(FULL_TARGET),i386-solaris) +override TARGET_PROGRAMS+=gtk_demo +endif +ifeq ($(FULL_TARGET),i386-qnx) +override TARGET_PROGRAMS+=gtk_demo +endif +ifeq ($(FULL_TARGET),i386-netware) +override TARGET_PROGRAMS+=gtk_demo +endif +ifeq ($(FULL_TARGET),i386-openbsd) +override TARGET_PROGRAMS+=gtk_demo +endif +ifeq ($(FULL_TARGET),i386-wdosx) +override TARGET_PROGRAMS+=gtk_demo +endif +ifeq ($(FULL_TARGET),i386-darwin) +override TARGET_PROGRAMS+=gtk_demo +endif +ifeq ($(FULL_TARGET),i386-emx) +override TARGET_PROGRAMS+=gtk_demo +endif +ifeq ($(FULL_TARGET),i386-watcom) +override TARGET_PROGRAMS+=gtk_demo +endif +ifeq ($(FULL_TARGET),i386-netwlibc) +override TARGET_PROGRAMS+=gtk_demo +endif +ifeq ($(FULL_TARGET),i386-wince) +override TARGET_PROGRAMS+=gtk_demo +endif +ifeq ($(FULL_TARGET),i386-embedded) +override TARGET_PROGRAMS+=gtk_demo +endif +ifeq ($(FULL_TARGET),i386-symbian) +override TARGET_PROGRAMS+=gtk_demo +endif +ifeq ($(FULL_TARGET),m68k-linux) +override TARGET_PROGRAMS+=gtk_demo +endif +ifeq ($(FULL_TARGET),m68k-freebsd) +override TARGET_PROGRAMS+=gtk_demo +endif +ifeq ($(FULL_TARGET),m68k-netbsd) +override TARGET_PROGRAMS+=gtk_demo +endif +ifeq ($(FULL_TARGET),m68k-amiga) +override TARGET_PROGRAMS+=gtk_demo +endif +ifeq ($(FULL_TARGET),m68k-atari) +override TARGET_PROGRAMS+=gtk_demo +endif +ifeq ($(FULL_TARGET),m68k-openbsd) +override TARGET_PROGRAMS+=gtk_demo +endif +ifeq ($(FULL_TARGET),m68k-palmos) +override TARGET_PROGRAMS+=gtk_demo +endif +ifeq ($(FULL_TARGET),m68k-embedded) +override TARGET_PROGRAMS+=gtk_demo +endif +ifeq ($(FULL_TARGET),powerpc-linux) +override TARGET_PROGRAMS+=gtk_demo +endif +ifeq ($(FULL_TARGET),powerpc-netbsd) +override TARGET_PROGRAMS+=gtk_demo +endif +ifeq ($(FULL_TARGET),powerpc-amiga) +override TARGET_PROGRAMS+=gtk_demo +endif +ifeq ($(FULL_TARGET),powerpc-macos) +override TARGET_PROGRAMS+=gtk_demo +endif +ifeq ($(FULL_TARGET),powerpc-darwin) +override TARGET_PROGRAMS+=gtk_demo +endif +ifeq ($(FULL_TARGET),powerpc-morphos) +override TARGET_PROGRAMS+=gtk_demo +endif +ifeq ($(FULL_TARGET),powerpc-embedded) +override TARGET_PROGRAMS+=gtk_demo +endif +ifeq ($(FULL_TARGET),sparc-linux) +override TARGET_PROGRAMS+=gtk_demo +endif +ifeq ($(FULL_TARGET),sparc-netbsd) +override TARGET_PROGRAMS+=gtk_demo +endif +ifeq ($(FULL_TARGET),sparc-solaris) +override TARGET_PROGRAMS+=gtk_demo +endif +ifeq ($(FULL_TARGET),sparc-embedded) +override TARGET_PROGRAMS+=gtk_demo +endif +ifeq ($(FULL_TARGET),x86_64-linux) +override TARGET_PROGRAMS+=gtk_demo +endif +ifeq ($(FULL_TARGET),x86_64-freebsd) +override TARGET_PROGRAMS+=gtk_demo +endif +ifeq ($(FULL_TARGET),x86_64-darwin) +override TARGET_PROGRAMS+=gtk_demo +endif +ifeq ($(FULL_TARGET),x86_64-win64) +override TARGET_PROGRAMS+=gtk_demo +endif +ifeq ($(FULL_TARGET),x86_64-embedded) +override TARGET_PROGRAMS+=gtk_demo +endif +ifeq ($(FULL_TARGET),arm-linux) +override TARGET_PROGRAMS+=gtk_demo +endif +ifeq ($(FULL_TARGET),arm-palmos) +override TARGET_PROGRAMS+=gtk_demo +endif +ifeq ($(FULL_TARGET),arm-wince) +override TARGET_PROGRAMS+=gtk_demo +endif +ifeq ($(FULL_TARGET),arm-gba) +override TARGET_PROGRAMS+=gtk_demo +endif +ifeq ($(FULL_TARGET),arm-nds) +override TARGET_PROGRAMS+=gtk_demo +endif +ifeq ($(FULL_TARGET),arm-embedded) +override TARGET_PROGRAMS+=gtk_demo +endif +ifeq ($(FULL_TARGET),arm-symbian) +override TARGET_PROGRAMS+=gtk_demo +endif +ifeq ($(FULL_TARGET),powerpc64-linux) +override TARGET_PROGRAMS+=gtk_demo +endif +ifeq ($(FULL_TARGET),powerpc64-darwin) +override TARGET_PROGRAMS+=gtk_demo +endif +ifeq ($(FULL_TARGET),powerpc64-embedded) +override TARGET_PROGRAMS+=gtk_demo +endif +override INSTALL_FPCPACKAGE=y +ifdef REQUIRE_UNITSDIR +override UNITSDIR+=$(REQUIRE_UNITSDIR) +endif +ifdef REQUIRE_PACKAGESDIR +override PACKAGESDIR+=$(REQUIRE_PACKAGESDIR) +endif +ifdef ZIPINSTALL +ifneq ($(findstring $(OS_TARGET),$(UNIXs)),) +UNIXHier=1 +endif +else +ifneq ($(findstring $(OS_SOURCE),$(UNIXs)),) +UNIXHier=1 +endif +endif +ifndef INSTALL_PREFIX +ifdef PREFIX +INSTALL_PREFIX=$(PREFIX) +endif +endif +ifndef INSTALL_PREFIX +ifdef UNIXHier +INSTALL_PREFIX=/usr/local +else +ifdef INSTALL_FPCPACKAGE +INSTALL_BASEDIR:=/pp +else +INSTALL_BASEDIR:=/$(PACKAGE_NAME) +endif +endif +endif +export INSTALL_PREFIX +ifdef INSTALL_FPCSUBDIR +export INSTALL_FPCSUBDIR +endif +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 +INSTALL_BASEDIR:=$(INSTALL_PREFIX)/lib/fpc/$(FPC_VERSION) +else +INSTALL_BASEDIR:=$(INSTALL_PREFIX)/lib/$(PACKAGE_NAME) +endif +else +INSTALL_BASEDIR:=$(INSTALL_PREFIX) +endif +endif +ifndef INSTALL_BINDIR +ifdef UNIXHier +INSTALL_BINDIR:=$(INSTALL_PREFIX)/bin +else +INSTALL_BINDIR:=$(INSTALL_BASEDIR)/bin +ifdef INSTALL_FPCPACKAGE +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 +INSTALL_UNITDIR:=$(INSTALL_BASEDIR)/units/$(TARGETSUFFIX) +ifdef INSTALL_FPCPACKAGE +ifdef PACKAGE_NAME +INSTALL_UNITDIR:=$(INSTALL_UNITDIR)/$(PACKAGE_NAME) +endif +endif +endif +ifndef INSTALL_LIBDIR +ifdef UNIXHier +INSTALL_LIBDIR:=$(INSTALL_PREFIX)/lib +else +INSTALL_LIBDIR:=$(INSTALL_UNITDIR) +endif +endif +ifndef INSTALL_SOURCEDIR +ifdef UNIXHier +ifdef BSDhier +SRCPREFIXDIR=share/src +else +ifdef linuxHier +SRCPREFIXDIR=share/src +else +SRCPREFIXDIR=src +endif +endif +ifdef INSTALL_FPCPACKAGE +ifdef INSTALL_FPCSUBDIR +INSTALL_SOURCEDIR:=$(INSTALL_PREFIX)/$(SRCPREFIXDIR)/fpc-$(FPC_VERSION)/$(INSTALL_FPCSUBDIR)/$(PACKAGE_NAME) +else +INSTALL_SOURCEDIR:=$(INSTALL_PREFIX)/$(SRCPREFIXDIR)/fpc-$(FPC_VERSION)/$(PACKAGE_NAME) +endif +else +INSTALL_SOURCEDIR:=$(INSTALL_PREFIX)/$(SRCPREFIXDIR)/$(PACKAGE_NAME)-$(PACKAGE_VERSION) +endif +else +ifdef INSTALL_FPCPACKAGE +ifdef INSTALL_FPCSUBDIR +INSTALL_SOURCEDIR:=$(INSTALL_BASEDIR)/source/$(INSTALL_FPCSUBDIR)/$(PACKAGE_NAME) +else +INSTALL_SOURCEDIR:=$(INSTALL_BASEDIR)/source/$(PACKAGE_NAME) +endif +else +INSTALL_SOURCEDIR:=$(INSTALL_BASEDIR)/source +endif +endif +endif +ifndef INSTALL_DOCDIR +ifdef UNIXHier +ifdef BSDhier +DOCPREFIXDIR=share/doc +else +ifdef linuxHier +DOCPREFIXDIR=share/doc +else +DOCPREFIXDIR=doc +endif +endif +ifdef INSTALL_FPCPACKAGE +INSTALL_DOCDIR:=$(INSTALL_PREFIX)/$(DOCPREFIXDIR)/fpc-$(FPC_VERSION)/$(PACKAGE_NAME) +else +INSTALL_DOCDIR:=$(INSTALL_PREFIX)/$(DOCPREFIXDIR)/$(PACKAGE_NAME)-$(PACKAGE_VERSION) +endif +else +ifdef INSTALL_FPCPACKAGE +INSTALL_DOCDIR:=$(INSTALL_BASEDIR)/doc/$(PACKAGE_NAME) +else +INSTALL_DOCDIR:=$(INSTALL_BASEDIR)/doc +endif +endif +endif +ifndef INSTALL_EXAMPLEDIR +ifdef UNIXHier +ifdef INSTALL_FPCPACKAGE +ifdef BSDhier +INSTALL_EXAMPLEDIR:=$(INSTALL_PREFIX)/share/examples/fpc-$(FPC_VERSION)/$(PACKAGE_NAME) +else +ifdef linuxHier +INSTALL_EXAMPLEDIR:=$(INSTALL_DOCDIR)/examples +else +INSTALL_EXAMPLEDIR:=$(INSTALL_PREFIX)/doc/fpc-$(FPC_VERSION)/examples/$(PACKAGE_NAME) +endif +endif +else +ifdef BSDhier +INSTALL_EXAMPLEDIR:=$(INSTALL_PREFIX)/share/examples/$(PACKAGE_NAME)-$(PACKAGE_VERSION) +else +ifdef linuxHier +INSTALL_EXAMPLEDIR:=$(INSTALL_DOCDIR)/examples/$(PACKAGE_NAME)-$(PACKAGE_VERSION) +else +INSTALL_EXAMPLEDIR:=$(INSTALL_PREFIX)/doc/$(PACKAGE_NAME)-$(PACKAGE_VERSION) +endif +endif +endif +else +ifdef INSTALL_FPCPACKAGE +INSTALL_EXAMPLEDIR:=$(INSTALL_BASEDIR)/examples/$(PACKAGE_NAME) +else +INSTALL_EXAMPLEDIR:=$(INSTALL_BASEDIR)/examples +endif +endif +endif +ifndef INSTALL_DATADIR +INSTALL_DATADIR=$(INSTALL_BASEDIR) +endif +ifndef INSTALL_SHAREDDIR +INSTALL_SHAREDDIR=$(INSTALL_PREFIX)/lib +endif +ifdef CROSSCOMPILE +ifndef CROSSBINDIR +CROSSBINDIR:=$(wildcard $(CROSSTARGETDIR)/bin/$(SOURCESUFFIX)) +ifeq ($(CROSSBINDIR),) +CROSSBINDIR:=$(wildcard $(INSTALL_BASEDIR)/cross/$(TARGETSUFFIX)/bin/$(FULL_SOURCE)) +endif +endif +else +CROSSBINDIR= +endif +ifeq ($(OS_SOURCE),linux) +ifndef GCCLIBDIR +ifeq ($(CPU_TARGET),i386) +ifneq ($(findstring x86_64,$(shell uname -a)),) +ifeq ($(BINUTILSPREFIX),) +GCCLIBDIR:=$(shell dirname `gcc -m32 -print-libgcc-file-name`) +endif +endif +endif +ifeq ($(CPU_TARGET),powerpc64) +ifeq ($(BINUTILSPREFIX),) +GCCLIBDIR:=$(shell dirname `gcc -m64 -print-libgcc-file-name`) +endif +endif +endif +ifndef GCCLIBDIR +CROSSGCC=$(strip $(wildcard $(addsuffix /$(BINUTILSPREFIX)gcc$(SRCEXEEXT),$(SEARCHPATH)))) +ifneq ($(CROSSGCC),) +GCCLIBDIR:=$(shell dirname `$(CROSSGCC) -print-libgcc-file-name`) +endif +endif +ifndef OTHERLIBDIR +OTHERLIBDIR:=$(shell grep -v "^\#" /etc/ld.so.conf | awk '{ ORS=" "; print $1 }') +endif +endif +ifdef inUnix +ifeq ($(OS_SOURCE),netbsd) +OTHERLIBDIR+=/usr/pkg/lib +endif +export GCCLIBDIR OTHERLIB +endif +BATCHEXT=.bat +LOADEREXT=.as +EXEEXT=.exe +PPLEXT=.ppl +PPUEXT=.ppu +OEXT=.o +ASMEXT=.s +SMARTEXT=.sl +STATICLIBEXT=.a +SHAREDLIBEXT=.so +SHAREDLIBPREFIX=libfp +STATICLIBPREFIX=libp +IMPORTLIBPREFIX=libimp +RSTEXT=.rst +ifeq ($(findstring 1.0.,$(FPC_VERSION)),) +ifeq ($(OS_TARGET),go32v1) +STATICLIBPREFIX= +SHORTSUFFIX=v1 +endif +ifeq ($(OS_TARGET),go32v2) +STATICLIBPREFIX= +SHORTSUFFIX=dos +endif +ifeq ($(OS_TARGET),watcom) +STATICLIBPREFIX= +OEXT=.obj +ASMEXT=.asm +SHAREDLIBEXT=.dll +SHORTSUFFIX=wat +endif +ifeq ($(OS_TARGET),linux) +BATCHEXT=.sh +EXEEXT= +HASSHAREDLIB=1 +SHORTSUFFIX=lnx +endif +ifeq ($(OS_TARGET),freebsd) +BATCHEXT=.sh +EXEEXT= +HASSHAREDLIB=1 +SHORTSUFFIX=fbs +endif +ifeq ($(OS_TARGET),netbsd) +BATCHEXT=.sh +EXEEXT= +HASSHAREDLIB=1 +SHORTSUFFIX=nbs +endif +ifeq ($(OS_TARGET),openbsd) +BATCHEXT=.sh +EXEEXT= +HASSHAREDLIB=1 +SHORTSUFFIX=obs +endif +ifeq ($(OS_TARGET),win32) +SHAREDLIBEXT=.dll +SHORTSUFFIX=w32 +endif +ifeq ($(OS_TARGET),os2) +BATCHEXT=.cmd +AOUTEXT=.out +STATICLIBPREFIX= +SHAREDLIBEXT=.dll +SHORTSUFFIX=os2 +ECHO=echo +endif +ifeq ($(OS_TARGET),emx) +BATCHEXT=.cmd +AOUTEXT=.out +STATICLIBPREFIX= +SHAREDLIBEXT=.dll +SHORTSUFFIX=emx +ECHO=echo +endif +ifeq ($(OS_TARGET),amiga) +EXEEXT= +SHAREDLIBEXT=.library +SHORTSUFFIX=amg +endif +ifeq ($(OS_TARGET),morphos) +EXEEXT= +SHAREDLIBEXT=.library +SHORTSUFFIX=mos +endif +ifeq ($(OS_TARGET),atari) +EXEEXT=.ttp +SHORTSUFFIX=ata +endif +ifeq ($(OS_TARGET),beos) +BATCHEXT=.sh +EXEEXT= +SHORTSUFFIX=be +endif +ifeq ($(OS_TARGET),solaris) +BATCHEXT=.sh +EXEEXT= +SHORTSUFFIX=sun +endif +ifeq ($(OS_TARGET),qnx) +BATCHEXT=.sh +EXEEXT= +SHORTSUFFIX=qnx +endif +ifeq ($(OS_TARGET),netware) +EXEEXT=.nlm +STATICLIBPREFIX= +SHORTSUFFIX=nw +endif +ifeq ($(OS_TARGET),netwlibc) +EXEEXT=.nlm +STATICLIBPREFIX= +SHORTSUFFIX=nwl +endif +ifeq ($(OS_TARGET),macos) +BATCHEXT= +EXEEXT= +DEBUGSYMEXT=.xcoff +SHORTSUFFIX=mac +endif +ifeq ($(OS_TARGET),darwin) +BATCHEXT=.sh +EXEEXT= +HASSHAREDLIB=1 +SHORTSUFFIX=dwn +endif +ifeq ($(OS_TARGET),gba) +EXEEXT=.gba +SHAREDLIBEXT=.so +SHORTSUFFIX=gba +endif +ifeq ($(OS_TARGET),symbian) +SHAREDLIBEXT=.dll +SHORTSUFFIX=symbian +endif +else +ifeq ($(OS_TARGET),go32v1) +PPUEXT=.pp1 +OEXT=.o1 +ASMEXT=.s1 +SMARTEXT=.sl1 +STATICLIBEXT=.a1 +SHAREDLIBEXT=.so1 +STATICLIBPREFIX= +SHORTSUFFIX=v1 +endif +ifeq ($(OS_TARGET),go32v2) +STATICLIBPREFIX= +SHORTSUFFIX=dos +endif +ifeq ($(OS_TARGET),watcom) +STATICLIBPREFIX= +SHORTSUFFIX=wat +endif +ifeq ($(OS_TARGET),linux) +BATCHEXT=.sh +EXEEXT= +HASSHAREDLIB=1 +SHORTSUFFIX=lnx +endif +ifeq ($(OS_TARGET),freebsd) +BATCHEXT=.sh +EXEEXT= +HASSHAREDLIB=1 +SHORTSUFFIX=fbs +endif +ifeq ($(OS_TARGET),netbsd) +BATCHEXT=.sh +EXEEXT= +HASSHAREDLIB=1 +SHORTSUFFIX=nbs +endif +ifeq ($(OS_TARGET),openbsd) +BATCHEXT=.sh +EXEEXT= +HASSHAREDLIB=1 +SHORTSUFFIX=obs +endif +ifeq ($(OS_TARGET),win32) +PPUEXT=.ppw +OEXT=.ow +ASMEXT=.sw +SMARTEXT=.slw +STATICLIBEXT=.aw +SHAREDLIBEXT=.dll +SHORTSUFFIX=w32 +endif +ifeq ($(OS_TARGET),os2) +BATCHEXT=.cmd +PPUEXT=.ppo +ASMEXT=.so2 +OEXT=.oo2 +AOUTEXT=.out +SMARTEXT=.sl2 +STATICLIBPREFIX= +STATICLIBEXT=.ao2 +SHAREDLIBEXT=.dll +SHORTSUFFIX=os2 +ECHO=echo +endif +ifeq ($(OS_TARGET),amiga) +EXEEXT= +PPUEXT=.ppu +ASMEXT=.s +OEXT=.o +SMARTEXT=.sl +STATICLIBEXT=.a +SHAREDLIBEXT=.library +SHORTSUFFIX=amg +endif +ifeq ($(OS_TARGET),atari) +PPUEXT=.ppu +ASMEXT=.s +OEXT=.o +SMARTEXT=.sl +STATICLIBEXT=.a +EXEEXT=.ttp +SHORTSUFFIX=ata +endif +ifeq ($(OS_TARGET),beos) +BATCHEXT=.sh +PPUEXT=.ppu +ASMEXT=.s +OEXT=.o +SMARTEXT=.sl +STATICLIBEXT=.a +EXEEXT= +SHORTSUFFIX=be +endif +ifeq ($(OS_TARGET),solaris) +BATCHEXT=.sh +PPUEXT=.ppu +ASMEXT=.s +OEXT=.o +SMARTEXT=.sl +STATICLIBEXT=.a +EXEEXT= +SHORTSUFFIX=sun +endif +ifeq ($(OS_TARGET),qnx) +BATCHEXT=.sh +PPUEXT=.ppu +ASMEXT=.s +OEXT=.o +SMARTEXT=.sl +STATICLIBEXT=.a +EXEEXT= +SHORTSUFFIX=qnx +endif +ifeq ($(OS_TARGET),netware) +STATICLIBPREFIX= +PPUEXT=.ppu +OEXT=.o +ASMEXT=.s +SMARTEXT=.sl +STATICLIBEXT=.a +SHAREDLIBEXT=.nlm +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= +PPUEXT=.ppu +ASMEXT=.s +OEXT=.o +SMARTEXT=.sl +STATICLIBEXT=.a +EXEEXT= +DEBUGSYMEXT=.xcoff +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 +ECHO:=$(strip $(wildcard $(addsuffix /gecho$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(ECHO),) +ECHO:=$(strip $(wildcard $(addsuffix /echo$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(ECHO),) +ECHO= __missing_command_ECHO +else +ECHO:=$(firstword $(ECHO)) +endif +else +ECHO:=$(firstword $(ECHO)) +endif +endif +export ECHO +ifndef DATE +DATE:=$(strip $(wildcard $(addsuffix /gdate$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(DATE),) +DATE:=$(strip $(wildcard $(addsuffix /date$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(DATE),) +DATE= __missing_command_DATE +else +DATE:=$(firstword $(DATE)) +endif +else +DATE:=$(firstword $(DATE)) +endif +endif +export DATE +ifndef GINSTALL +GINSTALL:=$(strip $(wildcard $(addsuffix /ginstall$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(GINSTALL),) +GINSTALL:=$(strip $(wildcard $(addsuffix /install$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(GINSTALL),) +GINSTALL= __missing_command_GINSTALL +else +GINSTALL:=$(firstword $(GINSTALL)) +endif +else +GINSTALL:=$(firstword $(GINSTALL)) +endif +endif +export GINSTALL +ifndef CPPROG +CPPROG:=$(strip $(wildcard $(addsuffix /cp$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(CPPROG),) +CPPROG= __missing_command_CPPROG +else +CPPROG:=$(firstword $(CPPROG)) +endif +endif +export CPPROG +ifndef RMPROG +RMPROG:=$(strip $(wildcard $(addsuffix /rm$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(RMPROG),) +RMPROG= __missing_command_RMPROG +else +RMPROG:=$(firstword $(RMPROG)) +endif +endif +export RMPROG +ifndef MVPROG +MVPROG:=$(strip $(wildcard $(addsuffix /mv$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(MVPROG),) +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 +else +ECHOREDIR=$(ECHO) +endif +endif +ifndef COPY +COPY:=$(CPPROG) -fp +endif +ifndef COPYTREE +COPYTREE:=$(CPPROG) -Rfp +endif +ifndef MKDIRTREE +MKDIRTREE:=$(MKDIRPROG) -p +endif +ifndef MOVE +MOVE:=$(MVPROG) -f +endif +ifndef DEL +DEL:=$(RMPROG) -f +endif +ifndef DELTREE +DELTREE:=$(RMPROG) -rf +endif +ifndef INSTALL +ifdef inUnix +INSTALL:=$(GINSTALL) -c -m 644 +else +INSTALL:=$(COPY) +endif +endif +ifndef INSTALLEXE +ifdef inUnix +INSTALLEXE:=$(GINSTALL) -c -m 755 +else +INSTALLEXE:=$(COPY) +endif +endif +ifndef MKDIR +MKDIR:=$(GINSTALL) -m 755 -d +endif +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 +else +PPUMOVE:=$(firstword $(PPUMOVE)) +endif +endif +export PPUMOVE +ifndef FPCMAKE +FPCMAKE:=$(strip $(wildcard $(addsuffix /fpcmake$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(FPCMAKE),) +FPCMAKE= __missing_command_FPCMAKE +else +FPCMAKE:=$(firstword $(FPCMAKE)) +endif +endif +export FPCMAKE +ifndef ZIPPROG +ZIPPROG:=$(strip $(wildcard $(addsuffix /zip$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(ZIPPROG),) +ZIPPROG= __missing_command_ZIPPROG +else +ZIPPROG:=$(firstword $(ZIPPROG)) +endif +endif +export ZIPPROG +ifndef TARPROG +TARPROG:=$(strip $(wildcard $(addsuffix /gtar$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(TARPROG),) +TARPROG:=$(strip $(wildcard $(addsuffix /tar$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(TARPROG),) +TARPROG= __missing_command_TARPROG +else +TARPROG:=$(firstword $(TARPROG)) +endif +else +TARPROG:=$(firstword $(TARPROG)) +endif +endif +export TARPROG +ASNAME=$(BINUTILSPREFIX)as +LDNAME=$(BINUTILSPREFIX)ld +ARNAME=$(BINUTILSPREFIX)ar +RCNAME=$(BINUTILSPREFIX)rc +ifneq ($(findstring 1.0.,$(FPC_VERSION)),) +ifeq ($(OS_TARGET),win32) +ifeq ($(CROSSBINDIR),) +ASNAME=asw +LDNAME=ldw +ARNAME=arw +endif +endif +endif +ifndef ASPROG +ifdef CROSSBINDIR +ASPROG=$(CROSSBINDIR)/$(ASNAME)$(SRCEXEEXT) +else +ASPROG=$(ASNAME) +endif +endif +ifndef LDPROG +ifdef CROSSBINDIR +LDPROG=$(CROSSBINDIR)/$(LDNAME)$(SRCEXEEXT) +else +LDPROG=$(LDNAME) +endif +endif +ifndef RCPROG +ifdef CROSSBINDIR +RCPROG=$(CROSSBINDIR)/$(RCNAME)$(SRCEXEEXT) +else +RCPROG=$(RCNAME) +endif +endif +ifndef ARPROG +ifdef CROSSBINDIR +ARPROG=$(CROSSBINDIR)/$(ARNAME)$(SRCEXEEXT) +else +ARPROG=$(ARNAME) +endif +endif +AS=$(ASPROG) +LD=$(LDPROG) +RC=$(RCPROG) +AR=$(ARPROG) +PPAS=ppas$(SRCBATCHEXT) +ifdef inUnix +LDCONFIG=ldconfig +else +LDCONFIG= +endif +ifdef DATE +DATESTR:=$(shell $(DATE) +%Y%m%d) +else +DATESTR= +endif +ifndef UPXPROG +ifeq ($(OS_TARGET),go32v2) +UPXPROG:=1 +endif +ifeq ($(OS_TARGET),win32) +UPXPROG:=1 +endif +ifdef UPXPROG +UPXPROG:=$(strip $(wildcard $(addsuffix /upx$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(UPXPROG),) +UPXPROG= +else +UPXPROG:=$(firstword $(UPXPROG)) +endif +else +UPXPROG= +endif +endif +export UPXPROG +ZIPOPT=-9 +ZIPEXT=.zip +ifeq ($(USETAR),bz2) +TAROPT=vj +TAREXT=.tar.bz2 +else +TAROPT=vz +TAREXT=.tar.gz +endif +override REQUIRE_PACKAGES=rtl gtk2 +ifeq ($(FULL_TARGET),i386-linux) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_X11=1 +REQUIRE_PACKAGES_GTK2=1 +endif +ifeq ($(FULL_TARGET),i386-go32v2) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_GTK2=1 +endif +ifeq ($(FULL_TARGET),i386-win32) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_GTK2=1 +endif +ifeq ($(FULL_TARGET),i386-os2) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_GTK2=1 +endif +ifeq ($(FULL_TARGET),i386-freebsd) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_X11=1 +REQUIRE_PACKAGES_GTK2=1 +endif +ifeq ($(FULL_TARGET),i386-beos) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_GTK2=1 +endif +ifeq ($(FULL_TARGET),i386-netbsd) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_X11=1 +REQUIRE_PACKAGES_GTK2=1 +endif +ifeq ($(FULL_TARGET),i386-solaris) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_X11=1 +REQUIRE_PACKAGES_GTK2=1 +endif +ifeq ($(FULL_TARGET),i386-qnx) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_GTK2=1 +endif +ifeq ($(FULL_TARGET),i386-netware) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_GTK2=1 +endif +ifeq ($(FULL_TARGET),i386-openbsd) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_X11=1 +REQUIRE_PACKAGES_GTK2=1 +endif +ifeq ($(FULL_TARGET),i386-wdosx) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_GTK2=1 +endif +ifeq ($(FULL_TARGET),i386-darwin) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_X11=1 +REQUIRE_PACKAGES_GTK2=1 +endif +ifeq ($(FULL_TARGET),i386-emx) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_GTK2=1 +endif +ifeq ($(FULL_TARGET),i386-watcom) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_GTK2=1 +endif +ifeq ($(FULL_TARGET),i386-netwlibc) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_GTK2=1 +endif +ifeq ($(FULL_TARGET),i386-wince) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_GTK2=1 +endif +ifeq ($(FULL_TARGET),i386-embedded) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_GTK2=1 +endif +ifeq ($(FULL_TARGET),i386-symbian) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_GTK2=1 +endif +ifeq ($(FULL_TARGET),m68k-linux) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_X11=1 +REQUIRE_PACKAGES_GTK2=1 +endif +ifeq ($(FULL_TARGET),m68k-freebsd) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_X11=1 +REQUIRE_PACKAGES_GTK2=1 +endif +ifeq ($(FULL_TARGET),m68k-netbsd) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_X11=1 +REQUIRE_PACKAGES_GTK2=1 +endif +ifeq ($(FULL_TARGET),m68k-amiga) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_GTK2=1 +endif +ifeq ($(FULL_TARGET),m68k-atari) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_GTK2=1 +endif +ifeq ($(FULL_TARGET),m68k-openbsd) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_X11=1 +REQUIRE_PACKAGES_GTK2=1 +endif +ifeq ($(FULL_TARGET),m68k-palmos) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_GTK2=1 +endif +ifeq ($(FULL_TARGET),m68k-embedded) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_GTK2=1 +endif +ifeq ($(FULL_TARGET),powerpc-linux) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_X11=1 +REQUIRE_PACKAGES_GTK2=1 +endif +ifeq ($(FULL_TARGET),powerpc-netbsd) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_X11=1 +REQUIRE_PACKAGES_GTK2=1 +endif +ifeq ($(FULL_TARGET),powerpc-amiga) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_GTK2=1 +endif +ifeq ($(FULL_TARGET),powerpc-macos) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_GTK2=1 +endif +ifeq ($(FULL_TARGET),powerpc-darwin) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_X11=1 +REQUIRE_PACKAGES_GTK2=1 +endif +ifeq ($(FULL_TARGET),powerpc-morphos) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_GTK2=1 +endif +ifeq ($(FULL_TARGET),powerpc-embedded) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_GTK2=1 +endif +ifeq ($(FULL_TARGET),sparc-linux) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_X11=1 +REQUIRE_PACKAGES_GTK2=1 +endif +ifeq ($(FULL_TARGET),sparc-netbsd) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_X11=1 +REQUIRE_PACKAGES_GTK2=1 +endif +ifeq ($(FULL_TARGET),sparc-solaris) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_X11=1 +REQUIRE_PACKAGES_GTK2=1 +endif +ifeq ($(FULL_TARGET),sparc-embedded) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_GTK2=1 +endif +ifeq ($(FULL_TARGET),x86_64-linux) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_X11=1 +REQUIRE_PACKAGES_GTK2=1 +endif +ifeq ($(FULL_TARGET),x86_64-freebsd) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_X11=1 +REQUIRE_PACKAGES_GTK2=1 +endif +ifeq ($(FULL_TARGET),x86_64-darwin) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_X11=1 +REQUIRE_PACKAGES_GTK2=1 +endif +ifeq ($(FULL_TARGET),x86_64-win64) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_GTK2=1 +endif +ifeq ($(FULL_TARGET),x86_64-embedded) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_GTK2=1 +endif +ifeq ($(FULL_TARGET),arm-linux) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_X11=1 +REQUIRE_PACKAGES_GTK2=1 +endif +ifeq ($(FULL_TARGET),arm-palmos) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_GTK2=1 +endif +ifeq ($(FULL_TARGET),arm-wince) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_GTK2=1 +endif +ifeq ($(FULL_TARGET),arm-gba) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_GTK2=1 +endif +ifeq ($(FULL_TARGET),arm-nds) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_GTK2=1 +endif +ifeq ($(FULL_TARGET),arm-embedded) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_GTK2=1 +endif +ifeq ($(FULL_TARGET),arm-symbian) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_GTK2=1 +endif +ifeq ($(FULL_TARGET),powerpc64-linux) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_X11=1 +REQUIRE_PACKAGES_GTK2=1 +endif +ifeq ($(FULL_TARGET),powerpc64-darwin) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_X11=1 +REQUIRE_PACKAGES_GTK2=1 +endif +ifeq ($(FULL_TARGET),powerpc64-embedded) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_GTK2=1 +endif +ifdef REQUIRE_PACKAGES_RTL +PACKAGEDIR_RTL:=$(firstword $(subst /Makefile.fpc,,$(strip $(wildcard $(addsuffix /rtl/Makefile.fpc,$(PACKAGESDIR)))))) +ifneq ($(PACKAGEDIR_RTL),) +ifneq ($(wildcard $(PACKAGEDIR_RTL)/units/$(TARGETSUFFIX)),) +UNITDIR_RTL=$(PACKAGEDIR_RTL)/units/$(TARGETSUFFIX) +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 +ifdef REQUIRE_PACKAGES_X11 +PACKAGEDIR_X11:=$(firstword $(subst /Makefile.fpc,,$(strip $(wildcard $(addsuffix /x11/Makefile.fpc,$(PACKAGESDIR)))))) +ifneq ($(PACKAGEDIR_X11),) +ifneq ($(wildcard $(PACKAGEDIR_X11)/units/$(TARGETSUFFIX)),) +UNITDIR_X11=$(PACKAGEDIR_X11)/units/$(TARGETSUFFIX) +else +UNITDIR_X11=$(PACKAGEDIR_X11) +endif +ifdef CHECKDEPEND +$(PACKAGEDIR_X11)/$(FPCMADE): + $(MAKE) -C $(PACKAGEDIR_X11) $(FPCMADE) +override ALLDEPENDENCIES+=$(PACKAGEDIR_X11)/$(FPCMADE) +endif +else +PACKAGEDIR_X11= +UNITDIR_X11:=$(subst /Package.fpc,,$(strip $(wildcard $(addsuffix /x11/Package.fpc,$(UNITSDIR))))) +ifneq ($(UNITDIR_X11),) +UNITDIR_X11:=$(firstword $(UNITDIR_X11)) +else +UNITDIR_X11= +endif +endif +ifdef UNITDIR_X11 +override COMPILER_UNITDIR+=$(UNITDIR_X11) +endif +endif +ifdef REQUIRE_PACKAGES_GTK2 +PACKAGEDIR_GTK2:=$(firstword $(subst /Makefile.fpc,,$(strip $(wildcard $(addsuffix /gtk2/Makefile.fpc,$(PACKAGESDIR)))))) +ifneq ($(PACKAGEDIR_GTK2),) +ifneq ($(wildcard $(PACKAGEDIR_GTK2)/units/$(TARGETSUFFIX)),) +UNITDIR_GTK2=$(PACKAGEDIR_GTK2)/units/$(TARGETSUFFIX) +else +UNITDIR_GTK2=$(PACKAGEDIR_GTK2) +endif +ifdef CHECKDEPEND +$(PACKAGEDIR_GTK2)/$(FPCMADE): + $(MAKE) -C $(PACKAGEDIR_GTK2) $(FPCMADE) +override ALLDEPENDENCIES+=$(PACKAGEDIR_GTK2)/$(FPCMADE) +endif +else +PACKAGEDIR_GTK2= +UNITDIR_GTK2:=$(subst /Package.fpc,,$(strip $(wildcard $(addsuffix /gtk2/Package.fpc,$(UNITSDIR))))) +ifneq ($(UNITDIR_GTK2),) +UNITDIR_GTK2:=$(firstword $(UNITDIR_GTK2)) +else +UNITDIR_GTK2= +endif +endif +ifdef UNITDIR_GTK2 +override COMPILER_UNITDIR+=$(UNITDIR_GTK2) +endif +endif +ifndef NOCPUDEF +override FPCOPTDEF=$(CPU_TARGET) +endif +ifneq ($(OS_TARGET),$(OS_SOURCE)) +override FPCOPT+=-T$(OS_TARGET) +endif +ifneq ($(CPU_TARGET),$(CPU_SOURCE)) +override FPCOPT+=-P$(CPU_TARGET) +endif +ifeq ($(OS_SOURCE),openbsd) +override FPCOPT+=-FD$(NEW_BINUTILS_PATH) +endif +ifndef CROSSBOOTSTRAP +ifneq ($(BINUTILSPREFIX),) +override FPCOPT+=-XP$(BINUTILSPREFIX) +endif +ifneq ($(BINUTILSPREFIX),) +override FPCOPT+=-Xr$(RLINKPATH) +endif +endif +ifdef UNITDIR +override FPCOPT+=$(addprefix -Fu,$(UNITDIR)) +endif +ifdef LIBDIR +override FPCOPT+=$(addprefix -Fl,$(LIBDIR)) +endif +ifdef OBJDIR +override FPCOPT+=$(addprefix -Fo,$(OBJDIR)) +endif +ifdef INCDIR +override FPCOPT+=$(addprefix -Fi,$(INCDIR)) +endif +ifdef LINKSMART +override FPCOPT+=-XX +endif +ifdef CREATESMART +override FPCOPT+=-CX +endif +ifdef DEBUG +override FPCOPT+=-gl +override FPCOPTDEF+=DEBUG +endif +ifdef RELEASE +ifneq ($(findstring 2.0.,$(FPC_VERSION)),) +ifeq ($(CPU_TARGET),i386) +FPCCPUOPT:=-OG2p3 +endif +ifeq ($(CPU_TARGET),powerpc) +FPCCPUOPT:=-O1r +endif +else +FPCCPUOPT:=-O2 +endif +override FPCOPT+=-Ur -Xs $(FPCCPUOPT) -n +override FPCOPTDEF+=RELEASE +endif +ifdef STRIP +override FPCOPT+=-Xs +endif +ifdef OPTIMIZE +override FPCOPT+=-O2 +endif +ifdef VERBOSE +override FPCOPT+=-vwni +endif +ifdef COMPILER_OPTIONS +override FPCOPT+=$(COMPILER_OPTIONS) +endif +ifdef COMPILER_UNITDIR +override FPCOPT+=$(addprefix -Fu,$(COMPILER_UNITDIR)) +endif +ifdef COMPILER_LIBRARYDIR +override FPCOPT+=$(addprefix -Fl,$(COMPILER_LIBRARYDIR)) +endif +ifdef COMPILER_OBJECTDIR +override FPCOPT+=$(addprefix -Fo,$(COMPILER_OBJECTDIR)) +endif +ifdef COMPILER_INCLUDEDIR +override FPCOPT+=$(addprefix -Fi,$(COMPILER_INCLUDEDIR)) +endif +ifdef CROSSBINDIR +override FPCOPT+=-FD$(CROSSBINDIR) +endif +ifdef COMPILER_TARGETDIR +override FPCOPT+=-FE$(COMPILER_TARGETDIR) +ifeq ($(COMPILER_TARGETDIR),.) +override TARGETDIRPREFIX= +else +override TARGETDIRPREFIX=$(COMPILER_TARGETDIR)/ +endif +endif +ifdef COMPILER_UNITTARGETDIR +override FPCOPT+=-FU$(COMPILER_UNITTARGETDIR) +ifeq ($(COMPILER_UNITTARGETDIR),.) +override UNITTARGETDIRPREFIX= +else +override UNITTARGETDIRPREFIX=$(COMPILER_UNITTARGETDIR)/ +endif +else +ifdef COMPILER_TARGETDIR +override COMPILER_UNITTARGETDIR=$(COMPILER_TARGETDIR) +override UNITTARGETDIRPREFIX=$(TARGETDIRPREFIX) +endif +endif +ifdef CREATESHARED +override FPCOPT+=-Cg +ifeq ($(CPU_TARGET),i386) +override FPCOPT+=-Aas +endif +endif +ifeq ($(findstring 2.0.,$(FPC_VERSION)),) +ifeq ($(OS_TARGET),linux) +ifeq ($(CPU_TARGET),x86_64) +override FPCOPT+=-Cg +endif +endif +endif +ifdef LINKSHARED +endif +ifdef GCCLIBDIR +override FPCOPT+=-Fl$(GCCLIBDIR) +endif +ifdef OTHERLIBDIR +override FPCOPT+=$(addprefix -Fl,$(OTHERLIBDIR)) +endif +ifdef OPT +override FPCOPT+=$(OPT) +endif +ifdef FPCOPTDEF +override FPCOPT+=$(addprefix -d,$(FPCOPTDEF)) +endif +ifdef CFGFILE +override FPCOPT+=@$(CFGFILE) +endif +ifdef USEENV +override FPCEXTCMD:=$(FPCOPT) +override FPCOPT:=!FPCEXTCMD +export FPCEXTCMD +endif +override AFULL_TARGET=$(CPU_TARGET)-$(OS_TARGET) +override AFULL_SOURCE=$(CPU_SOURCE)-$(OS_SOURCE) +ifneq ($(AFULL_TARGET),$(AFULL_SOURCE)) +override ACROSSCOMPILE=1 +endif +ifdef ACROSSCOMPILE +override FPCOPT+=$(CROSSOPT) +endif +override COMPILER:=$(FPC) $(FPCOPT) +ifeq (,$(findstring -s ,$(COMPILER))) +EXECPPAS= +else +ifeq ($(FULL_SOURCE),$(FULL_TARGET)) +ifdef RUNBATCH +EXECPPAS:=@$(RUNBATCH) $(PPAS) +else +EXECPPAS:=@$(PPAS) +endif +endif +endif +.PHONY: fpc_exes +ifndef CROSSINSTALL +ifneq ($(TARGET_PROGRAMS),) +override EXEFILES=$(addsuffix $(EXEEXT),$(TARGET_PROGRAMS)) +override EXEOFILES:=$(addsuffix $(OEXT),$(TARGET_PROGRAMS)) $(addprefix $(STATICLIBPREFIX),$(addsuffix $(STATICLIBEXT),$(TARGET_PROGRAMS))) $(addprefix $(IMPORTLIBPREFIX),$(addsuffix $(STATICLIBEXT),$(TARGET_PROGRAMS))) +override ALLTARGET+=fpc_exes +override INSTALLEXEFILES+=$(EXEFILES) +override CLEANEXEFILES+=$(EXEFILES) $(EXEOFILES) +ifeq ($(OS_TARGET),os2) +override CLEANEXEFILES+=$(addsuffix $(AOUTEXT),$(TARGET_PROGRAMS)) +endif +ifeq ($(OS_TARGET),emx) +override CLEANEXEFILES+=$(addsuffix $(AOUTEXT),$(TARGET_PROGRAMS)) +endif +endif +endif +fpc_exes: $(COMPILER_TARGETDIR) $(COMPILER_UNITTARGETDIR) $(EXEFILES) +ifdef TARGET_RSTS +override RSTFILES=$(addsuffix $(RSTEXT),$(TARGET_RSTS)) +override CLEANRSTFILES+=$(RSTFILES) +endif +.PHONY: fpc_all fpc_smart fpc_debug fpc_release fpc_shared +$(FPCMADE): $(ALLDEPENDENCIES) $(ALLTARGET) + @$(ECHOREDIR) Compiled > $(FPCMADE) +fpc_all: $(FPCMADE) +fpc_smart: + $(MAKE) all LINKSMART=1 CREATESMART=1 +fpc_debug: + $(MAKE) all DEBUG=1 +fpc_release: + $(MAKE) all RELEASE=1 +.SUFFIXES: $(EXEEXT) $(PPUEXT) $(OEXT) .pas .lpr .dpr .pp .rc .res +$(COMPILER_UNITTARGETDIR): + $(MKDIRTREE) $(COMPILER_UNITTARGETDIR) +$(COMPILER_TARGETDIR): + $(MKDIRTREE) $(COMPILER_TARGETDIR) +%$(PPUEXT): %.pp + $(COMPILER) $< + $(EXECPPAS) +%$(PPUEXT): %.pas + $(COMPILER) $< + $(EXECPPAS) +%$(EXEEXT): %.pp + $(COMPILER) $< + $(EXECPPAS) +%$(EXEEXT): %.pas + $(COMPILER) $< + $(EXECPPAS) +%$(EXEEXT): %.lpr + $(COMPILER) $< + $(EXECPPAS) +%$(EXEEXT): %.dpr + $(COMPILER) $< + $(EXECPPAS) +%.res: %.rc + windres -i $< -o $@ +vpath %.pp $(COMPILER_SOURCEDIR) $(COMPILER_INCLUDEDIR) +vpath %.pas $(COMPILER_SOURCEDIR) $(COMPILER_INCLUDEDIR) +vpath %.lpr $(COMPILER_SOURCEDIR) $(COMPILER_INCLUDEDIR) +vpath %.dpr $(COMPILER_SOURCEDIR) $(COMPILER_INCLUDEDIR) +vpath %.inc $(COMPILER_INCLUDEDIR) +vpath %$(OEXT) $(COMPILER_UNITTARGETDIR) +vpath %$(PPUEXT) $(COMPILER_UNITTARGETDIR) +.PHONY: fpc_shared +override INSTALLTARGET+=fpc_shared_install +ifndef SHARED_LIBVERSION +SHARED_LIBVERSION=$(FPC_VERSION) +endif +ifndef SHARED_LIBNAME +SHARED_LIBNAME=$(PACKAGE_NAME) +endif +ifndef SHARED_FULLNAME +SHARED_FULLNAME=$(SHAREDLIBPREFIX)$(SHARED_LIBNAME)-$(SHARED_LIBVERSION)$(SHAREDLIBEXT) +endif +ifndef SHARED_LIBUNITS +SHARED_LIBUNITS:=$(TARGET_UNITS) $(TARGET_IMPLICITUNITS) +override SHARED_LIBUNITS:=$(filter-out $(INSTALL_BUILDUNIT),$(SHARED_LIBUNITS)) +endif +fpc_shared: +ifdef HASSHAREDLIB + $(MAKE) all CREATESHARED=1 LINKSHARED=1 CREATESMART=1 +ifneq ($(SHARED_BUILD),n) + $(PPUMOVE) -q $(SHARED_LIBUNITS) -i$(COMPILER_UNITTARGETDIR) -o$(SHARED_FULLNAME) -d$(COMPILER_UNITTARGETDIR) +endif +else + @$(ECHO) Shared Libraries not supported +endif +fpc_shared_install: +ifneq ($(SHARED_BUILD),n) +ifneq ($(SHARED_LIBUNITS),) +ifneq ($(wildcard $(COMPILER_UNITTARGETDIR)/$(SHARED_FULLNAME)),) + $(INSTALL) $(COMPILER_UNITTARGETDIR)/$(SHARED_FULLNAME) $(INSTALL_SHAREDDIR) +endif +endif +endif +.PHONY: fpc_install fpc_sourceinstall fpc_exampleinstall +ifdef INSTALL_UNITS +override INSTALLPPUFILES+=$(addsuffix $(PPUEXT),$(INSTALL_UNITS)) +endif +ifdef INSTALL_BUILDUNIT +override INSTALLPPUFILES:=$(filter-out $(INSTALL_BUILDUNIT)$(PPUEXT),$(INSTALLPPUFILES)) +endif +ifdef INSTALLPPUFILES +override INSTALLPPULINKFILES:=$(subst $(PPUEXT),$(OEXT),$(INSTALLPPUFILES)) $(addprefix $(STATICLIBPREFIX),$(subst $(PPUEXT),$(STATICLIBEXT),$(INSTALLPPUFILES))) $(addprefix $(IMPORTLIBPREFIX),$(subst $(PPUEXT),$(STATICLIBEXT),$(INSTALLPPUFILES))) +ifneq ($(UNITTARGETDIRPREFIX),) +override INSTALLPPUFILES:=$(addprefix $(UNITTARGETDIRPREFIX),$(notdir $(INSTALLPPUFILES))) +override INSTALLPPULINKFILES:=$(wildcard $(addprefix $(UNITTARGETDIRPREFIX),$(notdir $(INSTALLPPULINKFILES)))) +endif +override INSTALL_CREATEPACKAGEFPC=1 +endif +ifdef INSTALLEXEFILES +ifneq ($(TARGETDIRPREFIX),) +override INSTALLEXEFILES:=$(addprefix $(TARGETDIRPREFIX),$(notdir $(INSTALLEXEFILES))) +endif +endif +fpc_install: all $(INSTALLTARGET) +ifdef INSTALLEXEFILES + $(MKDIR) $(INSTALL_BINDIR) +ifdef UPXPROG + -$(UPXPROG) $(INSTALLEXEFILES) +endif + $(INSTALLEXE) $(INSTALLEXEFILES) $(INSTALL_BINDIR) +endif +ifdef INSTALL_CREATEPACKAGEFPC +ifdef FPCMAKE +ifdef PACKAGE_VERSION +ifneq ($(wildcard Makefile.fpc),) + $(FPCMAKE) -p -T$(CPU_TARGET)-$(OS_TARGET) Makefile.fpc + $(MKDIR) $(INSTALL_UNITDIR) + $(INSTALL) Package.fpc $(INSTALL_UNITDIR) +endif +endif +endif +endif +ifdef INSTALLPPUFILES + $(MKDIR) $(INSTALL_UNITDIR) + $(INSTALL) $(INSTALLPPUFILES) $(INSTALL_UNITDIR) +ifneq ($(INSTALLPPULINKFILES),) + $(INSTALL) $(INSTALLPPULINKFILES) $(INSTALL_UNITDIR) +endif +ifneq ($(wildcard $(LIB_FULLNAME)),) + $(MKDIR) $(INSTALL_LIBDIR) + $(INSTALL) $(LIB_FULLNAME) $(INSTALL_LIBDIR) +ifdef inUnix + ln -sf $(LIB_FULLNAME) $(INSTALL_LIBDIR)/$(LIB_NAME) +endif +endif +endif +ifdef INSTALL_FILES + $(MKDIR) $(INSTALL_DATADIR) + $(INSTALL) $(INSTALL_FILES) $(INSTALL_DATADIR) +endif +fpc_sourceinstall: distclean + $(MKDIR) $(INSTALL_SOURCEDIR) + $(COPYTREE) $(BASEDIR)/* $(INSTALL_SOURCEDIR) +fpc_exampleinstall: $(addsuffix _distclean,$(TARGET_EXAMPLEDIRS)) +ifdef HASEXAMPLES + $(MKDIR) $(INSTALL_EXAMPLEDIR) +endif +ifdef EXAMPLESOURCEFILES + $(COPY) $(EXAMPLESOURCEFILES) $(INSTALL_EXAMPLEDIR) +endif +ifdef TARGET_EXAMPLEDIRS + $(COPYTREE) $(addsuffix /*,$(TARGET_EXAMPLEDIRS)) $(INSTALL_EXAMPLEDIR) +endif +.PHONY: fpc_clean fpc_cleanall fpc_distclean +ifdef EXEFILES +override CLEANEXEFILES:=$(addprefix $(TARGETDIRPREFIX),$(CLEANEXEFILES)) +endif +ifdef CLEAN_UNITS +override CLEANPPUFILES+=$(addsuffix $(PPUEXT),$(CLEAN_UNITS)) +endif +ifdef CLEANPPUFILES +override CLEANPPULINKFILES:=$(subst $(PPUEXT),$(OEXT),$(CLEANPPUFILES)) $(addprefix $(STATICLIBPREFIX),$(subst $(PPUEXT),$(STATICLIBEXT),$(CLEANPPUFILES))) $(addprefix $(IMPORTLIBPREFIX),$(subst $(PPUEXT),$(STATICLIBEXT),$(CLEANPPUFILES))) +ifdef DEBUGSYMEXT +override CLEANPPULINKFILES+=$(subst $(PPUEXT),$(DEBUGSYMEXT),$(CLEANPPUFILES)) +endif +override CLEANPPUFILES:=$(addprefix $(UNITTARGETDIRPREFIX),$(CLEANPPUFILES)) +override CLEANPPULINKFILES:=$(wildcard $(addprefix $(UNITTARGETDIRPREFIX),$(CLEANPPULINKFILES))) +endif +fpc_clean: $(CLEANTARGET) +ifdef CLEANEXEFILES + -$(DEL) $(CLEANEXEFILES) +endif +ifdef CLEANPPUFILES + -$(DEL) $(CLEANPPUFILES) +endif +ifneq ($(CLEANPPULINKFILES),) + -$(DEL) $(CLEANPPULINKFILES) +endif +ifdef CLEANRSTFILES + -$(DEL) $(addprefix $(UNITTARGETDIRPREFIX),$(CLEANRSTFILES)) +endif +ifdef CLEAN_FILES + -$(DEL) $(CLEAN_FILES) +endif +ifdef LIB_NAME + -$(DEL) $(LIB_NAME) $(LIB_FULLNAME) +endif + -$(DEL) $(FPCMADE) Package.fpc $(PPAS) script.res link.res $(FPCEXTFILE) $(REDIRFILE) + -$(DEL) *$(ASMEXT) *_ppas$(BATCHEXT) +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) *_ppas$(BATCHEXT) +ifdef AOUTEXT + -$(DEL) *$(AOUTEXT) +endif +ifdef DEBUGSYMEXT + -$(DEL) *$(DEBUGSYMEXT) +endif +fpc_distclean: cleanall +.PHONY: fpc_baseinfo +override INFORULES+=fpc_baseinfo +fpc_baseinfo: + @$(ECHO) + @$(ECHO) == Package info == + @$(ECHO) Package Name..... $(PACKAGE_NAME) + @$(ECHO) Package Version.. $(PACKAGE_VERSION) + @$(ECHO) + @$(ECHO) == Configuration info == + @$(ECHO) + @$(ECHO) FPC.......... $(FPC) + @$(ECHO) FPC Version.. $(FPC_VERSION) + @$(ECHO) Source CPU... $(CPU_SOURCE) + @$(ECHO) Target CPU... $(CPU_TARGET) + @$(ECHO) Source OS.... $(OS_SOURCE) + @$(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) + @$(ECHO) Required pkgs... $(REQUIRE_PACKAGES) + @$(ECHO) + @$(ECHO) Basedir......... $(BASEDIR) + @$(ECHO) FPCDir.......... $(FPCDIR) + @$(ECHO) CrossBinDir..... $(CROSSBINDIR) + @$(ECHO) UnitsDir........ $(UNITSDIR) + @$(ECHO) PackagesDir..... $(PACKAGESDIR) + @$(ECHO) + @$(ECHO) GCC library..... $(GCCLIBDIR) + @$(ECHO) Other library... $(OTHERLIBDIR) + @$(ECHO) + @$(ECHO) == Tools info == + @$(ECHO) + @$(ECHO) As........ $(AS) + @$(ECHO) Ld........ $(LD) + @$(ECHO) Ar........ $(AR) + @$(ECHO) Rc........ $(RC) + @$(ECHO) + @$(ECHO) Mv........ $(MVPROG) + @$(ECHO) Cp........ $(CPPROG) + @$(ECHO) Rm........ $(RMPROG) + @$(ECHO) GInstall.. $(GINSTALL) + @$(ECHO) Echo...... $(ECHO) + @$(ECHO) Shell..... $(SHELL) + @$(ECHO) Date...... $(DATE) + @$(ECHO) FPCMake... $(FPCMAKE) + @$(ECHO) PPUMove... $(PPUMOVE) + @$(ECHO) Upx....... $(UPXPROG) + @$(ECHO) Zip....... $(ZIPPROG) + @$(ECHO) + @$(ECHO) == Object info == + @$(ECHO) + @$(ECHO) Target Loaders........ $(TARGET_LOADERS) + @$(ECHO) Target Units.......... $(TARGET_UNITS) + @$(ECHO) Target Implicit Units. $(TARGET_IMPLICITUNITS) + @$(ECHO) Target Programs....... $(TARGET_PROGRAMS) + @$(ECHO) Target Dirs........... $(TARGET_DIRS) + @$(ECHO) Target Examples....... $(TARGET_EXAMPLES) + @$(ECHO) Target ExampleDirs.... $(TARGET_EXAMPLEDIRS) + @$(ECHO) + @$(ECHO) Clean Units......... $(CLEAN_UNITS) + @$(ECHO) Clean Files......... $(CLEAN_FILES) + @$(ECHO) + @$(ECHO) Install Units....... $(INSTALL_UNITS) + @$(ECHO) Install Files....... $(INSTALL_FILES) + @$(ECHO) + @$(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) + @$(ECHO) Install binary dir... $(INSTALL_BINDIR) + @$(ECHO) Install library dir.. $(INSTALL_LIBDIR) + @$(ECHO) Install units dir.... $(INSTALL_UNITDIR) + @$(ECHO) Install source dir... $(INSTALL_SOURCEDIR) + @$(ECHO) Install doc dir...... $(INSTALL_DOCDIR) + @$(ECHO) Install example dir.. $(INSTALL_EXAMPLEDIR) + @$(ECHO) Install data dir..... $(INSTALL_DATADIR) + @$(ECHO) + @$(ECHO) Dist destination dir. $(DIST_DESTDIR) + @$(ECHO) Dist zip name........ $(DIST_ZIPNAME) + @$(ECHO) +.PHONY: fpc_info +fpc_info: $(INFORULES) +.PHONY: fpc_makefile fpc_makefiles fpc_makefile_sub1 fpc_makefile_sub2 \ + fpc_makefile_dirs +fpc_makefile: + $(FPCMAKE) -w -T$(OS_TARGET) Makefile.fpc +fpc_makefile_sub1: +ifdef TARGET_DIRS + $(FPCMAKE) -w -T$(OS_TARGET) $(addsuffix /Makefile.fpc,$(TARGET_DIRS)) +endif +ifdef TARGET_EXAMPLEDIRS + $(FPCMAKE) -w -T$(OS_TARGET) $(addsuffix /Makefile.fpc,$(TARGET_EXAMPLEDIRS)) +endif +fpc_makefile_sub2: $(addsuffix _makefile_dirs,$(TARGET_DIRS) $(TARGET_EXAMPLEDIRS)) +fpc_makefile_dirs: fpc_makefile_sub1 fpc_makefile_sub2 +fpc_makefiles: fpc_makefile fpc_makefile_dirs +all: fpc_all +debug: fpc_debug +smart: fpc_smart +release: fpc_release +units: fpc_units +examples: +shared: fpc_shared +install: fpc_install +sourceinstall: fpc_sourceinstall +exampleinstall: fpc_exampleinstall +distinstall: +zipinstall: +zipsourceinstall: +zipexampleinstall: +zipdistinstall: +clean: fpc_clean +distclean: fpc_distclean +cleanall: fpc_cleanall +info: fpc_info +makefiles: fpc_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 +.NOTPARALLEL: diff --git a/packages/gtk2/examples/gtk_demo/Makefile.fpc b/packages/gtk2/examples/gtk_demo/Makefile.fpc new file mode 100644 index 0000000000..73aad79b12 --- /dev/null +++ b/packages/gtk2/examples/gtk_demo/Makefile.fpc @@ -0,0 +1,18 @@ +# +# Makefile.fpc for Free Pascal GTK 2.x.y Examples +# + +[target] +programs=gtk_demo + +[require] +packages=gtk2 + +[install] +fpcpackage=y + +[default] +fpcdir=../../../.. + +[rules] +.NOTPARALLEL: diff --git a/packages/gtk2/examples/gtk_demo/appwindow.inc b/packages/gtk2/examples/gtk_demo/appwindow.inc new file mode 100644 index 0000000000..e8fcc72758 --- /dev/null +++ b/packages/gtk2/examples/gtk_demo/appwindow.inc @@ -0,0 +1,399 @@ +(* Application main window + * + * Demonstrates a typical application window, with menubar, toolbar, statusbar. + *) + +var + appwindow_registered : gboolean; + +procedure menuitem_cb (callback_data : gpointer; + callback_action : guint; + widget : PGtkWidget);cdecl; +var + dialog : PGtkWidget; + + +begin + dialog := gtk_message_dialog_new (GTK_WINDOW (callback_data), + GTK_DIALOG_DESTROY_WITH_PARENT, + GTK_MESSAGE_INFO, + GTK_BUTTONS_CLOSE, + 'You selected or toggled the menu item: "%s"', + [gtk_item_factory_path_from_widget (widget)]); + + // Close dialog on user response + g_signal_connect (G_OBJECT (dialog), + 'response', + G_CALLBACK (@gtk_widget_destroy), + NULL); + + gtk_widget_show (dialog); +end; + + + +procedure toolbar_cb (button : PGtkWidget; + data : gpointer); cdecl; +var + dialog: PGtkWidget; +begin + + dialog := gtk_message_dialog_new (GTK_WINDOW (data), + GTK_DIALOG_DESTROY_WITH_PARENT, + GTK_MESSAGE_INFO, + GTK_BUTTONS_CLOSE, + 'You selected a toolbar button'); + + (* Close dialog on user response *) + g_signal_connect (G_OBJECT (dialog), + 'response', + G_CALLBACK (@gtk_widget_destroy), + NULL); + + gtk_widget_show (dialog); +end; + +const + + menu_items : array [1..18] of TGtkItemFactoryEntry = ( + ( path: '/_File'; accelerator: NULL; callback: nil; + callback_action: 0; item_type : '<Branch>'; extra_data: NULL), + + ( path: '/File/_New'; accelerator: '<control>N' ; callback: TGtkItemfactoryCallback(@menuitem_cb); + callback_action: 0; item_type : '<StockItem>'; extra_data: NULL{GTK_STOCK_NEW}), + + ( path: '/File/_Open'; accelerator: '<control>O' ; callback: TGtkItemfactoryCallback(@menuitem_cb); + callback_action: 0; item_type : '<StockItem>'; extra_data: NULL {GTK_STOCK_OPEN}), + + ( path: '/File/_Save'; accelerator: '<control>S' ; callback: TGtkItemfactoryCallback(@menuitem_cb); + callback_action: 0; item_type : '<StockItem>'; extra_data: NULL {GTK_STOCK_SAVE}), + + ( path: '/File/Save _As'; accelerator: NULL ; callback: TGtkItemfactoryCallback(@menuitem_cb); + callback_action: 0; item_type : '<StockItem>'; extra_data: NULL {GTK_STOCK_SAVE_AS}), + + ( path: '/File/sep1'; accelerator: NULL; callback: TGtkItemfactoryCallback(@menuitem_cb); + callback_action: 0; item_type : '<Separator>'; extra_data: NULL), + + ( path: '/File/_Quit'; accelerator: '<control>Q' ; callback: TGtkItemfactoryCallback(@menuitem_cb); + callback_action: 0; item_type : '<StockItem>'; extra_data: NULL), + + ( path: '/Preferences'; accelerator: NULL ; callback: nil; + callback_action: 0; item_type : '<Branch>'; extra_data: NULL), + + ( path: '/Preferences/_Color'; accelerator: NULL ; callback: nil; + callback_action: 0; item_type : '<Branch>'; extra_data: NULL), + + ( path: '/Preferences/Color/_Red'; accelerator: NULL ; callback: TGtkItemfactoryCallback(@menuitem_cb); + callback_action: 0; item_type : '<RadioItem>'; extra_data: NULL), + + ( path: '/Preferences/Color/_Green'; accelerator: NULL ; callback: TGtkItemfactoryCallback(@menuitem_cb); + callback_action: 0; item_type : '/Preferences/Color/Red'; extra_data: NULL), + + ( path: '/Preferences/Color/_Blue'; accelerator: NULL ; callback: TGtkItemfactoryCallback(@menuitem_cb); + callback_action: 0; item_type : '/Preferences/Color/Red'; extra_data: NULL), + + ( path: '/Preferences/_Shape'; accelerator: NULL ; callback: nil; + callback_action: 0; item_type : '<Branch>'; extra_data: NULL), + + ( path: '/Preferences/Shape/_Square'; accelerator: NULL ; callback: TGtkItemfactoryCallback(@menuitem_cb); + callback_action: 0; item_type : '<RadioItem>'; extra_data: NULL), + + ( path: '/Preferences/Shape/_Rectangle'; accelerator: NULL ; callback: TGtkItemfactoryCallback(@menuitem_cb); + callback_action: 0; item_type : '/Preferences/Shape/Square'; extra_data: NULL), + + ( path: '/Preferences/Shape/_Oval'; accelerator: NULL ; callback: TGtkItemfactoryCallback(@menuitem_cb); + callback_action: 0; item_type : '/Preferences/Shape/Rectangle'; extra_data: NULL), + + + (* If you wanted this to be right justified you would use "<LastBranch>", not "<Branch>". + * Right justified help menu items are generally considered a bad idea now days. + *) + + ( path: '/_Help'; accelerator: NULL ; callback: nil; + callback_action: 0; item_type : '<Branch>'; extra_data: NULL), + + ( path: '/Help/_About'; accelerator: NULL ; callback: nil; + callback_action: 0; item_type : NULL; extra_data: NULL) + + ); + + +var + application_window : PGtkWidget; // global variable (originally called window) + + + +(* This function registers our custom toolbar icons, so they can be themed. + * + * It's totally optional to do this, you could just manually insert icons + * and have them not be themeable, especially if you never expect people + * to theme your app. + *) + +const + items :array [1..1] of TGtkStockItem = ( + ( stock_id: 'demo-gtk-logo'; _label: '_GTK!'; + modifier: 0; keyval: 0; translation_domain : NULL) + ); + +procedure register_stock_icons; + +var + pixbuf : PGdkPixbuf; + factory : PGtkIconFactory; + filename : pgchar; + + icon_set : PGtkIconSet; + transparent : PGdkPixbuf; + +begin + if not appwindow_registered then + begin + appwindow_registered := TRUE; + + (* Register our stock items *) + gtk_stock_add (@items[1], high(items)); + + (* Add our custom icon factory to the list of defaults *) + factory := gtk_icon_factory_new (); + gtk_icon_factory_add_default (factory); + + (* demo_find_file() looks in the the current directory first, + * so you can run gtk-demo without installing GTK, then looks + * in the location where the file is installed. + *) + pixbuf := NULL; + filename := demo_find_file ('gtk-logo-rgb.gif', NULL); + + if filename <> NULL then begin + pixbuf := gdk_pixbuf_new_from_file (filename, NULL); + g_free (filename); + end; + + (* Register icon to accompany stock item *) + if pixbuf <> NULL then + begin + (* The gtk-logo-rgb icon has a white background, make it transparent *) + transparent := gdk_pixbuf_add_alpha (pixbuf, TRUE, $ff, $ff, $ff); + + icon_set := gtk_icon_set_new_from_pixbuf (transparent); + gtk_icon_factory_add (factory, 'demo-gtk-logo', icon_set); + gtk_icon_set_unref (icon_set); + g_object_unref (G_OBJECT (pixbuf)); + g_object_unref (G_OBJECT (transparent)); + end + else + g_warning ('failed to load GTK logo for toolbar'); + + (* Drop our reference to the factory, GTK will hold a reference. *) + g_object_unref (G_OBJECT (factory)); + end; +end; + +procedure update_statusbar ( buffer : PGtkTextBuffer; + statusbar : PGtkStatusbar); +var + msg : pgchar; + row, + col : gint; + count : gint; + iter : TGtkTextIter; + +begin + + gtk_statusbar_pop (statusbar, 0); (* clear any previous message, underflow is allowed *) + + count := gtk_text_buffer_get_char_count (buffer); + + gtk_text_buffer_get_iter_at_mark (buffer, + @iter, + gtk_text_buffer_get_insert (buffer)); + + row := gtk_text_iter_get_line (@iter); + col := gtk_text_iter_get_line_offset (@iter); + + msg := g_strdup_printf ('Cursor at row %d column %d - %d chars in document', + [row, col, count]); + + gtk_statusbar_push (statusbar, 0, msg); + + g_free (msg); +end; + +procedure mark_set_callback (buffer : PGtkTextBuffer; + new_location : PGtkTextIter; + mark : PGtkTextMark; + data : gpointer); cdecl; +begin + update_statusbar (buffer, GTK_STATUSBAR (data)); +end; + +function do_appwindow : PGtkWidget; +var + table, + toolbar, + statusbar, + contents, + sw : PGtkWidget; + + buffer : PGtkTextBuffer; + accel_group : PGtkAccelGroup; + item_factory : PGtkItemFactory; + +begin + if application_window = NULL then + begin + register_stock_icons (); + + (* Create the toplevel window + *) + + application_window := gtk_window_new (GTK_WINDOW_TOPLEVEL); + gtk_window_set_title (GTK_WINDOW (application_window ), 'Application Window'); + + + (* NULL window variable when window is closed *) + g_signal_connect (G_OBJECT (application_window ), 'destroy', + G_CALLBACK (@gtk_widget_destroyed), + @application_window ); + + table := gtk_table_new (1, 4, FALSE); + + gtk_container_add (GTK_CONTAINER (application_window ), table); + + (* Create the menubar + *) + + accel_group := gtk_accel_group_new (); + gtk_window_add_accel_group (GTK_WINDOW (application_window), accel_group); + g_object_unref (accel_group); + + item_factory := gtk_item_factory_new (GTK_TYPE_MENU_BAR, '<main>', accel_group); + + (* Set up item factory to go away with the window *) + g_object_ref (item_factory); + gtk_object_sink (GTK_OBJECT (item_factory)); + g_object_set_data_full (G_OBJECT (application_window ), + '<main>', + item_factory, + TGDestroyNotify (@g_object_unref)); + + (* create menu items *) + menu_items[2].extra_data:=PChar(GTK_STOCK_NEW); + menu_items[3].extra_data:=PChar(GTK_STOCK_OPEN); + menu_items[4].extra_data:=PChar(GTK_STOCK_SAVE); + menu_items[5].extra_data:=PChar(GTK_STOCK_SAVE_AS); + menu_items[7].extra_data:=PChar(GTK_STOCK_QUIT); + + gtk_item_factory_create_items (item_factory, high (menu_items), + @menu_items[1], application_window ); + + gtk_table_attach (GTK_TABLE (table), + gtk_item_factory_get_widget (item_factory, '<main>'), + (* X direction *) (* Y direction *) + 0, 1, 0, 1, + GTK_EXPAND or GTK_FILL, 0, + 0, 0); + + (* Create the toolbar + *) + toolbar := gtk_toolbar_new (); + + gtk_toolbar_insert_stock (GTK_TOOLBAR (toolbar), + GTK_STOCK_OPEN, + 'This is a demo button with an ''open'' icon', + NULL, + G_CALLBACK (@toolbar_cb), + application_window , (* user data for callback *) + -1); (* -1 means "append" *) + + gtk_toolbar_insert_stock (GTK_TOOLBAR (toolbar), + GTK_STOCK_QUIT, + 'This is a demo button with a ''quit'' icon', + NULL, + G_CALLBACK (@toolbar_cb), + application_window , (* user data for callback *) + -1); (* -1 means "append" *) + + gtk_toolbar_append_space (GTK_TOOLBAR (toolbar)); + gtk_toolbar_insert_stock (GTK_TOOLBAR (toolbar), + 'demo-gtk-logo', + 'This is a demo button with a ''gtk'' icon', + NULL, + G_CALLBACK (@toolbar_cb), + application_window , (* user data for callback *) + -1); (* -1 means "append" *) + + gtk_table_attach (GTK_TABLE (table), + toolbar, + (* X direction *) (* Y direction *) + 0, 1, 1, 2, + GTK_EXPAND or GTK_FILL, 0, + 0, 0); + + (* Create document + *) + + sw := gtk_scrolled_window_new (NULL, NULL); + + gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw), + GTK_POLICY_AUTOMATIC, + GTK_POLICY_AUTOMATIC); + + gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (sw), + GTK_SHADOW_IN); + + gtk_table_attach (GTK_TABLE (table), + sw, + (* X direction *) (* Y direction *) + 0, 1, 2, 3, + GTK_EXPAND or GTK_FILL, GTK_EXPAND or GTK_FILL, + 0, 0); + + gtk_window_set_default_size (GTK_WINDOW (application_window ), + 200, 200); + + contents := gtk_text_view_new (); + + gtk_container_add (GTK_CONTAINER (sw), + contents); + + (* Create statusbar *) + + statusbar := gtk_statusbar_new (); + gtk_table_attach (GTK_TABLE (table), + statusbar, + (* X direction *) (* Y direction *) + 0, 1, 3, 4, + GTK_EXPAND or GTK_FILL, 0, + 0, 0); + + (* Show text widget info in the statusbar *) + buffer := gtk_text_view_get_buffer (GTK_TEXT_VIEW (contents)); + + g_signal_connect_object (buffer, + 'changed', + G_CALLBACK (@update_statusbar), + statusbar, + 0); + + g_signal_connect_object (buffer, + 'mark_set', (* cursor moved *) + G_CALLBACK (@mark_set_callback), + statusbar, + 0); + + update_statusbar (buffer, GTK_STATUSBAR (statusbar)); + end; + + if not (GTK_WIDGET_VISIBLE (application_window )) then + gtk_widget_show_all (application_window ) + else begin + gtk_widget_destroy (application_window); + application_window := NULL; + end; + + do_appwindow := application_window ; +end; + + diff --git a/packages/gtk2/examples/gtk_demo/button_box.inc b/packages/gtk2/examples/gtk_demo/button_box.inc new file mode 100644 index 0000000000..77a33910ab --- /dev/null +++ b/packages/gtk2/examples/gtk_demo/button_box.inc @@ -0,0 +1,124 @@ +(* Button Boxes + * + * The Button Box widgets are used to arrange buttons with padding. + *) + +function create_bbox (horizontal : gboolean; + title : pgchar; + spacing : gint; + layout : TGtkButtonBoxStyle): PGtkWidget; +var + frame, + bbox, + button : PGtkWidget; + +begin + frame := gtk_frame_new (title); + + if horizontal then + bbox := gtk_hbutton_box_new () + else + bbox := gtk_vbutton_box_new (); + + gtk_container_set_border_width (GTK_CONTAINER (bbox), 5); + gtk_container_add (GTK_CONTAINER (frame), bbox); + + gtk_button_box_set_layout (GTK_BUTTON_BOX (bbox), layout); + gtk_box_set_spacing (GTK_BOX (bbox), spacing); + + button := gtk_button_new_from_stock (GTK_STOCK_OK); + gtk_container_add (GTK_CONTAINER (bbox), button); + + button := gtk_button_new_from_stock (GTK_STOCK_CANCEL); + gtk_container_add (GTK_CONTAINER (bbox), button); + + button := gtk_button_new_from_stock (GTK_STOCK_HELP); + gtk_container_add (GTK_CONTAINER (bbox), button); + + create_bbox := frame; +end; + +var bbox_window : PGtkWidget; + + +function do_button_box : PGtkWidget; +var + main_vbox, + vbox, + hbox, + frame_horz, + frame_vert : PGtkWidget; + +begin + + if bbox_window = NULL then + begin + bbox_window := gtk_window_new (GTK_WINDOW_TOPLEVEL); + gtk_window_set_title (GTK_WINDOW (bbox_window), 'Button Boxes'); + + g_signal_connect (bbox_window, 'destroy', + G_CALLBACK (@gtk_widget_destroyed), + @bbox_window); + + gtk_container_set_border_width (GTK_CONTAINER (bbox_window), 10); + + main_vbox := gtk_vbox_new (FALSE, 0); + gtk_container_add (GTK_CONTAINER (bbox_window), main_vbox); + + frame_horz := gtk_frame_new ('Horizontal Button Boxes'); + gtk_box_pack_start (GTK_BOX (main_vbox), frame_horz, TRUE, TRUE, 10); + + vbox := gtk_vbox_new (FALSE, 0); + gtk_container_set_border_width (GTK_CONTAINER (vbox), 10); + gtk_container_add (GTK_CONTAINER (frame_horz), vbox); + + gtk_box_pack_start (GTK_BOX (vbox), + create_bbox (TRUE, 'Spread', 40, GTK_BUTTONBOX_SPREAD), + TRUE, TRUE, 0); + + gtk_box_pack_start (GTK_BOX (vbox), + create_bbox (TRUE, 'Edge', 40, GTK_BUTTONBOX_EDGE), + TRUE, TRUE, 5); + + gtk_box_pack_start (GTK_BOX (vbox), + create_bbox (TRUE, 'Start', 40, GTK_BUTTONBOX_START), + TRUE, TRUE, 5); + + gtk_box_pack_start (GTK_BOX (vbox), + create_bbox (TRUE, 'End', 40, GTK_BUTTONBOX_END), + TRUE, TRUE, 5); + + frame_vert := gtk_frame_new ('Vertical Button Boxes'); + gtk_box_pack_start (GTK_BOX (main_vbox), frame_vert, TRUE, TRUE, 10); + + hbox := gtk_hbox_new (FALSE, 0); + gtk_container_set_border_width (GTK_CONTAINER (hbox), 10); + gtk_container_add (GTK_CONTAINER (frame_vert), hbox); + + gtk_box_pack_start (GTK_BOX (hbox), + create_bbox (FALSE, 'Spread', 30, GTK_BUTTONBOX_SPREAD), + TRUE, TRUE, 0); + + gtk_box_pack_start (GTK_BOX (hbox), + create_bbox (FALSE, 'Edge', 30, GTK_BUTTONBOX_EDGE), + TRUE, TRUE, 5); + + gtk_box_pack_start (GTK_BOX (hbox), + create_bbox (FALSE, 'Start', 30, GTK_BUTTONBOX_START), + TRUE, TRUE, 5); + + gtk_box_pack_start (GTK_BOX (hbox), + create_bbox (FALSE, 'End', 30, GTK_BUTTONBOX_END), + TRUE, TRUE, 5); + end; + + if not GTK_WIDGET_VISIBLE (bbox_window) then + gtk_widget_show_all (bbox_window) + else + begin + gtk_widget_destroy (bbox_window); + bbox_window := NULL; + end; + + do_button_box := bbox_window; +end; diff --git a/packages/gtk2/examples/gtk_demo/colorsel.inc b/packages/gtk2/examples/gtk_demo/colorsel.inc new file mode 100644 index 0000000000..b9d4331314 --- /dev/null +++ b/packages/gtk2/examples/gtk_demo/colorsel.inc @@ -0,0 +1,108 @@ +(* Color Selector + * + * GtkColorSelection lets the user choose a color. GtkColorSelectionDialog is + * a prebuilt dialog containing a GtkColorSelection. + * + *) + +var + colorsel_window, + colorsel_da, + colorsel_frame : PGtkWidget; + colorsel_color : TGdkColor; + + +procedure change_color_callback (button : PGtkWidget; + data : gpointer); cdecl; +var + dialog : PGtkWidget; + colorsel : PGtkColorSelection; + response : gint; + +begin + dialog := gtk_color_selection_dialog_new ('Changing color'); + + gtk_window_set_transient_for (GTK_WINDOW (dialog), GTK_WINDOW (colorsel_window)); + + colorsel := PGtkColorSelection ( PGtkColorSelectionDialog(dialog)^.colorsel ); + + gtk_color_selection_set_previous_color (colorsel, @colorsel_color); + gtk_color_selection_set_current_color (colorsel, @colorsel_color); + gtk_color_selection_set_has_palette (colorsel, TRUE); + + response := gtk_dialog_run (GTK_DIALOG (dialog)); + + if response = GTK_RESPONSE_OK then + begin + gtk_color_selection_get_current_color (colorsel, @colorsel_color); + + gtk_widget_modify_bg (colorsel_da, GTK_STATE_NORMAL, @colorsel_color); + end; + + gtk_widget_destroy (dialog); +end; + + +function do_colorsel : PGtkWidget; +var + vbox, + button, + alignment : PGtkWidget; + + + begin + if colorsel_window = NULL then + begin + colorsel_color.red := $0; + colorsel_color.blue := $ffff; + colorsel_color.green := $0; + + colorsel_window := gtk_window_new (GTK_WINDOW_TOPLEVEL); + gtk_window_set_title (GTK_WINDOW (colorsel_window), 'Color Selection'); + + g_signal_connect (colorsel_window, 'destroy', + G_CALLBACK (@gtk_widget_destroyed), @colorsel_window); + + gtk_container_set_border_width (GTK_CONTAINER (colorsel_window), 8); + + vbox := gtk_vbox_new (FALSE, 8); + gtk_container_set_border_width (GTK_CONTAINER (vbox), 8); + gtk_container_add (GTK_CONTAINER (colorsel_window), vbox); + + (* + * Create the color swatch area + *) + + + colorsel_frame := gtk_frame_new (NULL); + gtk_frame_set_shadow_type (GTK_FRAME (colorsel_frame), GTK_SHADOW_IN); + gtk_box_pack_start (GTK_BOX (vbox), colorsel_frame, TRUE, TRUE, 0); + + colorsel_da := gtk_drawing_area_new (); + (* set a minimum size *) + gtk_widget_set_size_request (colorsel_da, 200, 200); + (* set the color *) + gtk_widget_modify_bg (colorsel_da, GTK_STATE_NORMAL, @colorsel_color); + + gtk_container_add (GTK_CONTAINER (colorsel_frame), colorsel_da); + + alignment := gtk_alignment_new (1.0, 0.5, 0.0, 0.0); + + button := gtk_button_new_with_mnemonic ('_Change the above color'); + gtk_container_add (GTK_CONTAINER (alignment), button); + + gtk_box_pack_start (GTK_BOX (vbox), alignment, FALSE, FALSE, 0); + + g_signal_connect (button, 'clicked', + G_CALLBACK (@change_color_callback), NULL); + end; + + if not GTK_WIDGET_VISIBLE (colorsel_window) then + gtk_widget_show_all (colorsel_window) + else begin + gtk_widget_destroy (colorsel_window); + colorsel_window := NULL; + end; + + do_colorsel := colorsel_window; +end; diff --git a/packages/gtk2/examples/gtk_demo/data/alphatest.png b/packages/gtk2/examples/gtk_demo/data/alphatest.png Binary files differnew file mode 100644 index 0000000000..eb5885f89c --- /dev/null +++ b/packages/gtk2/examples/gtk_demo/data/alphatest.png diff --git a/packages/gtk2/examples/gtk_demo/data/apple-red.png b/packages/gtk2/examples/gtk_demo/data/apple-red.png Binary files differnew file mode 100644 index 0000000000..b0a24e9418 --- /dev/null +++ b/packages/gtk2/examples/gtk_demo/data/apple-red.png diff --git a/packages/gtk2/examples/gtk_demo/data/background.jpg b/packages/gtk2/examples/gtk_demo/data/background.jpg Binary files differnew file mode 100644 index 0000000000..86c006aa46 --- /dev/null +++ b/packages/gtk2/examples/gtk_demo/data/background.jpg diff --git a/packages/gtk2/examples/gtk_demo/data/floppybuddy.gif b/packages/gtk2/examples/gtk_demo/data/floppybuddy.gif Binary files differnew file mode 100644 index 0000000000..ac986c8ed3 --- /dev/null +++ b/packages/gtk2/examples/gtk_demo/data/floppybuddy.gif diff --git a/packages/gtk2/examples/gtk_demo/data/gnome-applets.png b/packages/gtk2/examples/gtk_demo/data/gnome-applets.png Binary files differnew file mode 100644 index 0000000000..8d3549e97c --- /dev/null +++ b/packages/gtk2/examples/gtk_demo/data/gnome-applets.png diff --git a/packages/gtk2/examples/gtk_demo/data/gnome-calendar.png b/packages/gtk2/examples/gtk_demo/data/gnome-calendar.png Binary files differnew file mode 100644 index 0000000000..889f329ae5 --- /dev/null +++ b/packages/gtk2/examples/gtk_demo/data/gnome-calendar.png diff --git a/packages/gtk2/examples/gtk_demo/data/gnome-foot.png b/packages/gtk2/examples/gtk_demo/data/gnome-foot.png Binary files differnew file mode 100644 index 0000000000..0476658517 --- /dev/null +++ b/packages/gtk2/examples/gtk_demo/data/gnome-foot.png diff --git a/packages/gtk2/examples/gtk_demo/data/gnome-gimp.png b/packages/gtk2/examples/gtk_demo/data/gnome-gimp.png Binary files differnew file mode 100644 index 0000000000..f6bbc6d36c --- /dev/null +++ b/packages/gtk2/examples/gtk_demo/data/gnome-gimp.png diff --git a/packages/gtk2/examples/gtk_demo/data/gnome-gmush.png b/packages/gtk2/examples/gtk_demo/data/gnome-gmush.png Binary files differnew file mode 100644 index 0000000000..0a4b0d04e6 --- /dev/null +++ b/packages/gtk2/examples/gtk_demo/data/gnome-gmush.png diff --git a/packages/gtk2/examples/gtk_demo/data/gnome-gsame.png b/packages/gtk2/examples/gtk_demo/data/gnome-gsame.png Binary files differnew file mode 100644 index 0000000000..01c061151f --- /dev/null +++ b/packages/gtk2/examples/gtk_demo/data/gnome-gsame.png diff --git a/packages/gtk2/examples/gtk_demo/data/gnu-keys.png b/packages/gtk2/examples/gtk_demo/data/gnu-keys.png Binary files differnew file mode 100644 index 0000000000..58a33770e6 --- /dev/null +++ b/packages/gtk2/examples/gtk_demo/data/gnu-keys.png diff --git a/packages/gtk2/examples/gtk_demo/data/gtk-logo-rgb.gif b/packages/gtk2/examples/gtk_demo/data/gtk-logo-rgb.gif Binary files differnew file mode 100644 index 0000000000..63c622b93c --- /dev/null +++ b/packages/gtk2/examples/gtk_demo/data/gtk-logo-rgb.gif diff --git a/packages/gtk2/examples/gtk_demo/dialog.inc b/packages/gtk2/examples/gtk_demo/dialog.inc new file mode 100644 index 0000000000..9ae17b0779 --- /dev/null +++ b/packages/gtk2/examples/gtk_demo/dialog.inc @@ -0,0 +1,189 @@ +(* Dialog and Message Boxes + * + * Dialog widgets are used to pop up a transient window for user feedback. + *) + + + + +var + dialog_entry1, + dialog_entry2, + dialog_window : PGtkWidget; + dialog_i : gint; + +procedure message_dialog_clicked (button : PGtkButton; + user_data : gpointer); +var + dialog : PGtkWidget; + +begin + dialog := gtk_message_dialog_new (GTK_WINDOW (dialog_window), + GTK_DIALOG_MODAL or GTK_DIALOG_DESTROY_WITH_PARENT, + GTK_MESSAGE_INFO, + GTK_BUTTONS_OK, + 'This message box has been popped up the following'#13#10+ + 'number of times:'#13#10#13#10+ + '%d', [dialog_i]); + + gtk_dialog_run (GTK_DIALOG (dialog)); + gtk_widget_destroy (dialog); + inc(dialog_i); +end; + +procedure interactive_dialog_clicked ( button : PGtkButton; + user_data : gpointer); +var + dialog, + hbox, + stock, + table, + local_entry1, + local_entry2, + thelabel : PGtkWidget; + response : gint; + +begin + + dialog := gtk_dialog_new_with_buttons ('Interactive Dialog', + GTK_WINDOW (dialog_window), + GTK_DIALOG_MODAL or + GTK_DIALOG_DESTROY_WITH_PARENT, + GTK_STOCK_OK, + [ GTK_RESPONSE_OK, + '_Non-stock Button', + GTK_RESPONSE_CANCEL, + NULL]); + + hbox := gtk_hbox_new (FALSE, 8); + gtk_container_set_border_width (GTK_CONTAINER (hbox), 8); + gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)^.vbox), hbox, FALSE, FALSE, 0); + + stock := gtk_image_new_from_stock (GTK_STOCK_DIALOG_QUESTION, GTK_ICON_SIZE_DIALOG); + gtk_box_pack_start (GTK_BOX (hbox), stock, FALSE, FALSE, 0); + + table := gtk_table_new (2, 2, FALSE); + gtk_table_set_row_spacings (GTK_TABLE (table), 4); + gtk_table_set_col_spacings (GTK_TABLE (table), 4); + gtk_box_pack_start (GTK_BOX (hbox), table, TRUE, TRUE, 0); + thelabel := gtk_label_new_with_mnemonic ('_Entry 1'); + gtk_table_attach_defaults (GTK_TABLE (table), + thelabel, + 0, 1, 0, 1); + local_entry1 := gtk_entry_new (); + gtk_entry_set_text (GTK_ENTRY (local_entry1), gtk_entry_get_text (GTK_ENTRY (dialog_entry1))); + gtk_table_attach_defaults (GTK_TABLE (table), local_entry1, 1, 2, 0, 1); + gtk_label_set_mnemonic_widget (GTK_LABEL (thelabel), local_entry1); + + thelabel := gtk_label_new_with_mnemonic ('E_ntry 2'); + gtk_table_attach_defaults (GTK_TABLE (table), + thelabel, + 0, 1, 1, 2); + + local_entry2 := gtk_entry_new (); + gtk_entry_set_text (GTK_ENTRY (local_entry2), gtk_entry_get_text (GTK_ENTRY (dialog_entry2))); + gtk_table_attach_defaults (GTK_TABLE (table), local_entry2, 1, 2, 1, 2); + gtk_label_set_mnemonic_widget (GTK_LABEL (thelabel), local_entry2); + + gtk_widget_show_all (hbox); + response := gtk_dialog_run (GTK_DIALOG (dialog)); + + if response = GTK_RESPONSE_OK then + begin + gtk_entry_set_text (GTK_ENTRY (dialog_entry1), gtk_entry_get_text (GTK_ENTRY (local_entry1))); + gtk_entry_set_text (GTK_ENTRY (dialog_entry2), gtk_entry_get_text (GTK_ENTRY (local_entry2))); + end; + + gtk_widget_destroy (dialog); +end; + + +function do_dialog : PGtkWidget; + +var + frame, + vbox, + vbox2, + hbox, + button, + table, + thelabel : PGtkWidget; + +begin + dialog_i := 1; + + if dialog_window = NULL then + begin + dialog_window := gtk_window_new (GTK_WINDOW_TOPLEVEL); + gtk_window_set_title (GTK_WINDOW (dialog_window), 'Dialogs'); + + g_signal_connect (dialog_window, 'destroy', G_CALLBACK (@gtk_widget_destroyed), @dialog_window); + gtk_container_set_border_width (GTK_CONTAINER (dialog_window), 8); + + frame := gtk_frame_new ('Dialogs'); + gtk_container_add (GTK_CONTAINER (dialog_window), frame); + + vbox := gtk_vbox_new (FALSE, 8); + gtk_container_set_border_width (GTK_CONTAINER (vbox), 8); + gtk_container_add (GTK_CONTAINER (frame), vbox); + + (* Standard message dialog *) + hbox := gtk_hbox_new (FALSE, 8); + gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0); + + button := gtk_button_new_with_mnemonic ('_Message Dialog'); + g_signal_connect (button, 'clicked', + G_CALLBACK (@message_dialog_clicked), @dialog_window); + + gtk_box_pack_start (GTK_BOX (hbox), button, FALSE, FALSE, 0); + + gtk_box_pack_start (GTK_BOX (vbox), gtk_hseparator_new (), FALSE, FALSE, 0); + + (* Interactive dialog*) + hbox := gtk_hbox_new (FALSE, 8); + gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0); + vbox2 := gtk_vbox_new (FALSE, 0); + + button := gtk_button_new_with_mnemonic ('_Interactive Dialog'); + g_signal_connect (button, 'clicked', + G_CALLBACK (@interactive_dialog_clicked), @dialog_window); + gtk_box_pack_start (GTK_BOX (hbox), vbox2, FALSE, FALSE, 0); + gtk_box_pack_start (GTK_BOX (vbox2), button, FALSE, FALSE, 0); + + table := gtk_table_new (2, 2, FALSE); + gtk_table_set_row_spacings (GTK_TABLE (table), 4); + gtk_table_set_col_spacings (GTK_TABLE (table), 4); + gtk_box_pack_start (GTK_BOX (hbox), table, FALSE, FALSE, 0); + + thelabel := gtk_label_new_with_mnemonic ('_Entry 1'); + gtk_table_attach_defaults (GTK_TABLE (table), + thelabel, + 0, 1, 0, 1); + + dialog_entry1 := gtk_entry_new (); + gtk_table_attach_defaults (GTK_TABLE (table), dialog_entry1, 1, 2, 0, 1); + gtk_label_set_mnemonic_widget (GTK_LABEL (thelabel), dialog_entry1); + + thelabel := gtk_label_new_with_mnemonic ('E_ntry 2'); + + gtk_table_attach_defaults (GTK_TABLE (table), + thelabel, + 0, 1, 1, 2); + + dialog_entry2 := gtk_entry_new (); + gtk_table_attach_defaults (GTK_TABLE (table), dialog_entry2, 1, 2, 1, 2); + gtk_label_set_mnemonic_widget (GTK_LABEL (thelabel), dialog_entry2); + end; + + if not GTK_WIDGET_VISIBLE (dialog_window) then + gtk_widget_show_all (dialog_window) + + else begin + gtk_widget_destroy (dialog_window); + dialog_window := NULL; + end; + + do_dialog := dialog_window; +end; + + diff --git a/packages/gtk2/examples/gtk_demo/drawingarea.inc b/packages/gtk2/examples/gtk_demo/drawingarea.inc new file mode 100644 index 0000000000..8fc06b14d4 --- /dev/null +++ b/packages/gtk2/examples/gtk_demo/drawingarea.inc @@ -0,0 +1,320 @@ +(* Drawing Area + * + * GtkDrawingArea is a blank area where you can draw custom displays + * of various kinds. + * + * This demo has two drawing areas. The checkerboard area shows + * how you can just draw something; all you have to do is write + * a signal handler for expose_event, as shown here. + * + * The "scribble" area is a bit more advanced, and shows how to handle + * events such as button presses and mouse motion. Click the mouse + * and drag in the scribble area to draw squiggles. Resize the window + * to clear the area. + *) + + +var + da_window : PGtkWidget; + +(* Pixmap for scribble area, to store current scribbles *) + da_pixmap : PGdkPixmap; + +(* Create a new pixmap of the appropriate size to store our scribbles *) + +function scribble_configure_event (widget : PGtkWidget; + event : PGdkEventConfigure; + data : gpointer): gboolean; cdecl; + +begin + if da_pixmap <> NULL then + g_object_unref (G_OBJECT (da_pixmap)); + + da_pixmap := gdk_pixmap_new (widget^.window, + widget^.allocation.width, + widget^.allocation.height, + -1); + + (* Initialize the pixmap to white *) + gdk_draw_rectangle (da_pixmap, + widget^.style^.white_gc, + gTRUE, + 0, 0, + widget^.allocation.width, + widget^.allocation.height); + + (* We've handled the configure event, no need for further processing. *) + scribble_configure_event := TRUE; + +end; + +(* Redraw the screen from the pixmap *) +function scribble_expose_event (widget : PGtkWidget; + event : PGdkEventExpose; + data : gpointer): gboolean; cdecl; + +begin + (* We use the "foreground GC" for the widget since it already exists, + * but honestly any GC would work. The only thing to worry about + * is whether the GC has an inappropriate clip region set. + *) + + gdk_draw_drawable (widget^.window, + widget^.style^.fg_gc[GTK_WIDGET_STATE (widget)], + da_pixmap, + (* Only copy the area that was exposed. *) + event^.area.x, event^.area.y, + event^.area.x, event^.area.y, + event^.area.width, event^.area.height); + + scribble_expose_event := FALSE; +end; + +(* Draw a rectangle on the screen *) +procedure draw_brush (widget : PGtkWidget; + x, y : gdouble); +var + update_rect : TGdkRectangle; + +begin + update_rect.x := round (x - 3); + update_rect.y := round (y - 3); + update_rect.width := 6; + update_rect.height := 6; + + (* Paint to the pixmap, where we store our state *) + gdk_draw_rectangle (da_pixmap, + widget^.style^.black_gc, + gTRUE, + update_rect.x, update_rect.y, + update_rect.width, update_rect.height); + + (* Now invalidate the affected region of the drawing area. *) + gdk_window_invalidate_rect (widget^.window, + @update_rect, + FALSE); +end; + +function scribble_button_press_event (widget : PGtkWidget; + event : PGdkEventButton; + data : gpointer): gboolean; cdecl; +begin + if da_pixmap = NULL then + exit (FALSE); (* paranoia check, in case we haven't gotten a configure event *) + + if event^.button = 1 then + draw_brush (widget, event^.x, event^.y); + + (* We've handled the event, stop processing *) + exit (TRUE); +end; + +function scribble_motion_notify_event (widget : PGtkWidget; + event : PGdkEventButton; + data : gpointer): gboolean; cdecl; +var + x, y : gint; + state : TGdkModifierType; + +begin + if da_pixmap = NULL then + exit (FALSE); (* paranoia check, in case we haven't gotten a configure event *) + + (* This call is very important; it requests the next motion event. + * If you don't call gdk_window_get_pointer() you'll only get + * a single motion event. The reason is that we specified + * GDK_POINTER_MOTION_HINT_MASK to gtk_widget_set_events(). + * If we hadn't specified that, we could just use event->x, event->y + * as the pointer location. But we'd also get deluged in events. + * By requesting the next event as we handle the current one, + * we avoid getting a huge number of events faster than we + * can cope. + *) + + gdk_window_get_pointer (event^.window, @x, @y, @state); + + if (state and GDK_BUTTON1_MASK) <> 0 then + draw_brush (widget, x, y); + + (* We've handled it, stop processing *) + exit (TRUE); +end; + + +const + CHECK_SIZE = 10; + SPACING = 2; + +function checkerboard_expose (da : PGtkWidget; + event : PGdkEventButton; + data : gpointer): gboolean; cdecl; +var + i, j, + xcount, ycount : gint; + gc1, gc2, gc : PGdkGc; + color : TGdkColor; + +begin + (* At the start of an expose handler, a clip region of event->area + * is set on the window, and event->area has been cleared to the + * widget's background color. The docs for + * gdk_window_begin_paint_region() give more details on how this + * works. + *) + + (* It would be a bit more efficient to keep these + * GC's around instead of recreating on each expose, but + * this is the lazy/slow way. + *) + gc1 := gdk_gc_new (da^.window); + color.red := $7530; + color.green := $0; + color.blue := $7530; + + gdk_gc_set_rgb_fg_color (gc1, @color); + + gc2 := gdk_gc_new (da^.window); + color.red := $ffff; + color.green := $ffff; + color.blue := $ffff; + + gdk_gc_set_rgb_fg_color (gc2, @color); + + xcount := 0; + i := SPACING; + while i < da^.allocation.width do + begin + j := SPACING; + ycount := xcount mod 2; (* start with even/odd depending on row *) + while j < da^.allocation.height do + begin + if (ycount mod 2) <> 0 then + gc := gc1 + else + gc := gc2; + + (* If we're outside event->area, this will do nothing. + * It might be mildly more efficient if we handled + * the clipping ourselves, but again we're feeling lazy. + *) + gdk_draw_rectangle (da^.window, + gc, + gTRUE, + i, j, + CHECK_SIZE, + CHECK_SIZE); + + j := j + CHECK_SIZE + SPACING; + inc (ycount); + end; + + i := i + CHECK_SIZE + SPACING; + inc (xcount); + end; + + g_object_unref (G_OBJECT (gc1)); + g_object_unref (G_OBJECT (gc2)); + + (* return TRUE because we've handled this event, so no + * further processing is required. + *) + checkerboard_expose := TRUE; +end; + +function do_drawingarea : PGtkWidget; +var + frame, + vbox, + da, + thelabel : PGtkWidget; + +begin + if da_window = NULL then + begin + da_window := gtk_window_new (GTK_WINDOW_TOPLEVEL); + gtk_window_set_title (GTK_WINDOW (da_window), 'Drawing Area'); + + g_signal_connect (da_window, 'destroy', G_CALLBACK (@gtk_widget_destroyed), @da_window); + + gtk_container_set_border_width (GTK_CONTAINER (da_window), 8); + + vbox := gtk_vbox_new (FALSE, 8); + gtk_container_set_border_width (GTK_CONTAINER (vbox), 8); + gtk_container_add (GTK_CONTAINER (da_window), vbox); + + (* + * Create the checkerboard area + *) + + thelabel := gtk_label_new (NULL); + gtk_label_set_markup (GTK_LABEL (thelabel), + '<u>Checkerboard pattern</u>'); + gtk_box_pack_start (GTK_BOX (vbox), thelabel, FALSE, FALSE, 0); + + frame := gtk_frame_new (NULL); + gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_IN); + gtk_box_pack_start (GTK_BOX (vbox), frame, TRUE, TRUE, 0); + + da := gtk_drawing_area_new (); + (* set a minimum size *) + gtk_widget_set_size_request (da, 100, 100); + + gtk_container_add (GTK_CONTAINER (frame), da); + + g_signal_connect (da, 'expose_event', + G_CALLBACK (@checkerboard_expose), NULL); + + (* + * Create the scribble area + *) + + thelabel := gtk_label_new (NULL); + gtk_label_set_markup (GTK_LABEL (thelabel), + '<u>Scribble area</u>'); + gtk_box_pack_start (GTK_BOX (vbox), thelabel, FALSE, FALSE, 0); + + frame := gtk_frame_new (NULL); + gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_IN); + gtk_box_pack_start (GTK_BOX (vbox), frame, TRUE, TRUE, 0); + + da := gtk_drawing_area_new (); + (* set a minimum size *) + gtk_widget_set_size_request (da, 100, 100); + + gtk_container_add (GTK_CONTAINER (frame), da); + + (* Signals used to handle backing pixmap *) + + g_signal_connect (da, 'expose_event', + G_CALLBACK (@scribble_expose_event), NULL); + g_signal_connect (da,'configure_event', + G_CALLBACK (@scribble_configure_event), NULL); + + (* Event signals *) + + g_signal_connect (da, 'motion_notify_event', + G_CALLBACK (@scribble_motion_notify_event), NULL); + g_signal_connect (da, 'button_press_event', + G_CALLBACK (@scribble_button_press_event), NULL); + + + (* Ask to receive events the drawing area doesn't normally + * subscribe to + *) + gtk_widget_set_events (da, gtk_widget_get_events (da) + or GDK_LEAVE_NOTIFY_MASK + or GDK_BUTTON_PRESS_MASK + or GDK_POINTER_MOTION_MASK + or GDK_POINTER_MOTION_HINT_MASK); + + end; + + if not GTK_WIDGET_VISIBLE (da_window) then + gtk_widget_show_all (da_window) + else begin + gtk_widget_destroy (da_window); + da_window := NULL; + end; + + do_drawingarea := da_window; +end; diff --git a/packages/gtk2/examples/gtk_demo/editable_cells.inc b/packages/gtk2/examples/gtk_demo/editable_cells.inc new file mode 100644 index 0000000000..9ef26258e4 --- /dev/null +++ b/packages/gtk2/examples/gtk_demo/editable_cells.inc @@ -0,0 +1,314 @@ +(* Tree View/Editable Cells + * + * This demo demonstrates the use of editable cells in a GtkTreeView. If + * you're new to the GtkTreeView widgets and associates, look into + * the GtkListStore example first. + * + *) + + (* + * todo: translate to pascal + *) + +function do_editable_cells : PGtkWidget; +begin + do_dummy ('Tree View / Editable Cells - Demo'); + do_editable_cells := NULL; +end; + + +(* +#include <gtk/gtk.h> +#include <string.h> +#include <stdlib.h> + +static GtkWidget *window = NULL; + +typedef struct +{ + gint number; + gchar *product; + gboolean editable; +} +Item; + +enum +{ + COLUMN_NUMBER, + COLUMN_PRODUCT, + COLUMN_EDITABLE, + NUM_COLUMNS +}; + +static GArray *articles = NULL; + +static void +add_items (void) +{ + Item foo; + + g_return_if_fail (articles != NULL); + + foo.number = 3; + foo.product = g_strdup ("bottles of coke"); + foo.editable = TRUE; + g_array_append_vals (articles, &foo, 1); + + foo.number = 5; + foo.product = g_strdup ("packages of noodles"); + foo.editable = TRUE; + g_array_append_vals (articles, &foo, 1); + + foo.number = 2; + foo.product = g_strdup ("packages of chocolate chip cookies"); + foo.editable = TRUE; + g_array_append_vals (articles, &foo, 1); + + foo.number = 1; + foo.product = g_strdup ("can vanilla ice cream"); + foo.editable = TRUE; + g_array_append_vals (articles, &foo, 1); + + foo.number = 6; + foo.product = g_strdup ("eggs"); + foo.editable = TRUE; + g_array_append_vals (articles, &foo, 1); +} + +static GtkTreeModel * +create_model (void) +{ + gint i = 0; + GtkListStore *model; + GtkTreeIter iter; + + /* create array */ + articles = g_array_sized_new (FALSE, FALSE, sizeof (Item), 1); + + add_items (); + + /* create list store */ + model = gtk_list_store_new (NUM_COLUMNS, G_TYPE_INT, G_TYPE_STRING, + G_TYPE_BOOLEAN); + + /* add items */ + for (i = 0; i < articles->len; i++) + { + gtk_list_store_append (model, &iter); + + gtk_list_store_set (model, &iter, + COLUMN_NUMBER, + g_array_index (articles, Item, i).number, + COLUMN_PRODUCT, + g_array_index (articles, Item, i).product, + COLUMN_EDITABLE, + g_array_index (articles, Item, i).editable, + -1); + } + + return GTK_TREE_MODEL (model); +} + +static void +add_item (GtkWidget *button, gpointer data) +{ + Item foo; + GtkTreeIter iter; + GtkTreeModel *model = (GtkTreeModel * )data; + + g_return_if_fail (articles != NULL); + + foo.number = 0; + foo.product = g_strdup ("Description here"); + foo.editable = TRUE; + g_array_append_vals (articles, &foo, 1); + + gtk_list_store_append (GTK_LIST_STORE (model), &iter); + gtk_list_store_set (GTK_LIST_STORE (model), &iter, + COLUMN_NUMBER, foo.number, + COLUMN_PRODUCT, foo.product, + COLUMN_EDITABLE, foo.editable, + -1); +} + +static void +remove_item (GtkWidget *widget, gpointer data) +{ + GtkTreeIter iter; + GtkTreeView *treeview = (GtkTreeView * )data; + GtkTreeModel *model = gtk_tree_view_get_model (treeview); + GtkTreeSelection *selection = gtk_tree_view_get_selection (treeview); + + if (gtk_tree_selection_get_selected (selection, NULL, &iter)) + { + gint i; + GtkTreePath *path; + + path = gtk_tree_model_get_path (model, &iter); + i = gtk_tree_path_get_indices (path)[0]; + gtk_list_store_remove (GTK_LIST_STORE (model), &iter); + + g_array_remove_index (articles, i); + + gtk_tree_path_free (path); + } +} + +static void +cell_edited (GtkCellRendererText *cell, + const gchar *path_string, + const gchar *new_text, + gpointer data) +{ + GtkTreeModel *model = (GtkTreeModel * )data; + GtkTreePath *path = gtk_tree_path_new_from_string (path_string); + GtkTreeIter iter; + + gint *column; + + column = g_object_get_data (G_OBJECT (cell), "column"); + + gtk_tree_model_get_iter (model, &iter, path); + + switch (GPOINTER_TO_INT (column)) + { + case COLUMN_NUMBER: + { + gint i; + + i = gtk_tree_path_get_indices (path)[0]; + g_array_index (articles, Item, i).number = atoi (new_text); + + gtk_list_store_set (GTK_LIST_STORE (model), &iter, column, + g_array_index (articles, Item, i).number, -1); + } + break; + + case COLUMN_PRODUCT: + { + gint i; + gchar *old_text; + + gtk_tree_model_get (model, &iter, column, &old_text, -1); + g_free (old_text); + + i = gtk_tree_path_get_indices (path)[0]; + g_free (g_array_index (articles, Item, i).product); + g_array_index (articles, Item, i).product = g_strdup (new_text); + + gtk_list_store_set (GTK_LIST_STORE (model), &iter, column, + g_array_index (articles, Item, i).product, -1); + } + break; + } + + gtk_tree_path_free (path); +} + +static void +add_columns (GtkTreeView *treeview) +{ + GtkCellRenderer *renderer; + GtkTreeModel *model = gtk_tree_view_get_model (treeview); + + /* number column */ + renderer = gtk_cell_renderer_text_new (); + g_signal_connect (G_OBJECT (renderer), "edited", + G_CALLBACK (cell_edited), model); + g_object_set_data (G_OBJECT (renderer), "column", (gint * )COLUMN_NUMBER); + + gtk_tree_view_insert_column_with_attributes (GTK_TREE_VIEW (treeview), + -1, "Number", renderer, + "text", COLUMN_NUMBER, + "editable", COLUMN_EDITABLE, + NULL); + + /* product column */ + renderer = gtk_cell_renderer_text_new (); + g_signal_connect (G_OBJECT (renderer), "edited", + G_CALLBACK (cell_edited), model); + g_object_set_data (G_OBJECT (renderer), "column", (gint * )COLUMN_PRODUCT); + + gtk_tree_view_insert_column_with_attributes (GTK_TREE_VIEW (treeview), + -1, "Product", renderer, + "text", COLUMN_PRODUCT, + "editable", COLUMN_EDITABLE, + NULL); +} + +GtkWidget * +do_editable_cells (void) +{ + if (!window) + { + GtkWidget *vbox; + GtkWidget *hbox; + GtkWidget *sw; + GtkWidget *treeview; + GtkWidget *button; + GtkTreeModel *model; + + /* create window, etc */ + window = gtk_window_new (GTK_WINDOW_TOPLEVEL); + gtk_window_set_title (GTK_WINDOW (window), "Shopping list"); + gtk_container_set_border_width (GTK_CONTAINER (window), 5); + g_signal_connect (G_OBJECT (window), "destroy", + G_CALLBACK (gtk_widget_destroyed), &window); + + vbox = gtk_vbox_new (FALSE, 5); + gtk_container_add (GTK_CONTAINER (window), vbox); + + gtk_box_pack_start (GTK_BOX (vbox), + gtk_label_new ("Shopping list (you can edit the cells!)"), + FALSE, FALSE, 0); + + sw = gtk_scrolled_window_new (NULL, NULL); + gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (sw), + GTK_SHADOW_ETCHED_IN); + gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw), + GTK_POLICY_AUTOMATIC, + GTK_POLICY_AUTOMATIC); + gtk_box_pack_start (GTK_BOX (vbox), sw, TRUE, TRUE, 0); + + /* create model */ + model = create_model (); + + /* create tree view */ + treeview = gtk_tree_view_new_with_model (model); + g_object_unref (G_OBJECT (model)); + gtk_tree_view_set_rules_hint (GTK_TREE_VIEW (treeview), TRUE); + gtk_tree_selection_set_mode (gtk_tree_view_get_selection (GTK_TREE_VIEW (treeview)), + GTK_SELECTION_SINGLE); + + add_columns (GTK_TREE_VIEW (treeview)); + + gtk_container_add (GTK_CONTAINER (sw), treeview); + + /* some buttons */ + hbox = gtk_hbox_new (TRUE, 4); + gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0); + + button = gtk_button_new_with_label ("Add item"); + g_signal_connect (G_OBJECT (button), "clicked", + G_CALLBACK (add_item), model); + gtk_box_pack_start (GTK_BOX (hbox), button, TRUE, TRUE, 0); + + button = gtk_button_new_with_label ("Remove item"); + g_signal_connect (G_OBJECT (button), "clicked", + G_CALLBACK (remove_item), treeview); + gtk_box_pack_start (GTK_BOX (hbox), button, TRUE, TRUE, 0); + + gtk_window_set_default_size (GTK_WINDOW (window), 320, 200); + } + + if (!GTK_WIDGET_VISIBLE (window)) + gtk_widget_show_all (window); + else + { + gtk_widget_destroy (window); + window = NULL; + } + + return window; +} +*) diff --git a/packages/gtk2/examples/gtk_demo/gtk_demo.pas b/packages/gtk2/examples/gtk_demo/gtk_demo.pas new file mode 100644 index 0000000000..d956180b57 --- /dev/null +++ b/packages/gtk2/examples/gtk_demo/gtk_demo.pas @@ -0,0 +1,1090 @@ +(* GTK Demo for Pascal + * + * Welcome to GTK Demo for Pascal. + * + * + * This demo is an adaption of the GTK Demo included in the GTK+-2.0 source. + * A new feature is syntax highligting for pascal. + *) + +program gtk_demo; + +{$mode objfpc} {$H+} +uses glib2, pango, gdk2, gtk2, gdk2pixbuf, strings, math; + +var + info_buffer : PGtkTextBuffer; + source_buffer : PGtkTextBuffer; + current_file : pgchar; + + + +type + TFileOfChar = file of char; + + TGDoDemoFunc = function : PGtkWidget; + + PDemo = ^TDemo; + TDemo = record + title : pgchar; + filename : pgchar; + func : TGDoDemoFunc; + children : PDemo; + end; + + PCallbackData = ^TCallbackData; + TCallbackData = record + model : PGtkTreeModel; + path : PGtkTreePath; + end; + +const + + DEMO_DATA_DIR = 'data'; + + TITLE_COLUMN = 0; + FILENAME_COLUMN = 1; + FUNC_COLUMN = 2; + ITALIC_COLUMN = 3; + NUM_COLUMNS = 4; + + STATE_NORMAL = 0; + STATE_IN_COMMENT = 1; + + function demo_find_file ( base : pchar; err : PPGError): pgchar; forward; + + (* file_is_valid + * a dirty little hack to find out if a file variable is assigned and the + * file is opened. + *) + function file_is_valid (var f: file): boolean; + begin + {$I-} + if eof(f) then + exit (TRUE); + {$I+} + if IOResult <> 0 then + file_is_valid := FALSE + else + file_is_valid := TRUE; + end; + + (* min, max + * these two functions of the math unit are overloaded to understand double + * values. + *) + function min (d1, d2: double): double; + begin + if d1 > d2 then min := d2 + else min := d1; + end; + + function max (d1, d2: double): double; + begin + if d1 < d2 then max := d2 + else max := d1; + end; + + (* do_dummy + * creates a widget informing the user that the demo isn't implemented, yet + *) + + procedure do_dummy (demo : pgchar); + var + dialog : PGtkWidget; + begin + dialog := gtk_message_dialog_new (NULL, 0, + GTK_MESSAGE_INFO, + GTK_BUTTONS_CLOSE, + 'Sorry, "%s" is''t implemented, yet.', + [demo]); + + gtk_widget_show (dialog); + + g_signal_connect (dialog, 'response', + G_CALLBACK (@gtk_widget_destroy), NULL); + end; + + (* include the modules here; + * if you'd like to add one add the include command and + * create a new entry in the testgtk_demos array + *) + + {$include appwindow.inc} + {$include button_box.inc} + {$include colorsel.inc} + {$include dialog.inc} + {$include drawingarea.inc} + {$include editable_cells.inc} + {$include images.inc} + {$include item_factory.inc} + {$include list_store.inc} + {$include menus.inc} + {$include panes.inc} + {$include pixbufs.inc} + {$include sizegroup.inc} + {$include stock_browser.inc} + {$include textview.inc} + {$include tree_store.inc} + + +const + child0 : array [1..4] of TDemo = ( + (title: 'Editable Cells'; filename: 'editable_cells.inc'; func: @do_editable_cells; children: nil), + (title: 'List Store'; filename: 'list_store.inc'; func: @do_list_store; children: nil), + (title: 'Tree Store'; filename: 'tree_store.inc'; func: @do_tree_store; children: nil), + (title: nil; filename: nil; func: nil; children: nil)); + + testgtk_demos: array [1..16] of TDemo = ( + (title: '* This Application *'; filename: 'gtk_demo.pas'; func: nil; children: nil), + (title: 'Application main window'; filename: 'appwindow.inc'; func: @do_appwindow; children: nil), + (title: 'Button Boxes'; filename: 'button_box.inc'; func: @do_button_box; children: nil), + (title: 'Color Selector'; filename: 'colorsel.inc'; func: @do_colorsel; children: nil), + (title: 'Dialog and Message Boxes'; filename: 'dialog.inc'; func: @do_dialog; children: nil), + (title: 'Drawing Area'; filename: 'drawingarea.inc'; func: @do_drawingarea; children: nil), + (title: 'Images'; filename: 'images.inc'; func: @do_images; children: nil), + (title: 'Item Factory'; filename: 'item_factory.inc'; func: @do_item_factory; children: nil), + (title: 'Menus'; filename: 'menus.inc'; func: @do_menus; children: nil), + (title: 'Paned Widgets'; filename: 'panes.inc'; func: @do_panes; children: nil), + (title: 'Pixbufs'; filename: 'pixbufs.inc'; func: @do_pixbufs; children: nil), + (title: 'Size Groups'; filename: 'sizegroup.inc'; func: @do_sizegroup; children: nil), + (title: 'Stock Item and Icon Browser'; filename: 'stock_browser.inc'; func: @do_stock_browser; children: nil), + (title: 'Text Widget'; filename: 'textview.inc'; func: @do_textview; children: nil), + (title: 'Tree View'; filename: nil; func: nil; children: @child0), + (title: nil; filename: nil; func: nil; children: nil)); + + +function demo_find_file ( base : pchar; + err : PPGError): pgchar; +var + filename : pchar; + +begin + + if g_file_test (base, G_FILE_TEST_EXISTS) then begin + demo_find_file := g_strdup (base); + exit; + end else + begin + filename := g_build_filename (DEMO_DATA_DIR, [ base, NULL ]); + + if not (g_file_test (filename, G_FILE_TEST_EXISTS)) then + begin + g_set_error (err, G_FILE_ERROR, G_FILE_ERROR_NOENT, + 'Cannot find demo data file "%s"', [base]); + g_free (filename); + demo_find_file := NULL; + end else + demo_find_file := filename; + end; +end; + + +function create_text (var buffer : PGtkTextBuffer; + is_source : gboolean): PGtkWidget; +var + scrolled_window, + text_view : PGtkWidget; + + font_desc : PPangoFontDescription; + +begin + scrolled_window := gtk_scrolled_window_new (NULL, NULL); + + gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled_window), + GTK_POLICY_AUTOMATIC, + GTK_POLICY_AUTOMATIC); + + gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (scrolled_window), + GTK_SHADOW_IN); + + text_view := gtk_text_view_new; + + buffer := gtk_text_buffer_new (NULL); + + gtk_text_view_set_buffer (GTK_TEXT_VIEW (text_view), buffer); + gtk_text_view_set_editable (GTK_TEXT_VIEW (text_view), FALSE); + gtk_text_view_set_cursor_visible (GTK_TEXT_VIEW (text_view), FALSE); + + gtk_container_add (GTK_CONTAINER (scrolled_window), text_view); + + if is_source then + begin + font_desc := pango_font_description_from_string ('Courier 12'); + gtk_widget_modify_font (text_view, font_desc); + pango_font_description_free (font_desc); + + gtk_text_view_set_wrap_mode (GTK_TEXT_VIEW (text_view), + GTK_WRAP_NONE); + end else + begin + (* Make it a bit nicer for text. *) + gtk_text_view_set_wrap_mode (GTK_TEXT_VIEW (text_view), + GTK_WRAP_WORD); + gtk_text_view_set_pixels_above_lines (GTK_TEXT_VIEW (text_view), 2); + gtk_text_view_set_pixels_below_lines (GTK_TEXT_VIEW (text_view), 2); + end; + + create_text := scrolled_window; +end; + + +const + tokens: array [1..4] of pgchar = + ('(*', + '''', + '{', + '//'); + + types: array [1..57] of pgchar = + ('integer', + 'gchar', + 'pgchar', + 'char', + 'gfloat', + 'real', + 'gint8', + 'gint16', + 'gint32', + 'gint', + 'guint', + 'guint8', + 'guint16', + 'guint32', + 'guchar', + 'glong', + 'longint', + 'gboolean' , + 'gshort', + 'gushort', + 'gulong', + 'gdouble', + 'double', + 'gldouble', + 'gpointer', + 'pointer', + 'NULL', + 'nil', + 'PGList', + 'TGList', + 'TGSList', + 'PGSList', + 'FALSE', + 'TRUE', + 'PGtkObject', + 'TGtkObject', + 'TGtkColorSelection', + 'PGtkColorSelection', + 'PGtkWidget', + 'TGtkWidget', + 'PGtkButton', + 'TGtkButton', + 'TGdkColor', + 'PGdkColor', + 'TGdkRectangle', + 'PGdkRectangle', + 'TGdkEventExpose', + 'PGdkEventExpose', + 'TGdkGC', + 'PGdkGC', + 'TGdkPixbufLoader', + 'PGdkPixbufLoader', + 'TGdkPixbuf', + 'PGdkPixbuf', + 'PPGError', + 'PGError', + 'array'); + + control: array [1..23] of pgchar = ( + 'if', + 'then', + 'case', + 'while', + 'else', + 'do', + 'for', + 'begin', + 'end', + 'exit', + 'goto', + 'program', + 'unit', + 'library', + 'procedure', + 'function', + 'type', + 'var', + 'const', + 'record', + 'uses', + 'of', + 'in'); + +procedure parse_chars ( text : pgchar; + var end_ptr : pgchar; + var state : gint; + var tag : pgchar; + start : gboolean); +var + i : gint; + next_token : pgchar; + + maybe_escape : boolean; +begin + (* leave out leading spaces *) + while (text^ <> #0) and (g_ascii_isspace (text^)) do + inc (text); + + (* Handle comments first *) + + if state = STATE_IN_COMMENT then + begin + end_ptr := StrPos (text, '*)'); + next_token := StrPos (text, '}'); + + if next_token > end_ptr then begin + end_ptr := next_token + 1; // '}' comment type + state := STATE_NORMAL; + tag := 'comment'; + end else + if end_ptr <> NULL then + begin + end_ptr := end_ptr + 2; // '* )' comment type + state := STATE_NORMAL; + tag := 'comment'; + end; + + exit; + end; + + tag := NULL; + end_ptr := NULL; + + if text^ = #0 then + exit; + + (* check for preprocessor defines *) + + if (((StrLComp (text, '(*', 2)) = 0) and (text[2] = '$') ) or + (((StrLComp (text, '{', 1)) = 0) and (text[1] = '$') ) then + begin + end_ptr := StrPos (text, '*)'); + next_token := StrPos (text, '}'); + + if next_token > end_ptr then + end_ptr := next_token + 1 + else + if end_ptr <> NULL then + end_ptr := end_ptr + 2; + + tag := 'preprocessor'; + exit; + end; + + + + (* check for comment *) + + if ((StrLComp (text, '(*', 2)) = 0) or + ((StrLComp (text, '{', 1)) = 0) then + begin + end_ptr := StrPos (text, '*)'); + next_token := StrPos (text, '}'); + + if next_token > end_ptr then + end_ptr := next_token+1 + else begin + if end_ptr <> NULL then + end_ptr := end_ptr + 2 + else + state := STATE_IN_COMMENT; + end; + tag := 'comment'; + exit; + end; + + if (StrLComp (text, '//', 2)) = 0 then + begin + end_ptr := NULL; + tag := 'comment'; + exit; + end; + + (* check for types *) + + for i := 1 to high (types) do + if ((StrLComp (text, types[i], strlen (types[i]))) = 0 ) and + ((text+strlen(types[i]))^ in [#8, #32, #0, ';', #13, #10, ')', ']', ':']) then + begin + end_ptr := text + strlen (types[i]); + tag := 'type'; + exit; + end; + + (* check for control *) + for i := 1 to high (control) do begin + if ((StrLComp (text, control[i], strlen (control[i]))) = 0) and + ((text+strlen(control[i]))^ in [#8, #32, #0, ';', #13, #10, ')', ']', ':']) then + begin + end_ptr := text + strlen (control[i]); + tag := 'control'; + exit; + end; + end; + + (* check for string *) + if text^= '''' then + begin + maybe_escape := FALSE; + + end_ptr := text + 1; + tag := 'string'; + + while end_ptr^ <> #0 do + begin + if (end_ptr^ = '''') and (maybe_escape = FALSE) then + begin + inc (end_ptr); + exit; + end; + + if end_ptr^ = '\' then + maybe_escape := TRUE + else + maybe_escape := FALSE; + + inc (end_ptr); + end; + exit; + end; + + + (* not at the start of a tag. Find the next one. *) + for i := 1 to high(tokens) do + begin + next_token := StrPos (text, tokens[i]); + if next_token <> NULL then + begin + if end_ptr <> NULL then + begin + if end_ptr > next_token then + end_ptr := next_token; + end else + end_ptr := next_token; + end; + end; + + for i := 1 to high(types) do + begin + next_token := StrPos (text, types[i]); + if next_token <> NULL then + if ( (next_token+strlen(types[i]))^ + in [#8, #32, #0, ';', #13, #10, ')', ']', ':']) and + g_ascii_isspace ((next_token-1)^) then + begin + if end_ptr <> NULL then + begin + if end_ptr > next_token then + end_ptr := next_token; + end else + end_ptr := next_token; + end; + end; + + + for i := 1 to high(control) do + begin + next_token := StrPos (text, control[i]); + if next_token <> NULL then + if ( (next_token+strlen(control[i]))^ + in [#8, #32, #0, ';', #13, #10, ')', ']', ':']) and + g_ascii_isspace ((next_token-1)^) then + begin + if end_ptr <> NULL then + begin + if end_ptr > next_token then + end_ptr := next_token; + end else + end_ptr := next_token; + end; + end; +end; + + +(* While not as cool as c-mode, this will do as a quick attempt at highlighting *) + +procedure fontify; + +var + start_iter, + next_iter, + tmp_iter : TGtkTextIter; + + state : gint; + text : pgchar; + start_ptr, + + end_ptr : pgchar; + tag : pgchar; + start : gboolean; + +begin + state := STATE_NORMAL; + + gtk_text_buffer_get_iter_at_offset (source_buffer, @start_iter, 0); + + next_iter := start_iter; + + while (gtk_text_iter_forward_line (@next_iter)) do + begin + start := TRUE; + text := gtk_text_iter_get_text ( @start_iter, @next_iter); + start_ptr := text; + + repeat + parse_chars (start_ptr, end_ptr, state, tag, start); + + start := FALSE; + if end_ptr <> NULL then begin + tmp_iter := start_iter; + gtk_text_iter_forward_chars (@tmp_iter, end_ptr - start_ptr); + end else + tmp_iter := next_iter; + + if tag <> NULL then + gtk_text_buffer_apply_tag_by_name (source_buffer, tag, @start_iter, @tmp_iter); + + start_iter := tmp_iter; + start_ptr := end_ptr; + until end_ptr = NULL; + + g_free (text); + start_iter := next_iter; + end; +end; + +function read_line (var f: TFileOfChar; str: PGString): boolean; +var + n_read : integer; + c, + next_c : char; + +begin + n_read := 0; + + g_string_truncate (str, 0); + + while not eof(f) do begin + read (f, c); + + inc (n_read); + + if (c = #10) or (c = #13) then + begin + if not eof(f) then + begin + read (f, next_c); + + if not ((next_c in [#13, #10]) and (c <> next_c)) then + seek(f, filepos(f)-1); + break; + end; + end else + g_string_append_c (str, c); + end; + + read_line := n_read > 0; +end; + + + +(* opens a textfile and reads it into the TGtkTextBuffer *) +procedure load_file (filename : pgchar); + +var + text_start, + text_end : TGtkTextIter; + + err : PGError; + buffer : PGString; + state, + len_chars, + len : integer; + + in_para : gboolean; + f : TFileOfChar; + full_name : pchar; + p, q, r : pgchar; + +begin + + err := NULL; + buffer := g_string_new (NULL); + state := 0; + in_para := FALSE; + + if (current_file <> NULL) and (StrComp (current_file, filename) = 0) then begin + g_string_free (buffer, TRUE); + exit; + end; + + g_free (current_file); + current_file := g_strdup (filename); + + gtk_text_buffer_get_bounds (info_buffer, @text_start, @text_end); + gtk_text_buffer_delete (info_buffer, @text_start, @text_end); + + gtk_text_buffer_get_bounds (source_buffer, @text_start, @text_end); + gtk_text_buffer_delete (source_buffer, @text_start, @text_end); + + full_name := demo_find_file (filename, @err); + + if full_name = NULL then begin + g_warning ('%s', [err^.message]); + g_error_free (err); + exit; + end; + + {$I-} + assign (f, full_name); + reset (f); + {$I+} + + if IOResult <> 0 then + g_print ('Cannot open %s: file not found'#13#10, [full_name]); + + g_free (full_name); + + if IOResult <> 0 then + exit; + + gtk_text_buffer_get_iter_at_offset (info_buffer, @text_start, 0); + + while read_line (f, buffer) do + begin + p := buffer^.str; + + case state of + 0 : begin (* Reading title *) + + while (((p^ = '(') or (p^ = '*')) or (p^ = '{')) or g_ascii_isspace (p^) do + inc (p); + r := p; + + while (r^ <> ')') and (strlen (r) > 0) do + inc (r); + + if strlen (r) > 0 then + p := r + 1; + + q := p + strlen (p); + + while (q > p) and g_ascii_isspace ((q - 1)^) do + dec(q); + + if q > p then + begin + len_chars := g_utf8_pointer_to_offset (p, q); + + text_end := text_start; + +// g_assert (strlen (p) >= (q - p)); + + gtk_text_buffer_insert (info_buffer, @text_end, p, q - p); + text_start := text_end; + + gtk_text_iter_backward_chars (@text_start, len_chars); + gtk_text_buffer_apply_tag_by_name (info_buffer, 'title', @text_start, @text_end); + + text_start := text_end; + + inc (state); + end; {of q > p } + end; {of state = 0} + + + 1: begin (* Reading body of info section *) + while g_ascii_isspace (p^) do + inc(p); + + if (p^ = '*') and ((p + 1)^ = ')') then + begin + gtk_text_buffer_get_iter_at_offset (source_buffer, @text_start, 0); + inc(state); + end else + begin + while (p^ = '*') or g_ascii_isspace (p^) do + inc(p); + + len := strlen (p); + + while g_ascii_isspace ( (p + len - 1)^) do + dec (len); + + if len > 0 then + begin + + if in_para then + gtk_text_buffer_insert (info_buffer, @text_start, ' ', 1); + +// g_assert (strlen (p) >= len); + + gtk_text_buffer_insert (info_buffer, @text_start, p, len); + + in_para := TRUE; + end else + begin + gtk_text_buffer_insert (info_buffer, @text_start, #10, 1); + in_para := FALSE; + end; {else len <= 0} + end; + end; + 2: begin (* Skipping blank lines *) + while g_ascii_isspace (p^) do + inc(p); + + if p^ <> #0 then + begin + p := buffer^.str; + inc (state); (* Fall through *) + + (* Reading program body *) + gtk_text_buffer_insert (source_buffer, @text_start, p, -1); + gtk_text_buffer_insert (source_buffer, @text_start, #10, 1); + end; + end; + + 3: begin (* Reading program body *) + gtk_text_buffer_insert (source_buffer, @text_start, p, -1); + gtk_text_buffer_insert (source_buffer, @text_start, #10, 1); + end; + end; + end; + + close (f); + fontify (); + + g_string_free (buffer, TRUE); +end; + +(* some callbacks *) + +procedure window_closed_cb (window : PGtkWidget; + data : gpointer); cdecl; +var + cbdata : PCallbackData; + iter : TGtkTreeIter; + italic, + nitalic : gboolean; + +begin + cbdata := data; + + gtk_tree_model_get_iter (cbdata^.model, @iter, cbdata^.path); + gtk_tree_model_get (GTK_TREE_MODEL (cbdata^.model), @iter, + [ ITALIC_COLUMN, @italic, -1] ); + nitalic := not italic; + + if italic then + gtk_tree_store_set (GTK_TREE_STORE (cbdata^.model), @iter, + [ ITALIC_COLUMN, nitalic, -1] ); + + gtk_tree_path_free (cbdata^.path); + dispose (cbdata); + +end; + + + +procedure row_activated_cb (tree_view : PGtkTreeView; + path : PGtkTreePath; + column : PGtkTreeViewColumn); cdecl; +var + iter : TGtkTreeIter; + italic, + nitalic : gboolean; + func : TGDoDemoFunc; + window : PGtkWidget; + model : PGtkTreeModel; + cbdata : PCallbackData; + +begin + model := gtk_tree_view_get_model (tree_view); + + gtk_tree_model_get_iter (model, @iter, path); + gtk_tree_model_get (GTK_TREE_MODEL (model), + @iter, + [ FUNC_COLUMN, @func, + ITALIC_COLUMN, @italic, -1 ]); + + if func <> NULL then + begin + nitalic := not italic; + gtk_tree_store_set (GTK_TREE_STORE (model), + @iter, + [ ITALIC_COLUMN, nitalic, -1 ] ); + + window := func(); + + if window <> NULL then + begin + new (cbdata); + cbdata^.model := model; + + cbdata^.path := gtk_tree_path_copy (path); + + g_signal_connect (window, 'destroy', + G_CALLBACK (@window_closed_cb), cbdata ); + end; + end; +end; + + +procedure selection_cb ( selection : PGtkTreeSelection; + model : PGtkTreeModel); cdecl; +var + iter : TGtkTreeIter; +// value : TGValue; + str : pgchar; + +begin + +(* g_value_init(@value, G_TYPE_STRING); // added to test if TGValue works + // -- its seems not as if it does *) + + if not gtk_tree_selection_get_selected (selection, NULL, @iter) then + exit; + +(* The original code used TGValue but it seems not to work; check why *) + +(* + gtk_tree_model_get_value (model, @iter, FILENAME_COLUMN, @value); + + if (g_value_get_string (@value)) <> NULL then + load_file (g_value_get_string (@value)); + + g_value_unset (@value); +*) + + gtk_tree_model_get (model, @iter, [FILENAME_COLUMN, @str, -1]); + + if str <> NULL then + load_file (str); + +end; + + +function create_tree: PGtkWidget; + +var + selection : PGtkTreeSelection; + cell : PGtkCellRenderer; + tree_view : PGtkWidget; + column : PGtkTreeViewColumn; + model : PGtkTreeStore; + + iter, + child_iter : TGtkTreeIter; + + d, + children : PDemo; + +begin + d := @testgtk_demos; + + model := gtk_tree_store_new (NUM_COLUMNS, [G_TYPE_STRING, G_TYPE_STRING, G_TYPE_POINTER, G_TYPE_BOOLEAN]); + + tree_view := gtk_tree_view_new (); + + gtk_tree_view_set_model (GTK_TREE_VIEW (tree_view), GTK_TREE_MODEL (model)); + selection := gtk_tree_view_get_selection (GTK_TREE_VIEW (tree_view)); + + gtk_tree_selection_set_mode (GTK_TREE_SELECTION (selection), + GTK_SELECTION_BROWSE); + + gtk_widget_set_size_request (tree_view, 200, -1); + + (* this code only supports 1 level of children. If we + * want more we probably have to use a recursing function. + *) + + + while d^.title <> NULL do begin + children := d^.children; + + gtk_tree_store_append (GTK_TREE_STORE (model), @iter, NULL); + + gtk_tree_store_set (GTK_TREE_STORE (model), + @iter, + [ TITLE_COLUMN, d^.title, + FILENAME_COLUMN, d^.filename, + FUNC_COLUMN, d^.func, + ITALIC_COLUMN, FALSE, -1 ] ); + + inc(d); + + if children = NULL then + continue; + + while children^.title <> NULL do begin + + gtk_tree_store_append (GTK_TREE_STORE (model), @child_iter, @iter); + + gtk_tree_store_set (GTK_TREE_STORE (model), + @child_iter, + [TITLE_COLUMN, children^.title, + FILENAME_COLUMN, children^.filename, + FUNC_COLUMN, children^.func, + ITALIC_COLUMN, FALSE, -1]); + inc (children); + end; + end; + + cell := gtk_cell_renderer_text_new (); + + g_object_set (G_OBJECT (cell), + 'style', [ PANGO_STYLE_ITALIC, NULL ]); + + + column := gtk_tree_view_column_new_with_attributes ('Widget (double click for demo)', + cell, + [ 'text', TITLE_COLUMN, + 'style_set', ITALIC_COLUMN, NULL ] ); + + gtk_tree_view_append_column (GTK_TREE_VIEW (tree_view), + GTK_TREE_VIEW_COLUMN (column)); + + g_signal_connect (selection, 'changed', G_CALLBACK (@selection_cb), model); + g_signal_connect (tree_view, 'row_activated', G_CALLBACK (@row_activated_cb), model); + + gtk_tree_view_expand_all (GTK_TREE_VIEW (tree_view)); + + create_tree := tree_view; +end; + + +procedure setup_default_icon; +var + pixbuf : PGdkPixbuf; + filename : pchar; + err : PGError; + + dialog : PGtkWidget; + + list : PGList; + transparent : PGdkPixbuf; + +begin + err := NULL; + pixbuf := NULL; + dialog := NULL; + + filename := demo_find_file ('gtk-logo-rgb.gif', @err); + + if filename <> NULL then + begin + pixbuf := gdk_pixbuf_new_from_file (filename, @err); + g_free (filename); + end; + + (* Ignoring this error (passing NULL instead of &err above) + * would probably be reasonable for most apps. We're just + * showing off. + *) + + if err <> NULL then + begin + dialog := gtk_message_dialog_new (NULL, 0, + GTK_MESSAGE_ERROR, + GTK_BUTTONS_CLOSE, + 'Failed to read icon file: %s', + [err^.message]); + gtk_widget_show (dialog); + g_error_free (err); + + g_signal_connect (dialog, 'response', + G_CALLBACK (@gtk_widget_destroy), NULL); + end; + + if pixbuf <> NULL then + begin + (* The gtk-logo-rgb icon has a white background, make it transparent *) + + transparent := gdk_pixbuf_add_alpha (pixbuf, TRUE, $ff, $ff, $ff); + + list := NULL; + list := g_list_append (list, transparent); + + gtk_window_set_default_icon_list (list); + + g_list_free (list); + g_object_unref (G_OBJECT (pixbuf)); + g_object_unref (G_OBJECT (transparent)); + end; +end; + + + +var + window, + notebook, + hbox, + tree : PGtkWidget; + +begin + current_file := NULL; + + {$include init.inc} (* contains all variable inits of the demos *) + + gtk_init (@argc, @argv); + + setup_default_icon (); + + window := gtk_window_new (GTK_WINDOW_TOPLEVEL); + + gtk_window_set_title (GTK_WINDOW (window), 'GTK+ Code Demos'); + + g_signal_connect (window, 'destroy', + G_CALLBACK (@gtk_main_quit), NULL); + + hbox := gtk_hbox_new (FALSE, 0); + gtk_container_add (GTK_CONTAINER (window), hbox); + + tree := create_tree; + + gtk_box_pack_start (GTK_BOX (hbox), tree, FALSE, FALSE, 0); + + notebook := gtk_notebook_new; + gtk_box_pack_start (GTK_BOX (hbox), notebook, TRUE, TRUE, 0); + + gtk_notebook_append_page (GTK_NOTEBOOK (notebook), + create_text (info_buffer, FALSE), + gtk_label_new_with_mnemonic ('_Info')); + + + gtk_notebook_append_page (GTK_NOTEBOOK (notebook), + create_text (source_buffer, TRUE), + gtk_label_new_with_mnemonic ('_Source')); + + gtk_text_buffer_create_tag (info_buffer, 'title', 'font', ['Sans 18', NULL ]); + + gtk_text_buffer_create_tag (source_buffer, 'comment', 'foreground', ['red', NULL]); + + gtk_text_buffer_create_tag (source_buffer, 'type', 'foreground', ['ForestGreen', NULL]); + + gtk_text_buffer_create_tag (source_buffer, 'string', 'foreground', + ['RosyBrown', 'weight', PANGO_WEIGHT_BOLD, NULL]); + + gtk_text_buffer_create_tag (source_buffer, 'control', 'foreground', ['purple', NULL]); + + gtk_text_buffer_create_tag (source_buffer, 'preprocessor', 'style', + [ PANGO_STYLE_OBLIQUE, 'foreground', 'blue', NULL] ); + + gtk_text_buffer_create_tag (source_buffer, 'function', 'weight', + [ PANGO_WEIGHT_BOLD, 'foreground', 'DarkGoldenrod4', NULL]); + + gtk_window_set_default_size (GTK_WINDOW (window), 600, 400); + gtk_widget_show_all (window); + + gtk_main; +end. diff --git a/packages/gtk2/examples/gtk_demo/images.inc b/packages/gtk2/examples/gtk_demo/images.inc new file mode 100644 index 0000000000..bc89affcbb --- /dev/null +++ b/packages/gtk2/examples/gtk_demo/images.inc @@ -0,0 +1,438 @@ +(* Images + * + * GtkImage is used to display an image; the image can be in a number of formats. + * Typically, you load an image into a GdkPixbuf, then display the pixbuf. + * + * This demo code shows some of the more obscure cases, in the simple + * case a call to gtk_image_new_from_file() is all you need. + * + * If you want to put image data in your program as a C variable, + * use the make-inline-pixbuf program that comes with GTK+. + * This way you won't need to depend on loading external files, your + * application binary can be self-contained. + *) + + +var + image_window : PGtkWidget; + image_pixbuf_loader : PGdkPixbufLoader; + image_load_timeout : guint; + image_stream : file; + +type + TBuffer256 = array [0..255] of byte; + +procedure progressive_prepared_callback (loader : PGdkPixbufLoader; + data : gpointer); cdecl; +var + pixbuf : PGdkPixbuf; + image : PGtkWidget; + +begin + image := PGtkWidget (data); + + pixbuf := gdk_pixbuf_loader_get_pixbuf (loader); + + (* Avoid displaying random memory contents, since the pixbuf + * isn't filled in yet. + *) + gdk_pixbuf_fill (pixbuf, $aaaaaaff); + + gtk_image_set_from_pixbuf (pGtkImage (image), pixbuf); +end; + +procedure progressive_updated_callback (loader : PGdkPixbufLoader; + x, y, + width, + height : gint; + data : gpointer); cdecl; +var + image : PGtkWidget; + +begin + image := PGtkWidget (data); + + (* We know the pixbuf inside the GtkImage has changed, but the image + * itself doesn't know this; so queue a redraw. If we wanted to be + * really efficient, we could use a drawing area or something + * instead of a GtkImage, so we could control the exact position of + * the pixbuf on the display, then we could queue a draw for only + * the updated area of the image. + *) + + gtk_widget_queue_draw (image); +end; + +function progressive_timeout (data : gpointer): gboolean; cdecl; +var + image : PGtkWidget; + buf : TBuffer256; + bytes_read : integer; + error : PGError; + dialog : PGtkWidget; + error_msg, + filename : pgchar; + +begin + image := PGtkWidget (data); + + (* This shows off fully-paranoid error handling, so looks scary. + * You could factor out the error handling code into a nice separate + * function to make things nicer. + *) + + if file_is_valid (image_stream) then // is there a better way??? + begin + error := NULL; + + blockread (image_stream, buf, sizeof(buf), bytes_read); + + if not gdk_pixbuf_loader_write (image_pixbuf_loader, + @buf[0], bytes_read, @error) then + begin + dialog := gtk_message_dialog_new (GTK_WINDOW (image_window), + GTK_DIALOG_DESTROY_WITH_PARENT, + GTK_MESSAGE_ERROR, + GTK_BUTTONS_CLOSE, + 'Failed to load image: %s', + [error^.message]); + + g_error_free (error); + + g_signal_connect (dialog, 'response', + G_CALLBACK (@gtk_widget_destroy), NULL); + + close (image_stream); + + gtk_widget_show (dialog); + + image_load_timeout := 0; + + exit (FALSE); (* uninstall the timeout *) + end; {of not gdk_pixbuf_loader_write} + + if eof (image_stream) then + begin + close (image_stream); + + (* Errors can happen on close, e.g. if the image + * file was truncated we'll know on close that + * it was incomplete. + *) + error := NULL; + if not gdk_pixbuf_loader_close (image_pixbuf_loader, @error) then + begin + dialog := gtk_message_dialog_new (GTK_WINDOW (image_window), + GTK_DIALOG_DESTROY_WITH_PARENT, + GTK_MESSAGE_ERROR, + GTK_BUTTONS_CLOSE, + 'Failed to load image: %s', + [error^.message]); + + g_error_free (error); + + g_signal_connect (dialog, 'response', + G_CALLBACK (@gtk_widget_destroy), NULL); + + gtk_widget_show (dialog); + + g_object_unref (G_OBJECT (image_pixbuf_loader)); + image_pixbuf_loader := NULL; + + image_load_timeout := 0; + + exit(FALSE); (* uninstall the timeout *) + end; {of not gdk_pixbuf_loader_close} + + g_object_unref (G_OBJECT (image_pixbuf_loader)); + image_pixbuf_loader := NULL; + end; {of eof} + end {of image_stream} + else begin + error_msg := NULL; + + (* demo_find_file() looks in the the current directory first, + * so you can run gtk-demo without installing GTK, then looks + * in the location where the file is installed. + *) + + filename := demo_find_file ('alphatest.png', @error); + if error <> NULL then + begin + error_msg := g_strdup (error^.message); + g_error_free (error); + end else + begin + {$I-} + assign (image_stream, filename); + reset (image_stream, 1); + {$I+} + + if IOResult <> 0 then + error_msg := g_strdup_printf ('Error while opening file "%s"', + [filename]); + g_free (filename); + end; + + if not file_is_valid (image_stream) then + begin + dialog := gtk_message_dialog_new (GTK_WINDOW (image_window), + GTK_DIALOG_DESTROY_WITH_PARENT, + GTK_MESSAGE_ERROR, + GTK_BUTTONS_CLOSE, + '%s', [error_msg]); + g_free (error_msg); + + g_signal_connect (dialog, 'response', + G_CALLBACK (@gtk_widget_destroy), NULL); + + gtk_widget_show (dialog); + + image_load_timeout := 0; + + exit (FALSE); (* uninstall the timeout *) + end; + + if image_pixbuf_loader <> NULL then + begin + gdk_pixbuf_loader_close (image_pixbuf_loader, NULL); + g_object_unref (G_OBJECT (image_pixbuf_loader)); + image_pixbuf_loader := NULL; + end; + + image_pixbuf_loader := gdk_pixbuf_loader_new (); + + g_signal_connect (G_OBJECT (image_pixbuf_loader), 'area_prepared', + G_CALLBACK (@progressive_prepared_callback), image); + + g_signal_connect (G_OBJECT (image_pixbuf_loader), 'area_updated', + G_CALLBACK (@progressive_updated_callback), image); + end; {of else image_stream} + + (* leave timeout installed *) + exit (TRUE); +end; + +procedure start_progressive_loading (image : PGtkWidget); cdecl; +begin + (* This is obviously totally contrived (we slow down loading + * on purpose to show how incremental loading works). + * The real purpose of incremental loading is the case where + * you are reading data from a slow source such as the network. + * The timeout simply simulates a slow data source by inserting + * pauses in the reading process. + *) + image_load_timeout := g_timeout_add (150, + @progressive_timeout, + image); +end; + +procedure images_cleanup_callback (theobject : PGtkObject; + data : gpointer); cdecl; +begin + if image_load_timeout <> 0 then + begin + g_source_remove (image_load_timeout); + image_load_timeout := 0; + end; + + if image_pixbuf_loader <> NULL then + begin + gdk_pixbuf_loader_close (image_pixbuf_loader, NULL); + g_object_unref (G_OBJECT (image_pixbuf_loader)); + image_pixbuf_loader := NULL; + end; + + if file_is_valid (image_stream) then + close (image_stream); +end; + +procedure toggle_sensitivity_callback (togglebutton : PGtkWidget; + user_data : gpointer);cdecl; +var + container : PGtkContainer; + list, + tmp : PGList; + +begin + container := PGtkContainer (user_data); + + list := gtk_container_get_children (container); + + tmp := list; + + while tmp <> NULL do + begin + (* don't disable our toggle *) + if pGtkWidget (tmp^.data) <> togglebutton then + gtk_widget_set_sensitive (pGtkWidget (tmp^.data), + not gtk_toggle_button_get_active (pGtkToggleButton (togglebutton))); + + tmp := tmp^.next; + end; + + g_list_free (list); +end; + + +function do_images : PGtkWidget; +var + frame, + vbox, + image, + thelabel, + align, + dialog, + button : PGtkWidget; + + pixbuf : PGdkPixbuf; + error : PGError; + filename : pgchar; + +begin + error := NULL; + + if image_window = NULL then + begin + image_window := gtk_window_new (GTK_WINDOW_TOPLEVEL); + gtk_window_set_title (GTK_WINDOW (image_window), 'Images'); + + g_signal_connect (image_window, 'destroy', + G_CALLBACK (@gtk_widget_destroyed), @image_window); + g_signal_connect (image_window, 'destroy', + G_CALLBACK (@images_cleanup_callback), NULL); + + gtk_container_set_border_width (GTK_CONTAINER (image_window), 8); + + vbox := gtk_vbox_new (FALSE, 8); + gtk_container_set_border_width (GTK_CONTAINER (vbox), 8); + gtk_container_add (GTK_CONTAINER (image_window), vbox); + + thelabel := gtk_label_new (NULL); + gtk_label_set_markup (GTK_LABEL (thelabel), + '<u>Image loaded from a file</u>'); + + gtk_box_pack_start (GTK_BOX (vbox), thelabel, FALSE, FALSE, 0); + + frame := gtk_frame_new (NULL); + gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_IN); + + (* The alignment keeps the frame from growing when users resize + * the window + *) + align := gtk_alignment_new (0.5, 0.5, 0, 0); + gtk_container_add (GTK_CONTAINER (align), frame); + gtk_box_pack_start (GTK_BOX (vbox), align, FALSE, FALSE, 0); + + (* demo_find_file() looks in the the current directory first, + * so you can run gtk-demo without installing GTK, then looks + * in the location where the file is installed. + *) + + pixbuf := NULL; + filename := demo_find_file ('gtk-logo-rgb.gif', @error); + if filename <> NULL then + begin + pixbuf := gdk_pixbuf_new_from_file (filename, @error); + g_free (filename); + end; + + if error <> NULL then + begin + (* This code shows off error handling. You can just use + * gtk_image_new_from_file() instead if you don't want to report + * errors to the user. If the file doesn't load when using + * gtk_image_new_from_file(), a "missing image" icon will + * be displayed instead. + *) + + dialog := gtk_message_dialog_new (GTK_WINDOW (image_window), + GTK_DIALOG_DESTROY_WITH_PARENT, + GTK_MESSAGE_ERROR, + GTK_BUTTONS_CLOSE, + 'Unable to open image file "gtk-logo-rgb.gif": %s', + [error^.message]); + g_error_free (error); + + g_signal_connect (dialog, 'response', + G_CALLBACK (@gtk_widget_destroy), NULL); + + gtk_widget_show (dialog); + end; + + image := gtk_image_new_from_pixbuf (pixbuf); + + gtk_container_add (GTK_CONTAINER (frame), image); + + + (* Animation *) + + thelabel := gtk_label_new (NULL); + gtk_label_set_markup (GTK_LABEL (thelabel), + '<u>Animation loaded from a file</u>'); + gtk_box_pack_start (GTK_BOX (vbox), thelabel, FALSE, FALSE, 0); + + frame := gtk_frame_new (NULL); + gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_IN); + + (* The alignment keeps the frame from growing when users resize + * the window + *) + align := gtk_alignment_new (0.5, 0.5, 0, 0); + gtk_container_add (GTK_CONTAINER (align), frame); + gtk_box_pack_start (GTK_BOX (vbox), align, FALSE, FALSE, 0); + + filename := demo_find_file ('floppybuddy.gif', NULL); + image := gtk_image_new_from_file (filename); + g_free (filename); + + gtk_container_add (GTK_CONTAINER (frame), image); + + + (* Progressive *) + + + thelabel := gtk_label_new (NULL); + gtk_label_set_markup (GTK_LABEL (thelabel), + '<u>Progressive image loading</u>'); + gtk_box_pack_start (GTK_BOX (vbox), thelabel, FALSE, FALSE, 0); + + frame := gtk_frame_new (NULL); + gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_IN); + + (* The alignment keeps the frame from growing when users resize + * the window + *) + align := gtk_alignment_new (0.5, 0.5, 0, 0); + gtk_container_add (GTK_CONTAINER (align), frame); + gtk_box_pack_start (GTK_BOX (vbox), align, FALSE, FALSE, 0); + + (* Create an empty image for now; the progressive loader + * will create the pixbuf and fill it in. + *) + + image := gtk_image_new_from_pixbuf (NULL); + gtk_container_add (GTK_CONTAINER (frame), image); + + start_progressive_loading (image); + + (* Sensitivity control *) + button := gtk_toggle_button_new_with_mnemonic ('_Insensitive'); + gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0); + + g_signal_connect (G_OBJECT (button), 'toggled', + G_CALLBACK (@toggle_sensitivity_callback), + vbox); + end; + + if not GTK_WIDGET_VISIBLE (image_window) then + gtk_widget_show_all (image_window) + else + begin + gtk_widget_destroy (image_window); + image_window := NULL; + end; + + do_images := image_window; +end; + diff --git a/packages/gtk2/examples/gtk_demo/init.inc b/packages/gtk2/examples/gtk_demo/init.inc new file mode 100644 index 0000000000..c77d58f717 --- /dev/null +++ b/packages/gtk2/examples/gtk_demo/init.inc @@ -0,0 +1,52 @@ +(* this file contains all inits of variables used in the demo *) + +(* appwindow.inc *) + appwindow_registered := FALSE; + application_window := NULL; + + +(* button_box.inc *) + bbox_window := NULL; + +(* colorsel.inc *) + colorsel_window := NULL; + colorsel_da := NULL; + colorsel_frame := NULL; + +(* drawingarea.inc *) + da_window := NULL; + +(* images.inc *) + image_window := NULL; + image_pixbuf_loader := NULL; + image_load_timeout := 0; + +(* item_factory *) + if_window := NULL; + +(* menus.inc *) + menu_window := NULL; + +(* panes.inc *) + panes_window := NULL; + +(* pixbufs.inc *) + pixbufs_window := NULL; + pixbufs_frame := NULL; + pixbufs_background := NULL; + pixbufs_back_width := 0; + pixbufs_back_height := 0; + pixbufs_da := NULL; + +(* sizegroup.inc *) + sg_window := NULL; + +(* stock_browser.inc *) + stock_window := NULL; + +(* textview.inc *) + text_window := NULL; + text_egg_window := NULL; + + + diff --git a/packages/gtk2/examples/gtk_demo/item_factory.inc b/packages/gtk2/examples/gtk_demo/item_factory.inc new file mode 100644 index 0000000000..d5c8f00f68 --- /dev/null +++ b/packages/gtk2/examples/gtk_demo/item_factory.inc @@ -0,0 +1,169 @@ +(* Item Factory + * + * The GtkItemFactory object allows the easy creation of menus + * from an array of descriptions of menu items. + *) + +var + if_window : PGtkWidget; + +procedure gtk_ifactory_cb (callback_data : gpointer; + callback_action : guint; + widget : PGTkWidget); cdecl; +begin + g_message ('ItemFactory: activated "%s"', + [gtk_item_factory_path_from_widget (widget) ]); +end; + + +const + if_menu_items : array [1..19] of TGtkItemFactoryEntry = ( + ( path: '/_File'; accelerator: NULL; callback: nil; + callback_action: 0; item_type : '<Branch>'; extra_data: NULL), + + ( path: '/File/tearoff1'; accelerator: NULL; callback: TGtkItemfactoryCallback(@gtk_ifactory_cb); + callback_action: 0; item_type : '<Tearoff>'; extra_data: NULL), + + ( path: '/File/_New'; accelerator: '<control>N'; callback: TGtkItemfactoryCallback(@gtk_ifactory_cb); + callback_action: 0; item_type : NULL; extra_data: NULL), + + ( path: '/File/_Open'; accelerator: '<control>O'; callback: TGtkItemfactoryCallback(@gtk_ifactory_cb); + callback_action: 0; item_type : NULL; extra_data: NULL), + + ( path: '/File/_Save'; accelerator: '<control>S'; callback: TGtkItemfactoryCallback(@gtk_ifactory_cb); + callback_action: 0; item_type : NULL; extra_data: NULL), + + ( path: '/File/Save _As'; accelerator: NULL; callback: TGtkItemfactoryCallback(@gtk_ifactory_cb); + callback_action: 0; item_type : NULL; extra_data: NULL), + + ( path: '/File/sep1'; accelerator: NULL; callback: TGtkItemfactoryCallback(@gtk_ifactory_cb); + callback_action: 0; item_type : '<Separator>'; extra_data: NULL), + + ( path: '/File/_Quit'; accelerator: '<control>Q'; callback: TGtkItemfactoryCallback(@gtk_ifactory_cb); + callback_action: 0; item_type : NULL; extra_data: NULL), + + ( path: '/_Preferences'; accelerator: NULL ; callback: nil; + callback_action: 0; item_type : '<Branch>'; extra_data: NULL), + + ( path: '/Preferences/_Color'; accelerator: NULL ; callback: nil; + callback_action: 0; item_type : '<Branch>'; extra_data: NULL), + + ( path: '/Preferences/Color/_Red'; accelerator: NULL ; callback: TGtkItemfactoryCallback(@gtk_ifactory_cb); + callback_action: 0; item_type : '<RadioItem>'; extra_data: NULL), + + ( path: '/Preferences/Color/_Green'; accelerator: NULL ; callback:TGtkItemfactoryCallback(@gtk_ifactory_cb); + callback_action: 0; item_type : '/Preferences/Color/Red'; extra_data: NULL), + + ( path: '/Preferences/Color/_Blue'; accelerator: NULL ; callback: TGtkItemfactoryCallback(@gtk_ifactory_cb); + callback_action: 0; item_type : '/Preferences/Color/Red'; extra_data: NULL), + + ( path: '/Preferences/_Shape'; accelerator: NULL ; callback: nil; + callback_action: 0; item_type : '<Branch>'; extra_data: NULL), + + ( path: '/Preferences/Shape/_Square'; accelerator: NULL ; callback: TGtkItemfactoryCallback(@gtk_ifactory_cb); + callback_action: 0; item_type : '<RadioItem>'; extra_data: NULL), + + ( path: '/Preferences/Shape/_Rectangle'; accelerator: NULL ; callback: TGtkItemfactoryCallback(@gtk_ifactory_cb); + callback_action: 0; item_type : '/Preferences/Shape/Square'; extra_data: NULL), + + ( path: '/Preferences/Shape/_Oval'; accelerator: NULL ; callback: TGtkItemfactoryCallback(@gtk_ifactory_cb); + callback_action: 0; item_type : '/Preferences/Shape/Rectangle'; extra_data: NULL), + + + (* If you wanted this to be right justified you would use "<LastBranch>", not "<Branch>". + * Right justified help menu items are generally considered a bad idea now days. + *) + + ( path: '/_Help'; accelerator: NULL ; callback: nil; + callback_action: 0; item_type : '<Branch>'; extra_data: NULL), + + ( path: '/Help/_About'; accelerator: NULL ; callback: nil; + callback_action: 0; item_type : NULL; extra_data: NULL) + ); + +const + nmenu_items = sizeof (if_menu_items) div sizeof (if_menu_items[1]); + + +function do_item_factory : PGtkWidget; +var + box1, + box2, + separator, + thelabel, + button : PGtkWidget; + + accel_group : PGtkAccelGroup; + item_factory : PGtkItemFactory; + +begin + + if if_window = NULL then + begin + if_window := gtk_window_new (GTK_WINDOW_TOPLEVEL); + + g_signal_connect (if_window, 'destroy', + G_CALLBACK (@gtk_widget_destroyed), @if_window); + + g_signal_connect (if_window, 'delete-event', + G_CALLBACK (@gtk_true), NULL); + + accel_group := gtk_accel_group_new (); + + item_factory := gtk_item_factory_new (GTK_TYPE_MENU_BAR, '<main>', accel_group); + + g_object_set_data_full (G_OBJECT (if_window), '<main>', + item_factory, @g_object_unref); + gtk_window_add_accel_group (GTK_WINDOW (if_window), accel_group); + + gtk_window_set_title (GTK_WINDOW (if_window), 'Item Factory'); + gtk_container_set_border_width (GTK_CONTAINER (if_window), 0); + gtk_item_factory_create_items (item_factory, nmenu_items, @if_menu_items[1], NULL); + + (* preselect /Preferences/Shape/Oval over the other radios + *) + gtk_check_menu_item_set_active + (GTK_CHECK_MENU_ITEM (gtk_item_factory_get_item (item_factory, + '/Preferences/Shape/Oval')), + TRUE); + + box1 := gtk_vbox_new (FALSE, 0); + gtk_container_add (GTK_CONTAINER (if_window), box1); + + gtk_box_pack_start (GTK_BOX (box1), + gtk_item_factory_get_widget (item_factory, '<main>'), + FALSE, FALSE, 0); + + thelabel := gtk_label_new ('Type'#13#10'<alt>'#13#10'to start'); + gtk_widget_set_size_request (thelabel, 200, 200); + gtk_misc_set_alignment (GTK_MISC (thelabel), 0.5, 0.5); + gtk_box_pack_start (GTK_BOX (box1), thelabel, TRUE, TRUE, 0); + + + separator := gtk_hseparator_new (); + gtk_box_pack_start (GTK_BOX (box1), separator, FALSE, TRUE, 0); + + box2 := gtk_vbox_new (FALSE, 10); + gtk_container_set_border_width (GTK_CONTAINER (box2), 10); + gtk_box_pack_start (GTK_BOX (box1), box2, FALSE, TRUE, 0); + + button := gtk_button_new_with_label ('close'); + g_signal_connect_swapped (button, 'clicked', + G_CALLBACK (@gtk_widget_destroy), if_window); + + + gtk_box_pack_start (GTK_BOX (box2), button, TRUE, TRUE, 0); + + GTK_WIDGET_SET_FLAGS (button, GTK_CAN_DEFAULT); + + gtk_widget_grab_default (button); + + gtk_widget_show_all (if_window); + end else + begin + gtk_widget_destroy (if_window); + if_window := NULL; + end; + + do_item_factory := if_window; +end; diff --git a/packages/gtk2/examples/gtk_demo/list_store.inc b/packages/gtk2/examples/gtk_demo/list_store.inc new file mode 100644 index 0000000000..30f803e315 --- /dev/null +++ b/packages/gtk2/examples/gtk_demo/list_store.inc @@ -0,0 +1,232 @@ +(* Tree View/List Store + * + * The GtkListStore is used to store data in list form, to be used + * later on by a GtkTreeView to display it. This demo builds a + * simple GtkListStore and displays it. See the Stock Browser + * demo for a more advanced example. + * + *) + + (* + * todo: translate to pascal + *) + +function do_list_store : PGtkWidget; +begin + do_dummy ('Tree View / List Store - Demo'); + do_list_store := NULL; +end; + +(* +#include <gtk/gtk.h> + +static GtkWidget *window = NULL; + +typedef struct +{ + const gboolean fixed; + const guint number; + const gchar *severity; + const gchar *description; +} +Bug; + +enum +{ + COLUMN_FIXED, + COLUMN_NUMBER, + COLUMN_SEVERITY, + COLUMN_DESCRIPTION, + NUM_COLUMNS +}; + +static Bug data[] = +{ + { FALSE, 60482, "Normal", "scrollable notebooks and hidden tabs" }, + { FALSE, 60620, "Critical", "gdk_window_clear_area (gdkwindow-win32.c) is not thread-safe" }, + { FALSE, 50214, "Major", "Xft support does not clean up correctly" }, + { TRUE, 52877, "Major", "GtkFileSelection needs a refresh method. " }, + { FALSE, 56070, "Normal", "Can't click button after setting in sensitive" }, + { TRUE, 56355, "Normal", "GtkLabel - Not all changes propagate correctly" }, + { FALSE, 50055, "Normal", "Rework width/height computations for TreeView" }, + { FALSE, 58278, "Normal", "gtk_dialog_set_response_sensitive () doesn't work" }, + { FALSE, 55767, "Normal", "Getters for all setters" }, + { FALSE, 56925, "Normal", "Gtkcalender size" }, + { FALSE, 56221, "Normal", "Selectable label needs right-click copy menu" }, + { TRUE, 50939, "Normal", "Add shift clicking to GtkTextView" }, + { FALSE, 6112, "Enhancement","netscape-like collapsable toolbars" }, + { FALSE, 1, "Normal", "First bug :=)" }, +}; + +static GtkTreeModel * +create_model (void) +{ + gint i = 0; + GtkListStore *store; + GtkTreeIter iter; + + /* create list store */ + store = gtk_list_store_new (NUM_COLUMNS, + G_TYPE_BOOLEAN, + G_TYPE_UINT, + G_TYPE_STRING, + G_TYPE_STRING); + + /* add data to the list store */ + for (i = 0; i < G_N_ELEMENTS (data); i++) + { + gtk_list_store_append (store, &iter); + gtk_list_store_set (store, &iter, + COLUMN_FIXED, data[i].fixed, + COLUMN_NUMBER, data[i].number, + COLUMN_SEVERITY, data[i].severity, + COLUMN_DESCRIPTION, data[i].description, + -1); + } + + return GTK_TREE_MODEL (store); +} + +static void +fixed_toggled (GtkCellRendererToggle *cell, + gchar *path_str, + gpointer data) +{ + GtkTreeModel *model = (GtkTreeModel * )data; + GtkTreeIter iter; + GtkTreePath *path = gtk_tree_path_new_from_string (path_str); + gboolean fixed; + + /* get toggled iter */ + gtk_tree_model_get_iter (model, &iter, path); + gtk_tree_model_get (model, &iter, COLUMN_FIXED, &fixed, -1); + + /* do something with the value */ + fixed ^= 1; + + /* set new value */ + gtk_list_store_set (GTK_LIST_STORE (model), &iter, COLUMN_FIXED, fixed, -1); + + /* clean up */ + gtk_tree_path_free (path); +} + +static void +add_columns (GtkTreeView *treeview) +{ + GtkCellRenderer *renderer; + GtkTreeViewColumn *column; + GtkTreeModel *model = gtk_tree_view_get_model (treeview); + + /* column for fixed toggles */ + renderer = gtk_cell_renderer_toggle_new (); + g_signal_connect (G_OBJECT (renderer), "toggled", + G_CALLBACK (fixed_toggled), model); + + column = gtk_tree_view_column_new_with_attributes ("Fixed?", + renderer, + "active", COLUMN_FIXED, + NULL); + + /* set this column to a fixed sizing (of 50 pixels) */ + gtk_tree_view_column_set_sizing (GTK_TREE_VIEW_COLUMN (column), + GTK_TREE_VIEW_COLUMN_FIXED); + gtk_tree_view_column_set_fixed_width (GTK_TREE_VIEW_COLUMN (column), 50); + gtk_tree_view_append_column (treeview, column); + + /* column for bug numbers */ + renderer = gtk_cell_renderer_text_new (); + column = gtk_tree_view_column_new_with_attributes ("Bug number", + renderer, + "text", + COLUMN_NUMBER, + NULL); + gtk_tree_view_column_set_sort_column_id (column, COLUMN_NUMBER); + gtk_tree_view_append_column (treeview, column); + + /* column for severities */ + renderer = gtk_cell_renderer_text_new (); + column = gtk_tree_view_column_new_with_attributes ("Severity", + renderer, + "text", + COLUMN_SEVERITY, + NULL); + gtk_tree_view_column_set_sort_column_id (column, COLUMN_SEVERITY); + gtk_tree_view_append_column (treeview, column); + + /* column for description */ + renderer = gtk_cell_renderer_text_new (); + column = gtk_tree_view_column_new_with_attributes ("Description", + renderer, + "text", + COLUMN_DESCRIPTION, + NULL); + gtk_tree_view_column_set_sort_column_id (column, COLUMN_DESCRIPTION); + gtk_tree_view_append_column (treeview, column); +} + +GtkWidget * +do_list_store (void) +{ + if (!window) + { + GtkWidget *vbox; + GtkWidget *label; + GtkWidget *sw; + GtkTreeModel *model; + GtkWidget *treeview; + + /* create window, etc */ + window = gtk_window_new (GTK_WINDOW_TOPLEVEL); + gtk_window_set_title (GTK_WINDOW (window), "GtkListStore demo"); + + g_signal_connect (G_OBJECT (window), "destroy", + G_CALLBACK (gtk_widget_destroyed), &window); + gtk_container_set_border_width (GTK_CONTAINER (window), 8); + + vbox = gtk_vbox_new (FALSE, 8); + gtk_container_add (GTK_CONTAINER (window), vbox); + + label = gtk_label_new ("This is the bug list (note: not based on real data, it would be nice to have a nice ODBC interface to bugzilla or so, though)."); + gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, FALSE, 0); + + sw = gtk_scrolled_window_new (NULL, NULL); + gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (sw), + GTK_SHADOW_ETCHED_IN); + gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw), + GTK_POLICY_NEVER, + GTK_POLICY_AUTOMATIC); + gtk_box_pack_start (GTK_BOX (vbox), sw, TRUE, TRUE, 0); + + /* create tree model */ + model = create_model (); + + /* create tree view */ + treeview = gtk_tree_view_new_with_model (model); + gtk_tree_view_set_rules_hint (GTK_TREE_VIEW (treeview), TRUE); + gtk_tree_view_set_search_column (GTK_TREE_VIEW (treeview), + COLUMN_DESCRIPTION); + + g_object_unref (G_OBJECT (model)); + + gtk_container_add (GTK_CONTAINER (sw), treeview); + + /* add columns to the tree view */ + add_columns (GTK_TREE_VIEW (treeview)); + + /* finish & show */ + gtk_window_set_default_size (GTK_WINDOW (window), 280, 250); + } + + if (!GTK_WIDGET_VISIBLE (window)) + gtk_widget_show_all (window); + else + { + gtk_widget_destroy (window); + window = NULL; + } + + return window; +} + +*) diff --git a/packages/gtk2/examples/gtk_demo/menus.inc b/packages/gtk2/examples/gtk_demo/menus.inc new file mode 100644 index 0000000000..56e23a5c99 --- /dev/null +++ b/packages/gtk2/examples/gtk_demo/menus.inc @@ -0,0 +1,220 @@ +(* Menus + * + * There are several widgets involved in displaying menus. The + * GtkMenuBar widget is a horizontal menu bar, which normally appears + * at the top of an application. The GtkMenu widget is the actual menu + * that pops up. Both GtkMenuBar and GtkMenu are subclasses of + * GtkMenuShell; a GtkMenuShell contains menu items + * (GtkMenuItem). Each menu item contains text and/or images and can + * be selected by the user. + * + * There are several kinds of menu item, including plain GtkMenuItem, + * GtkCheckMenuItem which can be checked/unchecked, GtkRadioMenuItem + * which is a check menu item that's in a mutually exclusive group, + * GtkSeparatorMenuItem which is a separator bar, GtkTearoffMenuItem + * which allows a GtkMenu to be torn off, and GtkImageMenuItem which + * can place a GtkImage or other widget next to the menu text. + * + * A GtkMenuItem can have a submenu, which is simply a GtkMenu to pop + * up when the menu item is selected. Typically, all menu items in a menu bar + * have submenus. + * + * The GtkOptionMenu widget is a button that pops up a GtkMenu when clicked. + * It's used inside dialogs and such. + * + * GtkItemFactory provides a higher-level interface for creating menu bars + * and menus; while you can construct menus manually, most people don't + * do that. There's a separate demo for GtkItemFactory. + * + *) + + +var + menu_window : PGtkWidget; + +function create_menu (depth : gint; + tearoff : gboolean): PGtkWidget; +var + menu, + menuitem : PGtkWidget; + + group : PGSList; + buf : pgchar; + i, j : gint; + +begin + + if depth < 1 then + exit (NULL); + + menu := gtk_menu_new (); + group := NULL; + + if tearoff then + begin + menuitem := gtk_tearoff_menu_item_new (); + gtk_menu_shell_append (GTK_MENU_SHELL (menu), menuitem); + gtk_widget_show (menuitem); + end; + + j:=1; + for i:=0 to 4 do + begin + buf := g_strdup_printf ('item %2d - %d', [depth, j]); + menuitem := gtk_radio_menu_item_new_with_label (group, buf); + group := gtk_radio_menu_item_get_group (GTK_RADIO_MENU_ITEM (menuitem)); + + gtk_menu_shell_append (GTK_MENU_SHELL (menu), menuitem); + gtk_widget_show (menuitem); + + if i = 3 then + gtk_widget_set_sensitive (menuitem, FALSE); + + gtk_menu_item_set_submenu (GTK_MENU_ITEM (menuitem), create_menu (depth - 1, TRUE)); + + g_free (buf); + inc (j); + end; + + create_menu := menu; +end; + +function do_menus : PGtkWidget; +var + box1, + box2, + button, + optionmenu, + separator, + menubar, + menu, + menuitem : PGtkWidget; + + accel_group : PGtkAccelGroup; + +begin + if menu_window = NULL then + begin + menu_window := gtk_window_new (GTK_WINDOW_TOPLEVEL); + + g_signal_connect (menu_window, 'destroy', + G_CALLBACK(@gtk_widget_destroyed), @menu_window); + g_signal_connect (menu_window, 'delete-event', + G_CALLBACK (@gtk_true), NULL); + + accel_group := gtk_accel_group_new (); + gtk_window_add_accel_group (GTK_WINDOW (menu_window), accel_group); + + gtk_window_set_title (GTK_WINDOW (menu_window), 'Menus'); + gtk_container_set_border_width (GTK_CONTAINER (menu_window), 0); + + + box1 := gtk_vbox_new (FALSE, 0); + gtk_container_add (GTK_CONTAINER (menu_window), box1); + gtk_widget_show (box1); + + menubar := gtk_menu_bar_new (); + gtk_box_pack_start (GTK_BOX (box1), menubar, FALSE, TRUE, 0); + gtk_widget_show (menubar); + + menu := create_menu (2, TRUE); + + menuitem := gtk_menu_item_new_with_label ('test'#13#10'line2'); + gtk_menu_item_set_submenu (GTK_MENU_ITEM (menuitem), menu); + gtk_menu_shell_append (GTK_MENU_SHELL (menubar), menuitem); + gtk_widget_show (menuitem); + + menuitem := gtk_menu_item_new_with_label ('foo'); + gtk_menu_item_set_submenu (GTK_MENU_ITEM (menuitem), create_menu (3, TRUE)); + gtk_menu_shell_append (GTK_MENU_SHELL (menubar), menuitem); + gtk_widget_show (menuitem); + + menuitem := gtk_menu_item_new_with_label ('bar'); + gtk_menu_item_set_submenu (GTK_MENU_ITEM (menuitem), create_menu (4, TRUE)); + gtk_menu_item_set_right_justified (GTK_MENU_ITEM (menuitem), TRUE); + gtk_menu_shell_append (GTK_MENU_SHELL (menubar), menuitem); + gtk_widget_show (menuitem); + + box2 := gtk_vbox_new (FALSE, 10); + gtk_container_set_border_width (GTK_CONTAINER (box2), 10); + gtk_box_pack_start (GTK_BOX (box1), box2, TRUE, TRUE, 0); + gtk_widget_show (box2); + + menu := create_menu (1, FALSE); + gtk_menu_set_accel_group (GTK_MENU (menu), accel_group); + + menuitem := gtk_separator_menu_item_new (); + gtk_menu_shell_append (GTK_MENU_SHELL (menu), menuitem); + gtk_widget_show (menuitem); + + menuitem := gtk_check_menu_item_new_with_label ('Accelerate Me'); + gtk_menu_shell_append (GTK_MENU_SHELL (menu), menuitem); + gtk_widget_show (menuitem); + gtk_widget_add_accelerator (menuitem, + 'activate', + accel_group, + GDK_KEY_F1, + 0, + GTK_ACCEL_VISIBLE); + + menuitem := gtk_check_menu_item_new_with_label ('Accelerator Locked'); + gtk_menu_shell_append (GTK_MENU_SHELL (menu), menuitem); + gtk_widget_show (menuitem); + gtk_widget_add_accelerator (menuitem, + 'activate', + accel_group, + GDK_KEY_F2, + 0, + GTK_ACCEL_VISIBLE or GTK_ACCEL_LOCKED); + + menuitem := gtk_check_menu_item_new_with_label ('Accelerators Frozen'); + gtk_menu_shell_append (GTK_MENU_SHELL (menu), menuitem); + gtk_widget_show (menuitem); + gtk_widget_add_accelerator (menuitem, + 'activate', + accel_group, + GDK_KEY_F2, + 0, + GTK_ACCEL_VISIBLE); + + gtk_widget_add_accelerator (menuitem, + 'activate', + accel_group, + GDK_KEY_F3, + 0, + GTK_ACCEL_VISIBLE); + + optionmenu := gtk_option_menu_new (); + gtk_option_menu_set_menu (GTK_OPTION_MENU (optionmenu), menu); + gtk_option_menu_set_history (GTK_OPTION_MENU (optionmenu), 3); + gtk_box_pack_start (GTK_BOX (box2), optionmenu, TRUE, TRUE, 0); + gtk_widget_show (optionmenu); + + separator := gtk_hseparator_new (); + gtk_box_pack_start (GTK_BOX (box1), separator, FALSE, TRUE, 0); + gtk_widget_show (separator); + + box2 := gtk_vbox_new (FALSE, 10); + gtk_container_set_border_width (GTK_CONTAINER (box2), 10); + gtk_box_pack_start (GTK_BOX (box1), box2, FALSE, TRUE, 0); + gtk_widget_show (box2); + + button := gtk_button_new_with_label ('close'); + g_signal_connect_swapped (button, 'clicked', + G_CALLBACK(@gtk_widget_destroy), menu_window); + + gtk_box_pack_start (GTK_BOX (box2), button, TRUE, TRUE, 0); + GTK_WIDGET_SET_FLAGS (button, GTK_CAN_DEFAULT); + gtk_widget_grab_default (button); + gtk_widget_show (button); + end; + + if not GTK_WIDGET_VISIBLE (menu_window) then + gtk_widget_show (menu_window) + else begin + gtk_widget_destroy (menu_window); + menu_window := NULL; + end; + + do_menus := menu_window; +end; diff --git a/packages/gtk2/examples/gtk_demo/panes.inc b/packages/gtk2/examples/gtk_demo/panes.inc new file mode 100644 index 0000000000..5fb1080c41 --- /dev/null +++ b/packages/gtk2/examples/gtk_demo/panes.inc @@ -0,0 +1,212 @@ +(* Paned Widgets + * + * The GtkHPaned and GtkVPaned Widgets divide their content + * area into two panes with a divider in between that the + * user can adjust. A separate child is placed into each + * pane. + * + * There are a number of options that can be set for each pane. + * This test contains both a horizontal (HPaned) and a vertical + * (VPaned) widget, and allows you to adjust the options for + * each side of each widget. + *) + +var + panes_window : PGtkWidget; + + +procedure toggle_resize (widget : PGtkWidget; + child : PGtkWidget); cdecl; +var + paned : PGtkPaned; + is_child1, + resize, + shrink : gboolean; + +begin + paned := PGtkPaned (child^.parent); + is_child1 := (child = paned^.child1); + + if is_child1 then + begin + resize := child1_resize (paned^) <> 0; + shrink := child1_shrink (paned^) <> 0; + end else + begin + resize := child2_resize (paned^) <> 0; + shrink := child2_shrink (paned^) <> 0; + end; + + gtk_widget_ref (child); + gtk_container_remove (pGtkContainer (child^.parent), child); + + if is_child1 then + gtk_paned_pack1 (paned, child, not resize, shrink) + else + gtk_paned_pack2 (paned, child, not resize, shrink); + + gtk_widget_unref (child); +end; + + + +procedure toggle_shrink (widget : PGtkWidget; + child : PGtkWidget); cdecl; +var + paned : PGtkPaned; + is_child1, + resize, + shrink : gboolean; + +begin + paned := PGtkPaned (child^.parent); + is_child1 := (child = paned^.child1); + + if is_child1 then + begin + resize := child1_resize (paned^) <> 0; + shrink := child1_shrink (paned^) <> 0; + end else + begin + resize := child2_resize (paned^) <> 0; + shrink := child2_shrink (paned^) <> 0; + end; + + gtk_widget_ref (child); + gtk_container_remove (pGtkContainer (child^.parent), child); + if is_child1 then + gtk_paned_pack1 (paned, child, resize, not shrink) + else + gtk_paned_pack2 (paned, child, resize, not shrink); + + gtk_widget_unref (child); +end; + +function create_pane_options (paned : PGtkPaned; + frame_label : pgchar; + label1 : pgchar; + label2 : pgchar): PGtkWidget; cdecl; +var + frame, + table, + thelabel, + check_button : PGtkWidget; + +begin + frame := gtk_frame_new (frame_label); + gtk_container_set_border_width (pGtkContainer(frame), 4); + + table := gtk_table_new (3, 2, TRUE); + gtk_container_add (pGtkContainer(frame), table); + + thelabel := gtk_label_new (label1); + gtk_table_attach_defaults (pGtkTable(table), thelabel, 0, 1, 0, 1); + + check_button := gtk_check_button_new_with_mnemonic ('_Resize'); + gtk_table_attach_defaults (pGtkTable(table), check_button, 0, 1, 1, 2); + + g_signal_connect (check_button, 'toggled', + TGCallback (@toggle_resize), paned^.child1); + + check_button := gtk_check_button_new_with_mnemonic ('_Shrink'); + gtk_table_attach_defaults (pGtkTable(table), check_button, 0, 1, 2, 3); + + gtk_toggle_button_set_active (pGtkToggleButton(check_button), TRUE); + + g_signal_connect (check_button, 'toggled', TGCallback(@toggle_shrink), paned^.child1); + + thelabel := gtk_label_new (label2); + gtk_table_attach_defaults (pGtkTable(table), thelabel, 1, 2, 0, 1); + + check_button := gtk_check_button_new_with_mnemonic ('_Resize'); + gtk_table_attach_defaults (pGtkTable(table), check_button, 1, 2, 1, 2); + + gtk_toggle_button_set_active (pGtkToggleButton(check_button), TRUE); + + g_signal_connect (check_button, 'toggled', TGCallback(@toggle_resize), paned^.child2); + + check_button := gtk_check_button_new_with_mnemonic ('_Shrink'); + gtk_table_attach_defaults (pGtkTable(table), check_button, 1, 2, 2, 3); + + gtk_toggle_button_set_active (pGtkToggleButton(check_button), TRUE); + g_signal_connect (check_button, 'toggled', TGCallback(@toggle_shrink), paned^.child2); + + create_pane_options := frame; +end; + +function do_panes : PGtkWidget; +var + frame, + hpaned, + vpaned, + button, + vbox : PGtkWidget; + +begin + if panes_window = NULL then + begin + panes_window := gtk_window_new (GTK_WINDOW_TOPLEVEL); + + g_signal_connect (panes_window, 'destroy', + TGCallback(@gtk_widget_destroyed), @panes_window); + + gtk_window_set_title (pGtkWindow(panes_window), 'Panes'); + gtk_container_set_border_width (pGtkContainer(panes_window), 0); + + vbox := gtk_vbox_new (FALSE, 0); + gtk_container_add (pGtkContainer(panes_window), vbox); + + vpaned := gtk_vpaned_new (); + gtk_box_pack_start (pGtkBox(vbox), vpaned, TRUE, TRUE, 0); + gtk_container_set_border_width (pGtkContainer(vpaned), 5); + + hpaned := gtk_hpaned_new (); + gtk_paned_add1 (pGtkPaned(vpaned), hpaned); + + frame := gtk_frame_new (NULL); + gtk_frame_set_shadow_type (pGtkFrame(frame), GTK_SHADOW_IN); + gtk_widget_set_size_request (frame, 60, 60); + gtk_paned_add1 (pGtkPaned(hpaned), frame); + + button := gtk_button_new_with_mnemonic ('_Hi there'); + gtk_container_add (pGtkContainer(frame), button); + + frame := gtk_frame_new (NULL); + gtk_frame_set_shadow_type (pGtkFrame(frame), GTK_SHADOW_IN); + gtk_widget_set_size_request (frame, 80, 60); + gtk_paned_add2 (pGtkPaned(hpaned), frame); + + frame := gtk_frame_new (NULL); + gtk_frame_set_shadow_type (pGtkFrame(frame), GTK_SHADOW_IN); + gtk_widget_set_size_request (frame, 60, 80); + gtk_paned_add2 (pGtkPaned(vpaned), frame); + + (* Now create toggle buttons to control sizing *) + + gtk_box_pack_start (pGtkBox(vbox), + create_pane_options (pGtkPaned(hpaned), + 'Horizontal', + 'Left', + 'Right'), + FALSE, FALSE, 0); + + gtk_box_pack_start (pGtkBox(vbox), + create_pane_options (pGtkPaned(vpaned), + 'Vertical', + 'Top', + 'Bottom'), + FALSE, FALSE, 0); + + gtk_widget_show_all (vbox); + end; + + if not GTK_WIDGET_VISIBLE (panes_window) then + gtk_widget_show (panes_window) + else begin + gtk_widget_destroy (panes_window); + panes_window := NULL; + end; + + do_panes := panes_window; +end; + diff --git a/packages/gtk2/examples/gtk_demo/pixbufs.inc b/packages/gtk2/examples/gtk_demo/pixbufs.inc new file mode 100644 index 0000000000..dadac90334 --- /dev/null +++ b/packages/gtk2/examples/gtk_demo/pixbufs.inc @@ -0,0 +1,293 @@ +(* Pixbufs + * + * A GdkPixbuf represents an image, normally in RGB or RGBA format. + * Pixbufs are normally used to load files from disk and perform + * image scaling. + * + * This demo is not all that educational, but looks cool. It was written + * by Extreme Pixbuf Hacker Federico Mena Quintero. It also shows + * off how to use GtkDrawingArea to do a simple animation. + * + * Look at the Image demo for additional pixbuf usage examples. + * + *) + + +const + FRAME_DELAY = 50; + + BACKGROUND_NAME = 'background.jpg'; + + image_names : array [1..8] of pchar = ( + 'apple-red.png', + 'gnome-applets.png', + 'gnome-calendar.png', + 'gnome-foot.png', + 'gnome-gmush.png', + 'gnome-gimp.png', + 'gnome-gsame.png', + 'gnu-keys.png'); + + N_IMAGES = high(image_names); + +(* demo window *) +var + pixbufs_window : PGtkWidget; + +(* Current frame *) + pixbufs_frame : PGdkPixbuf; + +(* Background image *) + pixbufs_background : PGdkPixbuf; + + pixbufs_back_width, + pixbufs_back_height : gint; + + +(* Images *) + images : array [1..N_IMAGES] of PGdkPixbuf; + +(* Widgets *) + pixbufs_da : PGtkWidget; + +(* Loads the images for the demo and returns whether the operation succeeded *) +function load_pixbufs (error : PPGError): gboolean; +var + i : gint; + filename : pgchar; + +begin + + if pixbufs_background <> NULL then begin + load_pixbufs := TRUE; (* already loaded earlier *) + exit; + end; + + (* demo_find_file() looks in the the current directory first, + * so you can run gtk-demo without installing GTK, then looks + * in the location where the file is installed. + *) + + filename := demo_find_file (BACKGROUND_NAME, error); + if filename = NULL then begin + load_pixbufs := FALSE; (* note that "error" was filled in and returned *) + exit; + end; + + pixbufs_background := gdk_pixbuf_new_from_file (filename, error); + g_free (filename); + + if pixbufs_background = NULL then begin + load_pixbufs := FALSE; (* Note that "error" was filled with a GError *) + exit; + end; + + pixbufs_back_width := gdk_pixbuf_get_width (pixbufs_background); + pixbufs_back_height := gdk_pixbuf_get_height (pixbufs_background); + + for i := 1 to N_IMAGES do + begin + filename := demo_find_file (image_names[i], error); + + if filename = NULL then begin + load_pixbufs := FALSE; (* Note that "error" was filled with a GError *) + exit + end; + + images[i] := gdk_pixbuf_new_from_file (filename, error); + g_free (filename); + + if images[i] = NULL then begin + load_pixbufs := FALSE; (* Note that "error" was filled with a GError *) + exit; + end; + + end; + + load_pixbufs := TRUE; +end; + +(* Expose callback for the drawing area *) +function expose_cb (widget : PGtkWidget; + event : PGdkEventExpose; + data : gpointer): gint; cdecl; +var + pixels : pguchar; + rowstride : gint; + +begin + rowstride := gdk_pixbuf_get_rowstride (pixbufs_frame); + + pixels := gdk_pixbuf_get_pixels (pixbufs_frame) + rowstride * event^.area.y + event^.area.x * 3; + + gdk_draw_rgb_image_dithalign (widget^.window, + widget^.style^.black_gc, + event^.area.x, event^.area.y, + event^.area.width, event^.area.height, + GDK_RGB_DITHER_NORMAL, + pixels, rowstride, + event^.area.x, event^.area.y); + + expose_cb := 1; +end; + +const + CYCLE_LEN = 60; + +var + pixbufs_frame_num : integer; + + +(* Timeout handler to regenerate the frame *) +function timeout (data : gpointer): gboolean; cdecl; +var + f : double; + i : integer; + xmid, + ymid, + radius : double; + + ang, r, k : double; + + alpha, + xpos, ypos, + iw, ih : integer; + + r1, r2, + dest : TGdkRectangle; + + +begin + gdk_pixbuf_copy_area (pixbufs_background, 0, 0, pixbufs_back_width, + pixbufs_back_height, pixbufs_frame, 0, 0); + + f := double(pixbufs_frame_num mod CYCLE_LEN) / CYCLE_LEN; + + xmid := pixbufs_back_width / 2.0; + ymid := pixbufs_back_height / 2.0; + + + radius := min (ymid, xmid) / 2.0; + + for i := 1 to N_IMAGES do + begin + ang := 2.0 * G_PI * double (i / N_IMAGES) - f * 2.0 * G_PI; + + iw := gdk_pixbuf_get_width (images[i]); + ih := gdk_pixbuf_get_height (images[i]); + + r := radius + (radius / 3.0) * sin (f * 2.0 * G_PI); + + xpos := floor (xmid + r * cos (ang) - iw / 2.0 + 0.5); + ypos := floor (ymid + r * sin (ang) - ih / 2.0 + 0.5); + + if (i and 1) <> 0 then k:= sin (f * 2.0 * G_PI) + else k:= cos (f * 2.0 * G_PI); + + k := 2.0 * k * k; + k := MAX (0.25, k); + + r1.x := xpos; + r1.y := ypos; + r1.width := round(iw * k); + r1.height := round(ih * k); + + r2.x := 0; + r2.y := 0; + r2.width := pixbufs_back_width; + r2.height := pixbufs_back_height; + + if gdk_rectangle_intersect (@r1, @r2, @dest) then begin + if (i and 1) <> 0 then + alpha := round (MAX (127, abs (255 * sin (f * 2.0 * G_PI)))) + else + alpha := round (MAX (127, abs (255 * cos (f * 2.0 * G_PI)))); + + gdk_pixbuf_composite (images[i], + pixbufs_frame, + dest.x, dest.y, + dest.width, dest.height, + xpos, ypos, + k, k, + GDK_INTERP_NEAREST, + alpha); + end; + end; + + gtk_widget_queue_draw (pixbufs_da); + + inc(pixbufs_frame_num); + exit (TRUE); +end; + +var + pixbufs_timeout_id : guint; + +procedure pixbufs_cleanup_callback (_object : PGtkObject; + data : gpointer); cdecl; +begin + g_source_remove (pixbufs_timeout_id); + pixbufs_timeout_id := 0; +end; + + + +function do_pixbufs : PGtkWidget; +var + error : PGError; + dialog : PGtkWidget; + +begin + if pixbufs_window = NULL then + begin + + pixbufs_window := gtk_window_new (GTK_WINDOW_TOPLEVEL); + gtk_window_set_title (GTK_WINDOW (pixbufs_window), 'Pixbufs'); + gtk_window_set_resizable (GTK_WINDOW (pixbufs_window), FALSE); + + g_signal_connect (pixbufs_window, 'destroy', G_CALLBACK (@gtk_widget_destroyed), @pixbufs_window); + g_signal_connect (pixbufs_window, 'destroy', G_CALLBACK (@pixbufs_cleanup_callback), NULL); + + + error := NULL; + if not load_pixbufs (@error) then + begin + dialog := gtk_message_dialog_new (GTK_WINDOW (pixbufs_window), + GTK_DIALOG_DESTROY_WITH_PARENT, + GTK_MESSAGE_ERROR, + GTK_BUTTONS_CLOSE, + 'Failed to load an image: %s', + [error^.message]); + + g_error_free (error); + + g_signal_connect (dialog, 'response', + G_CALLBACK (@gtk_widget_destroy), NULL); + + gtk_widget_show (dialog); + end else + begin + gtk_widget_set_size_request (pixbufs_window, pixbufs_back_width, pixbufs_back_height); + + pixbufs_frame := gdk_pixbuf_new (GDK_COLORSPACE_RGB, FALSE, 8, pixbufs_back_width, pixbufs_back_height); + + pixbufs_da := gtk_drawing_area_new (); + + g_signal_connect (pixbufs_da, 'expose_event', + G_CALLBACK (@expose_cb), NULL); + + gtk_container_add (GTK_CONTAINER (pixbufs_window), pixbufs_da); + + pixbufs_timeout_id := gtk_timeout_add (FRAME_DELAY, @timeout, NULL); + end; + end; + + if not GTK_WIDGET_VISIBLE (pixbufs_window) then + gtk_widget_show_all (pixbufs_window) + else begin + gtk_widget_destroy (pixbufs_window); + pixbufs_window := NULL; + end; + + do_pixbufs := pixbufs_window; +end; diff --git a/packages/gtk2/examples/gtk_demo/sizegroup.inc b/packages/gtk2/examples/gtk_demo/sizegroup.inc new file mode 100644 index 0000000000..63357c5865 --- /dev/null +++ b/packages/gtk2/examples/gtk_demo/sizegroup.inc @@ -0,0 +1,182 @@ +(* Size Groups + * + * GtkSizeGroup provides a mechanism for grouping a number of + * widgets together so they all request the same amount of space. + * This is typically useful when you want a column of widgets to + * have the same size, but you can't use a GtkTable widget. + * + * Note that size groups only affect the amount of space requested, + * not the size that the widgets finally receive. If you want the + * widgets in a GtkSizeGroup to actually be the same size, you need + * to pack them in such a way that they get the size they request + * and not more. For example, if you are packing your widgets + * into a table, you would not include the GTK_FILL flag. + *) + +var + sg_window : PGtkWidget; + + +const + color_options : array [0..3] of pchar = ('Red', 'Green', 'Blue', NULL); + + dash_options : array [0..3] of pchar = ('Solid', 'Dashed', 'Dotted', NULL); + + end_options : array [0..3] of pchar = ('Square', 'Round', 'Arrow', NULL); + + +(* Convenience function to create an option menu holding a number of strings + *) + +function create_option_menu (strings : ppchar): PGtkWidget; +var + menu, + menu_item, + option_menu : PGtkWidget; + + str : ppchar; + +begin + menu := gtk_menu_new (); + + str := strings; + while str^ <> NULL do + begin + menu_item := gtk_menu_item_new_with_label ( str[0]); + gtk_widget_show (menu_item); + + gtk_menu_shell_append (pGtkMenuShell(menu), menu_item); + inc(str); + end; + + option_menu := gtk_option_menu_new (); + gtk_option_menu_set_menu (pGtkOptionMenu(option_menu), menu); + + create_option_menu := option_menu; +end; + +procedure add_row (table : PGtkTable; + row : integer; + size_group : PGtkSizeGroup; + label_text : pchar; + options : ppchar); +var + option_menu : PGtkWidget; + thelabel : PGtkWidget; + +begin + thelabel := gtk_label_new_with_mnemonic (label_text); + gtk_misc_set_alignment (pGtkMisc(thelabel), 0, 1); + gtk_table_attach (pGtkTable(table), thelabel, + 0, 1, row, row + 1, + GTK_EXPAND or GTK_FILL, 0, + 0, 0); + + option_menu := create_option_menu (options); + gtk_label_set_mnemonic_widget (pGtkLabel(thelabel), option_menu); + gtk_size_group_add_widget (size_group, option_menu); + gtk_table_attach (pGtkTable(table), option_menu, + 1, 2, row, row + 1, + 0, 0, + 0, 0); +end; + +procedure toggle_grouping (check_button : PGtkToggleButton; + size_group : PGtkSizeGroup); cdecl; +var + new_mode : TGtkSizeGroupMode; + +begin + (* GTK_SIZE_GROUP_NONE is not generally useful, but is useful + * here to show the effect of GTK_SIZE_GROUP_HORIZONTAL by + * contrast. + *) + + if gtk_toggle_button_get_active (check_button) then + new_mode := GTK_SIZE_GROUP_HORIZONTAL + else + new_mode := GTK_SIZE_GROUP_NONE; + + gtk_size_group_set_mode (size_group, new_mode); +end; + + + + +function do_sizegroup : PGtkWidget; +var + table, + frame, + vbox, + check_button : PGtkWidget; + + size_group : PGtkSizeGroup; + +begin + if sg_window = NULL then + begin + sg_window := gtk_dialog_new_with_buttons ('Size Groups', + NULL, 0, + GTK_STOCK_CLOSE, + [ GTK_RESPONSE_NONE, + NULL]); + + gtk_window_set_resizable (pGtkWindow(sg_window), FALSE); + + g_signal_connect (sg_window, 'response', + TGCallback(@gtk_widget_destroy), NULL); + g_signal_connect (sg_window, 'destroy', + TGCallback(@gtk_widget_destroyed), @sg_window); + + vbox := gtk_vbox_new (FALSE, 5); + gtk_box_pack_start (pGtkBox(pGtkDialog (sg_window)^.vbox), vbox, TRUE, TRUE, 0); + gtk_container_set_border_width (pGtkContainer(vbox), 5); + + size_group := gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL); + + (* Create one frame holding color options + *) + frame := gtk_frame_new ('Color Options'); + gtk_box_pack_start (pGtkBox(vbox), frame, TRUE, TRUE, 0); + + table := gtk_table_new (2, 2, FALSE); + gtk_container_set_border_width (pGtkContainer(table), 5); + gtk_table_set_row_spacings (pGtkTable(table), 5); + gtk_table_set_col_spacings (pGtkTable(table), 10); + gtk_container_add (pGtkContainer(frame), table); + + add_row (pGtkTable(table), 0, size_group, '_Foreground', @color_options[0]); + add_row (pGtkTable(table), 1, size_group, '_Background', @color_options[0]); + + (* And another frame holding line style options + *) + frame := gtk_frame_new ('Line Options'); + gtk_box_pack_start (pGtkBox(vbox), frame, FALSE, FALSE, 0); + + table := gtk_table_new (2, 2, FALSE); + gtk_container_set_border_width (pGtkContainer(table), 5); + gtk_table_set_row_spacings (pGtkTable(table), 5); + gtk_table_set_col_spacings (pGtkTable(table), 10); + gtk_container_add (pGtkContainer(frame), table); + + add_row (pGtkTable(table), 0, size_group, '_Dashing', @dash_options[0]); + add_row (pGtkTable(table), 1, size_group, '_Line ends', @end_options[0]); + + (* And a check button to turn grouping on and off *) + check_button := gtk_check_button_new_with_mnemonic ('_Enable grouping'); + gtk_box_pack_start (pGtkBox(vbox), check_button, FALSE, FALSE, 0); + + gtk_toggle_button_set_active (pGtkToggleButton(check_button), TRUE); + g_signal_connect (check_button, 'toggled', + TGCallback (@toggle_grouping), size_group); + end; + + if not GTK_WIDGET_VISIBLE (sg_window) then + gtk_widget_show_all (sg_window) + else begin + gtk_widget_destroy (sg_window); + sg_window := NULL; + end; + + do_sizegroup := sg_window; +end; diff --git a/packages/gtk2/examples/gtk_demo/stock_browser.inc b/packages/gtk2/examples/gtk_demo/stock_browser.inc new file mode 100644 index 0000000000..7db3908968 --- /dev/null +++ b/packages/gtk2/examples/gtk_demo/stock_browser.inc @@ -0,0 +1,551 @@ +(* Stock Item and Icon Browser + * + * This source code for this demo doesn't demonstrate anything + * particularly useful in applications. The purpose of the "demo" is + * just to provide a handy place to browse the available stock icons + * and stock items. + *) + +var + stock_window : PGtkWidget; + +type + PStockItemInfo = ^TStockItemInfo; + TStockItemInfo = record + id : pgchar; + item : TGtkStockItem; + small_icon : PGdkPixbuf; + macro : pgchar; + accel_str : pgchar; + end; + + +(* Make StockItemInfo a boxed type so we can automatically + * manage memory + *) + +procedure stock_item_info_free (info : PStockItemInfo); cdecl; +begin + g_free (info^.id); + g_free (info^.macro); + g_free (info^.accel_str); + if info^.small_icon <> NULL then + g_object_unref (pGObject(info^.small_icon)); + + g_free (info); +end; + +function stock_item_info_copy (src : PStockItemInfo): PStockItemInfo; cdecl; +var + info : PStockItemInfo; + +begin + info := g_malloc0 (sizeof(TStockItemInfo)); + info^.id := g_strdup (src^.id); + info^.macro := g_strdup (src^.macro); + info^.accel_str := g_strdup (src^.accel_str); + + info^.item := src^.item; + + info^.small_icon := src^.small_icon; + if info^.small_icon <> NULL then + g_object_ref (pGObject(info^.small_icon)); + + stock_item_info_copy := info; +end; + +var + StockItemInfoType : GType; + +function stock_item_info_get_type: GType; +begin + + if StockItemInfoType = 0 then + StockItemInfoType := g_boxed_type_register_static ('StockItemInfo', + TGBoxedCopyFunc(@stock_item_info_copy), + TGBoxedFreeFunc (@stock_item_info_free)); + + stock_item_info_get_type := StockItemInfoType; +end; + +function STOCK_ITEM_INFO_TYPE: GType; +begin + STOCK_ITEM_INFO_TYPE := stock_item_info_get_type; +end; + + +type + PStockItemDisplay = ^TStockItemDisplay; + TStockItemDisplay = record + type_label : PGtkWidget; + macro_label : PGtkWidget; + id_label : PGtkWidget; + label_accel_label : PGtkWidget; + icon_image : PGtkWidget; + end; + + +function id_to_macro (id : pgchar): pgchar; +var + macro : PGString; + cp : pgchar; + +begin + (* gtk-foo-bar -> GTK_STOCK_FOO_BAR *) + + macro := g_string_new (NULL); + cp := id; + + if StrLComp (cp, 'gtk-', 4) = 0 then + begin + g_string_append (macro, 'GTK_STOCK_'); + cp := cp + 4; + end; + + while cp[0] <> #0 do + begin + if cp[0] = '-' then + g_string_append_c (macro, '_') + else if g_ascii_islower (cp[0]) then + g_string_append_c (macro, g_ascii_toupper (cp[0])) + else + g_string_append_c (macro, cp[0]); + + inc(cp); + end; + + id_to_macro := g_string_free (macro, FALSE); +end; + +function CompareString (string1 : pgchar; + string2 : pgchar): gint; cdecl; +begin + CompareString := StrComp (string1, string2); // maped to strcomp +end; + + +function create_model : PGtkTreeModel; +var + store : PGtkListStore; + ids, + tmp_list : PGSList; + + info : TStockItemInfo; + item : TGtkStockItem; + iter : TGtkTreeIter; + icon_set : PGtkIconSet; + + sizes : PGtkIconSize; + i, n_sizes : gint; + size : TGtkIconSize; + + w, h : gint; + scaled : PGdkPixbuf; + +begin + store := gtk_list_store_new (1, [STOCK_ITEM_INFO_TYPE]); + + ids := gtk_stock_list_ids (); + ids := g_slist_sort (ids, TGCompareFunc (@CompareString)); + tmp_list := ids; + + while tmp_list <> NULL do + begin + info.id := tmp_list^.data; + + if gtk_stock_lookup (info.id, @item) then + info.item := item + else begin + info.item._label := NULL; + info.item.stock_id := NULL; + info.item.modifier := 0; + info.item.keyval := 0; + info.item.translation_domain := NULL; + end; + + (* only show icons for stock IDs that have default icons *) + icon_set := gtk_icon_factory_lookup_default (info.id); + if icon_set <> NULL then + begin + sizes := NULL; + n_sizes := 0; + + (* See what sizes this stock icon really exists at *) + gtk_icon_set_get_sizes (icon_set, @sizes, @n_sizes); + + (* Use menu size if it exists, otherwise first size found *) + size := sizes[0]; + i := 0; + while i < n_sizes do + begin + if sizes[i] = GTK_ICON_SIZE_MENU then + begin + size := GTK_ICON_SIZE_MENU; + break; + end; {of size[i] = GTK_ICON_SIZE_MENU} + inc(i); + end; {of while} + + g_free (sizes); + + info.small_icon := gtk_widget_render_icon (stock_window, info.id, size, NULL); + + if size <> GTK_ICON_SIZE_MENU then + begin + (* Make the result the proper size for our thumbnail *) + gtk_icon_size_lookup (GTK_ICON_SIZE_MENU, @w, @h); + + scaled := gdk_pixbuf_scale_simple (info.small_icon, + w, h, + GDK_INTERP_BILINEAR); + + g_object_unref (pGObject(info.small_icon)); + info.small_icon := scaled; + end; {of size <> GTK_ICON_SIZE_MENU} + end else {icon_set = NULL} + info.small_icon := NULL; + + if info.item.keyval <> 0 then + + info.accel_str := gtk_accelerator_name (info.item.keyval, + info.item.modifier) + + else + info.accel_str := g_strdup (''); + + + info.macro := id_to_macro (info.id); + + gtk_list_store_append (store, @iter); + gtk_list_store_set (store, @iter, [0, @info, -1]); + + g_free (info.macro); + g_free (info.accel_str); + + if info.small_icon <> NULL then + g_object_unref (pGObject(info.small_icon)); + + tmp_list := g_slist_next (tmp_list); + end; {of while tmp_list <> NULL} + + g_slist_foreach (ids, TGFunc(@g_free), NULL); + g_slist_free (ids); + + create_model := pGtkTreeModel(store); +end; + +(* Finds the largest size at which the given image stock id is + * available. This would not be useful for a normal application + *) + +function get_largest_size (id : pgchar): TGtkIconSize; +var + theset : PGtkIconSet; + sizes : PGtkIconSize; + n_sizes, + i : gint; + best_size : TGtkIconsize; + best_pixels : gint; + + width, + height : gint; + +begin + theset := gtk_icon_factory_lookup_default (id); + best_size := GTK_ICON_SIZE_INVALID; + best_pixels := 0; + + gtk_icon_set_get_sizes (theset, @sizes, @n_sizes); + + for i:=0 to n_sizes-1 do + begin + gtk_icon_size_lookup (sizes[i], @width, @height); + + if (width * height) > best_pixels then + begin + best_size := sizes[i]; + best_pixels := width * height; + end; {of if} + end; {of for} + + g_free (sizes); + + get_largest_size := best_size; +end; + +procedure selection_changed (selection : PGtkTreeSelection); cdecl; +var + treeview : PGtkTreeView; + display : PStockItemDisplay; + model : PGtkTreeModel; + iter : TGtkTreeIter; + + info : PStockItemInfo; + str : pgchar; + +begin + + treeview := gtk_tree_selection_get_tree_view (selection); + display := g_object_get_data (pGObject(treeview), 'stock-display'); + + if gtk_tree_selection_get_selected (selection, @model, @iter) then + begin + gtk_tree_model_get (model, @iter, [0, @info, -1]); + + if (info^.small_icon <> NULL) and (info^.item._label <> NULL) then + gtk_label_set_text (pGtkLabel(display^.type_label), 'Icon and Item') + else if info^.small_icon <> NULL then + gtk_label_set_text (pGtkLabel(display^.type_label), 'Icon Only') + else if info^.item._label <> NULL then + gtk_label_set_text (pGtkLabel(display^.type_label), 'Item Only') + else + gtk_label_set_text (pGtkLabel(display^.type_label), '???????'); + + gtk_label_set_text (pGtkLabel(display^.macro_label), info^.macro); + gtk_label_set_text (pGtkLabel(display^.id_label), info^.id); + + if info^.item._label <> NULL then + begin + str := g_strdup_printf ('%s %s', [info^.item._label, info^.accel_str] ); + gtk_label_set_text_with_mnemonic (pGtkLabel(display^.label_accel_label), str); + g_free (str); + end else + gtk_label_set_text (pGtkLabel(display^.label_accel_label), ''); + + if info^.small_icon <> NULL then + gtk_image_set_from_stock (pGtkImage(display^.icon_image), info^.id, + get_largest_size (info^.id)) + else + gtk_image_set_from_pixbuf (pGtkImage(display^.icon_image), NULL); + + stock_item_info_free (info); + end { of if gtk_tree_selection_get_selected } + else + begin + gtk_label_set_text (pGtkLabel(display^.type_label), 'No selected item'); + gtk_label_set_text (pGtkLabel(display^.macro_label), ''); + gtk_label_set_text (pGtkLabel(display^.id_label), ''); + gtk_label_set_text (pGtkLabel(display^.label_accel_label), ''); + gtk_image_set_from_pixbuf (pGtkImage(display^.icon_image), NULL); + end; +end; + +procedure macro_set_func_text (tree_column : PGtkTreeViewColumn; + cell : PGtkCellRenderer; + model : PGtkTreeModel; + iter : PGtkTreeIter; + data : gpointer); cdecl; +var + info : PStockItemInfo; + +begin + gtk_tree_model_get (model, iter, [0, @info, -1]); + + g_object_set (pGtkCellRenderer(cell), 'text', [info^.macro, NULL]); + + stock_item_info_free (info); +end; + +procedure macro_set_func_pixbuf (tree_column : PGtkTreeViewColumn; + cell : PGtkCellRenderer; + model : PGtkTreeModel; + iter : PGtkTreeIter; + data : gpointer); cdecl; +var + info : PStockItemInfo; + +begin + gtk_tree_model_get (model, iter, [0, @info, -1]); + + g_object_set (pGtkCellRenderer(cell), 'pixbuf', [info^.small_icon, NULL]); + + stock_item_info_free (info); +end; + +procedure id_set_func (tree_column : PGtkTreeViewColumn; + cell : PGtkCellRenderer; + model : PGtkTreeModel; + iter : PGtkTreeIter; + data : gpointer); cdecl; +var + info : PStockItemInfo; + +begin + gtk_tree_model_get (model, iter, [0, @info, -1]); + + g_object_set (pGtkCellRenderer(cell), 'text', [info^.id, NULL]); + + stock_item_info_free (info); +end; + +procedure accel_set_func (tree_column : PGtkTreeViewColumn; + cell : PGtkCellRenderer; + model : PGtkTreeModel; + iter : PGtkTreeIter; + data : gpointer); cdecl; +var + info : PStockItemInfo; + +begin + gtk_tree_model_get (model, iter, [0, @info, -1]); + + g_object_set (pGtkCellRenderer(cell),'text', [info^.accel_str, NULL]); + + stock_item_info_free (info); +end; + +procedure label_set_func (tree_column : PGtkTreeViewColumn; + cell : PGtkCellRenderer; + model : PGtkTreeModel; + iter : PGtkTreeIter; + data : gpointer); cdecl; +var + info : PStockItemInfo; + +begin + gtk_tree_model_get (model, iter, [0, @info, -1]); + + g_object_set (pGtkCellRenderer(cell), 'text', [info^.item._label, NULL]); + + stock_item_info_free (info); +end; + +function do_stock_browser : PGtkWidget; +var + frame, + vbox, + hbox, + sw, + treeview, + align : PGtkWidget; + model : PGtkTreeModel; + cell_renderer : PGtkCellRenderer; + display : PStockItemDisplay; + selection : PGtkTreeSelection; + column : PGtkTreeViewColumn; + +begin + if stock_window = NULL then + begin + stock_window := gtk_window_new (GTK_WINDOW_TOPLEVEL); + gtk_window_set_title (pGtkWindow(stock_window), 'Stock Icons and Items'); + gtk_window_set_default_size (pGtkWindow(stock_window), -1, 500); + + g_signal_connect (stock_window, 'destroy', TGCallback(@gtk_widget_destroyed), @stock_window); + gtk_container_set_border_width (pGtkContainer(stock_window), 8); + + hbox := gtk_hbox_new (FALSE, 8); + gtk_container_add (pGtkContainer(stock_window), hbox); + + sw := gtk_scrolled_window_new (NULL, NULL); + gtk_scrolled_window_set_policy (pGtkScrolledWindow(sw), + GTK_POLICY_NEVER, + GTK_POLICY_AUTOMATIC); + gtk_box_pack_start (pGtkBox(hbox), sw, FALSE, FALSE, 0); + + model := create_model (); + + treeview := gtk_tree_view_new_with_model (model); + + g_object_unref (pGObject(model)); + + gtk_container_add (pGtkContainer(sw), treeview); + + column := gtk_tree_view_column_new (); + gtk_tree_view_column_set_title (column, 'Macro'); + + cell_renderer := gtk_cell_renderer_pixbuf_new (); + gtk_tree_view_column_pack_start (column, + cell_renderer, + FALSE); + gtk_tree_view_column_set_cell_data_func (column, cell_renderer, + @macro_set_func_pixbuf, NULL, NULL); + cell_renderer := gtk_cell_renderer_text_new (); + gtk_tree_view_column_pack_start (column, + cell_renderer, + TRUE); + gtk_tree_view_column_set_cell_data_func (column, cell_renderer, + @macro_set_func_text, NULL, NULL); + + gtk_tree_view_append_column (pGtkTreeView(treeview), column); + + cell_renderer := gtk_cell_renderer_text_new (); + + gtk_tree_view_insert_column_with_data_func (pGtkTreeView(treeview), + -1, + 'Label', + cell_renderer, + @label_set_func, + NULL, + NULL); + + gtk_tree_view_insert_column_with_data_func (pGtkTreeView(treeview), + -1, + 'Accel', + cell_renderer, + @accel_set_func, + NULL, + NULL); + + gtk_tree_view_insert_column_with_data_func (pGtkTreeView(treeview), + -1, + 'ID', + cell_renderer, + @id_set_func, + NULL, + NULL); + + align := gtk_alignment_new (0.5, 0.0, 0.0, 0.0); + gtk_box_pack_end (pGtkBox(hbox), align, FALSE, FALSE, 0); + + frame := gtk_frame_new ('Selected Item'); + gtk_container_add (pGtkContainer(align), frame); + + vbox := gtk_vbox_new (FALSE, 8); + gtk_container_set_border_width (pGtkContainer(vbox), 4); + gtk_container_add (pGtkContainer(frame), vbox); + + display := g_malloc0 (sizeof(TStockItemDisplay)); + g_object_set_data_full (pGObject(treeview), + 'stock-display', + display, + @g_free); (* free display with treeview *) + + display^.type_label := gtk_label_new (NULL); + display^.macro_label := gtk_label_new (NULL); + display^.id_label := gtk_label_new (NULL); + display^.label_accel_label := gtk_label_new (NULL); + display^.icon_image := gtk_image_new_from_pixbuf (NULL); (* empty image *) + + gtk_box_pack_start (pGtkBox(vbox), display^.type_label, + FALSE, FALSE, 0); + + gtk_box_pack_start (pGtkBox(vbox), display^.icon_image, + FALSE, FALSE, 0); + + gtk_box_pack_start (pGtkBox(vbox), display^.label_accel_label, + FALSE, FALSE, 0); + gtk_box_pack_start (pGtkBox(vbox), display^.macro_label, + FALSE, FALSE, 0); + gtk_box_pack_start (pGtkBox(vbox), display^.id_label, + FALSE, FALSE, 0); + + selection := gtk_tree_view_get_selection (pGtkTreeView(treeview)); + gtk_tree_selection_set_mode (selection, GTK_SELECTION_SINGLE); + + g_signal_connect (pGObject(selection), + 'changed', + TGCallback(@selection_changed), + NULL); + end; + + if not GTK_WIDGET_VISIBLE (stock_window) then + gtk_widget_show_all (stock_window) + else begin + gtk_widget_destroy (stock_window); + stock_window := NULL; + end; + + do_stock_browser := stock_window; +end; + diff --git a/packages/gtk2/examples/gtk_demo/textview.inc b/packages/gtk2/examples/gtk_demo/textview.inc new file mode 100644 index 0000000000..0ffc316f75 --- /dev/null +++ b/packages/gtk2/examples/gtk_demo/textview.inc @@ -0,0 +1,643 @@ +// included by gt_demo.pas + +(* Text Widget + * + * The GtkTextView widget displays a GtkTextBuffer. One GtkTextBuffer + * can be displayed by multiple GtkTextViews. This demo has two views + * displaying a single buffer, and shows off the widget's text + * formatting features. + * + *) + +var + text_window, + text_egg_window : PGtkWidget; + +procedure easter_egg_callback (button : PGtkWidget; + data : gpointer); forward; cdecl; + +const + gray50_width = 2; + gray50_height = 2; + + gray50_bits: array [0..1] of char = (#2, #1); + +procedure create_tags (buffer : PGtkTextBuffer); +var + stipple : PGdkBitmap; + +begin + (* Create a bunch of tags. Note that it's also possible to + * create tags with gtk_text_tag_new() then add them to the + * tag table for the buffer, gtk_text_buffer_create_tag() is + * just a convenience function. Also note that you don't have + * to give tags a name; pass NULL for the name to create an + * anonymous tag. + * + * In any real app, another useful optimization would be to create + * a GtkTextTagTable in advance, and reuse the same tag table for + * all the buffers with the same tag set, instead of creating + * new copies of the same tags for every buffer. + * + * Tags are assigned default priorities in order of addition to the + * tag table. That is, tags created later that affect the same text + * property affected by an earlier tag will override the earlier + * tag. You can modify tag priorities with + * gtk_text_tag_set_priority(). + *) + + gtk_text_buffer_create_tag (buffer, 'heading', + 'weight', [ PANGO_WEIGHT_BOLD, + 'size', 15 * PANGO_SCALE, + NULL] ); + + gtk_text_buffer_create_tag (buffer, 'italic', + 'style', [PANGO_STYLE_ITALIC, NULL]); + + gtk_text_buffer_create_tag (buffer, 'bold', + 'weight', [ PANGO_WEIGHT_BOLD, NULL] ); + + gtk_text_buffer_create_tag (buffer, 'big', + (* points times the PANGO_SCALE factor *) + 'size', [ 20 * PANGO_SCALE, NULL] ); + + gtk_text_buffer_create_tag (buffer, 'xx-small', + 'scale',[ PANGO_SCALE_XX_SMALL, NULL] ); + + gtk_text_buffer_create_tag (buffer, 'x-large', + 'scale', [ PANGO_SCALE_X_LARGE, NULL] ); + + gtk_text_buffer_create_tag (buffer, 'monospace', + 'family', [ 'monospace', NULL]); + + gtk_text_buffer_create_tag (buffer, 'blue_foreground', + 'foreground', [ 'blue', NULL] ); + + gtk_text_buffer_create_tag (buffer, 'red_background', + 'background', [ 'red', NULL] ); + + stipple := gdk_bitmap_create_from_data (NULL, + gray50_bits, gray50_width, + gray50_height); + + gtk_text_buffer_create_tag (buffer, 'background_stipple', + 'background_stipple',[ stipple, NULL] ); + + gtk_text_buffer_create_tag (buffer, 'foreground_stipple', + 'foreground_stipple', [stipple, NULL]); + + g_object_unref (pGObject(stipple)); + + gtk_text_buffer_create_tag (buffer, 'big_gap_before_line', + 'pixels_above_lines', [30, NULL]); + + gtk_text_buffer_create_tag (buffer, 'big_gap_after_line', + 'pixels_below_lines', [30, NULL]); + + gtk_text_buffer_create_tag (buffer, 'double_spaced_line', + 'pixels_inside_wrap', [10, NULL]); + + gtk_text_buffer_create_tag (buffer, 'not_editable', + 'editable', [FALSE, NULL]); + + gtk_text_buffer_create_tag (buffer, 'word_wrap', + 'wrap_mode', [GTK_WRAP_WORD, NULL]); + + gtk_text_buffer_create_tag (buffer, 'char_wrap', + 'wrap_mode', [GTK_WRAP_CHAR, NULL]); + + gtk_text_buffer_create_tag (buffer, 'no_wrap', + 'wrap_mode', [GTK_WRAP_NONE, NULL]); + + gtk_text_buffer_create_tag (buffer, 'center', + 'justification', [GTK_JUSTIFY_CENTER, NULL]); + + gtk_text_buffer_create_tag (buffer, 'right_justify', + 'justification', [GTK_JUSTIFY_RIGHT, NULL]); + + gtk_text_buffer_create_tag (buffer, 'wide_margins', + 'left_margin', [50, 'right_margin', 50, + NULL]); + + gtk_text_buffer_create_tag (buffer, 'strikethrough', + 'strikethrough', [TRUE, NULL]); + + gtk_text_buffer_create_tag (buffer, 'underline', + 'underline', [PANGO_UNDERLINE_SINGLE, NULL]); + + gtk_text_buffer_create_tag (buffer, 'double_underline', + 'underline', [PANGO_UNDERLINE_DOUBLE, NULL]); + + gtk_text_buffer_create_tag (buffer, 'superscript', + 'rise', [10 * PANGO_SCALE, (* 10 pixels *) + 'size', 8 * PANGO_SCALE, (* 8 points *) + NULL]); + + gtk_text_buffer_create_tag (buffer, 'subscript', + 'rise', [-10 * PANGO_SCALE, (* 10 pixels *) + 'size', 8 * PANGO_SCALE, (* 8 points *) + NULL]); + + gtk_text_buffer_create_tag (buffer, 'rtl_quote', + 'wrap_mode', [ GTK_WRAP_WORD, + 'direction', GTK_TEXT_DIR_RTL, + 'indent', 30, + 'left_margin', 20, + 'right_margin', 20, + NULL]); +end; + +procedure insert_text (buffer : PGtkTextBuffer); +var + iter, + text_start, + text_end : TGtkTextIter; + pixbuf, + scaled : PGdkPixbuf; + filename : pchar; + +begin + (* demo_find_file() looks in the the current directory first, + * so you can run gtk-demo without installing GTK, then looks + * in the location where the file is installed. + *) + pixbuf := NULL; + filename := demo_find_file ('gtk-logo-rgb.gif', NULL); + + if filename <> NULL then + begin + pixbuf := gdk_pixbuf_new_from_file (filename, NULL); + g_free (filename); + end; + + if pixbuf = NULL then + begin + g_error ('Failed to load image file gtk-logo-rgb.gif'#13#10); + exit; + end; + + scaled := gdk_pixbuf_scale_simple (pixbuf, 32, 32, GDK_INTERP_BILINEAR); + g_object_unref (pGObject(pixbuf)); + pixbuf := scaled; + + (* get start of buffer; each insertion will revalidate the + * iterator to point to just after the inserted text. + *) + gtk_text_buffer_get_iter_at_offset (buffer, @iter, 0); + + gtk_text_buffer_insert (buffer, @iter, + 'The text widget can display text with all kinds of nifty attributes. ' + + 'It also supports multiple views of the same buffer; ' + + 'this demo is showing the same buffer in two places.'#13#10#13#10, -1); + + gtk_text_buffer_insert_with_tags_by_name (buffer, @iter, 'Font styles. ', -1, + 'heading'); + + gtk_text_buffer_insert (buffer, @iter, 'For example, you can have ', -1); + + gtk_text_buffer_insert_with_tags_by_name (buffer, @iter, + 'italic', -1, + 'italic'); // test: left out last argument " NULL " + gtk_text_buffer_insert (buffer, @iter, ', ', -1); + gtk_text_buffer_insert_with_tags_by_name (buffer, @iter, + 'bold', -1, + 'bold'); + gtk_text_buffer_insert (buffer, @iter, ', or ', -1); + gtk_text_buffer_insert_with_tags_by_name (buffer, @iter, + 'monospace (typewriter)', -1, + 'monospace'); + gtk_text_buffer_insert (buffer, @iter, ', or ', -1); + gtk_text_buffer_insert_with_tags_by_name (buffer, @iter, + 'big', -1, + 'big'); + gtk_text_buffer_insert (buffer, @iter, ' text. ', -1); + gtk_text_buffer_insert (buffer, @iter, + 'It''s best not to hardcode specific text sizes; ' + + 'you can use relative sizes as with CSS, such as ', -1); + + gtk_text_buffer_insert_with_tags_by_name (buffer, @iter, + 'xx-small', -1, + 'xx-small'); + gtk_text_buffer_insert (buffer, @iter, ' or ', -1); + gtk_text_buffer_insert_with_tags_by_name (buffer, @iter, + 'x-large', -1, + 'x-large'); + gtk_text_buffer_insert (buffer, @iter, + ' to ensure that your program properly adapts if the user ' + + ' changes the default font size.'#13#10#13#10, -1); + + gtk_text_buffer_insert_with_tags_by_name (buffer, @iter, 'Colors. ', -1, + 'heading'); + + gtk_text_buffer_insert (buffer, @iter, 'Colors such as ', -1); + gtk_text_buffer_insert_with_tags_by_name (buffer, @iter, + 'a blue foreground', -1, + 'blue_foreground'); + gtk_text_buffer_insert (buffer, @iter, ' or ', -1); + gtk_text_buffer_insert_with_tags_by_name (buffer, @iter, + 'a red background', -1, + 'red_background'); + gtk_text_buffer_insert (buffer, @iter, ' or even ', -1); + gtk_text_buffer_insert_with_tags_by_name (buffer, @iter, + 'a stippled red background', -1, + 'red_background', + ['background_stipple', + NULL]); + + gtk_text_buffer_insert (buffer, @iter, ' or ', -1); + gtk_text_buffer_insert_with_tags_by_name (buffer, @iter, + 'a stippled blue foreground on solid red background', -1, + 'blue_foreground', + ['red_background', + 'foreground_stipple', + NULL]); + gtk_text_buffer_insert (buffer, @iter, ' (select that to read it) can be used.'#13#10#13#10, -1); + + gtk_text_buffer_insert_with_tags_by_name (buffer, @iter, 'Underline, strikethrough, and rise. ', -1, + 'heading'); + + gtk_text_buffer_insert_with_tags_by_name (buffer, @iter, + 'Strikethrough', -1, + 'strikethrough'); + gtk_text_buffer_insert (buffer, @iter, ', ', -1); + gtk_text_buffer_insert_with_tags_by_name (buffer, @iter, + 'underline', -1, + 'underline'); + gtk_text_buffer_insert (buffer, @iter, ', ', -1); + gtk_text_buffer_insert_with_tags_by_name (buffer, @iter, + 'double underline', -1, + 'double_underline'); + gtk_text_buffer_insert (buffer, @iter, ', ', -1); + gtk_text_buffer_insert_with_tags_by_name (buffer, @iter, + 'superscript', -1, + 'superscript'); + gtk_text_buffer_insert (buffer, @iter, ', and ', -1); + gtk_text_buffer_insert_with_tags_by_name (buffer, @iter, + 'subscript', -1, + 'subscript'); + gtk_text_buffer_insert (buffer, @iter, ' are all supported.'#13#10#13#10, -1); + + gtk_text_buffer_insert_with_tags_by_name (buffer, @iter, 'Images. ', -1, + 'heading'); + + gtk_text_buffer_insert (buffer, @iter, 'The buffer can have images in it: ', -1); + gtk_text_buffer_insert_pixbuf (buffer, @iter, pixbuf); + gtk_text_buffer_insert_pixbuf (buffer, @iter, pixbuf); + gtk_text_buffer_insert_pixbuf (buffer, @iter, pixbuf); + gtk_text_buffer_insert (buffer, @iter, ' for example.'#13#10, -1); + + gtk_text_buffer_insert_with_tags_by_name (buffer, @iter, 'Spacing. ', -1, + 'heading', [NULL]); + + gtk_text_buffer_insert (buffer, @iter, 'You can adjust the amount of space before each line.'#13#10, -1); + + gtk_text_buffer_insert_with_tags_by_name (buffer, @iter, + 'This line has a whole lot of space before it.'#13#10, -1, + 'big_gap_before_line', ['wide_margins', NULL]); + gtk_text_buffer_insert_with_tags_by_name (buffer, @iter, + 'You can also adjust the amount of space after each line; ' + + 'this line has a whole lot of space after it.'#13#10, -1, + 'big_gap_after_line', ['wide_margins', NULL]); + + gtk_text_buffer_insert_with_tags_by_name (buffer, @iter, + 'You can also adjust the amount of space between wrapped lines; ' + + 'this line has extra space between each wrapped line in the same paragraph. ' + + 'To show off wrapping, some filler text: the quick brown fox jumped over ' + + 'the lazy dog. Blah blah blah blah blah blah blah blah blah.'#13#10, -1, + 'double_spaced_line', ['wide_margins', NULL]); + + gtk_text_buffer_insert (buffer, @iter, 'Also note that those lines have extra-wide margins.'#13#10#13#10, -1); + + gtk_text_buffer_insert_with_tags_by_name (buffer, @iter, 'Editability. ', -1, + 'heading', [NULL]); + + gtk_text_buffer_insert_with_tags_by_name (buffer, @iter, + 'This line is ''locked down'' and can''t be edited by the user - ' + + 'just try it! You can''t delete this line.'#13#10#13#10, -1, + 'not_editable', [NULL]); + + gtk_text_buffer_insert_with_tags_by_name (buffer, @iter, 'Wrapping. ', -1, + 'heading', [NULL]); + + gtk_text_buffer_insert (buffer, @iter, + 'This line (and most of the others in this buffer) is word-wrapped, ' + + 'using the proper Unicode algorithm. Word wrap should work in all ' + + 'scripts and languages that GTK+ supports. Let''s make this a long ' + + 'paragraph to demonstrate: blah blah blah blah blah blah blah blah ' + + 'blah blah blah blah blah blah blah blah blah blah blah'#13#10#13#10, -1); + + gtk_text_buffer_insert_with_tags_by_name (buffer, @iter, + 'This line has character-based wrapping, and can wrap between ' + + 'any two character glyphs. Let''s make this a long paragraph to ' + + 'demonstrate: blah blah blah blah blah blah blah blah blah blah ' + + 'blah blah blah blah blah blah blah blah blah'#13#10#13#10, -1, + 'char_wrap', [NULL]); + + gtk_text_buffer_insert_with_tags_by_name (buffer, @iter, PChar( + 'This line has all wrapping turned off, so it makes the horizontal ' + + 'scrollbar appear.'#13#10#13#10#13#10), -1, + 'no_wrap', [NULL]); + + gtk_text_buffer_insert_with_tags_by_name (buffer, @iter, 'Justification. ', -1, + 'heading', [NULL]); + + gtk_text_buffer_insert_with_tags_by_name (buffer, @iter, + #13#10'This line has center justification.'#13#10, -1, + 'center', [NULL]); + + gtk_text_buffer_insert_with_tags_by_name (buffer, @iter, + 'This line has right justification.'#13#10, -1, + 'right_justify', [NULL]); + + gtk_text_buffer_insert_with_tags_by_name (buffer, @iter, + #13#10'This line has big wide margins. Text text text text text text ' + + 'text text text text text text text text text text text text text text ' + + 'text text text text text text text text text text text text text text ' + + 'text text.'#13#10, -1,'wide_margins', [NULL]); + + gtk_text_buffer_insert_with_tags_by_name (buffer, @iter, 'Internationalization. ', -1, + 'heading', [NULL]); + + gtk_text_buffer_insert (buffer, @iter, + 'You can put all sorts of Unicode text in the buffer.'#13#10#13#10 + + 'German (Deutsch Süd) Grüß Gott'#13#10 + + 'Greek (Ελληνικά) Γειά σας'#13#10 + + 'Hebrew שלום'#13#10 + + 'Japanese (日本語)'#13#10#13#10 + + 'The widget properly handles bidirectional text, word wrapping, ' + + 'DOS/UNIX/Unicode paragraph separators, grapheme boundaries, ' + + 'and so on using the Pango internationalization framework.'#13#10, -1); + + gtk_text_buffer_insert (buffer, @iter, 'Here''s a word-wrapped quote in a right-to-left language:'#13#10, -1); + gtk_text_buffer_insert_with_tags_by_name (buffer, @iter, + 'وقد بدأ ثلاث من أكثر المؤسسات تقدما في ' + + 'شبكة اكسيون برامجها كمنظمات لا تسعى للربح، ' + + 'ثم تحولت في السنوات الخمس الماضية إلى مؤسسات ' + + 'مالية منظمة، وباتت جزءا من النظام المالي في ' + + 'بلدانها، ولكنها تتخصص في خدمة قطاع المشروعات الصغيرة. ' + + 'وأحد أكثر هذه المؤسسات نجاحا هو »بانكوسول« ' + + 'في بوليفيا.'#13#10#13#10, -1, + 'rtl_quote', [NULL]); + + gtk_text_buffer_insert (buffer, @iter, 'You can put widgets in the buffer: Here''s a button: ', -1); + gtk_text_buffer_create_child_anchor (buffer, @iter); + gtk_text_buffer_insert (buffer, @iter, ' and a menu: ', -1); + gtk_text_buffer_create_child_anchor (buffer, @iter); + gtk_text_buffer_insert (buffer, @iter, ' and a scale: ', -1); + gtk_text_buffer_create_child_anchor (buffer, @iter); + gtk_text_buffer_insert (buffer, @iter, ' and an animation: ', -1); + gtk_text_buffer_create_child_anchor (buffer, @iter); + gtk_text_buffer_insert (buffer, @iter, ' finally a text entry: ', -1); + gtk_text_buffer_create_child_anchor (buffer, @iter); + gtk_text_buffer_insert (buffer, @iter, '.'#13#10, -1); + + gtk_text_buffer_insert (buffer, @iter, + #13#10#13#10'This demo doesn''t demonstrate all the GtkTextBuffer features; ' + + 'it leaves out, for example: invisible/hidden text (doesn''t work in GTK 2, but planned), ' + + 'tab stops, application-drawn areas on the sides of the widget for displaying breakpoints and such...', -1); + + (* Apply word_wrap tag to whole buffer *) + gtk_text_buffer_get_bounds (buffer, @text_start, @text_end); + gtk_text_buffer_apply_tag_by_name (buffer, 'word_wrap', @text_start, @text_end); + + g_object_unref (pGObject(pixbuf)); +end; + +function find_anchor (iter : PGtkTextIter): gboolean; cdecl; + +begin + while gtk_text_iter_forward_char (iter) do + begin + if gtk_text_iter_get_child_anchor (iter)<> NULL then + exit (TRUE); + end; +end; + +procedure attach_widgets (text_view : PGtkWidget); +var + iter : TGtkTextIter; + buffer : PGtkTextBuffer; + i : integer; + + anchor : PGtkTextChildAnchor; + widget, + menu, + menu_item : PGtkWidget; + + filename : pgchar; + +begin + buffer := gtk_text_view_get_buffer (pGtkTextView(text_view)); + + gtk_text_buffer_get_start_iter (buffer, @iter); + + i := 0; + while find_anchor (@iter) do + begin + anchor := gtk_text_iter_get_child_anchor (@iter); + + case i of + 0: begin + widget := gtk_button_new_with_label ('Click Me'); + + g_signal_connect (pGObject(widget), 'clicked', + TGCallback(@easter_egg_callback), + NULL); + end; + 1: begin + menu := gtk_menu_new (); + + widget := gtk_option_menu_new (); + + menu_item := gtk_menu_item_new_with_label ('Option 1'); + gtk_menu_shell_append (pGtkMenuShell(menu), menu_item); + + menu_item := gtk_menu_item_new_with_label ('Option 2'); + gtk_menu_shell_append (pGtkMenuShell(menu), menu_item); + + menu_item := gtk_menu_item_new_with_label ('Option 3'); + gtk_menu_shell_append (pGtkMenuShell(menu), menu_item); + + gtk_option_menu_set_menu (pGtkOptionMenu(widget), menu); + end; + 2: begin + widget := gtk_hscale_new (NULL); + gtk_range_set_range (pGtkRange(widget), 0, 100); + gtk_widget_set_size_request (widget, 70, -1); + end; + 3: begin + filename := demo_find_file ('floppybuddy.gif', NULL); + widget := gtk_image_new_from_file (filename); + g_free (filename); + end; + 4: begin + widget := gtk_entry_new (); + end; + else begin + widget := NULL; (* avoids a compiler warning *) + exit; + end; + end; {of case} + + if widget <> NULL then + begin + gtk_text_view_add_child_at_anchor (pGtkTextView(text_view), widget, anchor); + gtk_widget_show_all (widget); + end; + + inc(i); + end; {of while} +end; + + +function do_textview : PGtkWidget; +var + vpaned, + view1, + view2, + sw : PGtkWidget; + buffer : PGtkTextBuffer; + +begin + if text_window = NULL then + begin + text_window := gtk_window_new (GTK_WINDOW_TOPLEVEL); + gtk_window_set_default_size (pGtkWindow(text_window), 450, 450); + + g_signal_connect (text_window, 'destroy', + TGCallback(@gtk_widget_destroyed), @text_window); + + gtk_window_set_title (pGtkWindow(text_window), 'TextView'); + gtk_container_set_border_width (pGtkContainer(text_window), 0); + + vpaned := gtk_vpaned_new (); + gtk_container_set_border_width (pGtkContainer(vpaned), 5); + gtk_container_add (pGtkContainer(text_window), vpaned); + + (* For convenience, we just use the autocreated buffer from + * the first text view; you could also create the buffer + * by itself with gtk_text_buffer_new(), then later create + * a view widget. + *) + view1 := gtk_text_view_new (); + buffer := gtk_text_view_get_buffer (pGtkTextView(view1)); + view2 := gtk_text_view_new_with_buffer (buffer); + + sw := gtk_scrolled_window_new (NULL, NULL); + gtk_scrolled_window_set_policy (pGtkScrolledWindow(sw), + GTK_POLICY_AUTOMATIC, + GTK_POLICY_AUTOMATIC); + + gtk_paned_add1 (pGtkPaned(vpaned), sw); + + gtk_container_add (pGtkContainer(sw), view1); + + sw := gtk_scrolled_window_new (NULL, NULL); + gtk_scrolled_window_set_policy (pGtkScrolledWindow(sw), + GTK_POLICY_AUTOMATIC, + GTK_POLICY_AUTOMATIC); + gtk_paned_add2 (pGtkPaned(vpaned), sw); + + gtk_container_add (pGtkContainer(sw), view2); + + create_tags (buffer); + insert_text (buffer); + + attach_widgets (view1); + attach_widgets (view2); + + gtk_widget_show_all (vpaned); + end; + + if not GTK_WIDGET_VISIBLE (text_window) then + gtk_widget_show (text_window) + else begin + gtk_widget_destroy (text_window); + text_window := NULL; + end; + + do_textview := text_window; +end; + +procedure recursive_attach_view (depth : integer; + view : PGtkTextView; + anchor : PGtkTextChildAnchor); +var + child_view, + event_box, + align : PGtkWidget; + color : TGdkColor; + +begin + if depth > 4 then + exit; + + child_view := gtk_text_view_new_with_buffer (gtk_text_view_get_buffer (view)); + + (* Event box is to add a black border around each child view *) + event_box := gtk_event_box_new (); + gdk_color_parse ('black', @color); + gtk_widget_modify_bg (event_box, GTK_STATE_NORMAL, @color); + + align := gtk_alignment_new (0.5, 0.5, 1.0, 1.0); + gtk_container_set_border_width (pGtkContainer(align), 1); + + gtk_container_add (pGtkContainer(event_box), align); + gtk_container_add (pGtkContainer(align), child_view); + + gtk_text_view_add_child_at_anchor (view, event_box, anchor); + + recursive_attach_view (depth + 1, pGtkTextView(child_view), anchor); +end; + +procedure easter_egg_callback(button : PGtkWidget; + data : gpointer); cdecl; +var + sw, + view : PGtkWidget; + buffer : PGtkTextBuffer; + iter : TGtkTextIter; + anchor : PGtkTextChildAnchor; + +begin + if text_egg_window <> NULL then + begin + gtk_window_present (pGtkWindow(text_egg_window)); + exit; + end; + + buffer := gtk_text_buffer_new (NULL); + + gtk_text_buffer_get_start_iter (buffer, @iter); + + gtk_text_buffer_insert (buffer, @iter, + 'This buffer is shared by a set of nested text views.'#13#10'Nested view:'#13#10, -1); + anchor := gtk_text_buffer_create_child_anchor (buffer, @iter); + gtk_text_buffer_insert (buffer, @iter, + #13#10'Don''t do this in real applications, please.'#13#10, -1); + + view := gtk_text_view_new_with_buffer (buffer); + + recursive_attach_view (0, pGtkTextView(view), anchor); + + g_object_unref (pGObject(buffer)); + + text_egg_window := gtk_window_new (GTK_WINDOW_TOPLEVEL); + sw := gtk_scrolled_window_new (NULL, NULL); + gtk_scrolled_window_set_policy (pGtkScrolledWindow(sw), + GTK_POLICY_AUTOMATIC, + GTK_POLICY_AUTOMATIC); + + gtk_container_add (pGtkContainer(text_egg_window), sw); + gtk_container_add (pGtkContainer(sw), view); + + g_object_add_weak_pointer (pGObject(text_egg_window), + gpointer (@text_egg_window)); + + gtk_window_set_default_size (pGtkWindow(text_egg_window), 300, 400); + + gtk_widget_show_all (text_egg_window); +end; + +// included by gt_demo.pas + diff --git a/packages/gtk2/examples/gtk_demo/tree_store.inc b/packages/gtk2/examples/gtk_demo/tree_store.inc new file mode 100644 index 0000000000..dc9731c80f --- /dev/null +++ b/packages/gtk2/examples/gtk_demo/tree_store.inc @@ -0,0 +1,461 @@ +(* Tree View/Tree Store + * + * The GtkTreeStore is used to store data in tree form, to be + * used later on by a GtkTreeView to display it. This demo builds + * a simple GtkTreeStore and displays it. If you're new to the + * GtkTreeView widgets and associates, look into the GtkListStore + * example first. + * + *) + (* + * todo: translate to pascal + *) + +function do_tree_store : PGtkWidget; +begin + do_dummy ('Tree View / Tree Store - Demo'); + do_tree_store := NULL; +end; + + +(* +#include <gtk/gtk.h> + +static GtkWidget *window = NULL; + +/* TreeItem structure */ +typedef struct _TreeItem TreeItem; +struct _TreeItem +{ + const gchar *label; + gboolean alex; + gboolean havoc; + gboolean tim; + gboolean owen; + gboolean dave; + gboolean world_holiday; /* shared by the European hackers */ + TreeItem *children; +}; + +/* columns */ +enum +{ + HOLIDAY_NAME_COLUMN = 0, + ALEX_COLUMN, + HAVOC_COLUMN, + TIM_COLUMN, + OWEN_COLUMN, + DAVE_COLUMN, + + VISIBLE_COLUMN, + WORLD_COLUMN, + NUM_COLUMNS +}; + +/* tree data */ +static TreeItem january[] = +{ + {"New Years Day", TRUE, TRUE, TRUE, TRUE, FALSE, TRUE, NULL }, + {"Presidential Inauguration", FALSE, TRUE, FALSE, TRUE, FALSE, FALSE, NULL }, + {"Martin Luther King Jr. day", FALSE, TRUE, FALSE, TRUE, FALSE, FALSE, NULL }, + { NULL } +}; + +static TreeItem february[] = +{ + { "Presidents' Day", FALSE, TRUE, FALSE, TRUE, FALSE, FALSE, NULL }, + { "Groundhog Day", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, NULL }, + { "Valentine's Day", FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, NULL }, + { NULL } +}; + +static TreeItem march[] = +{ + { "National Tree Planting Day", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, NULL }, + { "St Patrick's Day", FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, NULL }, + { NULL } +}; +static TreeItem april[] = +{ + { "April Fools' Day", FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, NULL }, + { "Army Day", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, NULL }, + { "Earth Day", FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, NULL }, + { "Administrative Professionals' Day", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, NULL }, + { NULL } +}; + +static TreeItem may[] = +{ + { "Nurses' Day", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, NULL }, + { "National Day of Prayer", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, NULL }, + { "Mothers' Day", FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, NULL }, + { "Armed Forces Day", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, NULL }, + { "Memorial Day", TRUE, TRUE, TRUE, TRUE, FALSE, TRUE, NULL }, + { NULL } +}; + +static TreeItem june[] = +{ + { "June Fathers' Day", FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, NULL }, + { "Juneteenth (Liberation of Slaves)", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, NULL }, + { "Flag Day", FALSE, TRUE, FALSE, TRUE, FALSE, FALSE, NULL }, + { NULL } +}; + +static TreeItem july[] = +{ + { "Parents' Day", FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, NULL }, + { "Independence Day", FALSE, TRUE, FALSE, TRUE, FALSE, FALSE, NULL }, + { NULL } +}; + +static TreeItem august[] = +{ + { "Air Force Day", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, NULL }, + { "Coast Guard Day", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, NULL }, + { "Friendship Day", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, NULL }, + { NULL } +}; + +static TreeItem september[] = +{ + { "Grandparents' Day", FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, NULL }, + { "Citizenship Day or Constitution Day", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, NULL }, + { "Labor Day", TRUE, TRUE, TRUE, TRUE, FALSE, TRUE, NULL }, + { NULL } +}; + +static TreeItem october[] = +{ + { "National Children's Day", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, NULL }, + { "Bosses' Day", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, NULL }, + { "Sweetest Day", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, NULL }, + { "Mother-in-Law's Day", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, NULL }, + { "Navy Day", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, NULL }, + { "Columbus Day", FALSE, TRUE, FALSE, TRUE, FALSE, FALSE, NULL }, + { "Halloween", FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, NULL }, + { NULL } +}; + +static TreeItem november[] = +{ + { "Marine Corps Day", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, NULL }, + { "Veterans' Day", TRUE, TRUE, TRUE, TRUE, FALSE, TRUE, NULL }, + { "Thanksgiving", FALSE, TRUE, FALSE, TRUE, FALSE, FALSE, NULL }, + { NULL } +}; + +static TreeItem december[] = +{ + { "Pearl Harbor Remembrance Day", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, NULL }, + { "Christmas", TRUE, TRUE, TRUE, TRUE, FALSE, TRUE, NULL }, + { "Kwanzaa", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, NULL }, + { NULL } +}; + + +static TreeItem toplevel[] = +{ + {"January", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, january}, + {"February", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, february}, + {"March", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, march}, + {"April", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, april}, + {"May", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, may}, + {"June", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, june}, + {"July", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, july}, + {"August", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, august}, + {"September", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, september}, + {"October", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, october}, + {"November", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, november}, + {"December", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, december}, + {NULL} +}; + + +static GtkTreeModel * +create_model (void) +{ + GtkTreeStore *model; + GtkTreeIter iter; + TreeItem *month = toplevel; + + /* create tree store */ + model = gtk_tree_store_new (NUM_COLUMNS, + G_TYPE_STRING, + G_TYPE_BOOLEAN, + G_TYPE_BOOLEAN, + G_TYPE_BOOLEAN, + G_TYPE_BOOLEAN, + G_TYPE_BOOLEAN, + G_TYPE_BOOLEAN, + G_TYPE_BOOLEAN); + + /* add data to the tree store */ + while (month->label) + { + TreeItem *holiday = month->children; + + gtk_tree_store_append (model, &iter, NULL); + gtk_tree_store_set (model, &iter, + HOLIDAY_NAME_COLUMN, month->label, + ALEX_COLUMN, FALSE, + HAVOC_COLUMN, FALSE, + TIM_COLUMN, FALSE, + OWEN_COLUMN, FALSE, + DAVE_COLUMN, FALSE, + VISIBLE_COLUMN, FALSE, + WORLD_COLUMN, FALSE, + -1); + + /* add children */ + while (holiday->label) + { + GtkTreeIter child_iter; + + gtk_tree_store_append (model, &child_iter, &iter); + gtk_tree_store_set (model, &child_iter, + HOLIDAY_NAME_COLUMN, holiday->label, + ALEX_COLUMN, holiday->alex, + HAVOC_COLUMN, holiday->havoc, + TIM_COLUMN, holiday->tim, + OWEN_COLUMN, holiday->owen, + DAVE_COLUMN, holiday->dave, + VISIBLE_COLUMN, TRUE, + WORLD_COLUMN, holiday->world_holiday, + -1); + + holiday++; + } + + month++; + } + + return GTK_TREE_MODEL (model); +} + +static void +item_toggled (GtkCellRendererToggle *cell, + gchar *path_str, + gpointer data) +{ + GtkTreeModel *model = (GtkTreeModel * )data; + GtkTreePath *path = gtk_tree_path_new_from_string (path_str); + GtkTreeIter iter; + gboolean toggle_item; + + gint *column; + + column = g_object_get_data (G_OBJECT (cell), "column"); + + /* get toggled iter */ + gtk_tree_model_get_iter (model, &iter, path); + gtk_tree_model_get (model, &iter, column, &toggle_item, -1); + + /* do something with the value */ + toggle_item ^= 1; + + /* set new value */ + gtk_tree_store_set (GTK_TREE_STORE (model), &iter, column, + toggle_item, -1); + + /* clean up */ + gtk_tree_path_free (path); +} + +static void +add_columns (GtkTreeView *treeview) +{ + gint col_offset; + GtkCellRenderer *renderer; + GtkTreeViewColumn *column; + GtkTreeModel *model = gtk_tree_view_get_model (treeview); + + /* column for holiday names */ + renderer = gtk_cell_renderer_text_new (); + g_object_set (G_OBJECT (renderer), "xalign", 0.0, NULL); + + col_offset = gtk_tree_view_insert_column_with_attributes (GTK_TREE_VIEW (treeview), + -1, "Holiday", + renderer, "text", + HOLIDAY_NAME_COLUMN, + NULL); + column = gtk_tree_view_get_column (GTK_TREE_VIEW (treeview), col_offset - 1); + gtk_tree_view_column_set_clickable (GTK_TREE_VIEW_COLUMN (column), TRUE); + + /* alex column */ + renderer = gtk_cell_renderer_toggle_new (); + g_object_set (G_OBJECT (renderer), "xalign", 0.0, NULL); + g_object_set_data (G_OBJECT (renderer), "column", (gint * )ALEX_COLUMN); + + g_signal_connect (G_OBJECT (renderer), "toggled", G_CALLBACK (item_toggled), + model); + col_offset = gtk_tree_view_insert_column_with_attributes (GTK_TREE_VIEW (treeview), + -1, "Alex", + renderer, + "active", + ALEX_COLUMN, + "visible", + VISIBLE_COLUMN, + "activatable", + WORLD_COLUMN, NULL); + + column = gtk_tree_view_get_column (GTK_TREE_VIEW (treeview), col_offset - 1); + gtk_tree_view_column_set_sizing (GTK_TREE_VIEW_COLUMN (column), + GTK_TREE_VIEW_COLUMN_FIXED); + gtk_tree_view_column_set_fixed_width (GTK_TREE_VIEW_COLUMN (column), 50); + gtk_tree_view_column_set_clickable (GTK_TREE_VIEW_COLUMN (column), TRUE); + + /* havoc column */ + renderer = gtk_cell_renderer_toggle_new (); + g_object_set (G_OBJECT (renderer), "xalign", 0.0, NULL); + g_object_set_data (G_OBJECT (renderer), "column", (gint * )HAVOC_COLUMN); + + g_signal_connect (G_OBJECT (renderer), "toggled", G_CALLBACK (item_toggled), + model); + col_offset = gtk_tree_view_insert_column_with_attributes (GTK_TREE_VIEW (treeview), + -1, "Havoc", + renderer, + "active", + HAVOC_COLUMN, + "visible", + VISIBLE_COLUMN, + NULL); + + column = gtk_tree_view_get_column (GTK_TREE_VIEW (treeview), col_offset - 1); + gtk_tree_view_column_set_sizing (GTK_TREE_VIEW_COLUMN (column), + GTK_TREE_VIEW_COLUMN_FIXED); + gtk_tree_view_column_set_fixed_width (GTK_TREE_VIEW_COLUMN (column), 50); + gtk_tree_view_column_set_clickable (GTK_TREE_VIEW_COLUMN (column), TRUE); + + /* tim column */ + renderer = gtk_cell_renderer_toggle_new (); + g_object_set (G_OBJECT (renderer), "xalign", 0.0, NULL); + g_object_set_data (G_OBJECT (renderer), "column", (gint * )TIM_COLUMN); + + g_signal_connect (G_OBJECT (renderer), "toggled", G_CALLBACK (item_toggled), + model); + col_offset = gtk_tree_view_insert_column_with_attributes (GTK_TREE_VIEW (treeview), + -1, "Tim", + renderer, + "active", + TIM_COLUMN, + "visible", + VISIBLE_COLUMN, + "activatable", + WORLD_COLUMN, NULL); + + column = gtk_tree_view_get_column (GTK_TREE_VIEW (treeview), col_offset - 1); + gtk_tree_view_column_set_sizing (GTK_TREE_VIEW_COLUMN (column), + GTK_TREE_VIEW_COLUMN_FIXED); + gtk_tree_view_column_set_fixed_width (GTK_TREE_VIEW_COLUMN (column), 50); + gtk_tree_view_column_set_clickable (GTK_TREE_VIEW_COLUMN (column), TRUE); + + /* owen column */ + renderer = gtk_cell_renderer_toggle_new (); + g_object_set (G_OBJECT (renderer), "xalign", 0.0, NULL); + g_object_set_data (G_OBJECT (renderer), "column", (gint * )OWEN_COLUMN); + + g_signal_connect (G_OBJECT (renderer), "toggled", G_CALLBACK (item_toggled), + model); + col_offset = gtk_tree_view_insert_column_with_attributes (GTK_TREE_VIEW (treeview), + -1, "Owen", + renderer, + "active", + OWEN_COLUMN, + "visible", + VISIBLE_COLUMN, + NULL); + + column = gtk_tree_view_get_column (GTK_TREE_VIEW (treeview), col_offset - 1); + gtk_tree_view_column_set_sizing (GTK_TREE_VIEW_COLUMN (column), + GTK_TREE_VIEW_COLUMN_FIXED); + gtk_tree_view_column_set_fixed_width (GTK_TREE_VIEW_COLUMN (column), 50); + gtk_tree_view_column_set_clickable (GTK_TREE_VIEW_COLUMN (column), TRUE); + + /* dave column */ + renderer = gtk_cell_renderer_toggle_new (); + g_object_set (G_OBJECT (renderer), "xalign", 0.0, NULL); + g_object_set_data (G_OBJECT (renderer), "column", (gint * )DAVE_COLUMN); + + g_signal_connect (G_OBJECT (renderer), "toggled", G_CALLBACK (item_toggled), + model); + col_offset = gtk_tree_view_insert_column_with_attributes (GTK_TREE_VIEW (treeview), + -1, "Dave", + renderer, + "active", + DAVE_COLUMN, + "visible", + VISIBLE_COLUMN, + NULL); + + column = gtk_tree_view_get_column (GTK_TREE_VIEW (treeview), col_offset - 1); + gtk_tree_view_column_set_sizing (GTK_TREE_VIEW_COLUMN (column), + GTK_TREE_VIEW_COLUMN_FIXED); + gtk_tree_view_column_set_fixed_width (GTK_TREE_VIEW_COLUMN (column), 50); + gtk_tree_view_column_set_clickable (GTK_TREE_VIEW_COLUMN (column), TRUE); +} + +GtkWidget * +do_tree_store (void) +{ + if (!window) + { + GtkWidget *vbox; + GtkWidget *sw; + GtkWidget *treeview; + GtkTreeModel *model; + + /* create window, etc */ + window = gtk_window_new (GTK_WINDOW_TOPLEVEL); + gtk_window_set_title (GTK_WINDOW (window), "Card planning sheet"); + g_signal_connect (G_OBJECT (window), "destroy", + G_CALLBACK (gtk_widget_destroyed), &window); + + vbox = gtk_vbox_new (FALSE, 8); + gtk_container_set_border_width (GTK_CONTAINER (vbox), 8); + gtk_container_add (GTK_CONTAINER (window), vbox); + + gtk_box_pack_start (GTK_BOX (vbox), + gtk_label_new ("Jonathan's Holiday Card Planning Sheet"), + FALSE, FALSE, 0); + + sw = gtk_scrolled_window_new (NULL, NULL); + gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (sw), + GTK_SHADOW_ETCHED_IN); + gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw), + GTK_POLICY_AUTOMATIC, + GTK_POLICY_AUTOMATIC); + gtk_box_pack_start (GTK_BOX (vbox), sw, TRUE, TRUE, 0); + + /* create model */ + model = create_model (); + + /* create tree view */ + treeview = gtk_tree_view_new_with_model (model); + g_object_unref (G_OBJECT (model)); + gtk_tree_view_set_rules_hint (GTK_TREE_VIEW (treeview), TRUE); + gtk_tree_selection_set_mode (gtk_tree_view_get_selection (GTK_TREE_VIEW (treeview)), + GTK_SELECTION_MULTIPLE); + + add_columns (GTK_TREE_VIEW (treeview)); + + gtk_container_add (GTK_CONTAINER (sw), treeview); + + /* expand all rows after the treeview widget has been realized */ + g_signal_connect (G_OBJECT (treeview), "realize", + G_CALLBACK (gtk_tree_view_expand_all), NULL); + gtk_window_set_default_size (GTK_WINDOW (window), 650, 400); + } + + if (!GTK_WIDGET_VISIBLE (window)) + gtk_widget_show_all (window); + else + { + gtk_widget_destroy (window); + window = NULL; + } + + return window; +} + +*) diff --git a/packages/gtk2/examples/gtkglext/Makefile b/packages/gtk2/examples/gtkglext/Makefile new file mode 100644 index 0000000000..67d07ac332 --- /dev/null +++ b/packages/gtk2/examples/gtkglext/Makefile @@ -0,0 +1,2094 @@ +# +# Don't edit, this file is generated by FPCMake Version 2.0.0 [2008/01/26] +# +default: all +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-darwin i386-emx i386-watcom i386-netwlibc i386-wince i386-embedded i386-symbian m68k-linux m68k-freebsd m68k-netbsd m68k-amiga m68k-atari m68k-openbsd m68k-palmos m68k-embedded powerpc-linux powerpc-netbsd powerpc-amiga powerpc-macos powerpc-darwin powerpc-morphos powerpc-embedded sparc-linux sparc-netbsd sparc-solaris sparc-embedded x86_64-linux x86_64-freebsd x86_64-darwin x86_64-win64 x86_64-embedded arm-linux arm-palmos arm-wince arm-gba arm-nds arm-embedded arm-symbian powerpc64-linux powerpc64-darwin powerpc64-embedded +BSDs = freebsd netbsd openbsd darwin +UNIXs = linux $(BSDs) solaris qnx +LIMIT83fs = go32v2 os2 emx watcom +OSNeedsComspecToRunBatch = go32v2 watcom +FORCE: +.PHONY: FORCE +override PATH:=$(patsubst %/,%,$(subst \,/,$(PATH))) +ifneq ($(findstring darwin,$(OSTYPE)),) +inUnix=1 #darwin +SEARCHPATH:=$(filter-out .,$(subst :, ,$(PATH))) +else +ifeq ($(findstring ;,$(PATH)),) +inUnix=1 +SEARCHPATH:=$(filter-out .,$(subst :, ,$(PATH))) +else +SEARCHPATH:=$(subst ;, ,$(PATH)) +endif +endif +SEARCHPATH+=$(patsubst %/,%,$(subst \,/,$(dir $(MAKE)))) +PWD:=$(strip $(wildcard $(addsuffix /pwd.exe,$(SEARCHPATH)))) +ifeq ($(PWD),) +PWD:=$(strip $(wildcard $(addsuffix /pwd,$(SEARCHPATH)))) +ifeq ($(PWD),) +$(error You need the GNU utils package to use this Makefile) +else +PWD:=$(firstword $(PWD)) +SRCEXEEXT= +endif +else +PWD:=$(firstword $(PWD)) +SRCEXEEXT=.exe +endif +ifndef inUnix +ifeq ($(OS),Windows_NT) +inWinNT=1 +else +ifdef OS2_SHELL +inOS2=1 +endif +endif +else +ifneq ($(findstring cygdrive,$(PATH)),) +inCygWin=1 +endif +endif +ifdef inUnix +SRCBATCHEXT=.sh +else +ifdef inOS2 +SRCBATCHEXT=.cmd +else +SRCBATCHEXT=.bat +endif +endif +ifdef COMSPEC +ifneq ($(findstring $(OS_SOURCE),$(OSNeedsComspecToRunBatch)),) +RUNBATCH=$(COMSPEC) /C +endif +endif +ifdef inUnix +PATHSEP=/ +else +PATHSEP:=$(subst /,\,/) +ifdef inCygWin +PATHSEP=/ +endif +endif +ifdef PWD +BASEDIR:=$(subst \,/,$(shell $(PWD))) +ifdef inCygWin +ifneq ($(findstring /cygdrive/,$(BASEDIR)),) +BASENODIR:=$(patsubst /cygdrive%,%,$(BASEDIR)) +BASEDRIVE:=$(firstword $(subst /, ,$(BASENODIR))) +BASEDIR:=$(subst /cygdrive/$(BASEDRIVE)/,$(BASEDRIVE):/,$(BASEDIR)) +endif +endif +else +BASEDIR=. +endif +ifdef inOS2 +ifndef ECHO +ECHO:=$(strip $(wildcard $(addsuffix /gecho$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(ECHO),) +ECHO:=$(strip $(wildcard $(addsuffix /echo$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(ECHO),) +ECHO=echo +else +ECHO:=$(firstword $(ECHO)) +endif +else +ECHO:=$(firstword $(ECHO)) +endif +endif +export ECHO +endif +override DEFAULT_FPCDIR=../../../.. +ifndef FPC +ifdef PP +FPC=$(PP) +endif +endif +ifndef FPC +FPCPROG:=$(strip $(wildcard $(addsuffix /fpc$(SRCEXEEXT),$(SEARCHPATH)))) +ifneq ($(FPCPROG),) +FPCPROG:=$(firstword $(FPCPROG)) +ifneq ($(CPU_TARGET),) +FPC:=$(shell $(FPCPROG) -P$(CPU_TARGET) -PB) +else +FPC:=$(shell $(FPCPROG) -PB) +endif +ifneq ($(findstring Error,$(FPC)),) +override FPC=$(firstword $(strip $(wildcard $(addsuffix /ppc386$(SRCEXEEXT),$(SEARCHPATH))))) +endif +else +override FPC=$(firstword $(strip $(wildcard $(addsuffix /ppc386$(SRCEXEEXT),$(SEARCHPATH))))) +endif +endif +override FPC:=$(subst $(SRCEXEEXT),,$(FPC)) +override FPC:=$(subst \,/,$(FPC))$(SRCEXEEXT) +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 +unexport CHECKDEPEND ALLDEPENDENCIES +ifndef CPU_TARGET +ifdef CPU_TARGET_DEFAULT +CPU_TARGET=$(CPU_TARGET_DEFAULT) +endif +endif +ifndef OS_TARGET +ifdef OS_TARGET_DEFAULT +OS_TARGET=$(OS_TARGET_DEFAULT) +endif +endif +ifneq ($(words $(FPC_COMPILERINFO)),5) +FPC_COMPILERINFO+=$(shell $(FPC) -iSP) +FPC_COMPILERINFO+=$(shell $(FPC) -iTP) +FPC_COMPILERINFO+=$(shell $(FPC) -iSO) +FPC_COMPILERINFO+=$(shell $(FPC) -iTO) +endif +ifndef CPU_SOURCE +CPU_SOURCE:=$(word 2,$(FPC_COMPILERINFO)) +endif +ifndef CPU_TARGET +CPU_TARGET:=$(word 3,$(FPC_COMPILERINFO)) +endif +ifndef OS_SOURCE +OS_SOURCE:=$(word 4,$(FPC_COMPILERINFO)) +endif +ifndef OS_TARGET +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 $(FULL_TARGET),$(MAKEFILETARGETS)),) +$(error The Makefile doesn't support target $(FULL_TARGET), please run fpcmake first) +endif +endif +ifneq ($(findstring $(OS_TARGET),$(BSDs)),) +BSDhier=1 +endif +ifeq ($(OS_TARGET),linux) +linuxHier=1 +endif +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)),) +override FPCDIR=wrong +endif +else +override FPCDIR=wrong +endif +ifdef DEFAULT_FPCDIR +ifeq ($(FPCDIR),wrong) +override FPCDIR:=$(subst \,/,$(DEFAULT_FPCDIR)) +ifeq ($(wildcard $(addprefix $(FPCDIR)/,rtl units)),) +override FPCDIR=wrong +endif +endif +endif +ifeq ($(FPCDIR),wrong) +ifdef inUnix +override FPCDIR=/usr/local/lib/fpc/$(FPC_VERSION) +ifeq ($(wildcard $(FPCDIR)/units),) +override FPCDIR=/usr/lib/fpc/$(FPC_VERSION) +endif +else +override FPCDIR:=$(subst /$(FPC),,$(firstword $(strip $(wildcard $(addsuffix /$(FPC),$(SEARCHPATH)))))) +override FPCDIR:=$(FPCDIR)/.. +ifeq ($(wildcard $(addprefix $(FPCDIR)/,rtl units)),) +override FPCDIR:=$(FPCDIR)/.. +ifeq ($(wildcard $(addprefix $(FPCDIR)/,rtl units)),) +override FPCDIR:=$(BASEDIR) +ifeq ($(wildcard $(addprefix $(FPCDIR)/,rtl units)),) +override FPCDIR=c:/pp +endif +endif +endif +endif +endif +ifndef CROSSBINDIR +CROSSBINDIR:=$(wildcard $(FPCDIR)/bin/$(TARGETSUFFIX)) +endif +ifndef BINUTILSPREFIX +ifndef CROSSBINDIR +ifdef CROSSCOMPILE +BINUTILSPREFIX=$(CPU_TARGET)-$(OS_TARGET)- +endif +endif +endif +UNITSDIR:=$(wildcard $(FPCDIR)/units/$(TARGETSUFFIX)) +ifeq ($(UNITSDIR),) +UNITSDIR:=$(wildcard $(FPCDIR)/units/$(OS_TARGET)) +endif +PACKAGESDIR:=$(wildcard $(FPCDIR) $(FPCDIR)/packages $(FPCDIR)/packages/base $(FPCDIR)/packages/extra) +ifeq ($(FULL_TARGET),i386-linux) +override TARGET_PROGRAMS+=gears +endif +ifeq ($(FULL_TARGET),i386-go32v2) +override TARGET_PROGRAMS+=gears +endif +ifeq ($(FULL_TARGET),i386-win32) +override TARGET_PROGRAMS+=gears +endif +ifeq ($(FULL_TARGET),i386-os2) +override TARGET_PROGRAMS+=gears +endif +ifeq ($(FULL_TARGET),i386-freebsd) +override TARGET_PROGRAMS+=gears +endif +ifeq ($(FULL_TARGET),i386-beos) +override TARGET_PROGRAMS+=gears +endif +ifeq ($(FULL_TARGET),i386-netbsd) +override TARGET_PROGRAMS+=gears +endif +ifeq ($(FULL_TARGET),i386-solaris) +override TARGET_PROGRAMS+=gears +endif +ifeq ($(FULL_TARGET),i386-qnx) +override TARGET_PROGRAMS+=gears +endif +ifeq ($(FULL_TARGET),i386-netware) +override TARGET_PROGRAMS+=gears +endif +ifeq ($(FULL_TARGET),i386-openbsd) +override TARGET_PROGRAMS+=gears +endif +ifeq ($(FULL_TARGET),i386-wdosx) +override TARGET_PROGRAMS+=gears +endif +ifeq ($(FULL_TARGET),i386-darwin) +override TARGET_PROGRAMS+=gears +endif +ifeq ($(FULL_TARGET),i386-emx) +override TARGET_PROGRAMS+=gears +endif +ifeq ($(FULL_TARGET),i386-watcom) +override TARGET_PROGRAMS+=gears +endif +ifeq ($(FULL_TARGET),i386-netwlibc) +override TARGET_PROGRAMS+=gears +endif +ifeq ($(FULL_TARGET),i386-wince) +override TARGET_PROGRAMS+=gears +endif +ifeq ($(FULL_TARGET),i386-embedded) +override TARGET_PROGRAMS+=gears +endif +ifeq ($(FULL_TARGET),i386-symbian) +override TARGET_PROGRAMS+=gears +endif +ifeq ($(FULL_TARGET),m68k-linux) +override TARGET_PROGRAMS+=gears +endif +ifeq ($(FULL_TARGET),m68k-freebsd) +override TARGET_PROGRAMS+=gears +endif +ifeq ($(FULL_TARGET),m68k-netbsd) +override TARGET_PROGRAMS+=gears +endif +ifeq ($(FULL_TARGET),m68k-amiga) +override TARGET_PROGRAMS+=gears +endif +ifeq ($(FULL_TARGET),m68k-atari) +override TARGET_PROGRAMS+=gears +endif +ifeq ($(FULL_TARGET),m68k-openbsd) +override TARGET_PROGRAMS+=gears +endif +ifeq ($(FULL_TARGET),m68k-palmos) +override TARGET_PROGRAMS+=gears +endif +ifeq ($(FULL_TARGET),m68k-embedded) +override TARGET_PROGRAMS+=gears +endif +ifeq ($(FULL_TARGET),powerpc-linux) +override TARGET_PROGRAMS+=gears +endif +ifeq ($(FULL_TARGET),powerpc-netbsd) +override TARGET_PROGRAMS+=gears +endif +ifeq ($(FULL_TARGET),powerpc-amiga) +override TARGET_PROGRAMS+=gears +endif +ifeq ($(FULL_TARGET),powerpc-macos) +override TARGET_PROGRAMS+=gears +endif +ifeq ($(FULL_TARGET),powerpc-darwin) +override TARGET_PROGRAMS+=gears +endif +ifeq ($(FULL_TARGET),powerpc-morphos) +override TARGET_PROGRAMS+=gears +endif +ifeq ($(FULL_TARGET),powerpc-embedded) +override TARGET_PROGRAMS+=gears +endif +ifeq ($(FULL_TARGET),sparc-linux) +override TARGET_PROGRAMS+=gears +endif +ifeq ($(FULL_TARGET),sparc-netbsd) +override TARGET_PROGRAMS+=gears +endif +ifeq ($(FULL_TARGET),sparc-solaris) +override TARGET_PROGRAMS+=gears +endif +ifeq ($(FULL_TARGET),sparc-embedded) +override TARGET_PROGRAMS+=gears +endif +ifeq ($(FULL_TARGET),x86_64-linux) +override TARGET_PROGRAMS+=gears +endif +ifeq ($(FULL_TARGET),x86_64-freebsd) +override TARGET_PROGRAMS+=gears +endif +ifeq ($(FULL_TARGET),x86_64-darwin) +override TARGET_PROGRAMS+=gears +endif +ifeq ($(FULL_TARGET),x86_64-win64) +override TARGET_PROGRAMS+=gears +endif +ifeq ($(FULL_TARGET),x86_64-embedded) +override TARGET_PROGRAMS+=gears +endif +ifeq ($(FULL_TARGET),arm-linux) +override TARGET_PROGRAMS+=gears +endif +ifeq ($(FULL_TARGET),arm-palmos) +override TARGET_PROGRAMS+=gears +endif +ifeq ($(FULL_TARGET),arm-wince) +override TARGET_PROGRAMS+=gears +endif +ifeq ($(FULL_TARGET),arm-gba) +override TARGET_PROGRAMS+=gears +endif +ifeq ($(FULL_TARGET),arm-nds) +override TARGET_PROGRAMS+=gears +endif +ifeq ($(FULL_TARGET),arm-embedded) +override TARGET_PROGRAMS+=gears +endif +ifeq ($(FULL_TARGET),arm-symbian) +override TARGET_PROGRAMS+=gears +endif +ifeq ($(FULL_TARGET),powerpc64-linux) +override TARGET_PROGRAMS+=gears +endif +ifeq ($(FULL_TARGET),powerpc64-darwin) +override TARGET_PROGRAMS+=gears +endif +ifeq ($(FULL_TARGET),powerpc64-embedded) +override TARGET_PROGRAMS+=gears +endif +override INSTALL_FPCPACKAGE=y +ifdef REQUIRE_UNITSDIR +override UNITSDIR+=$(REQUIRE_UNITSDIR) +endif +ifdef REQUIRE_PACKAGESDIR +override PACKAGESDIR+=$(REQUIRE_PACKAGESDIR) +endif +ifdef ZIPINSTALL +ifneq ($(findstring $(OS_TARGET),$(UNIXs)),) +UNIXHier=1 +endif +else +ifneq ($(findstring $(OS_SOURCE),$(UNIXs)),) +UNIXHier=1 +endif +endif +ifndef INSTALL_PREFIX +ifdef PREFIX +INSTALL_PREFIX=$(PREFIX) +endif +endif +ifndef INSTALL_PREFIX +ifdef UNIXHier +INSTALL_PREFIX=/usr/local +else +ifdef INSTALL_FPCPACKAGE +INSTALL_BASEDIR:=/pp +else +INSTALL_BASEDIR:=/$(PACKAGE_NAME) +endif +endif +endif +export INSTALL_PREFIX +ifdef INSTALL_FPCSUBDIR +export INSTALL_FPCSUBDIR +endif +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 +INSTALL_BASEDIR:=$(INSTALL_PREFIX)/lib/fpc/$(FPC_VERSION) +else +INSTALL_BASEDIR:=$(INSTALL_PREFIX)/lib/$(PACKAGE_NAME) +endif +else +INSTALL_BASEDIR:=$(INSTALL_PREFIX) +endif +endif +ifndef INSTALL_BINDIR +ifdef UNIXHier +INSTALL_BINDIR:=$(INSTALL_PREFIX)/bin +else +INSTALL_BINDIR:=$(INSTALL_BASEDIR)/bin +ifdef INSTALL_FPCPACKAGE +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 +INSTALL_UNITDIR:=$(INSTALL_BASEDIR)/units/$(TARGETSUFFIX) +ifdef INSTALL_FPCPACKAGE +ifdef PACKAGE_NAME +INSTALL_UNITDIR:=$(INSTALL_UNITDIR)/$(PACKAGE_NAME) +endif +endif +endif +ifndef INSTALL_LIBDIR +ifdef UNIXHier +INSTALL_LIBDIR:=$(INSTALL_PREFIX)/lib +else +INSTALL_LIBDIR:=$(INSTALL_UNITDIR) +endif +endif +ifndef INSTALL_SOURCEDIR +ifdef UNIXHier +ifdef BSDhier +SRCPREFIXDIR=share/src +else +ifdef linuxHier +SRCPREFIXDIR=share/src +else +SRCPREFIXDIR=src +endif +endif +ifdef INSTALL_FPCPACKAGE +ifdef INSTALL_FPCSUBDIR +INSTALL_SOURCEDIR:=$(INSTALL_PREFIX)/$(SRCPREFIXDIR)/fpc-$(FPC_VERSION)/$(INSTALL_FPCSUBDIR)/$(PACKAGE_NAME) +else +INSTALL_SOURCEDIR:=$(INSTALL_PREFIX)/$(SRCPREFIXDIR)/fpc-$(FPC_VERSION)/$(PACKAGE_NAME) +endif +else +INSTALL_SOURCEDIR:=$(INSTALL_PREFIX)/$(SRCPREFIXDIR)/$(PACKAGE_NAME)-$(PACKAGE_VERSION) +endif +else +ifdef INSTALL_FPCPACKAGE +ifdef INSTALL_FPCSUBDIR +INSTALL_SOURCEDIR:=$(INSTALL_BASEDIR)/source/$(INSTALL_FPCSUBDIR)/$(PACKAGE_NAME) +else +INSTALL_SOURCEDIR:=$(INSTALL_BASEDIR)/source/$(PACKAGE_NAME) +endif +else +INSTALL_SOURCEDIR:=$(INSTALL_BASEDIR)/source +endif +endif +endif +ifndef INSTALL_DOCDIR +ifdef UNIXHier +ifdef BSDhier +DOCPREFIXDIR=share/doc +else +ifdef linuxHier +DOCPREFIXDIR=share/doc +else +DOCPREFIXDIR=doc +endif +endif +ifdef INSTALL_FPCPACKAGE +INSTALL_DOCDIR:=$(INSTALL_PREFIX)/$(DOCPREFIXDIR)/fpc-$(FPC_VERSION)/$(PACKAGE_NAME) +else +INSTALL_DOCDIR:=$(INSTALL_PREFIX)/$(DOCPREFIXDIR)/$(PACKAGE_NAME)-$(PACKAGE_VERSION) +endif +else +ifdef INSTALL_FPCPACKAGE +INSTALL_DOCDIR:=$(INSTALL_BASEDIR)/doc/$(PACKAGE_NAME) +else +INSTALL_DOCDIR:=$(INSTALL_BASEDIR)/doc +endif +endif +endif +ifndef INSTALL_EXAMPLEDIR +ifdef UNIXHier +ifdef INSTALL_FPCPACKAGE +ifdef BSDhier +INSTALL_EXAMPLEDIR:=$(INSTALL_PREFIX)/share/examples/fpc-$(FPC_VERSION)/$(PACKAGE_NAME) +else +ifdef linuxHier +INSTALL_EXAMPLEDIR:=$(INSTALL_DOCDIR)/examples +else +INSTALL_EXAMPLEDIR:=$(INSTALL_PREFIX)/doc/fpc-$(FPC_VERSION)/examples/$(PACKAGE_NAME) +endif +endif +else +ifdef BSDhier +INSTALL_EXAMPLEDIR:=$(INSTALL_PREFIX)/share/examples/$(PACKAGE_NAME)-$(PACKAGE_VERSION) +else +ifdef linuxHier +INSTALL_EXAMPLEDIR:=$(INSTALL_DOCDIR)/examples/$(PACKAGE_NAME)-$(PACKAGE_VERSION) +else +INSTALL_EXAMPLEDIR:=$(INSTALL_PREFIX)/doc/$(PACKAGE_NAME)-$(PACKAGE_VERSION) +endif +endif +endif +else +ifdef INSTALL_FPCPACKAGE +INSTALL_EXAMPLEDIR:=$(INSTALL_BASEDIR)/examples/$(PACKAGE_NAME) +else +INSTALL_EXAMPLEDIR:=$(INSTALL_BASEDIR)/examples +endif +endif +endif +ifndef INSTALL_DATADIR +INSTALL_DATADIR=$(INSTALL_BASEDIR) +endif +ifndef INSTALL_SHAREDDIR +INSTALL_SHAREDDIR=$(INSTALL_PREFIX)/lib +endif +ifdef CROSSCOMPILE +ifndef CROSSBINDIR +CROSSBINDIR:=$(wildcard $(CROSSTARGETDIR)/bin/$(SOURCESUFFIX)) +ifeq ($(CROSSBINDIR),) +CROSSBINDIR:=$(wildcard $(INSTALL_BASEDIR)/cross/$(TARGETSUFFIX)/bin/$(FULL_SOURCE)) +endif +endif +else +CROSSBINDIR= +endif +ifeq ($(OS_SOURCE),linux) +ifndef GCCLIBDIR +ifeq ($(CPU_TARGET),i386) +ifneq ($(findstring x86_64,$(shell uname -a)),) +ifeq ($(BINUTILSPREFIX),) +GCCLIBDIR:=$(shell dirname `gcc -m32 -print-libgcc-file-name`) +endif +endif +endif +ifeq ($(CPU_TARGET),powerpc64) +ifeq ($(BINUTILSPREFIX),) +GCCLIBDIR:=$(shell dirname `gcc -m64 -print-libgcc-file-name`) +endif +endif +endif +ifndef GCCLIBDIR +CROSSGCC=$(strip $(wildcard $(addsuffix /$(BINUTILSPREFIX)gcc$(SRCEXEEXT),$(SEARCHPATH)))) +ifneq ($(CROSSGCC),) +GCCLIBDIR:=$(shell dirname `$(CROSSGCC) -print-libgcc-file-name`) +endif +endif +ifndef OTHERLIBDIR +OTHERLIBDIR:=$(shell grep -v "^\#" /etc/ld.so.conf | awk '{ ORS=" "; print $1 }') +endif +endif +ifdef inUnix +ifeq ($(OS_SOURCE),netbsd) +OTHERLIBDIR+=/usr/pkg/lib +endif +export GCCLIBDIR OTHERLIB +endif +BATCHEXT=.bat +LOADEREXT=.as +EXEEXT=.exe +PPLEXT=.ppl +PPUEXT=.ppu +OEXT=.o +ASMEXT=.s +SMARTEXT=.sl +STATICLIBEXT=.a +SHAREDLIBEXT=.so +SHAREDLIBPREFIX=libfp +STATICLIBPREFIX=libp +IMPORTLIBPREFIX=libimp +RSTEXT=.rst +ifeq ($(findstring 1.0.,$(FPC_VERSION)),) +ifeq ($(OS_TARGET),go32v1) +STATICLIBPREFIX= +SHORTSUFFIX=v1 +endif +ifeq ($(OS_TARGET),go32v2) +STATICLIBPREFIX= +SHORTSUFFIX=dos +endif +ifeq ($(OS_TARGET),watcom) +STATICLIBPREFIX= +OEXT=.obj +ASMEXT=.asm +SHAREDLIBEXT=.dll +SHORTSUFFIX=wat +endif +ifeq ($(OS_TARGET),linux) +BATCHEXT=.sh +EXEEXT= +HASSHAREDLIB=1 +SHORTSUFFIX=lnx +endif +ifeq ($(OS_TARGET),freebsd) +BATCHEXT=.sh +EXEEXT= +HASSHAREDLIB=1 +SHORTSUFFIX=fbs +endif +ifeq ($(OS_TARGET),netbsd) +BATCHEXT=.sh +EXEEXT= +HASSHAREDLIB=1 +SHORTSUFFIX=nbs +endif +ifeq ($(OS_TARGET),openbsd) +BATCHEXT=.sh +EXEEXT= +HASSHAREDLIB=1 +SHORTSUFFIX=obs +endif +ifeq ($(OS_TARGET),win32) +SHAREDLIBEXT=.dll +SHORTSUFFIX=w32 +endif +ifeq ($(OS_TARGET),os2) +BATCHEXT=.cmd +AOUTEXT=.out +STATICLIBPREFIX= +SHAREDLIBEXT=.dll +SHORTSUFFIX=os2 +ECHO=echo +endif +ifeq ($(OS_TARGET),emx) +BATCHEXT=.cmd +AOUTEXT=.out +STATICLIBPREFIX= +SHAREDLIBEXT=.dll +SHORTSUFFIX=emx +ECHO=echo +endif +ifeq ($(OS_TARGET),amiga) +EXEEXT= +SHAREDLIBEXT=.library +SHORTSUFFIX=amg +endif +ifeq ($(OS_TARGET),morphos) +EXEEXT= +SHAREDLIBEXT=.library +SHORTSUFFIX=mos +endif +ifeq ($(OS_TARGET),atari) +EXEEXT=.ttp +SHORTSUFFIX=ata +endif +ifeq ($(OS_TARGET),beos) +BATCHEXT=.sh +EXEEXT= +SHORTSUFFIX=be +endif +ifeq ($(OS_TARGET),solaris) +BATCHEXT=.sh +EXEEXT= +SHORTSUFFIX=sun +endif +ifeq ($(OS_TARGET),qnx) +BATCHEXT=.sh +EXEEXT= +SHORTSUFFIX=qnx +endif +ifeq ($(OS_TARGET),netware) +EXEEXT=.nlm +STATICLIBPREFIX= +SHORTSUFFIX=nw +endif +ifeq ($(OS_TARGET),netwlibc) +EXEEXT=.nlm +STATICLIBPREFIX= +SHORTSUFFIX=nwl +endif +ifeq ($(OS_TARGET),macos) +BATCHEXT= +EXEEXT= +DEBUGSYMEXT=.xcoff +SHORTSUFFIX=mac +endif +ifeq ($(OS_TARGET),darwin) +BATCHEXT=.sh +EXEEXT= +HASSHAREDLIB=1 +SHORTSUFFIX=dwn +endif +ifeq ($(OS_TARGET),gba) +EXEEXT=.gba +SHAREDLIBEXT=.so +SHORTSUFFIX=gba +endif +ifeq ($(OS_TARGET),symbian) +SHAREDLIBEXT=.dll +SHORTSUFFIX=symbian +endif +else +ifeq ($(OS_TARGET),go32v1) +PPUEXT=.pp1 +OEXT=.o1 +ASMEXT=.s1 +SMARTEXT=.sl1 +STATICLIBEXT=.a1 +SHAREDLIBEXT=.so1 +STATICLIBPREFIX= +SHORTSUFFIX=v1 +endif +ifeq ($(OS_TARGET),go32v2) +STATICLIBPREFIX= +SHORTSUFFIX=dos +endif +ifeq ($(OS_TARGET),watcom) +STATICLIBPREFIX= +SHORTSUFFIX=wat +endif +ifeq ($(OS_TARGET),linux) +BATCHEXT=.sh +EXEEXT= +HASSHAREDLIB=1 +SHORTSUFFIX=lnx +endif +ifeq ($(OS_TARGET),freebsd) +BATCHEXT=.sh +EXEEXT= +HASSHAREDLIB=1 +SHORTSUFFIX=fbs +endif +ifeq ($(OS_TARGET),netbsd) +BATCHEXT=.sh +EXEEXT= +HASSHAREDLIB=1 +SHORTSUFFIX=nbs +endif +ifeq ($(OS_TARGET),openbsd) +BATCHEXT=.sh +EXEEXT= +HASSHAREDLIB=1 +SHORTSUFFIX=obs +endif +ifeq ($(OS_TARGET),win32) +PPUEXT=.ppw +OEXT=.ow +ASMEXT=.sw +SMARTEXT=.slw +STATICLIBEXT=.aw +SHAREDLIBEXT=.dll +SHORTSUFFIX=w32 +endif +ifeq ($(OS_TARGET),os2) +BATCHEXT=.cmd +PPUEXT=.ppo +ASMEXT=.so2 +OEXT=.oo2 +AOUTEXT=.out +SMARTEXT=.sl2 +STATICLIBPREFIX= +STATICLIBEXT=.ao2 +SHAREDLIBEXT=.dll +SHORTSUFFIX=os2 +ECHO=echo +endif +ifeq ($(OS_TARGET),amiga) +EXEEXT= +PPUEXT=.ppu +ASMEXT=.s +OEXT=.o +SMARTEXT=.sl +STATICLIBEXT=.a +SHAREDLIBEXT=.library +SHORTSUFFIX=amg +endif +ifeq ($(OS_TARGET),atari) +PPUEXT=.ppu +ASMEXT=.s +OEXT=.o +SMARTEXT=.sl +STATICLIBEXT=.a +EXEEXT=.ttp +SHORTSUFFIX=ata +endif +ifeq ($(OS_TARGET),beos) +BATCHEXT=.sh +PPUEXT=.ppu +ASMEXT=.s +OEXT=.o +SMARTEXT=.sl +STATICLIBEXT=.a +EXEEXT= +SHORTSUFFIX=be +endif +ifeq ($(OS_TARGET),solaris) +BATCHEXT=.sh +PPUEXT=.ppu +ASMEXT=.s +OEXT=.o +SMARTEXT=.sl +STATICLIBEXT=.a +EXEEXT= +SHORTSUFFIX=sun +endif +ifeq ($(OS_TARGET),qnx) +BATCHEXT=.sh +PPUEXT=.ppu +ASMEXT=.s +OEXT=.o +SMARTEXT=.sl +STATICLIBEXT=.a +EXEEXT= +SHORTSUFFIX=qnx +endif +ifeq ($(OS_TARGET),netware) +STATICLIBPREFIX= +PPUEXT=.ppu +OEXT=.o +ASMEXT=.s +SMARTEXT=.sl +STATICLIBEXT=.a +SHAREDLIBEXT=.nlm +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= +PPUEXT=.ppu +ASMEXT=.s +OEXT=.o +SMARTEXT=.sl +STATICLIBEXT=.a +EXEEXT= +DEBUGSYMEXT=.xcoff +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 +ECHO:=$(strip $(wildcard $(addsuffix /gecho$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(ECHO),) +ECHO:=$(strip $(wildcard $(addsuffix /echo$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(ECHO),) +ECHO= __missing_command_ECHO +else +ECHO:=$(firstword $(ECHO)) +endif +else +ECHO:=$(firstword $(ECHO)) +endif +endif +export ECHO +ifndef DATE +DATE:=$(strip $(wildcard $(addsuffix /gdate$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(DATE),) +DATE:=$(strip $(wildcard $(addsuffix /date$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(DATE),) +DATE= __missing_command_DATE +else +DATE:=$(firstword $(DATE)) +endif +else +DATE:=$(firstword $(DATE)) +endif +endif +export DATE +ifndef GINSTALL +GINSTALL:=$(strip $(wildcard $(addsuffix /ginstall$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(GINSTALL),) +GINSTALL:=$(strip $(wildcard $(addsuffix /install$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(GINSTALL),) +GINSTALL= __missing_command_GINSTALL +else +GINSTALL:=$(firstword $(GINSTALL)) +endif +else +GINSTALL:=$(firstword $(GINSTALL)) +endif +endif +export GINSTALL +ifndef CPPROG +CPPROG:=$(strip $(wildcard $(addsuffix /cp$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(CPPROG),) +CPPROG= __missing_command_CPPROG +else +CPPROG:=$(firstword $(CPPROG)) +endif +endif +export CPPROG +ifndef RMPROG +RMPROG:=$(strip $(wildcard $(addsuffix /rm$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(RMPROG),) +RMPROG= __missing_command_RMPROG +else +RMPROG:=$(firstword $(RMPROG)) +endif +endif +export RMPROG +ifndef MVPROG +MVPROG:=$(strip $(wildcard $(addsuffix /mv$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(MVPROG),) +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 +else +ECHOREDIR=$(ECHO) +endif +endif +ifndef COPY +COPY:=$(CPPROG) -fp +endif +ifndef COPYTREE +COPYTREE:=$(CPPROG) -Rfp +endif +ifndef MKDIRTREE +MKDIRTREE:=$(MKDIRPROG) -p +endif +ifndef MOVE +MOVE:=$(MVPROG) -f +endif +ifndef DEL +DEL:=$(RMPROG) -f +endif +ifndef DELTREE +DELTREE:=$(RMPROG) -rf +endif +ifndef INSTALL +ifdef inUnix +INSTALL:=$(GINSTALL) -c -m 644 +else +INSTALL:=$(COPY) +endif +endif +ifndef INSTALLEXE +ifdef inUnix +INSTALLEXE:=$(GINSTALL) -c -m 755 +else +INSTALLEXE:=$(COPY) +endif +endif +ifndef MKDIR +MKDIR:=$(GINSTALL) -m 755 -d +endif +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 +else +PPUMOVE:=$(firstword $(PPUMOVE)) +endif +endif +export PPUMOVE +ifndef FPCMAKE +FPCMAKE:=$(strip $(wildcard $(addsuffix /fpcmake$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(FPCMAKE),) +FPCMAKE= __missing_command_FPCMAKE +else +FPCMAKE:=$(firstword $(FPCMAKE)) +endif +endif +export FPCMAKE +ifndef ZIPPROG +ZIPPROG:=$(strip $(wildcard $(addsuffix /zip$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(ZIPPROG),) +ZIPPROG= __missing_command_ZIPPROG +else +ZIPPROG:=$(firstword $(ZIPPROG)) +endif +endif +export ZIPPROG +ifndef TARPROG +TARPROG:=$(strip $(wildcard $(addsuffix /gtar$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(TARPROG),) +TARPROG:=$(strip $(wildcard $(addsuffix /tar$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(TARPROG),) +TARPROG= __missing_command_TARPROG +else +TARPROG:=$(firstword $(TARPROG)) +endif +else +TARPROG:=$(firstword $(TARPROG)) +endif +endif +export TARPROG +ASNAME=$(BINUTILSPREFIX)as +LDNAME=$(BINUTILSPREFIX)ld +ARNAME=$(BINUTILSPREFIX)ar +RCNAME=$(BINUTILSPREFIX)rc +ifneq ($(findstring 1.0.,$(FPC_VERSION)),) +ifeq ($(OS_TARGET),win32) +ifeq ($(CROSSBINDIR),) +ASNAME=asw +LDNAME=ldw +ARNAME=arw +endif +endif +endif +ifndef ASPROG +ifdef CROSSBINDIR +ASPROG=$(CROSSBINDIR)/$(ASNAME)$(SRCEXEEXT) +else +ASPROG=$(ASNAME) +endif +endif +ifndef LDPROG +ifdef CROSSBINDIR +LDPROG=$(CROSSBINDIR)/$(LDNAME)$(SRCEXEEXT) +else +LDPROG=$(LDNAME) +endif +endif +ifndef RCPROG +ifdef CROSSBINDIR +RCPROG=$(CROSSBINDIR)/$(RCNAME)$(SRCEXEEXT) +else +RCPROG=$(RCNAME) +endif +endif +ifndef ARPROG +ifdef CROSSBINDIR +ARPROG=$(CROSSBINDIR)/$(ARNAME)$(SRCEXEEXT) +else +ARPROG=$(ARNAME) +endif +endif +AS=$(ASPROG) +LD=$(LDPROG) +RC=$(RCPROG) +AR=$(ARPROG) +PPAS=ppas$(SRCBATCHEXT) +ifdef inUnix +LDCONFIG=ldconfig +else +LDCONFIG= +endif +ifdef DATE +DATESTR:=$(shell $(DATE) +%Y%m%d) +else +DATESTR= +endif +ifndef UPXPROG +ifeq ($(OS_TARGET),go32v2) +UPXPROG:=1 +endif +ifeq ($(OS_TARGET),win32) +UPXPROG:=1 +endif +ifdef UPXPROG +UPXPROG:=$(strip $(wildcard $(addsuffix /upx$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(UPXPROG),) +UPXPROG= +else +UPXPROG:=$(firstword $(UPXPROG)) +endif +else +UPXPROG= +endif +endif +export UPXPROG +ZIPOPT=-9 +ZIPEXT=.zip +ifeq ($(USETAR),bz2) +TAROPT=vj +TAREXT=.tar.bz2 +else +TAROPT=vz +TAREXT=.tar.gz +endif +override REQUIRE_PACKAGES=rtl gtk2 opengl +ifeq ($(FULL_TARGET),i386-linux) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_X11=1 +REQUIRE_PACKAGES_GTK2=1 +REQUIRE_PACKAGES_OPENGL=1 +endif +ifeq ($(FULL_TARGET),i386-go32v2) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_GTK2=1 +REQUIRE_PACKAGES_OPENGL=1 +endif +ifeq ($(FULL_TARGET),i386-win32) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_GTK2=1 +REQUIRE_PACKAGES_OPENGL=1 +endif +ifeq ($(FULL_TARGET),i386-os2) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_GTK2=1 +REQUIRE_PACKAGES_OPENGL=1 +endif +ifeq ($(FULL_TARGET),i386-freebsd) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_X11=1 +REQUIRE_PACKAGES_GTK2=1 +REQUIRE_PACKAGES_OPENGL=1 +endif +ifeq ($(FULL_TARGET),i386-beos) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_GTK2=1 +REQUIRE_PACKAGES_OPENGL=1 +endif +ifeq ($(FULL_TARGET),i386-netbsd) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_X11=1 +REQUIRE_PACKAGES_GTK2=1 +REQUIRE_PACKAGES_OPENGL=1 +endif +ifeq ($(FULL_TARGET),i386-solaris) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_X11=1 +REQUIRE_PACKAGES_GTK2=1 +REQUIRE_PACKAGES_OPENGL=1 +endif +ifeq ($(FULL_TARGET),i386-qnx) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_GTK2=1 +REQUIRE_PACKAGES_OPENGL=1 +endif +ifeq ($(FULL_TARGET),i386-netware) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_GTK2=1 +REQUIRE_PACKAGES_OPENGL=1 +endif +ifeq ($(FULL_TARGET),i386-openbsd) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_X11=1 +REQUIRE_PACKAGES_GTK2=1 +REQUIRE_PACKAGES_OPENGL=1 +endif +ifeq ($(FULL_TARGET),i386-wdosx) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_GTK2=1 +REQUIRE_PACKAGES_OPENGL=1 +endif +ifeq ($(FULL_TARGET),i386-darwin) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_X11=1 +REQUIRE_PACKAGES_GTK2=1 +REQUIRE_PACKAGES_OPENGL=1 +endif +ifeq ($(FULL_TARGET),i386-emx) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_GTK2=1 +REQUIRE_PACKAGES_OPENGL=1 +endif +ifeq ($(FULL_TARGET),i386-watcom) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_GTK2=1 +REQUIRE_PACKAGES_OPENGL=1 +endif +ifeq ($(FULL_TARGET),i386-netwlibc) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_GTK2=1 +REQUIRE_PACKAGES_OPENGL=1 +endif +ifeq ($(FULL_TARGET),i386-wince) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_GTK2=1 +REQUIRE_PACKAGES_OPENGL=1 +endif +ifeq ($(FULL_TARGET),i386-embedded) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_GTK2=1 +REQUIRE_PACKAGES_OPENGL=1 +endif +ifeq ($(FULL_TARGET),i386-symbian) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_GTK2=1 +REQUIRE_PACKAGES_OPENGL=1 +endif +ifeq ($(FULL_TARGET),m68k-linux) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_X11=1 +REQUIRE_PACKAGES_GTK2=1 +REQUIRE_PACKAGES_OPENGL=1 +endif +ifeq ($(FULL_TARGET),m68k-freebsd) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_X11=1 +REQUIRE_PACKAGES_GTK2=1 +REQUIRE_PACKAGES_OPENGL=1 +endif +ifeq ($(FULL_TARGET),m68k-netbsd) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_X11=1 +REQUIRE_PACKAGES_GTK2=1 +REQUIRE_PACKAGES_OPENGL=1 +endif +ifeq ($(FULL_TARGET),m68k-amiga) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_GTK2=1 +REQUIRE_PACKAGES_OPENGL=1 +endif +ifeq ($(FULL_TARGET),m68k-atari) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_GTK2=1 +REQUIRE_PACKAGES_OPENGL=1 +endif +ifeq ($(FULL_TARGET),m68k-openbsd) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_X11=1 +REQUIRE_PACKAGES_GTK2=1 +REQUIRE_PACKAGES_OPENGL=1 +endif +ifeq ($(FULL_TARGET),m68k-palmos) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_GTK2=1 +REQUIRE_PACKAGES_OPENGL=1 +endif +ifeq ($(FULL_TARGET),m68k-embedded) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_GTK2=1 +REQUIRE_PACKAGES_OPENGL=1 +endif +ifeq ($(FULL_TARGET),powerpc-linux) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_X11=1 +REQUIRE_PACKAGES_GTK2=1 +REQUIRE_PACKAGES_OPENGL=1 +endif +ifeq ($(FULL_TARGET),powerpc-netbsd) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_X11=1 +REQUIRE_PACKAGES_GTK2=1 +REQUIRE_PACKAGES_OPENGL=1 +endif +ifeq ($(FULL_TARGET),powerpc-amiga) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_GTK2=1 +REQUIRE_PACKAGES_OPENGL=1 +endif +ifeq ($(FULL_TARGET),powerpc-macos) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_GTK2=1 +REQUIRE_PACKAGES_OPENGL=1 +endif +ifeq ($(FULL_TARGET),powerpc-darwin) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_X11=1 +REQUIRE_PACKAGES_GTK2=1 +REQUIRE_PACKAGES_OPENGL=1 +endif +ifeq ($(FULL_TARGET),powerpc-morphos) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_GTK2=1 +REQUIRE_PACKAGES_OPENGL=1 +endif +ifeq ($(FULL_TARGET),powerpc-embedded) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_GTK2=1 +REQUIRE_PACKAGES_OPENGL=1 +endif +ifeq ($(FULL_TARGET),sparc-linux) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_X11=1 +REQUIRE_PACKAGES_GTK2=1 +REQUIRE_PACKAGES_OPENGL=1 +endif +ifeq ($(FULL_TARGET),sparc-netbsd) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_X11=1 +REQUIRE_PACKAGES_GTK2=1 +REQUIRE_PACKAGES_OPENGL=1 +endif +ifeq ($(FULL_TARGET),sparc-solaris) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_X11=1 +REQUIRE_PACKAGES_GTK2=1 +REQUIRE_PACKAGES_OPENGL=1 +endif +ifeq ($(FULL_TARGET),sparc-embedded) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_GTK2=1 +REQUIRE_PACKAGES_OPENGL=1 +endif +ifeq ($(FULL_TARGET),x86_64-linux) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_X11=1 +REQUIRE_PACKAGES_GTK2=1 +REQUIRE_PACKAGES_OPENGL=1 +endif +ifeq ($(FULL_TARGET),x86_64-freebsd) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_X11=1 +REQUIRE_PACKAGES_GTK2=1 +REQUIRE_PACKAGES_OPENGL=1 +endif +ifeq ($(FULL_TARGET),x86_64-darwin) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_X11=1 +REQUIRE_PACKAGES_GTK2=1 +REQUIRE_PACKAGES_OPENGL=1 +endif +ifeq ($(FULL_TARGET),x86_64-win64) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_GTK2=1 +REQUIRE_PACKAGES_OPENGL=1 +endif +ifeq ($(FULL_TARGET),x86_64-embedded) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_GTK2=1 +REQUIRE_PACKAGES_OPENGL=1 +endif +ifeq ($(FULL_TARGET),arm-linux) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_X11=1 +REQUIRE_PACKAGES_GTK2=1 +REQUIRE_PACKAGES_OPENGL=1 +endif +ifeq ($(FULL_TARGET),arm-palmos) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_GTK2=1 +REQUIRE_PACKAGES_OPENGL=1 +endif +ifeq ($(FULL_TARGET),arm-wince) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_GTK2=1 +REQUIRE_PACKAGES_OPENGL=1 +endif +ifeq ($(FULL_TARGET),arm-gba) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_GTK2=1 +REQUIRE_PACKAGES_OPENGL=1 +endif +ifeq ($(FULL_TARGET),arm-nds) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_GTK2=1 +REQUIRE_PACKAGES_OPENGL=1 +endif +ifeq ($(FULL_TARGET),arm-embedded) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_GTK2=1 +REQUIRE_PACKAGES_OPENGL=1 +endif +ifeq ($(FULL_TARGET),arm-symbian) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_GTK2=1 +REQUIRE_PACKAGES_OPENGL=1 +endif +ifeq ($(FULL_TARGET),powerpc64-linux) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_X11=1 +REQUIRE_PACKAGES_GTK2=1 +REQUIRE_PACKAGES_OPENGL=1 +endif +ifeq ($(FULL_TARGET),powerpc64-darwin) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_X11=1 +REQUIRE_PACKAGES_GTK2=1 +REQUIRE_PACKAGES_OPENGL=1 +endif +ifeq ($(FULL_TARGET),powerpc64-embedded) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_GTK2=1 +REQUIRE_PACKAGES_OPENGL=1 +endif +ifdef REQUIRE_PACKAGES_RTL +PACKAGEDIR_RTL:=$(firstword $(subst /Makefile.fpc,,$(strip $(wildcard $(addsuffix /rtl/Makefile.fpc,$(PACKAGESDIR)))))) +ifneq ($(PACKAGEDIR_RTL),) +ifneq ($(wildcard $(PACKAGEDIR_RTL)/units/$(TARGETSUFFIX)),) +UNITDIR_RTL=$(PACKAGEDIR_RTL)/units/$(TARGETSUFFIX) +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 +ifdef REQUIRE_PACKAGES_X11 +PACKAGEDIR_X11:=$(firstword $(subst /Makefile.fpc,,$(strip $(wildcard $(addsuffix /x11/Makefile.fpc,$(PACKAGESDIR)))))) +ifneq ($(PACKAGEDIR_X11),) +ifneq ($(wildcard $(PACKAGEDIR_X11)/units/$(TARGETSUFFIX)),) +UNITDIR_X11=$(PACKAGEDIR_X11)/units/$(TARGETSUFFIX) +else +UNITDIR_X11=$(PACKAGEDIR_X11) +endif +ifdef CHECKDEPEND +$(PACKAGEDIR_X11)/$(FPCMADE): + $(MAKE) -C $(PACKAGEDIR_X11) $(FPCMADE) +override ALLDEPENDENCIES+=$(PACKAGEDIR_X11)/$(FPCMADE) +endif +else +PACKAGEDIR_X11= +UNITDIR_X11:=$(subst /Package.fpc,,$(strip $(wildcard $(addsuffix /x11/Package.fpc,$(UNITSDIR))))) +ifneq ($(UNITDIR_X11),) +UNITDIR_X11:=$(firstword $(UNITDIR_X11)) +else +UNITDIR_X11= +endif +endif +ifdef UNITDIR_X11 +override COMPILER_UNITDIR+=$(UNITDIR_X11) +endif +endif +ifdef REQUIRE_PACKAGES_GTK2 +PACKAGEDIR_GTK2:=$(firstword $(subst /Makefile.fpc,,$(strip $(wildcard $(addsuffix /gtk2/Makefile.fpc,$(PACKAGESDIR)))))) +ifneq ($(PACKAGEDIR_GTK2),) +ifneq ($(wildcard $(PACKAGEDIR_GTK2)/units/$(TARGETSUFFIX)),) +UNITDIR_GTK2=$(PACKAGEDIR_GTK2)/units/$(TARGETSUFFIX) +else +UNITDIR_GTK2=$(PACKAGEDIR_GTK2) +endif +ifdef CHECKDEPEND +$(PACKAGEDIR_GTK2)/$(FPCMADE): + $(MAKE) -C $(PACKAGEDIR_GTK2) $(FPCMADE) +override ALLDEPENDENCIES+=$(PACKAGEDIR_GTK2)/$(FPCMADE) +endif +else +PACKAGEDIR_GTK2= +UNITDIR_GTK2:=$(subst /Package.fpc,,$(strip $(wildcard $(addsuffix /gtk2/Package.fpc,$(UNITSDIR))))) +ifneq ($(UNITDIR_GTK2),) +UNITDIR_GTK2:=$(firstword $(UNITDIR_GTK2)) +else +UNITDIR_GTK2= +endif +endif +ifdef UNITDIR_GTK2 +override COMPILER_UNITDIR+=$(UNITDIR_GTK2) +endif +endif +ifdef REQUIRE_PACKAGES_OPENGL +PACKAGEDIR_OPENGL:=$(firstword $(subst /Makefile.fpc,,$(strip $(wildcard $(addsuffix /opengl/Makefile.fpc,$(PACKAGESDIR)))))) +ifneq ($(PACKAGEDIR_OPENGL),) +ifneq ($(wildcard $(PACKAGEDIR_OPENGL)/units/$(TARGETSUFFIX)),) +UNITDIR_OPENGL=$(PACKAGEDIR_OPENGL)/units/$(TARGETSUFFIX) +else +UNITDIR_OPENGL=$(PACKAGEDIR_OPENGL) +endif +ifdef CHECKDEPEND +$(PACKAGEDIR_OPENGL)/$(FPCMADE): + $(MAKE) -C $(PACKAGEDIR_OPENGL) $(FPCMADE) +override ALLDEPENDENCIES+=$(PACKAGEDIR_OPENGL)/$(FPCMADE) +endif +else +PACKAGEDIR_OPENGL= +UNITDIR_OPENGL:=$(subst /Package.fpc,,$(strip $(wildcard $(addsuffix /opengl/Package.fpc,$(UNITSDIR))))) +ifneq ($(UNITDIR_OPENGL),) +UNITDIR_OPENGL:=$(firstword $(UNITDIR_OPENGL)) +else +UNITDIR_OPENGL= +endif +endif +ifdef UNITDIR_OPENGL +override COMPILER_UNITDIR+=$(UNITDIR_OPENGL) +endif +endif +ifndef NOCPUDEF +override FPCOPTDEF=$(CPU_TARGET) +endif +ifneq ($(OS_TARGET),$(OS_SOURCE)) +override FPCOPT+=-T$(OS_TARGET) +endif +ifneq ($(CPU_TARGET),$(CPU_SOURCE)) +override FPCOPT+=-P$(CPU_TARGET) +endif +ifeq ($(OS_SOURCE),openbsd) +override FPCOPT+=-FD$(NEW_BINUTILS_PATH) +endif +ifndef CROSSBOOTSTRAP +ifneq ($(BINUTILSPREFIX),) +override FPCOPT+=-XP$(BINUTILSPREFIX) +endif +ifneq ($(BINUTILSPREFIX),) +override FPCOPT+=-Xr$(RLINKPATH) +endif +endif +ifdef UNITDIR +override FPCOPT+=$(addprefix -Fu,$(UNITDIR)) +endif +ifdef LIBDIR +override FPCOPT+=$(addprefix -Fl,$(LIBDIR)) +endif +ifdef OBJDIR +override FPCOPT+=$(addprefix -Fo,$(OBJDIR)) +endif +ifdef INCDIR +override FPCOPT+=$(addprefix -Fi,$(INCDIR)) +endif +ifdef LINKSMART +override FPCOPT+=-XX +endif +ifdef CREATESMART +override FPCOPT+=-CX +endif +ifdef DEBUG +override FPCOPT+=-gl +override FPCOPTDEF+=DEBUG +endif +ifdef RELEASE +ifneq ($(findstring 2.0.,$(FPC_VERSION)),) +ifeq ($(CPU_TARGET),i386) +FPCCPUOPT:=-OG2p3 +endif +ifeq ($(CPU_TARGET),powerpc) +FPCCPUOPT:=-O1r +endif +else +FPCCPUOPT:=-O2 +endif +override FPCOPT+=-Ur -Xs $(FPCCPUOPT) -n +override FPCOPTDEF+=RELEASE +endif +ifdef STRIP +override FPCOPT+=-Xs +endif +ifdef OPTIMIZE +override FPCOPT+=-O2 +endif +ifdef VERBOSE +override FPCOPT+=-vwni +endif +ifdef COMPILER_OPTIONS +override FPCOPT+=$(COMPILER_OPTIONS) +endif +ifdef COMPILER_UNITDIR +override FPCOPT+=$(addprefix -Fu,$(COMPILER_UNITDIR)) +endif +ifdef COMPILER_LIBRARYDIR +override FPCOPT+=$(addprefix -Fl,$(COMPILER_LIBRARYDIR)) +endif +ifdef COMPILER_OBJECTDIR +override FPCOPT+=$(addprefix -Fo,$(COMPILER_OBJECTDIR)) +endif +ifdef COMPILER_INCLUDEDIR +override FPCOPT+=$(addprefix -Fi,$(COMPILER_INCLUDEDIR)) +endif +ifdef CROSSBINDIR +override FPCOPT+=-FD$(CROSSBINDIR) +endif +ifdef COMPILER_TARGETDIR +override FPCOPT+=-FE$(COMPILER_TARGETDIR) +ifeq ($(COMPILER_TARGETDIR),.) +override TARGETDIRPREFIX= +else +override TARGETDIRPREFIX=$(COMPILER_TARGETDIR)/ +endif +endif +ifdef COMPILER_UNITTARGETDIR +override FPCOPT+=-FU$(COMPILER_UNITTARGETDIR) +ifeq ($(COMPILER_UNITTARGETDIR),.) +override UNITTARGETDIRPREFIX= +else +override UNITTARGETDIRPREFIX=$(COMPILER_UNITTARGETDIR)/ +endif +else +ifdef COMPILER_TARGETDIR +override COMPILER_UNITTARGETDIR=$(COMPILER_TARGETDIR) +override UNITTARGETDIRPREFIX=$(TARGETDIRPREFIX) +endif +endif +ifdef CREATESHARED +override FPCOPT+=-Cg +ifeq ($(CPU_TARGET),i386) +override FPCOPT+=-Aas +endif +endif +ifeq ($(findstring 2.0.,$(FPC_VERSION)),) +ifeq ($(OS_TARGET),linux) +ifeq ($(CPU_TARGET),x86_64) +override FPCOPT+=-Cg +endif +endif +endif +ifdef LINKSHARED +endif +ifdef GCCLIBDIR +override FPCOPT+=-Fl$(GCCLIBDIR) +endif +ifdef OTHERLIBDIR +override FPCOPT+=$(addprefix -Fl,$(OTHERLIBDIR)) +endif +ifdef OPT +override FPCOPT+=$(OPT) +endif +ifdef FPCOPTDEF +override FPCOPT+=$(addprefix -d,$(FPCOPTDEF)) +endif +ifdef CFGFILE +override FPCOPT+=@$(CFGFILE) +endif +ifdef USEENV +override FPCEXTCMD:=$(FPCOPT) +override FPCOPT:=!FPCEXTCMD +export FPCEXTCMD +endif +override AFULL_TARGET=$(CPU_TARGET)-$(OS_TARGET) +override AFULL_SOURCE=$(CPU_SOURCE)-$(OS_SOURCE) +ifneq ($(AFULL_TARGET),$(AFULL_SOURCE)) +override ACROSSCOMPILE=1 +endif +ifdef ACROSSCOMPILE +override FPCOPT+=$(CROSSOPT) +endif +override COMPILER:=$(FPC) $(FPCOPT) +ifeq (,$(findstring -s ,$(COMPILER))) +EXECPPAS= +else +ifeq ($(FULL_SOURCE),$(FULL_TARGET)) +ifdef RUNBATCH +EXECPPAS:=@$(RUNBATCH) $(PPAS) +else +EXECPPAS:=@$(PPAS) +endif +endif +endif +.PHONY: fpc_exes +ifndef CROSSINSTALL +ifneq ($(TARGET_PROGRAMS),) +override EXEFILES=$(addsuffix $(EXEEXT),$(TARGET_PROGRAMS)) +override EXEOFILES:=$(addsuffix $(OEXT),$(TARGET_PROGRAMS)) $(addprefix $(STATICLIBPREFIX),$(addsuffix $(STATICLIBEXT),$(TARGET_PROGRAMS))) $(addprefix $(IMPORTLIBPREFIX),$(addsuffix $(STATICLIBEXT),$(TARGET_PROGRAMS))) +override ALLTARGET+=fpc_exes +override INSTALLEXEFILES+=$(EXEFILES) +override CLEANEXEFILES+=$(EXEFILES) $(EXEOFILES) +ifeq ($(OS_TARGET),os2) +override CLEANEXEFILES+=$(addsuffix $(AOUTEXT),$(TARGET_PROGRAMS)) +endif +ifeq ($(OS_TARGET),emx) +override CLEANEXEFILES+=$(addsuffix $(AOUTEXT),$(TARGET_PROGRAMS)) +endif +endif +endif +fpc_exes: $(COMPILER_TARGETDIR) $(COMPILER_UNITTARGETDIR) $(EXEFILES) +ifdef TARGET_RSTS +override RSTFILES=$(addsuffix $(RSTEXT),$(TARGET_RSTS)) +override CLEANRSTFILES+=$(RSTFILES) +endif +.PHONY: fpc_all fpc_smart fpc_debug fpc_release fpc_shared +$(FPCMADE): $(ALLDEPENDENCIES) $(ALLTARGET) + @$(ECHOREDIR) Compiled > $(FPCMADE) +fpc_all: $(FPCMADE) +fpc_smart: + $(MAKE) all LINKSMART=1 CREATESMART=1 +fpc_debug: + $(MAKE) all DEBUG=1 +fpc_release: + $(MAKE) all RELEASE=1 +.SUFFIXES: $(EXEEXT) $(PPUEXT) $(OEXT) .pas .lpr .dpr .pp .rc .res +$(COMPILER_UNITTARGETDIR): + $(MKDIRTREE) $(COMPILER_UNITTARGETDIR) +$(COMPILER_TARGETDIR): + $(MKDIRTREE) $(COMPILER_TARGETDIR) +%$(PPUEXT): %.pp + $(COMPILER) $< + $(EXECPPAS) +%$(PPUEXT): %.pas + $(COMPILER) $< + $(EXECPPAS) +%$(EXEEXT): %.pp + $(COMPILER) $< + $(EXECPPAS) +%$(EXEEXT): %.pas + $(COMPILER) $< + $(EXECPPAS) +%$(EXEEXT): %.lpr + $(COMPILER) $< + $(EXECPPAS) +%$(EXEEXT): %.dpr + $(COMPILER) $< + $(EXECPPAS) +%.res: %.rc + windres -i $< -o $@ +vpath %.pp $(COMPILER_SOURCEDIR) $(COMPILER_INCLUDEDIR) +vpath %.pas $(COMPILER_SOURCEDIR) $(COMPILER_INCLUDEDIR) +vpath %.lpr $(COMPILER_SOURCEDIR) $(COMPILER_INCLUDEDIR) +vpath %.dpr $(COMPILER_SOURCEDIR) $(COMPILER_INCLUDEDIR) +vpath %.inc $(COMPILER_INCLUDEDIR) +vpath %$(OEXT) $(COMPILER_UNITTARGETDIR) +vpath %$(PPUEXT) $(COMPILER_UNITTARGETDIR) +.PHONY: fpc_shared +override INSTALLTARGET+=fpc_shared_install +ifndef SHARED_LIBVERSION +SHARED_LIBVERSION=$(FPC_VERSION) +endif +ifndef SHARED_LIBNAME +SHARED_LIBNAME=$(PACKAGE_NAME) +endif +ifndef SHARED_FULLNAME +SHARED_FULLNAME=$(SHAREDLIBPREFIX)$(SHARED_LIBNAME)-$(SHARED_LIBVERSION)$(SHAREDLIBEXT) +endif +ifndef SHARED_LIBUNITS +SHARED_LIBUNITS:=$(TARGET_UNITS) $(TARGET_IMPLICITUNITS) +override SHARED_LIBUNITS:=$(filter-out $(INSTALL_BUILDUNIT),$(SHARED_LIBUNITS)) +endif +fpc_shared: +ifdef HASSHAREDLIB + $(MAKE) all CREATESHARED=1 LINKSHARED=1 CREATESMART=1 +ifneq ($(SHARED_BUILD),n) + $(PPUMOVE) -q $(SHARED_LIBUNITS) -i$(COMPILER_UNITTARGETDIR) -o$(SHARED_FULLNAME) -d$(COMPILER_UNITTARGETDIR) +endif +else + @$(ECHO) Shared Libraries not supported +endif +fpc_shared_install: +ifneq ($(SHARED_BUILD),n) +ifneq ($(SHARED_LIBUNITS),) +ifneq ($(wildcard $(COMPILER_UNITTARGETDIR)/$(SHARED_FULLNAME)),) + $(INSTALL) $(COMPILER_UNITTARGETDIR)/$(SHARED_FULLNAME) $(INSTALL_SHAREDDIR) +endif +endif +endif +.PHONY: fpc_install fpc_sourceinstall fpc_exampleinstall +ifdef INSTALL_UNITS +override INSTALLPPUFILES+=$(addsuffix $(PPUEXT),$(INSTALL_UNITS)) +endif +ifdef INSTALL_BUILDUNIT +override INSTALLPPUFILES:=$(filter-out $(INSTALL_BUILDUNIT)$(PPUEXT),$(INSTALLPPUFILES)) +endif +ifdef INSTALLPPUFILES +override INSTALLPPULINKFILES:=$(subst $(PPUEXT),$(OEXT),$(INSTALLPPUFILES)) $(addprefix $(STATICLIBPREFIX),$(subst $(PPUEXT),$(STATICLIBEXT),$(INSTALLPPUFILES))) $(addprefix $(IMPORTLIBPREFIX),$(subst $(PPUEXT),$(STATICLIBEXT),$(INSTALLPPUFILES))) +ifneq ($(UNITTARGETDIRPREFIX),) +override INSTALLPPUFILES:=$(addprefix $(UNITTARGETDIRPREFIX),$(notdir $(INSTALLPPUFILES))) +override INSTALLPPULINKFILES:=$(wildcard $(addprefix $(UNITTARGETDIRPREFIX),$(notdir $(INSTALLPPULINKFILES)))) +endif +override INSTALL_CREATEPACKAGEFPC=1 +endif +ifdef INSTALLEXEFILES +ifneq ($(TARGETDIRPREFIX),) +override INSTALLEXEFILES:=$(addprefix $(TARGETDIRPREFIX),$(notdir $(INSTALLEXEFILES))) +endif +endif +fpc_install: all $(INSTALLTARGET) +ifdef INSTALLEXEFILES + $(MKDIR) $(INSTALL_BINDIR) +ifdef UPXPROG + -$(UPXPROG) $(INSTALLEXEFILES) +endif + $(INSTALLEXE) $(INSTALLEXEFILES) $(INSTALL_BINDIR) +endif +ifdef INSTALL_CREATEPACKAGEFPC +ifdef FPCMAKE +ifdef PACKAGE_VERSION +ifneq ($(wildcard Makefile.fpc),) + $(FPCMAKE) -p -T$(CPU_TARGET)-$(OS_TARGET) Makefile.fpc + $(MKDIR) $(INSTALL_UNITDIR) + $(INSTALL) Package.fpc $(INSTALL_UNITDIR) +endif +endif +endif +endif +ifdef INSTALLPPUFILES + $(MKDIR) $(INSTALL_UNITDIR) + $(INSTALL) $(INSTALLPPUFILES) $(INSTALL_UNITDIR) +ifneq ($(INSTALLPPULINKFILES),) + $(INSTALL) $(INSTALLPPULINKFILES) $(INSTALL_UNITDIR) +endif +ifneq ($(wildcard $(LIB_FULLNAME)),) + $(MKDIR) $(INSTALL_LIBDIR) + $(INSTALL) $(LIB_FULLNAME) $(INSTALL_LIBDIR) +ifdef inUnix + ln -sf $(LIB_FULLNAME) $(INSTALL_LIBDIR)/$(LIB_NAME) +endif +endif +endif +ifdef INSTALL_FILES + $(MKDIR) $(INSTALL_DATADIR) + $(INSTALL) $(INSTALL_FILES) $(INSTALL_DATADIR) +endif +fpc_sourceinstall: distclean + $(MKDIR) $(INSTALL_SOURCEDIR) + $(COPYTREE) $(BASEDIR)/* $(INSTALL_SOURCEDIR) +fpc_exampleinstall: $(addsuffix _distclean,$(TARGET_EXAMPLEDIRS)) +ifdef HASEXAMPLES + $(MKDIR) $(INSTALL_EXAMPLEDIR) +endif +ifdef EXAMPLESOURCEFILES + $(COPY) $(EXAMPLESOURCEFILES) $(INSTALL_EXAMPLEDIR) +endif +ifdef TARGET_EXAMPLEDIRS + $(COPYTREE) $(addsuffix /*,$(TARGET_EXAMPLEDIRS)) $(INSTALL_EXAMPLEDIR) +endif +.PHONY: fpc_clean fpc_cleanall fpc_distclean +ifdef EXEFILES +override CLEANEXEFILES:=$(addprefix $(TARGETDIRPREFIX),$(CLEANEXEFILES)) +endif +ifdef CLEAN_UNITS +override CLEANPPUFILES+=$(addsuffix $(PPUEXT),$(CLEAN_UNITS)) +endif +ifdef CLEANPPUFILES +override CLEANPPULINKFILES:=$(subst $(PPUEXT),$(OEXT),$(CLEANPPUFILES)) $(addprefix $(STATICLIBPREFIX),$(subst $(PPUEXT),$(STATICLIBEXT),$(CLEANPPUFILES))) $(addprefix $(IMPORTLIBPREFIX),$(subst $(PPUEXT),$(STATICLIBEXT),$(CLEANPPUFILES))) +ifdef DEBUGSYMEXT +override CLEANPPULINKFILES+=$(subst $(PPUEXT),$(DEBUGSYMEXT),$(CLEANPPUFILES)) +endif +override CLEANPPUFILES:=$(addprefix $(UNITTARGETDIRPREFIX),$(CLEANPPUFILES)) +override CLEANPPULINKFILES:=$(wildcard $(addprefix $(UNITTARGETDIRPREFIX),$(CLEANPPULINKFILES))) +endif +fpc_clean: $(CLEANTARGET) +ifdef CLEANEXEFILES + -$(DEL) $(CLEANEXEFILES) +endif +ifdef CLEANPPUFILES + -$(DEL) $(CLEANPPUFILES) +endif +ifneq ($(CLEANPPULINKFILES),) + -$(DEL) $(CLEANPPULINKFILES) +endif +ifdef CLEANRSTFILES + -$(DEL) $(addprefix $(UNITTARGETDIRPREFIX),$(CLEANRSTFILES)) +endif +ifdef CLEAN_FILES + -$(DEL) $(CLEAN_FILES) +endif +ifdef LIB_NAME + -$(DEL) $(LIB_NAME) $(LIB_FULLNAME) +endif + -$(DEL) $(FPCMADE) Package.fpc $(PPAS) script.res link.res $(FPCEXTFILE) $(REDIRFILE) + -$(DEL) *$(ASMEXT) *_ppas$(BATCHEXT) +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) *_ppas$(BATCHEXT) +ifdef AOUTEXT + -$(DEL) *$(AOUTEXT) +endif +ifdef DEBUGSYMEXT + -$(DEL) *$(DEBUGSYMEXT) +endif +fpc_distclean: cleanall +.PHONY: fpc_baseinfo +override INFORULES+=fpc_baseinfo +fpc_baseinfo: + @$(ECHO) + @$(ECHO) == Package info == + @$(ECHO) Package Name..... $(PACKAGE_NAME) + @$(ECHO) Package Version.. $(PACKAGE_VERSION) + @$(ECHO) + @$(ECHO) == Configuration info == + @$(ECHO) + @$(ECHO) FPC.......... $(FPC) + @$(ECHO) FPC Version.. $(FPC_VERSION) + @$(ECHO) Source CPU... $(CPU_SOURCE) + @$(ECHO) Target CPU... $(CPU_TARGET) + @$(ECHO) Source OS.... $(OS_SOURCE) + @$(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) + @$(ECHO) Required pkgs... $(REQUIRE_PACKAGES) + @$(ECHO) + @$(ECHO) Basedir......... $(BASEDIR) + @$(ECHO) FPCDir.......... $(FPCDIR) + @$(ECHO) CrossBinDir..... $(CROSSBINDIR) + @$(ECHO) UnitsDir........ $(UNITSDIR) + @$(ECHO) PackagesDir..... $(PACKAGESDIR) + @$(ECHO) + @$(ECHO) GCC library..... $(GCCLIBDIR) + @$(ECHO) Other library... $(OTHERLIBDIR) + @$(ECHO) + @$(ECHO) == Tools info == + @$(ECHO) + @$(ECHO) As........ $(AS) + @$(ECHO) Ld........ $(LD) + @$(ECHO) Ar........ $(AR) + @$(ECHO) Rc........ $(RC) + @$(ECHO) + @$(ECHO) Mv........ $(MVPROG) + @$(ECHO) Cp........ $(CPPROG) + @$(ECHO) Rm........ $(RMPROG) + @$(ECHO) GInstall.. $(GINSTALL) + @$(ECHO) Echo...... $(ECHO) + @$(ECHO) Shell..... $(SHELL) + @$(ECHO) Date...... $(DATE) + @$(ECHO) FPCMake... $(FPCMAKE) + @$(ECHO) PPUMove... $(PPUMOVE) + @$(ECHO) Upx....... $(UPXPROG) + @$(ECHO) Zip....... $(ZIPPROG) + @$(ECHO) + @$(ECHO) == Object info == + @$(ECHO) + @$(ECHO) Target Loaders........ $(TARGET_LOADERS) + @$(ECHO) Target Units.......... $(TARGET_UNITS) + @$(ECHO) Target Implicit Units. $(TARGET_IMPLICITUNITS) + @$(ECHO) Target Programs....... $(TARGET_PROGRAMS) + @$(ECHO) Target Dirs........... $(TARGET_DIRS) + @$(ECHO) Target Examples....... $(TARGET_EXAMPLES) + @$(ECHO) Target ExampleDirs.... $(TARGET_EXAMPLEDIRS) + @$(ECHO) + @$(ECHO) Clean Units......... $(CLEAN_UNITS) + @$(ECHO) Clean Files......... $(CLEAN_FILES) + @$(ECHO) + @$(ECHO) Install Units....... $(INSTALL_UNITS) + @$(ECHO) Install Files....... $(INSTALL_FILES) + @$(ECHO) + @$(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) + @$(ECHO) Install binary dir... $(INSTALL_BINDIR) + @$(ECHO) Install library dir.. $(INSTALL_LIBDIR) + @$(ECHO) Install units dir.... $(INSTALL_UNITDIR) + @$(ECHO) Install source dir... $(INSTALL_SOURCEDIR) + @$(ECHO) Install doc dir...... $(INSTALL_DOCDIR) + @$(ECHO) Install example dir.. $(INSTALL_EXAMPLEDIR) + @$(ECHO) Install data dir..... $(INSTALL_DATADIR) + @$(ECHO) + @$(ECHO) Dist destination dir. $(DIST_DESTDIR) + @$(ECHO) Dist zip name........ $(DIST_ZIPNAME) + @$(ECHO) +.PHONY: fpc_info +fpc_info: $(INFORULES) +.PHONY: fpc_makefile fpc_makefiles fpc_makefile_sub1 fpc_makefile_sub2 \ + fpc_makefile_dirs +fpc_makefile: + $(FPCMAKE) -w -T$(OS_TARGET) Makefile.fpc +fpc_makefile_sub1: +ifdef TARGET_DIRS + $(FPCMAKE) -w -T$(OS_TARGET) $(addsuffix /Makefile.fpc,$(TARGET_DIRS)) +endif +ifdef TARGET_EXAMPLEDIRS + $(FPCMAKE) -w -T$(OS_TARGET) $(addsuffix /Makefile.fpc,$(TARGET_EXAMPLEDIRS)) +endif +fpc_makefile_sub2: $(addsuffix _makefile_dirs,$(TARGET_DIRS) $(TARGET_EXAMPLEDIRS)) +fpc_makefile_dirs: fpc_makefile_sub1 fpc_makefile_sub2 +fpc_makefiles: fpc_makefile fpc_makefile_dirs +all: fpc_all +debug: fpc_debug +smart: fpc_smart +release: fpc_release +units: fpc_units +examples: +shared: fpc_shared +install: fpc_install +sourceinstall: fpc_sourceinstall +exampleinstall: fpc_exampleinstall +distinstall: +zipinstall: +zipsourceinstall: +zipexampleinstall: +zipdistinstall: +clean: fpc_clean +distclean: fpc_distclean +cleanall: fpc_cleanall +info: fpc_info +makefiles: fpc_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 +.NOTPARALLEL: diff --git a/packages/gtk2/examples/gtkglext/Makefile.fpc b/packages/gtk2/examples/gtkglext/Makefile.fpc new file mode 100644 index 0000000000..ce3de27709 --- /dev/null +++ b/packages/gtk2/examples/gtkglext/Makefile.fpc @@ -0,0 +1,18 @@ +# +# Makefile.fpc for Free Pascal GTK 2.x.y Examples +# + +[target] +programs=gears + +[require] +packages=gtk2 opengl + +[install] +fpcpackage=y + +[default] +fpcdir=../../../.. + +[rules] +.NOTPARALLEL: diff --git a/packages/gtk2/examples/gtkglext/gears.pas b/packages/gtk2/examples/gtkglext/gears.pas new file mode 100644 index 0000000000..7381c599fc --- /dev/null +++ b/packages/gtk2/examples/gtkglext/gears.pas @@ -0,0 +1,549 @@ +{ 3-D gear wheels. This program is in the public domain. + Brian Paul + Conversion to GLUT by Mark J. Kilgard + Conversion to GtkGLExt by Naofumi Yasufuku + Conversion to Pascal binding of GtkGLExt by Michalis Kamburelis +} + +{$mode delphi} + +uses Glib2, Gtk2, Gdk2, GdkGLExt, GtkGLExt, gl; + +{* + * Draw a gear wheel. You'll probably want to call this function when + * building a display list since we do a lot of trig here. + * + * Input: inner_radius - radius of hole at center + * outer_radius - radius at center of teeth + * width - width of gear + * teeth - number of teeth + * tooth_depth - depth of tooth + *} + +procedure gear( + inner_radius, outer_radius, width: GLfloat; + teeth: GLint; + tooth_depth: GLfloat); +var + i: GLint; + r0, r1, r2: GLfloat; + angle, da: GLfloat; + u, v, len: GLfloat; +begin + r0 := inner_radius; + r1 := outer_radius - tooth_depth / 2.0; + r2 := outer_radius + tooth_depth / 2.0; + + da := 2.0 * Pi / teeth / 4.0; + + glShadeModel(GL_FLAT); + + glNormal3f(0.0, 0.0, 1.0); + + {* draw front face *} + glBegin(GL_QUAD_STRIP); + for i := 0 to teeth do + begin + angle := i * 2.0 * Pi / teeth; + glVertex3f(r0 * cos(angle), r0 * sin(angle), width * 0.5); + glVertex3f(r1 * cos(angle), r1 * sin(angle), width * 0.5); + if i < teeth then + begin + glVertex3f(r0 * cos(angle), r0 * sin(angle), width * 0.5); + glVertex3f(r1 * cos(angle + 3 * da), r1 * sin(angle + 3 * da), width * 0.5); + end; + end; + glEnd(); + + {* draw front sides of teeth *} + glBegin(GL_QUADS); + da := 2.0 * Pi / teeth / 4.0; + for i := 0 to teeth - 1 do + begin + angle := i * 2.0 * Pi / teeth; + + glVertex3f(r1 * cos(angle), r1 * sin(angle), width * 0.5); + glVertex3f(r2 * cos(angle + da), r2 * sin(angle + da), width * 0.5); + glVertex3f(r2 * cos(angle + 2 * da), r2 * sin(angle + 2 * da), width * 0.5); + glVertex3f(r1 * cos(angle + 3 * da), r1 * sin(angle + 3 * da), width * 0.5); + end; + glEnd(); + + glNormal3f(0.0, 0.0, -1.0); + + {* draw back face *} + glBegin(GL_QUAD_STRIP); + for i := 0 to teeth do + begin + angle := i * 2.0 * Pi / teeth; + glVertex3f(r1 * cos(angle), r1 * sin(angle), -width * 0.5); + glVertex3f(r0 * cos(angle), r0 * sin(angle), -width * 0.5); + if i < teeth then + begin + glVertex3f(r1 * cos(angle + 3 * da), r1 * sin(angle + 3 * da), -width * 0.5); + glVertex3f(r0 * cos(angle), r0 * sin(angle), -width * 0.5); + end; + end; + glEnd(); + + {* draw back sides of teeth *} + glBegin(GL_QUADS); + da := 2.0 * Pi / teeth / 4.0; + for i := 0 to teeth - 1 do + begin + angle := i * 2.0 * Pi / teeth; + + glVertex3f(r1 * cos(angle + 3 * da), r1 * sin(angle + 3 * da), -width * 0.5); + glVertex3f(r2 * cos(angle + 2 * da), r2 * sin(angle + 2 * da), -width * 0.5); + glVertex3f(r2 * cos(angle + da), r2 * sin(angle + da), -width * 0.5); + glVertex3f(r1 * cos(angle), r1 * sin(angle), -width * 0.5); + end; + glEnd(); + + {* draw outward faces of teeth *} + glBegin(GL_QUAD_STRIP); + for i := 0 to teeth - 1 do + begin + angle := i * 2.0 * Pi / teeth; + + glVertex3f(r1 * cos(angle), r1 * sin(angle), width * 0.5); + glVertex3f(r1 * cos(angle), r1 * sin(angle), -width * 0.5); + u := r2 * cos(angle + da) - r1 * cos(angle); + v := r2 * sin(angle + da) - r1 * sin(angle); + len := sqrt(u * u + v * v); + u := u / len; + v := v / len; + glNormal3f(v, -u, 0.0); + glVertex3f(r2 * cos(angle + da), r2 * sin(angle + da), width * 0.5); + glVertex3f(r2 * cos(angle + da), r2 * sin(angle + da), -width * 0.5); + glNormal3f(cos(angle), sin(angle), 0.0); + glVertex3f(r2 * cos(angle + 2 * da), r2 * sin(angle + 2 * da), width * 0.5); + glVertex3f(r2 * cos(angle + 2 * da), r2 * sin(angle + 2 * da), -width * 0.5); + u := r1 * cos(angle + 3 * da) - r2 * cos(angle + 2 * da); + v := r1 * sin(angle + 3 * da) - r2 * sin(angle + 2 * da); + glNormal3f(v, -u, 0.0); + glVertex3f(r1 * cos(angle + 3 * da), r1 * sin(angle + 3 * da), width * 0.5); + glVertex3f(r1 * cos(angle + 3 * da), r1 * sin(angle + 3 * da), -width * 0.5); + glNormal3f(cos(angle), sin(angle), 0.0); + end; + + glVertex3f(r1 * cos(0), r1 * sin(0), width * 0.5); + glVertex3f(r1 * cos(0), r1 * sin(0), -width * 0.5); + + glEnd(); + + glShadeModel(GL_SMOOTH); + + {* draw inside radius cylinder *} + glBegin(GL_QUAD_STRIP); + for i := 0 to teeth do + begin + angle := i * 2.0 * Pi / teeth; + glNormal3f(-cos(angle), -sin(angle), 0.0); + glVertex3f(r0 * cos(angle), r0 * sin(angle), -width * 0.5); + glVertex3f(r0 * cos(angle), r0 * sin(angle), width * 0.5); + end; + glEnd(); + +end; + +var + view_rotx: GLfloat = 20.0; + view_roty: GLfloat = 30.0; + view_rotz: GLfloat = 0.0; + gear1, gear2, gear3: GLint; + angle: GLfloat = 0.0; + + timer: PGTimer = nil; + frames: gint = 0; + + is_sync: boolean = true; + +function draw( + widget: PGtkWidget; + event: PGdkEventExpose; + data: gpointer): gboolean; cdecl; +var + seconds: gdouble; + fps: gdouble; + glcontext: PGdkGLContext; + gldrawable: PGdkGLDrawable; +begin + glcontext := gtk_widget_get_gl_context (widget); + gldrawable := gtk_widget_get_gl_drawable (widget); + + {*** OpenGL BEGIN ***} + if not gdk_gl_drawable_gl_begin (gldrawable, glcontext) then + Exit(false); + + glClear (GL_COLOR_BUFFER_BIT or GL_DEPTH_BUFFER_BIT); + + glPushMatrix (); + glRotatef (view_rotx, 1.0, 0.0, 0.0); + glRotatef (view_roty, 0.0, 1.0, 0.0); + glRotatef (view_rotz, 0.0, 0.0, 1.0); + + glPushMatrix (); + glTranslatef (-3.0, -2.0, 0.0); + glRotatef (angle, 0.0, 0.0, 1.0); + glCallList (gear1); + glPopMatrix (); + + glPushMatrix (); + glTranslatef (3.1, -2.0, 0.0); + glRotatef (-2.0 * angle - 9.0, 0.0, 0.0, 1.0); + glCallList (gear2); + glPopMatrix (); + + glPushMatrix (); + glTranslatef (-3.1, 4.2, 0.0); + glRotatef (-2.0 * angle - 25.0, 0.0, 0.0, 1.0); + glCallList (gear3); + glPopMatrix (); + + glPopMatrix (); + + if gdk_gl_drawable_is_double_buffered (gldrawable) then + gdk_gl_drawable_swap_buffers (gldrawable) else + glFlush (); + + gdk_gl_drawable_gl_end (gldrawable); + {*** OpenGL END ***} + + Inc(frames); + + seconds := g_timer_elapsed (timer, NULL); + if seconds >= 5.0 then + begin + fps := frames / seconds; + g_print ('%d frames in %6.3f seconds = %6.3f FPS' + LineEnding, [frames, seconds, fps]); + g_timer_reset (timer); + frames := 0; + end; + + Result := true; +end; + +{* new window size or exposure *} +function reshape ( + widget: PGtkWidget; + event: PGdkEventConfigure; + data: gpointer): gboolean; cdecl; +var + glcontext: PGdkGLContext; + gldrawable: PGdkGLDrawable; + h: GLfloat; +begin + glcontext := gtk_widget_get_gl_context (widget); + gldrawable := gtk_widget_get_gl_drawable (widget); + + h := widget.allocation.height / widget.allocation.width; + + {*** OpenGL BEGIN ***} + if not gdk_gl_drawable_gl_begin (gldrawable, glcontext) then + Exit(false); + + glViewport (0, 0, widget.allocation.width, widget.allocation.height); + glMatrixMode (GL_PROJECTION); + glLoadIdentity (); + glFrustum (-1.0, 1.0, -h, h, 5.0, 60.0); + glMatrixMode (GL_MODELVIEW); + glLoadIdentity (); + glTranslatef (0.0, 0.0, -40.0); + + gdk_gl_drawable_gl_end (gldrawable); + {*** OpenGL END ***} + + Result := true; +end; + +procedure init( + widget: PGtkWidget; + data: gpointer); cdecl; +const + pos: array[0..3] of GLfloat = (5.0, 5.0, 10.0, 0.0); + red: array[0..3] of GLfloat = (0.8, 0.1, 0.0, 1.0); + green: array[0..3] of GLfloat = (0.0, 0.8, 0.2, 1.0); + blue: array[0..3] of GLfloat = (0.2, 0.2, 1.0, 1.0); +var + glcontext: PGdkGLContext; + gldrawable: PGdkGLDrawable; +begin + glcontext := gtk_widget_get_gl_context (widget); + gldrawable := gtk_widget_get_gl_drawable (widget); + + {*** OpenGL BEGIN ***} + if not gdk_gl_drawable_gl_begin (gldrawable, glcontext) then + Exit; + + glLightfv (GL_LIGHT0, GL_POSITION, pos); + glEnable (GL_CULL_FACE); + glEnable (GL_LIGHTING); + glEnable (GL_LIGHT0); + glEnable (GL_DEPTH_TEST); + + {* make the gears *} + gear1 := glGenLists (1); + glNewList (gear1, GL_COMPILE); + glMaterialfv (GL_FRONT, GL_AMBIENT_AND_DIFFUSE, red); + gear (1.0, 4.0, 1.0, 20, 0.7); + glEndList (); + + gear2 := glGenLists (1); + glNewList (gear2, GL_COMPILE); + glMaterialfv (GL_FRONT, GL_AMBIENT_AND_DIFFUSE, green); + gear (0.5, 2.0, 2.0, 10, 0.7); + glEndList (); + + gear3 := glGenLists (1); + glNewList (gear3, GL_COMPILE); + glMaterialfv (GL_FRONT, GL_AMBIENT_AND_DIFFUSE, blue); + gear (1.3, 2.0, 0.5, 10, 0.7); + glEndList (); + + glEnable (GL_NORMALIZE); + + g_print (LineEnding); + g_print ('GL_RENDERER = %s' + LineEnding, [glGetString (GL_RENDERER)]); + g_print ('GL_VERSION = %s' + LineEnding, [glGetString (GL_VERSION)]); + g_print ('GL_VENDOR = %s' + LineEnding, [glGetString (GL_VENDOR)]); + g_print ('GL_EXTENSIONS = %s' + LineEnding, [glGetString (GL_EXTENSIONS)]); + g_print (LineEnding); + + gdk_gl_drawable_gl_end (gldrawable); + {*** OpenGL END ***} + + {* create timer *} + if timer = nil then + timer := g_timer_new (); + + g_timer_start (timer); +end; + +function idle (widget: PGtkWidget): gboolean; cdecl; +begin + angle := angle + 2.0; + + {* Invalidate the whole window. *} + gdk_window_invalidate_rect (widget.window, @widget.allocation, false); + + {* Update synchronously (fast). *} + if is_sync then + gdk_window_process_updates (widget.window, false); + + Result := true; +end; + +var + idle_id: guint = 0; + +procedure idle_add (widget: PGtkWidget); cdecl; +begin + if idle_id = 0 then + begin + idle_id := g_idle_add_full (GDK_PRIORITY_REDRAW, + TGSourceFunc(@idle), + widget, + NULL); + end; +end; + +procedure idle_remove (widget: PGtkWidget); cdecl; +begin + if idle_id <> 0 then + begin + g_source_remove (idle_id); + idle_id := 0; + end; +end; + +function map ( + widget: PGtkWidget; + event: PGdkEventAny; + data: gpointer): gboolean; cdecl; +begin + idle_add (widget); + + Result := true; +end; + +function unmap ( + widget: PGtkWidget; + event: PGdkEventAny; + data: gpointer): gboolean; cdecl; +begin + idle_remove (widget); + + Result := true; +end; + +function visible ( + widget: PGtkWidget; + event: PGdkEventVisibility; + data: gpointer): gboolean; cdecl; +begin + if event.state = GDK_VISIBILITY_FULLY_OBSCURED then + idle_remove (widget) else + idle_add (widget); + + Result := true; +end; + +{* change view angle, exit upon ESC *} +function key ( + widget: PGtkWidget; + event: PGdkEventKey; + data: gpointer): gboolean; cdecl; +begin + case event.keyval of + GDK_KEY_z : view_rotz := view_rotz + 5.0; + GDK_KEY_Capital_Z : view_rotz := view_rotz - 5.0; + GDK_KEY_Up : view_roty := view_roty + 5.0; + GDK_KEY_Down : view_roty := view_roty - 5.0; + GDK_KEY_Left : view_rotx := view_rotx + 5.0; + GDK_KEY_Right : view_rotx := view_rotx - 5.0; + GDK_KEY_Escape : gtk_main_quit (); + else Exit(false); + end; + + gdk_window_invalidate_rect (widget.window, @widget.allocation, FALSE); + + Result := true; +end; + +var + glconfig: PGdkGLConfig; + window: PGtkWidget; + vbox: PGtkWidget; + drawing_area: PGtkWidget; + button: PGtkWidget; + i: Integer; +begin + + {* + * Init GTK. + *} + + gtk_init (@argc, @argv); + + {* + * Init GtkGLExt. + *} + + gtk_gl_init (@argc, @argv); + + {* + * Command line options. + *} + + for i := 1 to ParamCount do + if ParamStr(i) = '--async' then + is_sync := FALSE; + + {* + * Configure OpenGL-capable visual. + *} + + {* Try double-buffered visual *} + glconfig := gdk_gl_config_new_by_mode (GDK_GL_MODE_RGB or + GDK_GL_MODE_DEPTH or + GDK_GL_MODE_DOUBLE); + if glconfig = nil then + begin + g_print ('*** Cannot find the double-buffered visual.' +LineEnding); + g_print ('*** Trying single-buffered visual.' +LineEnding); + + {* Try single-buffered visual *} + glconfig := gdk_gl_config_new_by_mode (GDK_GL_MODE_RGB or + GDK_GL_MODE_DEPTH); + if glconfig = nil then + begin + g_print ('*** No appropriate OpenGL-capable visual found.' +LineEnding); + Halt(1); + end; + end; + + {* + * Top-level window. + *} + + window := gtk_window_new (GTK_WINDOW_TOPLEVEL); + gtk_window_set_title (GTK_WINDOW (window), 'gears'); + + {* Get automatically redrawn if any of their children changed allocation. *} + gtk_container_set_reallocate_redraws (GTK_CONTAINER (window), TRUE); + + g_signal_connect (G_OBJECT (window), 'delete_event', + G_CALLBACK (@gtk_main_quit), NULL); + + {* + * VBox. + *} + + vbox := gtk_vbox_new (FALSE, 0); + gtk_container_add (GTK_CONTAINER (window), vbox); + gtk_widget_show (vbox); + + {* + * Drawing area for drawing OpenGL scene. + *} + + drawing_area := gtk_drawing_area_new (); + gtk_widget_set_size_request (drawing_area, 300, 300); + + {* Set OpenGL-capability to the widget. *} + gtk_widget_set_gl_capability (drawing_area, + glconfig, + NULL, + TRUE, + GDK_GL_RGBA_TYPE); + + gtk_widget_add_events (drawing_area, + GDK_VISIBILITY_NOTIFY_MASK); + + g_signal_connect_after (G_OBJECT (drawing_area), 'realize', + G_CALLBACK (@init), NULL); + g_signal_connect (G_OBJECT (drawing_area), 'configure_event', + G_CALLBACK (@reshape), NULL); + g_signal_connect (G_OBJECT (drawing_area), 'expose_event', + G_CALLBACK (@draw), NULL); + g_signal_connect (G_OBJECT (drawing_area), 'map_event', + G_CALLBACK (@map), NULL); + g_signal_connect (G_OBJECT (drawing_area), 'unmap_event', + G_CALLBACK (@unmap), NULL); + g_signal_connect (G_OBJECT (drawing_area), 'visibility_notify_event', + G_CALLBACK (@visible), NULL); + + g_signal_connect_swapped (G_OBJECT (window), 'key_press_event', + G_CALLBACK (@key), drawing_area); + + gtk_box_pack_start (GTK_BOX (vbox), drawing_area, TRUE, TRUE, 0); + + gtk_widget_show (drawing_area); + + {* + * Simple quit button. + *} + + button := gtk_button_new_with_label ('Quit'); + + g_signal_connect (G_OBJECT (button), 'clicked', + G_CALLBACK (@gtk_main_quit), NULL); + + gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0); + + gtk_widget_show (button); + + {* + * Show window. + *} + + gtk_widget_show (window); + + {* + * Main loop. + *} + + gtk_main (); + +end. diff --git a/packages/gtk2/examples/helloworld/Makefile b/packages/gtk2/examples/helloworld/Makefile new file mode 100644 index 0000000000..ea43297126 --- /dev/null +++ b/packages/gtk2/examples/helloworld/Makefile @@ -0,0 +1,2015 @@ +# +# Don't edit, this file is generated by FPCMake Version 2.0.0 [2008/01/26] +# +default: all +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-darwin i386-emx i386-watcom i386-netwlibc i386-wince i386-embedded i386-symbian m68k-linux m68k-freebsd m68k-netbsd m68k-amiga m68k-atari m68k-openbsd m68k-palmos m68k-embedded powerpc-linux powerpc-netbsd powerpc-amiga powerpc-macos powerpc-darwin powerpc-morphos powerpc-embedded sparc-linux sparc-netbsd sparc-solaris sparc-embedded x86_64-linux x86_64-freebsd x86_64-darwin x86_64-win64 x86_64-embedded arm-linux arm-palmos arm-wince arm-gba arm-nds arm-embedded arm-symbian powerpc64-linux powerpc64-darwin powerpc64-embedded +BSDs = freebsd netbsd openbsd darwin +UNIXs = linux $(BSDs) solaris qnx +LIMIT83fs = go32v2 os2 emx watcom +OSNeedsComspecToRunBatch = go32v2 watcom +FORCE: +.PHONY: FORCE +override PATH:=$(patsubst %/,%,$(subst \,/,$(PATH))) +ifneq ($(findstring darwin,$(OSTYPE)),) +inUnix=1 #darwin +SEARCHPATH:=$(filter-out .,$(subst :, ,$(PATH))) +else +ifeq ($(findstring ;,$(PATH)),) +inUnix=1 +SEARCHPATH:=$(filter-out .,$(subst :, ,$(PATH))) +else +SEARCHPATH:=$(subst ;, ,$(PATH)) +endif +endif +SEARCHPATH+=$(patsubst %/,%,$(subst \,/,$(dir $(MAKE)))) +PWD:=$(strip $(wildcard $(addsuffix /pwd.exe,$(SEARCHPATH)))) +ifeq ($(PWD),) +PWD:=$(strip $(wildcard $(addsuffix /pwd,$(SEARCHPATH)))) +ifeq ($(PWD),) +$(error You need the GNU utils package to use this Makefile) +else +PWD:=$(firstword $(PWD)) +SRCEXEEXT= +endif +else +PWD:=$(firstword $(PWD)) +SRCEXEEXT=.exe +endif +ifndef inUnix +ifeq ($(OS),Windows_NT) +inWinNT=1 +else +ifdef OS2_SHELL +inOS2=1 +endif +endif +else +ifneq ($(findstring cygdrive,$(PATH)),) +inCygWin=1 +endif +endif +ifdef inUnix +SRCBATCHEXT=.sh +else +ifdef inOS2 +SRCBATCHEXT=.cmd +else +SRCBATCHEXT=.bat +endif +endif +ifdef COMSPEC +ifneq ($(findstring $(OS_SOURCE),$(OSNeedsComspecToRunBatch)),) +RUNBATCH=$(COMSPEC) /C +endif +endif +ifdef inUnix +PATHSEP=/ +else +PATHSEP:=$(subst /,\,/) +ifdef inCygWin +PATHSEP=/ +endif +endif +ifdef PWD +BASEDIR:=$(subst \,/,$(shell $(PWD))) +ifdef inCygWin +ifneq ($(findstring /cygdrive/,$(BASEDIR)),) +BASENODIR:=$(patsubst /cygdrive%,%,$(BASEDIR)) +BASEDRIVE:=$(firstword $(subst /, ,$(BASENODIR))) +BASEDIR:=$(subst /cygdrive/$(BASEDRIVE)/,$(BASEDRIVE):/,$(BASEDIR)) +endif +endif +else +BASEDIR=. +endif +ifdef inOS2 +ifndef ECHO +ECHO:=$(strip $(wildcard $(addsuffix /gecho$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(ECHO),) +ECHO:=$(strip $(wildcard $(addsuffix /echo$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(ECHO),) +ECHO=echo +else +ECHO:=$(firstword $(ECHO)) +endif +else +ECHO:=$(firstword $(ECHO)) +endif +endif +export ECHO +endif +override DEFAULT_FPCDIR=../../../.. +ifndef FPC +ifdef PP +FPC=$(PP) +endif +endif +ifndef FPC +FPCPROG:=$(strip $(wildcard $(addsuffix /fpc$(SRCEXEEXT),$(SEARCHPATH)))) +ifneq ($(FPCPROG),) +FPCPROG:=$(firstword $(FPCPROG)) +ifneq ($(CPU_TARGET),) +FPC:=$(shell $(FPCPROG) -P$(CPU_TARGET) -PB) +else +FPC:=$(shell $(FPCPROG) -PB) +endif +ifneq ($(findstring Error,$(FPC)),) +override FPC=$(firstword $(strip $(wildcard $(addsuffix /ppc386$(SRCEXEEXT),$(SEARCHPATH))))) +endif +else +override FPC=$(firstword $(strip $(wildcard $(addsuffix /ppc386$(SRCEXEEXT),$(SEARCHPATH))))) +endif +endif +override FPC:=$(subst $(SRCEXEEXT),,$(FPC)) +override FPC:=$(subst \,/,$(FPC))$(SRCEXEEXT) +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 +unexport CHECKDEPEND ALLDEPENDENCIES +ifndef CPU_TARGET +ifdef CPU_TARGET_DEFAULT +CPU_TARGET=$(CPU_TARGET_DEFAULT) +endif +endif +ifndef OS_TARGET +ifdef OS_TARGET_DEFAULT +OS_TARGET=$(OS_TARGET_DEFAULT) +endif +endif +ifneq ($(words $(FPC_COMPILERINFO)),5) +FPC_COMPILERINFO+=$(shell $(FPC) -iSP) +FPC_COMPILERINFO+=$(shell $(FPC) -iTP) +FPC_COMPILERINFO+=$(shell $(FPC) -iSO) +FPC_COMPILERINFO+=$(shell $(FPC) -iTO) +endif +ifndef CPU_SOURCE +CPU_SOURCE:=$(word 2,$(FPC_COMPILERINFO)) +endif +ifndef CPU_TARGET +CPU_TARGET:=$(word 3,$(FPC_COMPILERINFO)) +endif +ifndef OS_SOURCE +OS_SOURCE:=$(word 4,$(FPC_COMPILERINFO)) +endif +ifndef OS_TARGET +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 $(FULL_TARGET),$(MAKEFILETARGETS)),) +$(error The Makefile doesn't support target $(FULL_TARGET), please run fpcmake first) +endif +endif +ifneq ($(findstring $(OS_TARGET),$(BSDs)),) +BSDhier=1 +endif +ifeq ($(OS_TARGET),linux) +linuxHier=1 +endif +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)),) +override FPCDIR=wrong +endif +else +override FPCDIR=wrong +endif +ifdef DEFAULT_FPCDIR +ifeq ($(FPCDIR),wrong) +override FPCDIR:=$(subst \,/,$(DEFAULT_FPCDIR)) +ifeq ($(wildcard $(addprefix $(FPCDIR)/,rtl units)),) +override FPCDIR=wrong +endif +endif +endif +ifeq ($(FPCDIR),wrong) +ifdef inUnix +override FPCDIR=/usr/local/lib/fpc/$(FPC_VERSION) +ifeq ($(wildcard $(FPCDIR)/units),) +override FPCDIR=/usr/lib/fpc/$(FPC_VERSION) +endif +else +override FPCDIR:=$(subst /$(FPC),,$(firstword $(strip $(wildcard $(addsuffix /$(FPC),$(SEARCHPATH)))))) +override FPCDIR:=$(FPCDIR)/.. +ifeq ($(wildcard $(addprefix $(FPCDIR)/,rtl units)),) +override FPCDIR:=$(FPCDIR)/.. +ifeq ($(wildcard $(addprefix $(FPCDIR)/,rtl units)),) +override FPCDIR:=$(BASEDIR) +ifeq ($(wildcard $(addprefix $(FPCDIR)/,rtl units)),) +override FPCDIR=c:/pp +endif +endif +endif +endif +endif +ifndef CROSSBINDIR +CROSSBINDIR:=$(wildcard $(FPCDIR)/bin/$(TARGETSUFFIX)) +endif +ifndef BINUTILSPREFIX +ifndef CROSSBINDIR +ifdef CROSSCOMPILE +BINUTILSPREFIX=$(CPU_TARGET)-$(OS_TARGET)- +endif +endif +endif +UNITSDIR:=$(wildcard $(FPCDIR)/units/$(TARGETSUFFIX)) +ifeq ($(UNITSDIR),) +UNITSDIR:=$(wildcard $(FPCDIR)/units/$(OS_TARGET)) +endif +PACKAGESDIR:=$(wildcard $(FPCDIR) $(FPCDIR)/packages $(FPCDIR)/packages/base $(FPCDIR)/packages/extra) +ifeq ($(FULL_TARGET),i386-linux) +override TARGET_PROGRAMS+=helloworld +endif +ifeq ($(FULL_TARGET),i386-go32v2) +override TARGET_PROGRAMS+=helloworld +endif +ifeq ($(FULL_TARGET),i386-win32) +override TARGET_PROGRAMS+=helloworld +endif +ifeq ($(FULL_TARGET),i386-os2) +override TARGET_PROGRAMS+=helloworld +endif +ifeq ($(FULL_TARGET),i386-freebsd) +override TARGET_PROGRAMS+=helloworld +endif +ifeq ($(FULL_TARGET),i386-beos) +override TARGET_PROGRAMS+=helloworld +endif +ifeq ($(FULL_TARGET),i386-netbsd) +override TARGET_PROGRAMS+=helloworld +endif +ifeq ($(FULL_TARGET),i386-solaris) +override TARGET_PROGRAMS+=helloworld +endif +ifeq ($(FULL_TARGET),i386-qnx) +override TARGET_PROGRAMS+=helloworld +endif +ifeq ($(FULL_TARGET),i386-netware) +override TARGET_PROGRAMS+=helloworld +endif +ifeq ($(FULL_TARGET),i386-openbsd) +override TARGET_PROGRAMS+=helloworld +endif +ifeq ($(FULL_TARGET),i386-wdosx) +override TARGET_PROGRAMS+=helloworld +endif +ifeq ($(FULL_TARGET),i386-darwin) +override TARGET_PROGRAMS+=helloworld +endif +ifeq ($(FULL_TARGET),i386-emx) +override TARGET_PROGRAMS+=helloworld +endif +ifeq ($(FULL_TARGET),i386-watcom) +override TARGET_PROGRAMS+=helloworld +endif +ifeq ($(FULL_TARGET),i386-netwlibc) +override TARGET_PROGRAMS+=helloworld +endif +ifeq ($(FULL_TARGET),i386-wince) +override TARGET_PROGRAMS+=helloworld +endif +ifeq ($(FULL_TARGET),i386-embedded) +override TARGET_PROGRAMS+=helloworld +endif +ifeq ($(FULL_TARGET),i386-symbian) +override TARGET_PROGRAMS+=helloworld +endif +ifeq ($(FULL_TARGET),m68k-linux) +override TARGET_PROGRAMS+=helloworld +endif +ifeq ($(FULL_TARGET),m68k-freebsd) +override TARGET_PROGRAMS+=helloworld +endif +ifeq ($(FULL_TARGET),m68k-netbsd) +override TARGET_PROGRAMS+=helloworld +endif +ifeq ($(FULL_TARGET),m68k-amiga) +override TARGET_PROGRAMS+=helloworld +endif +ifeq ($(FULL_TARGET),m68k-atari) +override TARGET_PROGRAMS+=helloworld +endif +ifeq ($(FULL_TARGET),m68k-openbsd) +override TARGET_PROGRAMS+=helloworld +endif +ifeq ($(FULL_TARGET),m68k-palmos) +override TARGET_PROGRAMS+=helloworld +endif +ifeq ($(FULL_TARGET),m68k-embedded) +override TARGET_PROGRAMS+=helloworld +endif +ifeq ($(FULL_TARGET),powerpc-linux) +override TARGET_PROGRAMS+=helloworld +endif +ifeq ($(FULL_TARGET),powerpc-netbsd) +override TARGET_PROGRAMS+=helloworld +endif +ifeq ($(FULL_TARGET),powerpc-amiga) +override TARGET_PROGRAMS+=helloworld +endif +ifeq ($(FULL_TARGET),powerpc-macos) +override TARGET_PROGRAMS+=helloworld +endif +ifeq ($(FULL_TARGET),powerpc-darwin) +override TARGET_PROGRAMS+=helloworld +endif +ifeq ($(FULL_TARGET),powerpc-morphos) +override TARGET_PROGRAMS+=helloworld +endif +ifeq ($(FULL_TARGET),powerpc-embedded) +override TARGET_PROGRAMS+=helloworld +endif +ifeq ($(FULL_TARGET),sparc-linux) +override TARGET_PROGRAMS+=helloworld +endif +ifeq ($(FULL_TARGET),sparc-netbsd) +override TARGET_PROGRAMS+=helloworld +endif +ifeq ($(FULL_TARGET),sparc-solaris) +override TARGET_PROGRAMS+=helloworld +endif +ifeq ($(FULL_TARGET),sparc-embedded) +override TARGET_PROGRAMS+=helloworld +endif +ifeq ($(FULL_TARGET),x86_64-linux) +override TARGET_PROGRAMS+=helloworld +endif +ifeq ($(FULL_TARGET),x86_64-freebsd) +override TARGET_PROGRAMS+=helloworld +endif +ifeq ($(FULL_TARGET),x86_64-darwin) +override TARGET_PROGRAMS+=helloworld +endif +ifeq ($(FULL_TARGET),x86_64-win64) +override TARGET_PROGRAMS+=helloworld +endif +ifeq ($(FULL_TARGET),x86_64-embedded) +override TARGET_PROGRAMS+=helloworld +endif +ifeq ($(FULL_TARGET),arm-linux) +override TARGET_PROGRAMS+=helloworld +endif +ifeq ($(FULL_TARGET),arm-palmos) +override TARGET_PROGRAMS+=helloworld +endif +ifeq ($(FULL_TARGET),arm-wince) +override TARGET_PROGRAMS+=helloworld +endif +ifeq ($(FULL_TARGET),arm-gba) +override TARGET_PROGRAMS+=helloworld +endif +ifeq ($(FULL_TARGET),arm-nds) +override TARGET_PROGRAMS+=helloworld +endif +ifeq ($(FULL_TARGET),arm-embedded) +override TARGET_PROGRAMS+=helloworld +endif +ifeq ($(FULL_TARGET),arm-symbian) +override TARGET_PROGRAMS+=helloworld +endif +ifeq ($(FULL_TARGET),powerpc64-linux) +override TARGET_PROGRAMS+=helloworld +endif +ifeq ($(FULL_TARGET),powerpc64-darwin) +override TARGET_PROGRAMS+=helloworld +endif +ifeq ($(FULL_TARGET),powerpc64-embedded) +override TARGET_PROGRAMS+=helloworld +endif +override INSTALL_FPCPACKAGE=y +ifdef REQUIRE_UNITSDIR +override UNITSDIR+=$(REQUIRE_UNITSDIR) +endif +ifdef REQUIRE_PACKAGESDIR +override PACKAGESDIR+=$(REQUIRE_PACKAGESDIR) +endif +ifdef ZIPINSTALL +ifneq ($(findstring $(OS_TARGET),$(UNIXs)),) +UNIXHier=1 +endif +else +ifneq ($(findstring $(OS_SOURCE),$(UNIXs)),) +UNIXHier=1 +endif +endif +ifndef INSTALL_PREFIX +ifdef PREFIX +INSTALL_PREFIX=$(PREFIX) +endif +endif +ifndef INSTALL_PREFIX +ifdef UNIXHier +INSTALL_PREFIX=/usr/local +else +ifdef INSTALL_FPCPACKAGE +INSTALL_BASEDIR:=/pp +else +INSTALL_BASEDIR:=/$(PACKAGE_NAME) +endif +endif +endif +export INSTALL_PREFIX +ifdef INSTALL_FPCSUBDIR +export INSTALL_FPCSUBDIR +endif +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 +INSTALL_BASEDIR:=$(INSTALL_PREFIX)/lib/fpc/$(FPC_VERSION) +else +INSTALL_BASEDIR:=$(INSTALL_PREFIX)/lib/$(PACKAGE_NAME) +endif +else +INSTALL_BASEDIR:=$(INSTALL_PREFIX) +endif +endif +ifndef INSTALL_BINDIR +ifdef UNIXHier +INSTALL_BINDIR:=$(INSTALL_PREFIX)/bin +else +INSTALL_BINDIR:=$(INSTALL_BASEDIR)/bin +ifdef INSTALL_FPCPACKAGE +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 +INSTALL_UNITDIR:=$(INSTALL_BASEDIR)/units/$(TARGETSUFFIX) +ifdef INSTALL_FPCPACKAGE +ifdef PACKAGE_NAME +INSTALL_UNITDIR:=$(INSTALL_UNITDIR)/$(PACKAGE_NAME) +endif +endif +endif +ifndef INSTALL_LIBDIR +ifdef UNIXHier +INSTALL_LIBDIR:=$(INSTALL_PREFIX)/lib +else +INSTALL_LIBDIR:=$(INSTALL_UNITDIR) +endif +endif +ifndef INSTALL_SOURCEDIR +ifdef UNIXHier +ifdef BSDhier +SRCPREFIXDIR=share/src +else +ifdef linuxHier +SRCPREFIXDIR=share/src +else +SRCPREFIXDIR=src +endif +endif +ifdef INSTALL_FPCPACKAGE +ifdef INSTALL_FPCSUBDIR +INSTALL_SOURCEDIR:=$(INSTALL_PREFIX)/$(SRCPREFIXDIR)/fpc-$(FPC_VERSION)/$(INSTALL_FPCSUBDIR)/$(PACKAGE_NAME) +else +INSTALL_SOURCEDIR:=$(INSTALL_PREFIX)/$(SRCPREFIXDIR)/fpc-$(FPC_VERSION)/$(PACKAGE_NAME) +endif +else +INSTALL_SOURCEDIR:=$(INSTALL_PREFIX)/$(SRCPREFIXDIR)/$(PACKAGE_NAME)-$(PACKAGE_VERSION) +endif +else +ifdef INSTALL_FPCPACKAGE +ifdef INSTALL_FPCSUBDIR +INSTALL_SOURCEDIR:=$(INSTALL_BASEDIR)/source/$(INSTALL_FPCSUBDIR)/$(PACKAGE_NAME) +else +INSTALL_SOURCEDIR:=$(INSTALL_BASEDIR)/source/$(PACKAGE_NAME) +endif +else +INSTALL_SOURCEDIR:=$(INSTALL_BASEDIR)/source +endif +endif +endif +ifndef INSTALL_DOCDIR +ifdef UNIXHier +ifdef BSDhier +DOCPREFIXDIR=share/doc +else +ifdef linuxHier +DOCPREFIXDIR=share/doc +else +DOCPREFIXDIR=doc +endif +endif +ifdef INSTALL_FPCPACKAGE +INSTALL_DOCDIR:=$(INSTALL_PREFIX)/$(DOCPREFIXDIR)/fpc-$(FPC_VERSION)/$(PACKAGE_NAME) +else +INSTALL_DOCDIR:=$(INSTALL_PREFIX)/$(DOCPREFIXDIR)/$(PACKAGE_NAME)-$(PACKAGE_VERSION) +endif +else +ifdef INSTALL_FPCPACKAGE +INSTALL_DOCDIR:=$(INSTALL_BASEDIR)/doc/$(PACKAGE_NAME) +else +INSTALL_DOCDIR:=$(INSTALL_BASEDIR)/doc +endif +endif +endif +ifndef INSTALL_EXAMPLEDIR +ifdef UNIXHier +ifdef INSTALL_FPCPACKAGE +ifdef BSDhier +INSTALL_EXAMPLEDIR:=$(INSTALL_PREFIX)/share/examples/fpc-$(FPC_VERSION)/$(PACKAGE_NAME) +else +ifdef linuxHier +INSTALL_EXAMPLEDIR:=$(INSTALL_DOCDIR)/examples +else +INSTALL_EXAMPLEDIR:=$(INSTALL_PREFIX)/doc/fpc-$(FPC_VERSION)/examples/$(PACKAGE_NAME) +endif +endif +else +ifdef BSDhier +INSTALL_EXAMPLEDIR:=$(INSTALL_PREFIX)/share/examples/$(PACKAGE_NAME)-$(PACKAGE_VERSION) +else +ifdef linuxHier +INSTALL_EXAMPLEDIR:=$(INSTALL_DOCDIR)/examples/$(PACKAGE_NAME)-$(PACKAGE_VERSION) +else +INSTALL_EXAMPLEDIR:=$(INSTALL_PREFIX)/doc/$(PACKAGE_NAME)-$(PACKAGE_VERSION) +endif +endif +endif +else +ifdef INSTALL_FPCPACKAGE +INSTALL_EXAMPLEDIR:=$(INSTALL_BASEDIR)/examples/$(PACKAGE_NAME) +else +INSTALL_EXAMPLEDIR:=$(INSTALL_BASEDIR)/examples +endif +endif +endif +ifndef INSTALL_DATADIR +INSTALL_DATADIR=$(INSTALL_BASEDIR) +endif +ifndef INSTALL_SHAREDDIR +INSTALL_SHAREDDIR=$(INSTALL_PREFIX)/lib +endif +ifdef CROSSCOMPILE +ifndef CROSSBINDIR +CROSSBINDIR:=$(wildcard $(CROSSTARGETDIR)/bin/$(SOURCESUFFIX)) +ifeq ($(CROSSBINDIR),) +CROSSBINDIR:=$(wildcard $(INSTALL_BASEDIR)/cross/$(TARGETSUFFIX)/bin/$(FULL_SOURCE)) +endif +endif +else +CROSSBINDIR= +endif +ifeq ($(OS_SOURCE),linux) +ifndef GCCLIBDIR +ifeq ($(CPU_TARGET),i386) +ifneq ($(findstring x86_64,$(shell uname -a)),) +ifeq ($(BINUTILSPREFIX),) +GCCLIBDIR:=$(shell dirname `gcc -m32 -print-libgcc-file-name`) +endif +endif +endif +ifeq ($(CPU_TARGET),powerpc64) +ifeq ($(BINUTILSPREFIX),) +GCCLIBDIR:=$(shell dirname `gcc -m64 -print-libgcc-file-name`) +endif +endif +endif +ifndef GCCLIBDIR +CROSSGCC=$(strip $(wildcard $(addsuffix /$(BINUTILSPREFIX)gcc$(SRCEXEEXT),$(SEARCHPATH)))) +ifneq ($(CROSSGCC),) +GCCLIBDIR:=$(shell dirname `$(CROSSGCC) -print-libgcc-file-name`) +endif +endif +ifndef OTHERLIBDIR +OTHERLIBDIR:=$(shell grep -v "^\#" /etc/ld.so.conf | awk '{ ORS=" "; print $1 }') +endif +endif +ifdef inUnix +ifeq ($(OS_SOURCE),netbsd) +OTHERLIBDIR+=/usr/pkg/lib +endif +export GCCLIBDIR OTHERLIB +endif +BATCHEXT=.bat +LOADEREXT=.as +EXEEXT=.exe +PPLEXT=.ppl +PPUEXT=.ppu +OEXT=.o +ASMEXT=.s +SMARTEXT=.sl +STATICLIBEXT=.a +SHAREDLIBEXT=.so +SHAREDLIBPREFIX=libfp +STATICLIBPREFIX=libp +IMPORTLIBPREFIX=libimp +RSTEXT=.rst +ifeq ($(findstring 1.0.,$(FPC_VERSION)),) +ifeq ($(OS_TARGET),go32v1) +STATICLIBPREFIX= +SHORTSUFFIX=v1 +endif +ifeq ($(OS_TARGET),go32v2) +STATICLIBPREFIX= +SHORTSUFFIX=dos +endif +ifeq ($(OS_TARGET),watcom) +STATICLIBPREFIX= +OEXT=.obj +ASMEXT=.asm +SHAREDLIBEXT=.dll +SHORTSUFFIX=wat +endif +ifeq ($(OS_TARGET),linux) +BATCHEXT=.sh +EXEEXT= +HASSHAREDLIB=1 +SHORTSUFFIX=lnx +endif +ifeq ($(OS_TARGET),freebsd) +BATCHEXT=.sh +EXEEXT= +HASSHAREDLIB=1 +SHORTSUFFIX=fbs +endif +ifeq ($(OS_TARGET),netbsd) +BATCHEXT=.sh +EXEEXT= +HASSHAREDLIB=1 +SHORTSUFFIX=nbs +endif +ifeq ($(OS_TARGET),openbsd) +BATCHEXT=.sh +EXEEXT= +HASSHAREDLIB=1 +SHORTSUFFIX=obs +endif +ifeq ($(OS_TARGET),win32) +SHAREDLIBEXT=.dll +SHORTSUFFIX=w32 +endif +ifeq ($(OS_TARGET),os2) +BATCHEXT=.cmd +AOUTEXT=.out +STATICLIBPREFIX= +SHAREDLIBEXT=.dll +SHORTSUFFIX=os2 +ECHO=echo +endif +ifeq ($(OS_TARGET),emx) +BATCHEXT=.cmd +AOUTEXT=.out +STATICLIBPREFIX= +SHAREDLIBEXT=.dll +SHORTSUFFIX=emx +ECHO=echo +endif +ifeq ($(OS_TARGET),amiga) +EXEEXT= +SHAREDLIBEXT=.library +SHORTSUFFIX=amg +endif +ifeq ($(OS_TARGET),morphos) +EXEEXT= +SHAREDLIBEXT=.library +SHORTSUFFIX=mos +endif +ifeq ($(OS_TARGET),atari) +EXEEXT=.ttp +SHORTSUFFIX=ata +endif +ifeq ($(OS_TARGET),beos) +BATCHEXT=.sh +EXEEXT= +SHORTSUFFIX=be +endif +ifeq ($(OS_TARGET),solaris) +BATCHEXT=.sh +EXEEXT= +SHORTSUFFIX=sun +endif +ifeq ($(OS_TARGET),qnx) +BATCHEXT=.sh +EXEEXT= +SHORTSUFFIX=qnx +endif +ifeq ($(OS_TARGET),netware) +EXEEXT=.nlm +STATICLIBPREFIX= +SHORTSUFFIX=nw +endif +ifeq ($(OS_TARGET),netwlibc) +EXEEXT=.nlm +STATICLIBPREFIX= +SHORTSUFFIX=nwl +endif +ifeq ($(OS_TARGET),macos) +BATCHEXT= +EXEEXT= +DEBUGSYMEXT=.xcoff +SHORTSUFFIX=mac +endif +ifeq ($(OS_TARGET),darwin) +BATCHEXT=.sh +EXEEXT= +HASSHAREDLIB=1 +SHORTSUFFIX=dwn +endif +ifeq ($(OS_TARGET),gba) +EXEEXT=.gba +SHAREDLIBEXT=.so +SHORTSUFFIX=gba +endif +ifeq ($(OS_TARGET),symbian) +SHAREDLIBEXT=.dll +SHORTSUFFIX=symbian +endif +else +ifeq ($(OS_TARGET),go32v1) +PPUEXT=.pp1 +OEXT=.o1 +ASMEXT=.s1 +SMARTEXT=.sl1 +STATICLIBEXT=.a1 +SHAREDLIBEXT=.so1 +STATICLIBPREFIX= +SHORTSUFFIX=v1 +endif +ifeq ($(OS_TARGET),go32v2) +STATICLIBPREFIX= +SHORTSUFFIX=dos +endif +ifeq ($(OS_TARGET),watcom) +STATICLIBPREFIX= +SHORTSUFFIX=wat +endif +ifeq ($(OS_TARGET),linux) +BATCHEXT=.sh +EXEEXT= +HASSHAREDLIB=1 +SHORTSUFFIX=lnx +endif +ifeq ($(OS_TARGET),freebsd) +BATCHEXT=.sh +EXEEXT= +HASSHAREDLIB=1 +SHORTSUFFIX=fbs +endif +ifeq ($(OS_TARGET),netbsd) +BATCHEXT=.sh +EXEEXT= +HASSHAREDLIB=1 +SHORTSUFFIX=nbs +endif +ifeq ($(OS_TARGET),openbsd) +BATCHEXT=.sh +EXEEXT= +HASSHAREDLIB=1 +SHORTSUFFIX=obs +endif +ifeq ($(OS_TARGET),win32) +PPUEXT=.ppw +OEXT=.ow +ASMEXT=.sw +SMARTEXT=.slw +STATICLIBEXT=.aw +SHAREDLIBEXT=.dll +SHORTSUFFIX=w32 +endif +ifeq ($(OS_TARGET),os2) +BATCHEXT=.cmd +PPUEXT=.ppo +ASMEXT=.so2 +OEXT=.oo2 +AOUTEXT=.out +SMARTEXT=.sl2 +STATICLIBPREFIX= +STATICLIBEXT=.ao2 +SHAREDLIBEXT=.dll +SHORTSUFFIX=os2 +ECHO=echo +endif +ifeq ($(OS_TARGET),amiga) +EXEEXT= +PPUEXT=.ppu +ASMEXT=.s +OEXT=.o +SMARTEXT=.sl +STATICLIBEXT=.a +SHAREDLIBEXT=.library +SHORTSUFFIX=amg +endif +ifeq ($(OS_TARGET),atari) +PPUEXT=.ppu +ASMEXT=.s +OEXT=.o +SMARTEXT=.sl +STATICLIBEXT=.a +EXEEXT=.ttp +SHORTSUFFIX=ata +endif +ifeq ($(OS_TARGET),beos) +BATCHEXT=.sh +PPUEXT=.ppu +ASMEXT=.s +OEXT=.o +SMARTEXT=.sl +STATICLIBEXT=.a +EXEEXT= +SHORTSUFFIX=be +endif +ifeq ($(OS_TARGET),solaris) +BATCHEXT=.sh +PPUEXT=.ppu +ASMEXT=.s +OEXT=.o +SMARTEXT=.sl +STATICLIBEXT=.a +EXEEXT= +SHORTSUFFIX=sun +endif +ifeq ($(OS_TARGET),qnx) +BATCHEXT=.sh +PPUEXT=.ppu +ASMEXT=.s +OEXT=.o +SMARTEXT=.sl +STATICLIBEXT=.a +EXEEXT= +SHORTSUFFIX=qnx +endif +ifeq ($(OS_TARGET),netware) +STATICLIBPREFIX= +PPUEXT=.ppu +OEXT=.o +ASMEXT=.s +SMARTEXT=.sl +STATICLIBEXT=.a +SHAREDLIBEXT=.nlm +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= +PPUEXT=.ppu +ASMEXT=.s +OEXT=.o +SMARTEXT=.sl +STATICLIBEXT=.a +EXEEXT= +DEBUGSYMEXT=.xcoff +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 +ECHO:=$(strip $(wildcard $(addsuffix /gecho$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(ECHO),) +ECHO:=$(strip $(wildcard $(addsuffix /echo$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(ECHO),) +ECHO= __missing_command_ECHO +else +ECHO:=$(firstword $(ECHO)) +endif +else +ECHO:=$(firstword $(ECHO)) +endif +endif +export ECHO +ifndef DATE +DATE:=$(strip $(wildcard $(addsuffix /gdate$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(DATE),) +DATE:=$(strip $(wildcard $(addsuffix /date$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(DATE),) +DATE= __missing_command_DATE +else +DATE:=$(firstword $(DATE)) +endif +else +DATE:=$(firstword $(DATE)) +endif +endif +export DATE +ifndef GINSTALL +GINSTALL:=$(strip $(wildcard $(addsuffix /ginstall$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(GINSTALL),) +GINSTALL:=$(strip $(wildcard $(addsuffix /install$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(GINSTALL),) +GINSTALL= __missing_command_GINSTALL +else +GINSTALL:=$(firstword $(GINSTALL)) +endif +else +GINSTALL:=$(firstword $(GINSTALL)) +endif +endif +export GINSTALL +ifndef CPPROG +CPPROG:=$(strip $(wildcard $(addsuffix /cp$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(CPPROG),) +CPPROG= __missing_command_CPPROG +else +CPPROG:=$(firstword $(CPPROG)) +endif +endif +export CPPROG +ifndef RMPROG +RMPROG:=$(strip $(wildcard $(addsuffix /rm$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(RMPROG),) +RMPROG= __missing_command_RMPROG +else +RMPROG:=$(firstword $(RMPROG)) +endif +endif +export RMPROG +ifndef MVPROG +MVPROG:=$(strip $(wildcard $(addsuffix /mv$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(MVPROG),) +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 +else +ECHOREDIR=$(ECHO) +endif +endif +ifndef COPY +COPY:=$(CPPROG) -fp +endif +ifndef COPYTREE +COPYTREE:=$(CPPROG) -Rfp +endif +ifndef MKDIRTREE +MKDIRTREE:=$(MKDIRPROG) -p +endif +ifndef MOVE +MOVE:=$(MVPROG) -f +endif +ifndef DEL +DEL:=$(RMPROG) -f +endif +ifndef DELTREE +DELTREE:=$(RMPROG) -rf +endif +ifndef INSTALL +ifdef inUnix +INSTALL:=$(GINSTALL) -c -m 644 +else +INSTALL:=$(COPY) +endif +endif +ifndef INSTALLEXE +ifdef inUnix +INSTALLEXE:=$(GINSTALL) -c -m 755 +else +INSTALLEXE:=$(COPY) +endif +endif +ifndef MKDIR +MKDIR:=$(GINSTALL) -m 755 -d +endif +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 +else +PPUMOVE:=$(firstword $(PPUMOVE)) +endif +endif +export PPUMOVE +ifndef FPCMAKE +FPCMAKE:=$(strip $(wildcard $(addsuffix /fpcmake$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(FPCMAKE),) +FPCMAKE= __missing_command_FPCMAKE +else +FPCMAKE:=$(firstword $(FPCMAKE)) +endif +endif +export FPCMAKE +ifndef ZIPPROG +ZIPPROG:=$(strip $(wildcard $(addsuffix /zip$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(ZIPPROG),) +ZIPPROG= __missing_command_ZIPPROG +else +ZIPPROG:=$(firstword $(ZIPPROG)) +endif +endif +export ZIPPROG +ifndef TARPROG +TARPROG:=$(strip $(wildcard $(addsuffix /gtar$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(TARPROG),) +TARPROG:=$(strip $(wildcard $(addsuffix /tar$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(TARPROG),) +TARPROG= __missing_command_TARPROG +else +TARPROG:=$(firstword $(TARPROG)) +endif +else +TARPROG:=$(firstword $(TARPROG)) +endif +endif +export TARPROG +ASNAME=$(BINUTILSPREFIX)as +LDNAME=$(BINUTILSPREFIX)ld +ARNAME=$(BINUTILSPREFIX)ar +RCNAME=$(BINUTILSPREFIX)rc +ifneq ($(findstring 1.0.,$(FPC_VERSION)),) +ifeq ($(OS_TARGET),win32) +ifeq ($(CROSSBINDIR),) +ASNAME=asw +LDNAME=ldw +ARNAME=arw +endif +endif +endif +ifndef ASPROG +ifdef CROSSBINDIR +ASPROG=$(CROSSBINDIR)/$(ASNAME)$(SRCEXEEXT) +else +ASPROG=$(ASNAME) +endif +endif +ifndef LDPROG +ifdef CROSSBINDIR +LDPROG=$(CROSSBINDIR)/$(LDNAME)$(SRCEXEEXT) +else +LDPROG=$(LDNAME) +endif +endif +ifndef RCPROG +ifdef CROSSBINDIR +RCPROG=$(CROSSBINDIR)/$(RCNAME)$(SRCEXEEXT) +else +RCPROG=$(RCNAME) +endif +endif +ifndef ARPROG +ifdef CROSSBINDIR +ARPROG=$(CROSSBINDIR)/$(ARNAME)$(SRCEXEEXT) +else +ARPROG=$(ARNAME) +endif +endif +AS=$(ASPROG) +LD=$(LDPROG) +RC=$(RCPROG) +AR=$(ARPROG) +PPAS=ppas$(SRCBATCHEXT) +ifdef inUnix +LDCONFIG=ldconfig +else +LDCONFIG= +endif +ifdef DATE +DATESTR:=$(shell $(DATE) +%Y%m%d) +else +DATESTR= +endif +ifndef UPXPROG +ifeq ($(OS_TARGET),go32v2) +UPXPROG:=1 +endif +ifeq ($(OS_TARGET),win32) +UPXPROG:=1 +endif +ifdef UPXPROG +UPXPROG:=$(strip $(wildcard $(addsuffix /upx$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(UPXPROG),) +UPXPROG= +else +UPXPROG:=$(firstword $(UPXPROG)) +endif +else +UPXPROG= +endif +endif +export UPXPROG +ZIPOPT=-9 +ZIPEXT=.zip +ifeq ($(USETAR),bz2) +TAROPT=vj +TAREXT=.tar.bz2 +else +TAROPT=vz +TAREXT=.tar.gz +endif +override REQUIRE_PACKAGES=rtl gtk2 +ifeq ($(FULL_TARGET),i386-linux) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_X11=1 +REQUIRE_PACKAGES_GTK2=1 +endif +ifeq ($(FULL_TARGET),i386-go32v2) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_GTK2=1 +endif +ifeq ($(FULL_TARGET),i386-win32) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_GTK2=1 +endif +ifeq ($(FULL_TARGET),i386-os2) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_GTK2=1 +endif +ifeq ($(FULL_TARGET),i386-freebsd) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_X11=1 +REQUIRE_PACKAGES_GTK2=1 +endif +ifeq ($(FULL_TARGET),i386-beos) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_GTK2=1 +endif +ifeq ($(FULL_TARGET),i386-netbsd) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_X11=1 +REQUIRE_PACKAGES_GTK2=1 +endif +ifeq ($(FULL_TARGET),i386-solaris) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_X11=1 +REQUIRE_PACKAGES_GTK2=1 +endif +ifeq ($(FULL_TARGET),i386-qnx) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_GTK2=1 +endif +ifeq ($(FULL_TARGET),i386-netware) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_GTK2=1 +endif +ifeq ($(FULL_TARGET),i386-openbsd) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_X11=1 +REQUIRE_PACKAGES_GTK2=1 +endif +ifeq ($(FULL_TARGET),i386-wdosx) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_GTK2=1 +endif +ifeq ($(FULL_TARGET),i386-darwin) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_X11=1 +REQUIRE_PACKAGES_GTK2=1 +endif +ifeq ($(FULL_TARGET),i386-emx) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_GTK2=1 +endif +ifeq ($(FULL_TARGET),i386-watcom) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_GTK2=1 +endif +ifeq ($(FULL_TARGET),i386-netwlibc) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_GTK2=1 +endif +ifeq ($(FULL_TARGET),i386-wince) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_GTK2=1 +endif +ifeq ($(FULL_TARGET),i386-embedded) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_GTK2=1 +endif +ifeq ($(FULL_TARGET),i386-symbian) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_GTK2=1 +endif +ifeq ($(FULL_TARGET),m68k-linux) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_X11=1 +REQUIRE_PACKAGES_GTK2=1 +endif +ifeq ($(FULL_TARGET),m68k-freebsd) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_X11=1 +REQUIRE_PACKAGES_GTK2=1 +endif +ifeq ($(FULL_TARGET),m68k-netbsd) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_X11=1 +REQUIRE_PACKAGES_GTK2=1 +endif +ifeq ($(FULL_TARGET),m68k-amiga) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_GTK2=1 +endif +ifeq ($(FULL_TARGET),m68k-atari) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_GTK2=1 +endif +ifeq ($(FULL_TARGET),m68k-openbsd) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_X11=1 +REQUIRE_PACKAGES_GTK2=1 +endif +ifeq ($(FULL_TARGET),m68k-palmos) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_GTK2=1 +endif +ifeq ($(FULL_TARGET),m68k-embedded) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_GTK2=1 +endif +ifeq ($(FULL_TARGET),powerpc-linux) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_X11=1 +REQUIRE_PACKAGES_GTK2=1 +endif +ifeq ($(FULL_TARGET),powerpc-netbsd) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_X11=1 +REQUIRE_PACKAGES_GTK2=1 +endif +ifeq ($(FULL_TARGET),powerpc-amiga) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_GTK2=1 +endif +ifeq ($(FULL_TARGET),powerpc-macos) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_GTK2=1 +endif +ifeq ($(FULL_TARGET),powerpc-darwin) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_X11=1 +REQUIRE_PACKAGES_GTK2=1 +endif +ifeq ($(FULL_TARGET),powerpc-morphos) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_GTK2=1 +endif +ifeq ($(FULL_TARGET),powerpc-embedded) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_GTK2=1 +endif +ifeq ($(FULL_TARGET),sparc-linux) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_X11=1 +REQUIRE_PACKAGES_GTK2=1 +endif +ifeq ($(FULL_TARGET),sparc-netbsd) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_X11=1 +REQUIRE_PACKAGES_GTK2=1 +endif +ifeq ($(FULL_TARGET),sparc-solaris) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_X11=1 +REQUIRE_PACKAGES_GTK2=1 +endif +ifeq ($(FULL_TARGET),sparc-embedded) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_GTK2=1 +endif +ifeq ($(FULL_TARGET),x86_64-linux) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_X11=1 +REQUIRE_PACKAGES_GTK2=1 +endif +ifeq ($(FULL_TARGET),x86_64-freebsd) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_X11=1 +REQUIRE_PACKAGES_GTK2=1 +endif +ifeq ($(FULL_TARGET),x86_64-darwin) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_X11=1 +REQUIRE_PACKAGES_GTK2=1 +endif +ifeq ($(FULL_TARGET),x86_64-win64) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_GTK2=1 +endif +ifeq ($(FULL_TARGET),x86_64-embedded) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_GTK2=1 +endif +ifeq ($(FULL_TARGET),arm-linux) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_X11=1 +REQUIRE_PACKAGES_GTK2=1 +endif +ifeq ($(FULL_TARGET),arm-palmos) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_GTK2=1 +endif +ifeq ($(FULL_TARGET),arm-wince) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_GTK2=1 +endif +ifeq ($(FULL_TARGET),arm-gba) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_GTK2=1 +endif +ifeq ($(FULL_TARGET),arm-nds) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_GTK2=1 +endif +ifeq ($(FULL_TARGET),arm-embedded) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_GTK2=1 +endif +ifeq ($(FULL_TARGET),arm-symbian) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_GTK2=1 +endif +ifeq ($(FULL_TARGET),powerpc64-linux) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_X11=1 +REQUIRE_PACKAGES_GTK2=1 +endif +ifeq ($(FULL_TARGET),powerpc64-darwin) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_X11=1 +REQUIRE_PACKAGES_GTK2=1 +endif +ifeq ($(FULL_TARGET),powerpc64-embedded) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_GTK2=1 +endif +ifdef REQUIRE_PACKAGES_RTL +PACKAGEDIR_RTL:=$(firstword $(subst /Makefile.fpc,,$(strip $(wildcard $(addsuffix /rtl/Makefile.fpc,$(PACKAGESDIR)))))) +ifneq ($(PACKAGEDIR_RTL),) +ifneq ($(wildcard $(PACKAGEDIR_RTL)/units/$(TARGETSUFFIX)),) +UNITDIR_RTL=$(PACKAGEDIR_RTL)/units/$(TARGETSUFFIX) +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 +ifdef REQUIRE_PACKAGES_X11 +PACKAGEDIR_X11:=$(firstword $(subst /Makefile.fpc,,$(strip $(wildcard $(addsuffix /x11/Makefile.fpc,$(PACKAGESDIR)))))) +ifneq ($(PACKAGEDIR_X11),) +ifneq ($(wildcard $(PACKAGEDIR_X11)/units/$(TARGETSUFFIX)),) +UNITDIR_X11=$(PACKAGEDIR_X11)/units/$(TARGETSUFFIX) +else +UNITDIR_X11=$(PACKAGEDIR_X11) +endif +ifdef CHECKDEPEND +$(PACKAGEDIR_X11)/$(FPCMADE): + $(MAKE) -C $(PACKAGEDIR_X11) $(FPCMADE) +override ALLDEPENDENCIES+=$(PACKAGEDIR_X11)/$(FPCMADE) +endif +else +PACKAGEDIR_X11= +UNITDIR_X11:=$(subst /Package.fpc,,$(strip $(wildcard $(addsuffix /x11/Package.fpc,$(UNITSDIR))))) +ifneq ($(UNITDIR_X11),) +UNITDIR_X11:=$(firstword $(UNITDIR_X11)) +else +UNITDIR_X11= +endif +endif +ifdef UNITDIR_X11 +override COMPILER_UNITDIR+=$(UNITDIR_X11) +endif +endif +ifdef REQUIRE_PACKAGES_GTK2 +PACKAGEDIR_GTK2:=$(firstword $(subst /Makefile.fpc,,$(strip $(wildcard $(addsuffix /gtk2/Makefile.fpc,$(PACKAGESDIR)))))) +ifneq ($(PACKAGEDIR_GTK2),) +ifneq ($(wildcard $(PACKAGEDIR_GTK2)/units/$(TARGETSUFFIX)),) +UNITDIR_GTK2=$(PACKAGEDIR_GTK2)/units/$(TARGETSUFFIX) +else +UNITDIR_GTK2=$(PACKAGEDIR_GTK2) +endif +ifdef CHECKDEPEND +$(PACKAGEDIR_GTK2)/$(FPCMADE): + $(MAKE) -C $(PACKAGEDIR_GTK2) $(FPCMADE) +override ALLDEPENDENCIES+=$(PACKAGEDIR_GTK2)/$(FPCMADE) +endif +else +PACKAGEDIR_GTK2= +UNITDIR_GTK2:=$(subst /Package.fpc,,$(strip $(wildcard $(addsuffix /gtk2/Package.fpc,$(UNITSDIR))))) +ifneq ($(UNITDIR_GTK2),) +UNITDIR_GTK2:=$(firstword $(UNITDIR_GTK2)) +else +UNITDIR_GTK2= +endif +endif +ifdef UNITDIR_GTK2 +override COMPILER_UNITDIR+=$(UNITDIR_GTK2) +endif +endif +ifndef NOCPUDEF +override FPCOPTDEF=$(CPU_TARGET) +endif +ifneq ($(OS_TARGET),$(OS_SOURCE)) +override FPCOPT+=-T$(OS_TARGET) +endif +ifneq ($(CPU_TARGET),$(CPU_SOURCE)) +override FPCOPT+=-P$(CPU_TARGET) +endif +ifeq ($(OS_SOURCE),openbsd) +override FPCOPT+=-FD$(NEW_BINUTILS_PATH) +endif +ifndef CROSSBOOTSTRAP +ifneq ($(BINUTILSPREFIX),) +override FPCOPT+=-XP$(BINUTILSPREFIX) +endif +ifneq ($(BINUTILSPREFIX),) +override FPCOPT+=-Xr$(RLINKPATH) +endif +endif +ifdef UNITDIR +override FPCOPT+=$(addprefix -Fu,$(UNITDIR)) +endif +ifdef LIBDIR +override FPCOPT+=$(addprefix -Fl,$(LIBDIR)) +endif +ifdef OBJDIR +override FPCOPT+=$(addprefix -Fo,$(OBJDIR)) +endif +ifdef INCDIR +override FPCOPT+=$(addprefix -Fi,$(INCDIR)) +endif +ifdef LINKSMART +override FPCOPT+=-XX +endif +ifdef CREATESMART +override FPCOPT+=-CX +endif +ifdef DEBUG +override FPCOPT+=-gl +override FPCOPTDEF+=DEBUG +endif +ifdef RELEASE +ifneq ($(findstring 2.0.,$(FPC_VERSION)),) +ifeq ($(CPU_TARGET),i386) +FPCCPUOPT:=-OG2p3 +endif +ifeq ($(CPU_TARGET),powerpc) +FPCCPUOPT:=-O1r +endif +else +FPCCPUOPT:=-O2 +endif +override FPCOPT+=-Ur -Xs $(FPCCPUOPT) -n +override FPCOPTDEF+=RELEASE +endif +ifdef STRIP +override FPCOPT+=-Xs +endif +ifdef OPTIMIZE +override FPCOPT+=-O2 +endif +ifdef VERBOSE +override FPCOPT+=-vwni +endif +ifdef COMPILER_OPTIONS +override FPCOPT+=$(COMPILER_OPTIONS) +endif +ifdef COMPILER_UNITDIR +override FPCOPT+=$(addprefix -Fu,$(COMPILER_UNITDIR)) +endif +ifdef COMPILER_LIBRARYDIR +override FPCOPT+=$(addprefix -Fl,$(COMPILER_LIBRARYDIR)) +endif +ifdef COMPILER_OBJECTDIR +override FPCOPT+=$(addprefix -Fo,$(COMPILER_OBJECTDIR)) +endif +ifdef COMPILER_INCLUDEDIR +override FPCOPT+=$(addprefix -Fi,$(COMPILER_INCLUDEDIR)) +endif +ifdef CROSSBINDIR +override FPCOPT+=-FD$(CROSSBINDIR) +endif +ifdef COMPILER_TARGETDIR +override FPCOPT+=-FE$(COMPILER_TARGETDIR) +ifeq ($(COMPILER_TARGETDIR),.) +override TARGETDIRPREFIX= +else +override TARGETDIRPREFIX=$(COMPILER_TARGETDIR)/ +endif +endif +ifdef COMPILER_UNITTARGETDIR +override FPCOPT+=-FU$(COMPILER_UNITTARGETDIR) +ifeq ($(COMPILER_UNITTARGETDIR),.) +override UNITTARGETDIRPREFIX= +else +override UNITTARGETDIRPREFIX=$(COMPILER_UNITTARGETDIR)/ +endif +else +ifdef COMPILER_TARGETDIR +override COMPILER_UNITTARGETDIR=$(COMPILER_TARGETDIR) +override UNITTARGETDIRPREFIX=$(TARGETDIRPREFIX) +endif +endif +ifdef CREATESHARED +override FPCOPT+=-Cg +ifeq ($(CPU_TARGET),i386) +override FPCOPT+=-Aas +endif +endif +ifeq ($(findstring 2.0.,$(FPC_VERSION)),) +ifeq ($(OS_TARGET),linux) +ifeq ($(CPU_TARGET),x86_64) +override FPCOPT+=-Cg +endif +endif +endif +ifdef LINKSHARED +endif +ifdef GCCLIBDIR +override FPCOPT+=-Fl$(GCCLIBDIR) +endif +ifdef OTHERLIBDIR +override FPCOPT+=$(addprefix -Fl,$(OTHERLIBDIR)) +endif +ifdef OPT +override FPCOPT+=$(OPT) +endif +ifdef FPCOPTDEF +override FPCOPT+=$(addprefix -d,$(FPCOPTDEF)) +endif +ifdef CFGFILE +override FPCOPT+=@$(CFGFILE) +endif +ifdef USEENV +override FPCEXTCMD:=$(FPCOPT) +override FPCOPT:=!FPCEXTCMD +export FPCEXTCMD +endif +override AFULL_TARGET=$(CPU_TARGET)-$(OS_TARGET) +override AFULL_SOURCE=$(CPU_SOURCE)-$(OS_SOURCE) +ifneq ($(AFULL_TARGET),$(AFULL_SOURCE)) +override ACROSSCOMPILE=1 +endif +ifdef ACROSSCOMPILE +override FPCOPT+=$(CROSSOPT) +endif +override COMPILER:=$(FPC) $(FPCOPT) +ifeq (,$(findstring -s ,$(COMPILER))) +EXECPPAS= +else +ifeq ($(FULL_SOURCE),$(FULL_TARGET)) +ifdef RUNBATCH +EXECPPAS:=@$(RUNBATCH) $(PPAS) +else +EXECPPAS:=@$(PPAS) +endif +endif +endif +.PHONY: fpc_exes +ifndef CROSSINSTALL +ifneq ($(TARGET_PROGRAMS),) +override EXEFILES=$(addsuffix $(EXEEXT),$(TARGET_PROGRAMS)) +override EXEOFILES:=$(addsuffix $(OEXT),$(TARGET_PROGRAMS)) $(addprefix $(STATICLIBPREFIX),$(addsuffix $(STATICLIBEXT),$(TARGET_PROGRAMS))) $(addprefix $(IMPORTLIBPREFIX),$(addsuffix $(STATICLIBEXT),$(TARGET_PROGRAMS))) +override ALLTARGET+=fpc_exes +override INSTALLEXEFILES+=$(EXEFILES) +override CLEANEXEFILES+=$(EXEFILES) $(EXEOFILES) +ifeq ($(OS_TARGET),os2) +override CLEANEXEFILES+=$(addsuffix $(AOUTEXT),$(TARGET_PROGRAMS)) +endif +ifeq ($(OS_TARGET),emx) +override CLEANEXEFILES+=$(addsuffix $(AOUTEXT),$(TARGET_PROGRAMS)) +endif +endif +endif +fpc_exes: $(COMPILER_TARGETDIR) $(COMPILER_UNITTARGETDIR) $(EXEFILES) +ifdef TARGET_RSTS +override RSTFILES=$(addsuffix $(RSTEXT),$(TARGET_RSTS)) +override CLEANRSTFILES+=$(RSTFILES) +endif +.PHONY: fpc_all fpc_smart fpc_debug fpc_release fpc_shared +$(FPCMADE): $(ALLDEPENDENCIES) $(ALLTARGET) + @$(ECHOREDIR) Compiled > $(FPCMADE) +fpc_all: $(FPCMADE) +fpc_smart: + $(MAKE) all LINKSMART=1 CREATESMART=1 +fpc_debug: + $(MAKE) all DEBUG=1 +fpc_release: + $(MAKE) all RELEASE=1 +.SUFFIXES: $(EXEEXT) $(PPUEXT) $(OEXT) .pas .lpr .dpr .pp .rc .res +$(COMPILER_UNITTARGETDIR): + $(MKDIRTREE) $(COMPILER_UNITTARGETDIR) +$(COMPILER_TARGETDIR): + $(MKDIRTREE) $(COMPILER_TARGETDIR) +%$(PPUEXT): %.pp + $(COMPILER) $< + $(EXECPPAS) +%$(PPUEXT): %.pas + $(COMPILER) $< + $(EXECPPAS) +%$(EXEEXT): %.pp + $(COMPILER) $< + $(EXECPPAS) +%$(EXEEXT): %.pas + $(COMPILER) $< + $(EXECPPAS) +%$(EXEEXT): %.lpr + $(COMPILER) $< + $(EXECPPAS) +%$(EXEEXT): %.dpr + $(COMPILER) $< + $(EXECPPAS) +%.res: %.rc + windres -i $< -o $@ +vpath %.pp $(COMPILER_SOURCEDIR) $(COMPILER_INCLUDEDIR) +vpath %.pas $(COMPILER_SOURCEDIR) $(COMPILER_INCLUDEDIR) +vpath %.lpr $(COMPILER_SOURCEDIR) $(COMPILER_INCLUDEDIR) +vpath %.dpr $(COMPILER_SOURCEDIR) $(COMPILER_INCLUDEDIR) +vpath %.inc $(COMPILER_INCLUDEDIR) +vpath %$(OEXT) $(COMPILER_UNITTARGETDIR) +vpath %$(PPUEXT) $(COMPILER_UNITTARGETDIR) +.PHONY: fpc_shared +override INSTALLTARGET+=fpc_shared_install +ifndef SHARED_LIBVERSION +SHARED_LIBVERSION=$(FPC_VERSION) +endif +ifndef SHARED_LIBNAME +SHARED_LIBNAME=$(PACKAGE_NAME) +endif +ifndef SHARED_FULLNAME +SHARED_FULLNAME=$(SHAREDLIBPREFIX)$(SHARED_LIBNAME)-$(SHARED_LIBVERSION)$(SHAREDLIBEXT) +endif +ifndef SHARED_LIBUNITS +SHARED_LIBUNITS:=$(TARGET_UNITS) $(TARGET_IMPLICITUNITS) +override SHARED_LIBUNITS:=$(filter-out $(INSTALL_BUILDUNIT),$(SHARED_LIBUNITS)) +endif +fpc_shared: +ifdef HASSHAREDLIB + $(MAKE) all CREATESHARED=1 LINKSHARED=1 CREATESMART=1 +ifneq ($(SHARED_BUILD),n) + $(PPUMOVE) -q $(SHARED_LIBUNITS) -i$(COMPILER_UNITTARGETDIR) -o$(SHARED_FULLNAME) -d$(COMPILER_UNITTARGETDIR) +endif +else + @$(ECHO) Shared Libraries not supported +endif +fpc_shared_install: +ifneq ($(SHARED_BUILD),n) +ifneq ($(SHARED_LIBUNITS),) +ifneq ($(wildcard $(COMPILER_UNITTARGETDIR)/$(SHARED_FULLNAME)),) + $(INSTALL) $(COMPILER_UNITTARGETDIR)/$(SHARED_FULLNAME) $(INSTALL_SHAREDDIR) +endif +endif +endif +.PHONY: fpc_install fpc_sourceinstall fpc_exampleinstall +ifdef INSTALL_UNITS +override INSTALLPPUFILES+=$(addsuffix $(PPUEXT),$(INSTALL_UNITS)) +endif +ifdef INSTALL_BUILDUNIT +override INSTALLPPUFILES:=$(filter-out $(INSTALL_BUILDUNIT)$(PPUEXT),$(INSTALLPPUFILES)) +endif +ifdef INSTALLPPUFILES +override INSTALLPPULINKFILES:=$(subst $(PPUEXT),$(OEXT),$(INSTALLPPUFILES)) $(addprefix $(STATICLIBPREFIX),$(subst $(PPUEXT),$(STATICLIBEXT),$(INSTALLPPUFILES))) $(addprefix $(IMPORTLIBPREFIX),$(subst $(PPUEXT),$(STATICLIBEXT),$(INSTALLPPUFILES))) +ifneq ($(UNITTARGETDIRPREFIX),) +override INSTALLPPUFILES:=$(addprefix $(UNITTARGETDIRPREFIX),$(notdir $(INSTALLPPUFILES))) +override INSTALLPPULINKFILES:=$(wildcard $(addprefix $(UNITTARGETDIRPREFIX),$(notdir $(INSTALLPPULINKFILES)))) +endif +override INSTALL_CREATEPACKAGEFPC=1 +endif +ifdef INSTALLEXEFILES +ifneq ($(TARGETDIRPREFIX),) +override INSTALLEXEFILES:=$(addprefix $(TARGETDIRPREFIX),$(notdir $(INSTALLEXEFILES))) +endif +endif +fpc_install: all $(INSTALLTARGET) +ifdef INSTALLEXEFILES + $(MKDIR) $(INSTALL_BINDIR) +ifdef UPXPROG + -$(UPXPROG) $(INSTALLEXEFILES) +endif + $(INSTALLEXE) $(INSTALLEXEFILES) $(INSTALL_BINDIR) +endif +ifdef INSTALL_CREATEPACKAGEFPC +ifdef FPCMAKE +ifdef PACKAGE_VERSION +ifneq ($(wildcard Makefile.fpc),) + $(FPCMAKE) -p -T$(CPU_TARGET)-$(OS_TARGET) Makefile.fpc + $(MKDIR) $(INSTALL_UNITDIR) + $(INSTALL) Package.fpc $(INSTALL_UNITDIR) +endif +endif +endif +endif +ifdef INSTALLPPUFILES + $(MKDIR) $(INSTALL_UNITDIR) + $(INSTALL) $(INSTALLPPUFILES) $(INSTALL_UNITDIR) +ifneq ($(INSTALLPPULINKFILES),) + $(INSTALL) $(INSTALLPPULINKFILES) $(INSTALL_UNITDIR) +endif +ifneq ($(wildcard $(LIB_FULLNAME)),) + $(MKDIR) $(INSTALL_LIBDIR) + $(INSTALL) $(LIB_FULLNAME) $(INSTALL_LIBDIR) +ifdef inUnix + ln -sf $(LIB_FULLNAME) $(INSTALL_LIBDIR)/$(LIB_NAME) +endif +endif +endif +ifdef INSTALL_FILES + $(MKDIR) $(INSTALL_DATADIR) + $(INSTALL) $(INSTALL_FILES) $(INSTALL_DATADIR) +endif +fpc_sourceinstall: distclean + $(MKDIR) $(INSTALL_SOURCEDIR) + $(COPYTREE) $(BASEDIR)/* $(INSTALL_SOURCEDIR) +fpc_exampleinstall: $(addsuffix _distclean,$(TARGET_EXAMPLEDIRS)) +ifdef HASEXAMPLES + $(MKDIR) $(INSTALL_EXAMPLEDIR) +endif +ifdef EXAMPLESOURCEFILES + $(COPY) $(EXAMPLESOURCEFILES) $(INSTALL_EXAMPLEDIR) +endif +ifdef TARGET_EXAMPLEDIRS + $(COPYTREE) $(addsuffix /*,$(TARGET_EXAMPLEDIRS)) $(INSTALL_EXAMPLEDIR) +endif +.PHONY: fpc_clean fpc_cleanall fpc_distclean +ifdef EXEFILES +override CLEANEXEFILES:=$(addprefix $(TARGETDIRPREFIX),$(CLEANEXEFILES)) +endif +ifdef CLEAN_UNITS +override CLEANPPUFILES+=$(addsuffix $(PPUEXT),$(CLEAN_UNITS)) +endif +ifdef CLEANPPUFILES +override CLEANPPULINKFILES:=$(subst $(PPUEXT),$(OEXT),$(CLEANPPUFILES)) $(addprefix $(STATICLIBPREFIX),$(subst $(PPUEXT),$(STATICLIBEXT),$(CLEANPPUFILES))) $(addprefix $(IMPORTLIBPREFIX),$(subst $(PPUEXT),$(STATICLIBEXT),$(CLEANPPUFILES))) +ifdef DEBUGSYMEXT +override CLEANPPULINKFILES+=$(subst $(PPUEXT),$(DEBUGSYMEXT),$(CLEANPPUFILES)) +endif +override CLEANPPUFILES:=$(addprefix $(UNITTARGETDIRPREFIX),$(CLEANPPUFILES)) +override CLEANPPULINKFILES:=$(wildcard $(addprefix $(UNITTARGETDIRPREFIX),$(CLEANPPULINKFILES))) +endif +fpc_clean: $(CLEANTARGET) +ifdef CLEANEXEFILES + -$(DEL) $(CLEANEXEFILES) +endif +ifdef CLEANPPUFILES + -$(DEL) $(CLEANPPUFILES) +endif +ifneq ($(CLEANPPULINKFILES),) + -$(DEL) $(CLEANPPULINKFILES) +endif +ifdef CLEANRSTFILES + -$(DEL) $(addprefix $(UNITTARGETDIRPREFIX),$(CLEANRSTFILES)) +endif +ifdef CLEAN_FILES + -$(DEL) $(CLEAN_FILES) +endif +ifdef LIB_NAME + -$(DEL) $(LIB_NAME) $(LIB_FULLNAME) +endif + -$(DEL) $(FPCMADE) Package.fpc $(PPAS) script.res link.res $(FPCEXTFILE) $(REDIRFILE) + -$(DEL) *$(ASMEXT) *_ppas$(BATCHEXT) +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) *_ppas$(BATCHEXT) +ifdef AOUTEXT + -$(DEL) *$(AOUTEXT) +endif +ifdef DEBUGSYMEXT + -$(DEL) *$(DEBUGSYMEXT) +endif +fpc_distclean: cleanall +.PHONY: fpc_baseinfo +override INFORULES+=fpc_baseinfo +fpc_baseinfo: + @$(ECHO) + @$(ECHO) == Package info == + @$(ECHO) Package Name..... $(PACKAGE_NAME) + @$(ECHO) Package Version.. $(PACKAGE_VERSION) + @$(ECHO) + @$(ECHO) == Configuration info == + @$(ECHO) + @$(ECHO) FPC.......... $(FPC) + @$(ECHO) FPC Version.. $(FPC_VERSION) + @$(ECHO) Source CPU... $(CPU_SOURCE) + @$(ECHO) Target CPU... $(CPU_TARGET) + @$(ECHO) Source OS.... $(OS_SOURCE) + @$(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) + @$(ECHO) Required pkgs... $(REQUIRE_PACKAGES) + @$(ECHO) + @$(ECHO) Basedir......... $(BASEDIR) + @$(ECHO) FPCDir.......... $(FPCDIR) + @$(ECHO) CrossBinDir..... $(CROSSBINDIR) + @$(ECHO) UnitsDir........ $(UNITSDIR) + @$(ECHO) PackagesDir..... $(PACKAGESDIR) + @$(ECHO) + @$(ECHO) GCC library..... $(GCCLIBDIR) + @$(ECHO) Other library... $(OTHERLIBDIR) + @$(ECHO) + @$(ECHO) == Tools info == + @$(ECHO) + @$(ECHO) As........ $(AS) + @$(ECHO) Ld........ $(LD) + @$(ECHO) Ar........ $(AR) + @$(ECHO) Rc........ $(RC) + @$(ECHO) + @$(ECHO) Mv........ $(MVPROG) + @$(ECHO) Cp........ $(CPPROG) + @$(ECHO) Rm........ $(RMPROG) + @$(ECHO) GInstall.. $(GINSTALL) + @$(ECHO) Echo...... $(ECHO) + @$(ECHO) Shell..... $(SHELL) + @$(ECHO) Date...... $(DATE) + @$(ECHO) FPCMake... $(FPCMAKE) + @$(ECHO) PPUMove... $(PPUMOVE) + @$(ECHO) Upx....... $(UPXPROG) + @$(ECHO) Zip....... $(ZIPPROG) + @$(ECHO) + @$(ECHO) == Object info == + @$(ECHO) + @$(ECHO) Target Loaders........ $(TARGET_LOADERS) + @$(ECHO) Target Units.......... $(TARGET_UNITS) + @$(ECHO) Target Implicit Units. $(TARGET_IMPLICITUNITS) + @$(ECHO) Target Programs....... $(TARGET_PROGRAMS) + @$(ECHO) Target Dirs........... $(TARGET_DIRS) + @$(ECHO) Target Examples....... $(TARGET_EXAMPLES) + @$(ECHO) Target ExampleDirs.... $(TARGET_EXAMPLEDIRS) + @$(ECHO) + @$(ECHO) Clean Units......... $(CLEAN_UNITS) + @$(ECHO) Clean Files......... $(CLEAN_FILES) + @$(ECHO) + @$(ECHO) Install Units....... $(INSTALL_UNITS) + @$(ECHO) Install Files....... $(INSTALL_FILES) + @$(ECHO) + @$(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) + @$(ECHO) Install binary dir... $(INSTALL_BINDIR) + @$(ECHO) Install library dir.. $(INSTALL_LIBDIR) + @$(ECHO) Install units dir.... $(INSTALL_UNITDIR) + @$(ECHO) Install source dir... $(INSTALL_SOURCEDIR) + @$(ECHO) Install doc dir...... $(INSTALL_DOCDIR) + @$(ECHO) Install example dir.. $(INSTALL_EXAMPLEDIR) + @$(ECHO) Install data dir..... $(INSTALL_DATADIR) + @$(ECHO) + @$(ECHO) Dist destination dir. $(DIST_DESTDIR) + @$(ECHO) Dist zip name........ $(DIST_ZIPNAME) + @$(ECHO) +.PHONY: fpc_info +fpc_info: $(INFORULES) +.PHONY: fpc_makefile fpc_makefiles fpc_makefile_sub1 fpc_makefile_sub2 \ + fpc_makefile_dirs +fpc_makefile: + $(FPCMAKE) -w -T$(OS_TARGET) Makefile.fpc +fpc_makefile_sub1: +ifdef TARGET_DIRS + $(FPCMAKE) -w -T$(OS_TARGET) $(addsuffix /Makefile.fpc,$(TARGET_DIRS)) +endif +ifdef TARGET_EXAMPLEDIRS + $(FPCMAKE) -w -T$(OS_TARGET) $(addsuffix /Makefile.fpc,$(TARGET_EXAMPLEDIRS)) +endif +fpc_makefile_sub2: $(addsuffix _makefile_dirs,$(TARGET_DIRS) $(TARGET_EXAMPLEDIRS)) +fpc_makefile_dirs: fpc_makefile_sub1 fpc_makefile_sub2 +fpc_makefiles: fpc_makefile fpc_makefile_dirs +all: fpc_all +debug: fpc_debug +smart: fpc_smart +release: fpc_release +units: fpc_units +examples: +shared: fpc_shared +install: fpc_install +sourceinstall: fpc_sourceinstall +exampleinstall: fpc_exampleinstall +distinstall: +zipinstall: +zipsourceinstall: +zipexampleinstall: +zipdistinstall: +clean: fpc_clean +distclean: fpc_distclean +cleanall: fpc_cleanall +info: fpc_info +makefiles: fpc_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 +.NOTPARALLEL: diff --git a/packages/gtk2/examples/helloworld/Makefile.fpc b/packages/gtk2/examples/helloworld/Makefile.fpc new file mode 100644 index 0000000000..2a960a8a39 --- /dev/null +++ b/packages/gtk2/examples/helloworld/Makefile.fpc @@ -0,0 +1,18 @@ +# +# Makefile.fpc for Free Pascal GTK 2.x.y Examples +# + +[target] +programs=helloworld + +[require] +packages=gtk2 + +[install] +fpcpackage=y + +[default] +fpcdir=../../../.. + +[rules] +.NOTPARALLEL: diff --git a/packages/gtk2/examples/helloworld/helloworld.pas b/packages/gtk2/examples/helloworld/helloworld.pas new file mode 100644 index 0000000000..b929707fa1 --- /dev/null +++ b/packages/gtk2/examples/helloworld/helloworld.pas @@ -0,0 +1,95 @@ +program HelloWorld; + +{$mode objfpc}{$H+} + +uses + Glib2, Gdk2, Gtk2; + +(* This is a callback function. The data arguments are ignored + * in this example. More on callbacks below. *) +procedure hello(Widget: PGtkWidget; Data: gpointer); cdecl; +begin + g_print ('Hello World'#13#10); +end; + +function delete_event( Widget: PGtkWidget; Event: PGdkEvent; Data: gpointer):gint; cdecl; +begin + (* If you return FALSE in the "delete_event" signal handler, + * GTK will emit the "destroy" signal. Returning TRUE means + * you don't want the window to be destroyed. + * This is useful for popping up 'are you sure you want to quit?' + * type dialogs. *) + + g_print ('delete event occurred'#13#10); + + (* Change TRUE to FALSE and the main window will be destroyed with + * a "delete_event". *) + + Result:=gTRUE; +end; + +(* Another callback *) +procedure destroy(Widget: PGtkWidget; Data: gpointer); cdecl; +begin + gtk_main_quit; +end; + +var + (* GtkWidget is the storage type for widgets *) + Window: PGtkWidget; + Button: PGtkWidget; +begin + + (* This is called in all GTK applications. Arguments are parsed + * from the command line and are returned to the application. *) + gtk_init (@argc, @argv); + + (* create a new window *) + window := gtk_window_new (GTK_WINDOW_TOPLEVEL); + + (* When the window is given the "delete_event" signal (this is given + * by the window manager, usually by the "close" option, or on the + * titlebar), we ask it to call the delete_event () function + * as defined above. The data passed to the callback + * function is NULL and is ignored in the callback function. *) + g_signal_connect (G_OBJECT (window), 'delete_event', + G_CALLBACK (@delete_event), NULL); + + (* Here we connect the "destroy" event to a signal handler. + * This event occurs when we call gtk_widget_destroy() on the window, + * or if we return FALSE in the "delete_event" callback. *) + g_signal_connect (G_OBJECT (window), 'destroy', + G_CALLBACK (@destroy), NULL); + + (* Sets the border width of the window. *) + gtk_container_set_border_width (GTK_CONTAINER (window), 10); + + (* Creates a new button with the label "Hello World". *) + button := gtk_button_new_with_label ('Hello World'); + + (* When the button receives the "clicked" signal, it will call the + * function hello() passing it NULL as its argument. The hello() + * function is defined above. *) + g_signal_connect (G_OBJECT (button), 'clicked', + G_CALLBACK (@hello), NULL); + + (* This will cause the window to be destroyed by calling + * gtk_widget_destroy(window) when "clicked". Again, the destroy + * signal could come from here, or the window manager. *) + g_signal_connect_swapped (G_OBJECT (button), 'clicked', + G_CALLBACK (@gtk_widget_destroy), window); + + (* This packs the button into the window (a gtk container). *) + gtk_container_add (GTK_CONTAINER (window), button); + + (* The final step is to display this newly created widget. *) + gtk_widget_show (button); + + (* and the window *) + gtk_widget_show (window); + + (* All GTK applications must have a gtk_main(). Control ends here + * and waits for an event to occur (like a key press or + * mouse event). *) + gtk_main (); +end. diff --git a/packages/gtk2/examples/helloworld2/Makefile b/packages/gtk2/examples/helloworld2/Makefile new file mode 100644 index 0000000000..816deacaf0 --- /dev/null +++ b/packages/gtk2/examples/helloworld2/Makefile @@ -0,0 +1,2015 @@ +# +# Don't edit, this file is generated by FPCMake Version 2.0.0 [2008/01/26] +# +default: all +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-darwin i386-emx i386-watcom i386-netwlibc i386-wince i386-embedded i386-symbian m68k-linux m68k-freebsd m68k-netbsd m68k-amiga m68k-atari m68k-openbsd m68k-palmos m68k-embedded powerpc-linux powerpc-netbsd powerpc-amiga powerpc-macos powerpc-darwin powerpc-morphos powerpc-embedded sparc-linux sparc-netbsd sparc-solaris sparc-embedded x86_64-linux x86_64-freebsd x86_64-darwin x86_64-win64 x86_64-embedded arm-linux arm-palmos arm-wince arm-gba arm-nds arm-embedded arm-symbian powerpc64-linux powerpc64-darwin powerpc64-embedded +BSDs = freebsd netbsd openbsd darwin +UNIXs = linux $(BSDs) solaris qnx +LIMIT83fs = go32v2 os2 emx watcom +OSNeedsComspecToRunBatch = go32v2 watcom +FORCE: +.PHONY: FORCE +override PATH:=$(patsubst %/,%,$(subst \,/,$(PATH))) +ifneq ($(findstring darwin,$(OSTYPE)),) +inUnix=1 #darwin +SEARCHPATH:=$(filter-out .,$(subst :, ,$(PATH))) +else +ifeq ($(findstring ;,$(PATH)),) +inUnix=1 +SEARCHPATH:=$(filter-out .,$(subst :, ,$(PATH))) +else +SEARCHPATH:=$(subst ;, ,$(PATH)) +endif +endif +SEARCHPATH+=$(patsubst %/,%,$(subst \,/,$(dir $(MAKE)))) +PWD:=$(strip $(wildcard $(addsuffix /pwd.exe,$(SEARCHPATH)))) +ifeq ($(PWD),) +PWD:=$(strip $(wildcard $(addsuffix /pwd,$(SEARCHPATH)))) +ifeq ($(PWD),) +$(error You need the GNU utils package to use this Makefile) +else +PWD:=$(firstword $(PWD)) +SRCEXEEXT= +endif +else +PWD:=$(firstword $(PWD)) +SRCEXEEXT=.exe +endif +ifndef inUnix +ifeq ($(OS),Windows_NT) +inWinNT=1 +else +ifdef OS2_SHELL +inOS2=1 +endif +endif +else +ifneq ($(findstring cygdrive,$(PATH)),) +inCygWin=1 +endif +endif +ifdef inUnix +SRCBATCHEXT=.sh +else +ifdef inOS2 +SRCBATCHEXT=.cmd +else +SRCBATCHEXT=.bat +endif +endif +ifdef COMSPEC +ifneq ($(findstring $(OS_SOURCE),$(OSNeedsComspecToRunBatch)),) +RUNBATCH=$(COMSPEC) /C +endif +endif +ifdef inUnix +PATHSEP=/ +else +PATHSEP:=$(subst /,\,/) +ifdef inCygWin +PATHSEP=/ +endif +endif +ifdef PWD +BASEDIR:=$(subst \,/,$(shell $(PWD))) +ifdef inCygWin +ifneq ($(findstring /cygdrive/,$(BASEDIR)),) +BASENODIR:=$(patsubst /cygdrive%,%,$(BASEDIR)) +BASEDRIVE:=$(firstword $(subst /, ,$(BASENODIR))) +BASEDIR:=$(subst /cygdrive/$(BASEDRIVE)/,$(BASEDRIVE):/,$(BASEDIR)) +endif +endif +else +BASEDIR=. +endif +ifdef inOS2 +ifndef ECHO +ECHO:=$(strip $(wildcard $(addsuffix /gecho$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(ECHO),) +ECHO:=$(strip $(wildcard $(addsuffix /echo$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(ECHO),) +ECHO=echo +else +ECHO:=$(firstword $(ECHO)) +endif +else +ECHO:=$(firstword $(ECHO)) +endif +endif +export ECHO +endif +override DEFAULT_FPCDIR=../../../.. +ifndef FPC +ifdef PP +FPC=$(PP) +endif +endif +ifndef FPC +FPCPROG:=$(strip $(wildcard $(addsuffix /fpc$(SRCEXEEXT),$(SEARCHPATH)))) +ifneq ($(FPCPROG),) +FPCPROG:=$(firstword $(FPCPROG)) +ifneq ($(CPU_TARGET),) +FPC:=$(shell $(FPCPROG) -P$(CPU_TARGET) -PB) +else +FPC:=$(shell $(FPCPROG) -PB) +endif +ifneq ($(findstring Error,$(FPC)),) +override FPC=$(firstword $(strip $(wildcard $(addsuffix /ppc386$(SRCEXEEXT),$(SEARCHPATH))))) +endif +else +override FPC=$(firstword $(strip $(wildcard $(addsuffix /ppc386$(SRCEXEEXT),$(SEARCHPATH))))) +endif +endif +override FPC:=$(subst $(SRCEXEEXT),,$(FPC)) +override FPC:=$(subst \,/,$(FPC))$(SRCEXEEXT) +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 +unexport CHECKDEPEND ALLDEPENDENCIES +ifndef CPU_TARGET +ifdef CPU_TARGET_DEFAULT +CPU_TARGET=$(CPU_TARGET_DEFAULT) +endif +endif +ifndef OS_TARGET +ifdef OS_TARGET_DEFAULT +OS_TARGET=$(OS_TARGET_DEFAULT) +endif +endif +ifneq ($(words $(FPC_COMPILERINFO)),5) +FPC_COMPILERINFO+=$(shell $(FPC) -iSP) +FPC_COMPILERINFO+=$(shell $(FPC) -iTP) +FPC_COMPILERINFO+=$(shell $(FPC) -iSO) +FPC_COMPILERINFO+=$(shell $(FPC) -iTO) +endif +ifndef CPU_SOURCE +CPU_SOURCE:=$(word 2,$(FPC_COMPILERINFO)) +endif +ifndef CPU_TARGET +CPU_TARGET:=$(word 3,$(FPC_COMPILERINFO)) +endif +ifndef OS_SOURCE +OS_SOURCE:=$(word 4,$(FPC_COMPILERINFO)) +endif +ifndef OS_TARGET +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 $(FULL_TARGET),$(MAKEFILETARGETS)),) +$(error The Makefile doesn't support target $(FULL_TARGET), please run fpcmake first) +endif +endif +ifneq ($(findstring $(OS_TARGET),$(BSDs)),) +BSDhier=1 +endif +ifeq ($(OS_TARGET),linux) +linuxHier=1 +endif +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)),) +override FPCDIR=wrong +endif +else +override FPCDIR=wrong +endif +ifdef DEFAULT_FPCDIR +ifeq ($(FPCDIR),wrong) +override FPCDIR:=$(subst \,/,$(DEFAULT_FPCDIR)) +ifeq ($(wildcard $(addprefix $(FPCDIR)/,rtl units)),) +override FPCDIR=wrong +endif +endif +endif +ifeq ($(FPCDIR),wrong) +ifdef inUnix +override FPCDIR=/usr/local/lib/fpc/$(FPC_VERSION) +ifeq ($(wildcard $(FPCDIR)/units),) +override FPCDIR=/usr/lib/fpc/$(FPC_VERSION) +endif +else +override FPCDIR:=$(subst /$(FPC),,$(firstword $(strip $(wildcard $(addsuffix /$(FPC),$(SEARCHPATH)))))) +override FPCDIR:=$(FPCDIR)/.. +ifeq ($(wildcard $(addprefix $(FPCDIR)/,rtl units)),) +override FPCDIR:=$(FPCDIR)/.. +ifeq ($(wildcard $(addprefix $(FPCDIR)/,rtl units)),) +override FPCDIR:=$(BASEDIR) +ifeq ($(wildcard $(addprefix $(FPCDIR)/,rtl units)),) +override FPCDIR=c:/pp +endif +endif +endif +endif +endif +ifndef CROSSBINDIR +CROSSBINDIR:=$(wildcard $(FPCDIR)/bin/$(TARGETSUFFIX)) +endif +ifndef BINUTILSPREFIX +ifndef CROSSBINDIR +ifdef CROSSCOMPILE +BINUTILSPREFIX=$(CPU_TARGET)-$(OS_TARGET)- +endif +endif +endif +UNITSDIR:=$(wildcard $(FPCDIR)/units/$(TARGETSUFFIX)) +ifeq ($(UNITSDIR),) +UNITSDIR:=$(wildcard $(FPCDIR)/units/$(OS_TARGET)) +endif +PACKAGESDIR:=$(wildcard $(FPCDIR) $(FPCDIR)/packages $(FPCDIR)/packages/base $(FPCDIR)/packages/extra) +ifeq ($(FULL_TARGET),i386-linux) +override TARGET_PROGRAMS+=helloworld2 +endif +ifeq ($(FULL_TARGET),i386-go32v2) +override TARGET_PROGRAMS+=helloworld2 +endif +ifeq ($(FULL_TARGET),i386-win32) +override TARGET_PROGRAMS+=helloworld2 +endif +ifeq ($(FULL_TARGET),i386-os2) +override TARGET_PROGRAMS+=helloworld2 +endif +ifeq ($(FULL_TARGET),i386-freebsd) +override TARGET_PROGRAMS+=helloworld2 +endif +ifeq ($(FULL_TARGET),i386-beos) +override TARGET_PROGRAMS+=helloworld2 +endif +ifeq ($(FULL_TARGET),i386-netbsd) +override TARGET_PROGRAMS+=helloworld2 +endif +ifeq ($(FULL_TARGET),i386-solaris) +override TARGET_PROGRAMS+=helloworld2 +endif +ifeq ($(FULL_TARGET),i386-qnx) +override TARGET_PROGRAMS+=helloworld2 +endif +ifeq ($(FULL_TARGET),i386-netware) +override TARGET_PROGRAMS+=helloworld2 +endif +ifeq ($(FULL_TARGET),i386-openbsd) +override TARGET_PROGRAMS+=helloworld2 +endif +ifeq ($(FULL_TARGET),i386-wdosx) +override TARGET_PROGRAMS+=helloworld2 +endif +ifeq ($(FULL_TARGET),i386-darwin) +override TARGET_PROGRAMS+=helloworld2 +endif +ifeq ($(FULL_TARGET),i386-emx) +override TARGET_PROGRAMS+=helloworld2 +endif +ifeq ($(FULL_TARGET),i386-watcom) +override TARGET_PROGRAMS+=helloworld2 +endif +ifeq ($(FULL_TARGET),i386-netwlibc) +override TARGET_PROGRAMS+=helloworld2 +endif +ifeq ($(FULL_TARGET),i386-wince) +override TARGET_PROGRAMS+=helloworld2 +endif +ifeq ($(FULL_TARGET),i386-embedded) +override TARGET_PROGRAMS+=helloworld2 +endif +ifeq ($(FULL_TARGET),i386-symbian) +override TARGET_PROGRAMS+=helloworld2 +endif +ifeq ($(FULL_TARGET),m68k-linux) +override TARGET_PROGRAMS+=helloworld2 +endif +ifeq ($(FULL_TARGET),m68k-freebsd) +override TARGET_PROGRAMS+=helloworld2 +endif +ifeq ($(FULL_TARGET),m68k-netbsd) +override TARGET_PROGRAMS+=helloworld2 +endif +ifeq ($(FULL_TARGET),m68k-amiga) +override TARGET_PROGRAMS+=helloworld2 +endif +ifeq ($(FULL_TARGET),m68k-atari) +override TARGET_PROGRAMS+=helloworld2 +endif +ifeq ($(FULL_TARGET),m68k-openbsd) +override TARGET_PROGRAMS+=helloworld2 +endif +ifeq ($(FULL_TARGET),m68k-palmos) +override TARGET_PROGRAMS+=helloworld2 +endif +ifeq ($(FULL_TARGET),m68k-embedded) +override TARGET_PROGRAMS+=helloworld2 +endif +ifeq ($(FULL_TARGET),powerpc-linux) +override TARGET_PROGRAMS+=helloworld2 +endif +ifeq ($(FULL_TARGET),powerpc-netbsd) +override TARGET_PROGRAMS+=helloworld2 +endif +ifeq ($(FULL_TARGET),powerpc-amiga) +override TARGET_PROGRAMS+=helloworld2 +endif +ifeq ($(FULL_TARGET),powerpc-macos) +override TARGET_PROGRAMS+=helloworld2 +endif +ifeq ($(FULL_TARGET),powerpc-darwin) +override TARGET_PROGRAMS+=helloworld2 +endif +ifeq ($(FULL_TARGET),powerpc-morphos) +override TARGET_PROGRAMS+=helloworld2 +endif +ifeq ($(FULL_TARGET),powerpc-embedded) +override TARGET_PROGRAMS+=helloworld2 +endif +ifeq ($(FULL_TARGET),sparc-linux) +override TARGET_PROGRAMS+=helloworld2 +endif +ifeq ($(FULL_TARGET),sparc-netbsd) +override TARGET_PROGRAMS+=helloworld2 +endif +ifeq ($(FULL_TARGET),sparc-solaris) +override TARGET_PROGRAMS+=helloworld2 +endif +ifeq ($(FULL_TARGET),sparc-embedded) +override TARGET_PROGRAMS+=helloworld2 +endif +ifeq ($(FULL_TARGET),x86_64-linux) +override TARGET_PROGRAMS+=helloworld2 +endif +ifeq ($(FULL_TARGET),x86_64-freebsd) +override TARGET_PROGRAMS+=helloworld2 +endif +ifeq ($(FULL_TARGET),x86_64-darwin) +override TARGET_PROGRAMS+=helloworld2 +endif +ifeq ($(FULL_TARGET),x86_64-win64) +override TARGET_PROGRAMS+=helloworld2 +endif +ifeq ($(FULL_TARGET),x86_64-embedded) +override TARGET_PROGRAMS+=helloworld2 +endif +ifeq ($(FULL_TARGET),arm-linux) +override TARGET_PROGRAMS+=helloworld2 +endif +ifeq ($(FULL_TARGET),arm-palmos) +override TARGET_PROGRAMS+=helloworld2 +endif +ifeq ($(FULL_TARGET),arm-wince) +override TARGET_PROGRAMS+=helloworld2 +endif +ifeq ($(FULL_TARGET),arm-gba) +override TARGET_PROGRAMS+=helloworld2 +endif +ifeq ($(FULL_TARGET),arm-nds) +override TARGET_PROGRAMS+=helloworld2 +endif +ifeq ($(FULL_TARGET),arm-embedded) +override TARGET_PROGRAMS+=helloworld2 +endif +ifeq ($(FULL_TARGET),arm-symbian) +override TARGET_PROGRAMS+=helloworld2 +endif +ifeq ($(FULL_TARGET),powerpc64-linux) +override TARGET_PROGRAMS+=helloworld2 +endif +ifeq ($(FULL_TARGET),powerpc64-darwin) +override TARGET_PROGRAMS+=helloworld2 +endif +ifeq ($(FULL_TARGET),powerpc64-embedded) +override TARGET_PROGRAMS+=helloworld2 +endif +override INSTALL_FPCPACKAGE=y +ifdef REQUIRE_UNITSDIR +override UNITSDIR+=$(REQUIRE_UNITSDIR) +endif +ifdef REQUIRE_PACKAGESDIR +override PACKAGESDIR+=$(REQUIRE_PACKAGESDIR) +endif +ifdef ZIPINSTALL +ifneq ($(findstring $(OS_TARGET),$(UNIXs)),) +UNIXHier=1 +endif +else +ifneq ($(findstring $(OS_SOURCE),$(UNIXs)),) +UNIXHier=1 +endif +endif +ifndef INSTALL_PREFIX +ifdef PREFIX +INSTALL_PREFIX=$(PREFIX) +endif +endif +ifndef INSTALL_PREFIX +ifdef UNIXHier +INSTALL_PREFIX=/usr/local +else +ifdef INSTALL_FPCPACKAGE +INSTALL_BASEDIR:=/pp +else +INSTALL_BASEDIR:=/$(PACKAGE_NAME) +endif +endif +endif +export INSTALL_PREFIX +ifdef INSTALL_FPCSUBDIR +export INSTALL_FPCSUBDIR +endif +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 +INSTALL_BASEDIR:=$(INSTALL_PREFIX)/lib/fpc/$(FPC_VERSION) +else +INSTALL_BASEDIR:=$(INSTALL_PREFIX)/lib/$(PACKAGE_NAME) +endif +else +INSTALL_BASEDIR:=$(INSTALL_PREFIX) +endif +endif +ifndef INSTALL_BINDIR +ifdef UNIXHier +INSTALL_BINDIR:=$(INSTALL_PREFIX)/bin +else +INSTALL_BINDIR:=$(INSTALL_BASEDIR)/bin +ifdef INSTALL_FPCPACKAGE +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 +INSTALL_UNITDIR:=$(INSTALL_BASEDIR)/units/$(TARGETSUFFIX) +ifdef INSTALL_FPCPACKAGE +ifdef PACKAGE_NAME +INSTALL_UNITDIR:=$(INSTALL_UNITDIR)/$(PACKAGE_NAME) +endif +endif +endif +ifndef INSTALL_LIBDIR +ifdef UNIXHier +INSTALL_LIBDIR:=$(INSTALL_PREFIX)/lib +else +INSTALL_LIBDIR:=$(INSTALL_UNITDIR) +endif +endif +ifndef INSTALL_SOURCEDIR +ifdef UNIXHier +ifdef BSDhier +SRCPREFIXDIR=share/src +else +ifdef linuxHier +SRCPREFIXDIR=share/src +else +SRCPREFIXDIR=src +endif +endif +ifdef INSTALL_FPCPACKAGE +ifdef INSTALL_FPCSUBDIR +INSTALL_SOURCEDIR:=$(INSTALL_PREFIX)/$(SRCPREFIXDIR)/fpc-$(FPC_VERSION)/$(INSTALL_FPCSUBDIR)/$(PACKAGE_NAME) +else +INSTALL_SOURCEDIR:=$(INSTALL_PREFIX)/$(SRCPREFIXDIR)/fpc-$(FPC_VERSION)/$(PACKAGE_NAME) +endif +else +INSTALL_SOURCEDIR:=$(INSTALL_PREFIX)/$(SRCPREFIXDIR)/$(PACKAGE_NAME)-$(PACKAGE_VERSION) +endif +else +ifdef INSTALL_FPCPACKAGE +ifdef INSTALL_FPCSUBDIR +INSTALL_SOURCEDIR:=$(INSTALL_BASEDIR)/source/$(INSTALL_FPCSUBDIR)/$(PACKAGE_NAME) +else +INSTALL_SOURCEDIR:=$(INSTALL_BASEDIR)/source/$(PACKAGE_NAME) +endif +else +INSTALL_SOURCEDIR:=$(INSTALL_BASEDIR)/source +endif +endif +endif +ifndef INSTALL_DOCDIR +ifdef UNIXHier +ifdef BSDhier +DOCPREFIXDIR=share/doc +else +ifdef linuxHier +DOCPREFIXDIR=share/doc +else +DOCPREFIXDIR=doc +endif +endif +ifdef INSTALL_FPCPACKAGE +INSTALL_DOCDIR:=$(INSTALL_PREFIX)/$(DOCPREFIXDIR)/fpc-$(FPC_VERSION)/$(PACKAGE_NAME) +else +INSTALL_DOCDIR:=$(INSTALL_PREFIX)/$(DOCPREFIXDIR)/$(PACKAGE_NAME)-$(PACKAGE_VERSION) +endif +else +ifdef INSTALL_FPCPACKAGE +INSTALL_DOCDIR:=$(INSTALL_BASEDIR)/doc/$(PACKAGE_NAME) +else +INSTALL_DOCDIR:=$(INSTALL_BASEDIR)/doc +endif +endif +endif +ifndef INSTALL_EXAMPLEDIR +ifdef UNIXHier +ifdef INSTALL_FPCPACKAGE +ifdef BSDhier +INSTALL_EXAMPLEDIR:=$(INSTALL_PREFIX)/share/examples/fpc-$(FPC_VERSION)/$(PACKAGE_NAME) +else +ifdef linuxHier +INSTALL_EXAMPLEDIR:=$(INSTALL_DOCDIR)/examples +else +INSTALL_EXAMPLEDIR:=$(INSTALL_PREFIX)/doc/fpc-$(FPC_VERSION)/examples/$(PACKAGE_NAME) +endif +endif +else +ifdef BSDhier +INSTALL_EXAMPLEDIR:=$(INSTALL_PREFIX)/share/examples/$(PACKAGE_NAME)-$(PACKAGE_VERSION) +else +ifdef linuxHier +INSTALL_EXAMPLEDIR:=$(INSTALL_DOCDIR)/examples/$(PACKAGE_NAME)-$(PACKAGE_VERSION) +else +INSTALL_EXAMPLEDIR:=$(INSTALL_PREFIX)/doc/$(PACKAGE_NAME)-$(PACKAGE_VERSION) +endif +endif +endif +else +ifdef INSTALL_FPCPACKAGE +INSTALL_EXAMPLEDIR:=$(INSTALL_BASEDIR)/examples/$(PACKAGE_NAME) +else +INSTALL_EXAMPLEDIR:=$(INSTALL_BASEDIR)/examples +endif +endif +endif +ifndef INSTALL_DATADIR +INSTALL_DATADIR=$(INSTALL_BASEDIR) +endif +ifndef INSTALL_SHAREDDIR +INSTALL_SHAREDDIR=$(INSTALL_PREFIX)/lib +endif +ifdef CROSSCOMPILE +ifndef CROSSBINDIR +CROSSBINDIR:=$(wildcard $(CROSSTARGETDIR)/bin/$(SOURCESUFFIX)) +ifeq ($(CROSSBINDIR),) +CROSSBINDIR:=$(wildcard $(INSTALL_BASEDIR)/cross/$(TARGETSUFFIX)/bin/$(FULL_SOURCE)) +endif +endif +else +CROSSBINDIR= +endif +ifeq ($(OS_SOURCE),linux) +ifndef GCCLIBDIR +ifeq ($(CPU_TARGET),i386) +ifneq ($(findstring x86_64,$(shell uname -a)),) +ifeq ($(BINUTILSPREFIX),) +GCCLIBDIR:=$(shell dirname `gcc -m32 -print-libgcc-file-name`) +endif +endif +endif +ifeq ($(CPU_TARGET),powerpc64) +ifeq ($(BINUTILSPREFIX),) +GCCLIBDIR:=$(shell dirname `gcc -m64 -print-libgcc-file-name`) +endif +endif +endif +ifndef GCCLIBDIR +CROSSGCC=$(strip $(wildcard $(addsuffix /$(BINUTILSPREFIX)gcc$(SRCEXEEXT),$(SEARCHPATH)))) +ifneq ($(CROSSGCC),) +GCCLIBDIR:=$(shell dirname `$(CROSSGCC) -print-libgcc-file-name`) +endif +endif +ifndef OTHERLIBDIR +OTHERLIBDIR:=$(shell grep -v "^\#" /etc/ld.so.conf | awk '{ ORS=" "; print $1 }') +endif +endif +ifdef inUnix +ifeq ($(OS_SOURCE),netbsd) +OTHERLIBDIR+=/usr/pkg/lib +endif +export GCCLIBDIR OTHERLIB +endif +BATCHEXT=.bat +LOADEREXT=.as +EXEEXT=.exe +PPLEXT=.ppl +PPUEXT=.ppu +OEXT=.o +ASMEXT=.s +SMARTEXT=.sl +STATICLIBEXT=.a +SHAREDLIBEXT=.so +SHAREDLIBPREFIX=libfp +STATICLIBPREFIX=libp +IMPORTLIBPREFIX=libimp +RSTEXT=.rst +ifeq ($(findstring 1.0.,$(FPC_VERSION)),) +ifeq ($(OS_TARGET),go32v1) +STATICLIBPREFIX= +SHORTSUFFIX=v1 +endif +ifeq ($(OS_TARGET),go32v2) +STATICLIBPREFIX= +SHORTSUFFIX=dos +endif +ifeq ($(OS_TARGET),watcom) +STATICLIBPREFIX= +OEXT=.obj +ASMEXT=.asm +SHAREDLIBEXT=.dll +SHORTSUFFIX=wat +endif +ifeq ($(OS_TARGET),linux) +BATCHEXT=.sh +EXEEXT= +HASSHAREDLIB=1 +SHORTSUFFIX=lnx +endif +ifeq ($(OS_TARGET),freebsd) +BATCHEXT=.sh +EXEEXT= +HASSHAREDLIB=1 +SHORTSUFFIX=fbs +endif +ifeq ($(OS_TARGET),netbsd) +BATCHEXT=.sh +EXEEXT= +HASSHAREDLIB=1 +SHORTSUFFIX=nbs +endif +ifeq ($(OS_TARGET),openbsd) +BATCHEXT=.sh +EXEEXT= +HASSHAREDLIB=1 +SHORTSUFFIX=obs +endif +ifeq ($(OS_TARGET),win32) +SHAREDLIBEXT=.dll +SHORTSUFFIX=w32 +endif +ifeq ($(OS_TARGET),os2) +BATCHEXT=.cmd +AOUTEXT=.out +STATICLIBPREFIX= +SHAREDLIBEXT=.dll +SHORTSUFFIX=os2 +ECHO=echo +endif +ifeq ($(OS_TARGET),emx) +BATCHEXT=.cmd +AOUTEXT=.out +STATICLIBPREFIX= +SHAREDLIBEXT=.dll +SHORTSUFFIX=emx +ECHO=echo +endif +ifeq ($(OS_TARGET),amiga) +EXEEXT= +SHAREDLIBEXT=.library +SHORTSUFFIX=amg +endif +ifeq ($(OS_TARGET),morphos) +EXEEXT= +SHAREDLIBEXT=.library +SHORTSUFFIX=mos +endif +ifeq ($(OS_TARGET),atari) +EXEEXT=.ttp +SHORTSUFFIX=ata +endif +ifeq ($(OS_TARGET),beos) +BATCHEXT=.sh +EXEEXT= +SHORTSUFFIX=be +endif +ifeq ($(OS_TARGET),solaris) +BATCHEXT=.sh +EXEEXT= +SHORTSUFFIX=sun +endif +ifeq ($(OS_TARGET),qnx) +BATCHEXT=.sh +EXEEXT= +SHORTSUFFIX=qnx +endif +ifeq ($(OS_TARGET),netware) +EXEEXT=.nlm +STATICLIBPREFIX= +SHORTSUFFIX=nw +endif +ifeq ($(OS_TARGET),netwlibc) +EXEEXT=.nlm +STATICLIBPREFIX= +SHORTSUFFIX=nwl +endif +ifeq ($(OS_TARGET),macos) +BATCHEXT= +EXEEXT= +DEBUGSYMEXT=.xcoff +SHORTSUFFIX=mac +endif +ifeq ($(OS_TARGET),darwin) +BATCHEXT=.sh +EXEEXT= +HASSHAREDLIB=1 +SHORTSUFFIX=dwn +endif +ifeq ($(OS_TARGET),gba) +EXEEXT=.gba +SHAREDLIBEXT=.so +SHORTSUFFIX=gba +endif +ifeq ($(OS_TARGET),symbian) +SHAREDLIBEXT=.dll +SHORTSUFFIX=symbian +endif +else +ifeq ($(OS_TARGET),go32v1) +PPUEXT=.pp1 +OEXT=.o1 +ASMEXT=.s1 +SMARTEXT=.sl1 +STATICLIBEXT=.a1 +SHAREDLIBEXT=.so1 +STATICLIBPREFIX= +SHORTSUFFIX=v1 +endif +ifeq ($(OS_TARGET),go32v2) +STATICLIBPREFIX= +SHORTSUFFIX=dos +endif +ifeq ($(OS_TARGET),watcom) +STATICLIBPREFIX= +SHORTSUFFIX=wat +endif +ifeq ($(OS_TARGET),linux) +BATCHEXT=.sh +EXEEXT= +HASSHAREDLIB=1 +SHORTSUFFIX=lnx +endif +ifeq ($(OS_TARGET),freebsd) +BATCHEXT=.sh +EXEEXT= +HASSHAREDLIB=1 +SHORTSUFFIX=fbs +endif +ifeq ($(OS_TARGET),netbsd) +BATCHEXT=.sh +EXEEXT= +HASSHAREDLIB=1 +SHORTSUFFIX=nbs +endif +ifeq ($(OS_TARGET),openbsd) +BATCHEXT=.sh +EXEEXT= +HASSHAREDLIB=1 +SHORTSUFFIX=obs +endif +ifeq ($(OS_TARGET),win32) +PPUEXT=.ppw +OEXT=.ow +ASMEXT=.sw +SMARTEXT=.slw +STATICLIBEXT=.aw +SHAREDLIBEXT=.dll +SHORTSUFFIX=w32 +endif +ifeq ($(OS_TARGET),os2) +BATCHEXT=.cmd +PPUEXT=.ppo +ASMEXT=.so2 +OEXT=.oo2 +AOUTEXT=.out +SMARTEXT=.sl2 +STATICLIBPREFIX= +STATICLIBEXT=.ao2 +SHAREDLIBEXT=.dll +SHORTSUFFIX=os2 +ECHO=echo +endif +ifeq ($(OS_TARGET),amiga) +EXEEXT= +PPUEXT=.ppu +ASMEXT=.s +OEXT=.o +SMARTEXT=.sl +STATICLIBEXT=.a +SHAREDLIBEXT=.library +SHORTSUFFIX=amg +endif +ifeq ($(OS_TARGET),atari) +PPUEXT=.ppu +ASMEXT=.s +OEXT=.o +SMARTEXT=.sl +STATICLIBEXT=.a +EXEEXT=.ttp +SHORTSUFFIX=ata +endif +ifeq ($(OS_TARGET),beos) +BATCHEXT=.sh +PPUEXT=.ppu +ASMEXT=.s +OEXT=.o +SMARTEXT=.sl +STATICLIBEXT=.a +EXEEXT= +SHORTSUFFIX=be +endif +ifeq ($(OS_TARGET),solaris) +BATCHEXT=.sh +PPUEXT=.ppu +ASMEXT=.s +OEXT=.o +SMARTEXT=.sl +STATICLIBEXT=.a +EXEEXT= +SHORTSUFFIX=sun +endif +ifeq ($(OS_TARGET),qnx) +BATCHEXT=.sh +PPUEXT=.ppu +ASMEXT=.s +OEXT=.o +SMARTEXT=.sl +STATICLIBEXT=.a +EXEEXT= +SHORTSUFFIX=qnx +endif +ifeq ($(OS_TARGET),netware) +STATICLIBPREFIX= +PPUEXT=.ppu +OEXT=.o +ASMEXT=.s +SMARTEXT=.sl +STATICLIBEXT=.a +SHAREDLIBEXT=.nlm +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= +PPUEXT=.ppu +ASMEXT=.s +OEXT=.o +SMARTEXT=.sl +STATICLIBEXT=.a +EXEEXT= +DEBUGSYMEXT=.xcoff +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 +ECHO:=$(strip $(wildcard $(addsuffix /gecho$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(ECHO),) +ECHO:=$(strip $(wildcard $(addsuffix /echo$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(ECHO),) +ECHO= __missing_command_ECHO +else +ECHO:=$(firstword $(ECHO)) +endif +else +ECHO:=$(firstword $(ECHO)) +endif +endif +export ECHO +ifndef DATE +DATE:=$(strip $(wildcard $(addsuffix /gdate$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(DATE),) +DATE:=$(strip $(wildcard $(addsuffix /date$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(DATE),) +DATE= __missing_command_DATE +else +DATE:=$(firstword $(DATE)) +endif +else +DATE:=$(firstword $(DATE)) +endif +endif +export DATE +ifndef GINSTALL +GINSTALL:=$(strip $(wildcard $(addsuffix /ginstall$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(GINSTALL),) +GINSTALL:=$(strip $(wildcard $(addsuffix /install$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(GINSTALL),) +GINSTALL= __missing_command_GINSTALL +else +GINSTALL:=$(firstword $(GINSTALL)) +endif +else +GINSTALL:=$(firstword $(GINSTALL)) +endif +endif +export GINSTALL +ifndef CPPROG +CPPROG:=$(strip $(wildcard $(addsuffix /cp$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(CPPROG),) +CPPROG= __missing_command_CPPROG +else +CPPROG:=$(firstword $(CPPROG)) +endif +endif +export CPPROG +ifndef RMPROG +RMPROG:=$(strip $(wildcard $(addsuffix /rm$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(RMPROG),) +RMPROG= __missing_command_RMPROG +else +RMPROG:=$(firstword $(RMPROG)) +endif +endif +export RMPROG +ifndef MVPROG +MVPROG:=$(strip $(wildcard $(addsuffix /mv$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(MVPROG),) +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 +else +ECHOREDIR=$(ECHO) +endif +endif +ifndef COPY +COPY:=$(CPPROG) -fp +endif +ifndef COPYTREE +COPYTREE:=$(CPPROG) -Rfp +endif +ifndef MKDIRTREE +MKDIRTREE:=$(MKDIRPROG) -p +endif +ifndef MOVE +MOVE:=$(MVPROG) -f +endif +ifndef DEL +DEL:=$(RMPROG) -f +endif +ifndef DELTREE +DELTREE:=$(RMPROG) -rf +endif +ifndef INSTALL +ifdef inUnix +INSTALL:=$(GINSTALL) -c -m 644 +else +INSTALL:=$(COPY) +endif +endif +ifndef INSTALLEXE +ifdef inUnix +INSTALLEXE:=$(GINSTALL) -c -m 755 +else +INSTALLEXE:=$(COPY) +endif +endif +ifndef MKDIR +MKDIR:=$(GINSTALL) -m 755 -d +endif +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 +else +PPUMOVE:=$(firstword $(PPUMOVE)) +endif +endif +export PPUMOVE +ifndef FPCMAKE +FPCMAKE:=$(strip $(wildcard $(addsuffix /fpcmake$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(FPCMAKE),) +FPCMAKE= __missing_command_FPCMAKE +else +FPCMAKE:=$(firstword $(FPCMAKE)) +endif +endif +export FPCMAKE +ifndef ZIPPROG +ZIPPROG:=$(strip $(wildcard $(addsuffix /zip$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(ZIPPROG),) +ZIPPROG= __missing_command_ZIPPROG +else +ZIPPROG:=$(firstword $(ZIPPROG)) +endif +endif +export ZIPPROG +ifndef TARPROG +TARPROG:=$(strip $(wildcard $(addsuffix /gtar$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(TARPROG),) +TARPROG:=$(strip $(wildcard $(addsuffix /tar$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(TARPROG),) +TARPROG= __missing_command_TARPROG +else +TARPROG:=$(firstword $(TARPROG)) +endif +else +TARPROG:=$(firstword $(TARPROG)) +endif +endif +export TARPROG +ASNAME=$(BINUTILSPREFIX)as +LDNAME=$(BINUTILSPREFIX)ld +ARNAME=$(BINUTILSPREFIX)ar +RCNAME=$(BINUTILSPREFIX)rc +ifneq ($(findstring 1.0.,$(FPC_VERSION)),) +ifeq ($(OS_TARGET),win32) +ifeq ($(CROSSBINDIR),) +ASNAME=asw +LDNAME=ldw +ARNAME=arw +endif +endif +endif +ifndef ASPROG +ifdef CROSSBINDIR +ASPROG=$(CROSSBINDIR)/$(ASNAME)$(SRCEXEEXT) +else +ASPROG=$(ASNAME) +endif +endif +ifndef LDPROG +ifdef CROSSBINDIR +LDPROG=$(CROSSBINDIR)/$(LDNAME)$(SRCEXEEXT) +else +LDPROG=$(LDNAME) +endif +endif +ifndef RCPROG +ifdef CROSSBINDIR +RCPROG=$(CROSSBINDIR)/$(RCNAME)$(SRCEXEEXT) +else +RCPROG=$(RCNAME) +endif +endif +ifndef ARPROG +ifdef CROSSBINDIR +ARPROG=$(CROSSBINDIR)/$(ARNAME)$(SRCEXEEXT) +else +ARPROG=$(ARNAME) +endif +endif +AS=$(ASPROG) +LD=$(LDPROG) +RC=$(RCPROG) +AR=$(ARPROG) +PPAS=ppas$(SRCBATCHEXT) +ifdef inUnix +LDCONFIG=ldconfig +else +LDCONFIG= +endif +ifdef DATE +DATESTR:=$(shell $(DATE) +%Y%m%d) +else +DATESTR= +endif +ifndef UPXPROG +ifeq ($(OS_TARGET),go32v2) +UPXPROG:=1 +endif +ifeq ($(OS_TARGET),win32) +UPXPROG:=1 +endif +ifdef UPXPROG +UPXPROG:=$(strip $(wildcard $(addsuffix /upx$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(UPXPROG),) +UPXPROG= +else +UPXPROG:=$(firstword $(UPXPROG)) +endif +else +UPXPROG= +endif +endif +export UPXPROG +ZIPOPT=-9 +ZIPEXT=.zip +ifeq ($(USETAR),bz2) +TAROPT=vj +TAREXT=.tar.bz2 +else +TAROPT=vz +TAREXT=.tar.gz +endif +override REQUIRE_PACKAGES=rtl gtk2 +ifeq ($(FULL_TARGET),i386-linux) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_X11=1 +REQUIRE_PACKAGES_GTK2=1 +endif +ifeq ($(FULL_TARGET),i386-go32v2) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_GTK2=1 +endif +ifeq ($(FULL_TARGET),i386-win32) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_GTK2=1 +endif +ifeq ($(FULL_TARGET),i386-os2) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_GTK2=1 +endif +ifeq ($(FULL_TARGET),i386-freebsd) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_X11=1 +REQUIRE_PACKAGES_GTK2=1 +endif +ifeq ($(FULL_TARGET),i386-beos) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_GTK2=1 +endif +ifeq ($(FULL_TARGET),i386-netbsd) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_X11=1 +REQUIRE_PACKAGES_GTK2=1 +endif +ifeq ($(FULL_TARGET),i386-solaris) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_X11=1 +REQUIRE_PACKAGES_GTK2=1 +endif +ifeq ($(FULL_TARGET),i386-qnx) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_GTK2=1 +endif +ifeq ($(FULL_TARGET),i386-netware) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_GTK2=1 +endif +ifeq ($(FULL_TARGET),i386-openbsd) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_X11=1 +REQUIRE_PACKAGES_GTK2=1 +endif +ifeq ($(FULL_TARGET),i386-wdosx) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_GTK2=1 +endif +ifeq ($(FULL_TARGET),i386-darwin) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_X11=1 +REQUIRE_PACKAGES_GTK2=1 +endif +ifeq ($(FULL_TARGET),i386-emx) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_GTK2=1 +endif +ifeq ($(FULL_TARGET),i386-watcom) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_GTK2=1 +endif +ifeq ($(FULL_TARGET),i386-netwlibc) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_GTK2=1 +endif +ifeq ($(FULL_TARGET),i386-wince) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_GTK2=1 +endif +ifeq ($(FULL_TARGET),i386-embedded) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_GTK2=1 +endif +ifeq ($(FULL_TARGET),i386-symbian) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_GTK2=1 +endif +ifeq ($(FULL_TARGET),m68k-linux) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_X11=1 +REQUIRE_PACKAGES_GTK2=1 +endif +ifeq ($(FULL_TARGET),m68k-freebsd) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_X11=1 +REQUIRE_PACKAGES_GTK2=1 +endif +ifeq ($(FULL_TARGET),m68k-netbsd) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_X11=1 +REQUIRE_PACKAGES_GTK2=1 +endif +ifeq ($(FULL_TARGET),m68k-amiga) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_GTK2=1 +endif +ifeq ($(FULL_TARGET),m68k-atari) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_GTK2=1 +endif +ifeq ($(FULL_TARGET),m68k-openbsd) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_X11=1 +REQUIRE_PACKAGES_GTK2=1 +endif +ifeq ($(FULL_TARGET),m68k-palmos) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_GTK2=1 +endif +ifeq ($(FULL_TARGET),m68k-embedded) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_GTK2=1 +endif +ifeq ($(FULL_TARGET),powerpc-linux) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_X11=1 +REQUIRE_PACKAGES_GTK2=1 +endif +ifeq ($(FULL_TARGET),powerpc-netbsd) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_X11=1 +REQUIRE_PACKAGES_GTK2=1 +endif +ifeq ($(FULL_TARGET),powerpc-amiga) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_GTK2=1 +endif +ifeq ($(FULL_TARGET),powerpc-macos) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_GTK2=1 +endif +ifeq ($(FULL_TARGET),powerpc-darwin) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_X11=1 +REQUIRE_PACKAGES_GTK2=1 +endif +ifeq ($(FULL_TARGET),powerpc-morphos) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_GTK2=1 +endif +ifeq ($(FULL_TARGET),powerpc-embedded) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_GTK2=1 +endif +ifeq ($(FULL_TARGET),sparc-linux) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_X11=1 +REQUIRE_PACKAGES_GTK2=1 +endif +ifeq ($(FULL_TARGET),sparc-netbsd) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_X11=1 +REQUIRE_PACKAGES_GTK2=1 +endif +ifeq ($(FULL_TARGET),sparc-solaris) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_X11=1 +REQUIRE_PACKAGES_GTK2=1 +endif +ifeq ($(FULL_TARGET),sparc-embedded) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_GTK2=1 +endif +ifeq ($(FULL_TARGET),x86_64-linux) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_X11=1 +REQUIRE_PACKAGES_GTK2=1 +endif +ifeq ($(FULL_TARGET),x86_64-freebsd) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_X11=1 +REQUIRE_PACKAGES_GTK2=1 +endif +ifeq ($(FULL_TARGET),x86_64-darwin) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_X11=1 +REQUIRE_PACKAGES_GTK2=1 +endif +ifeq ($(FULL_TARGET),x86_64-win64) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_GTK2=1 +endif +ifeq ($(FULL_TARGET),x86_64-embedded) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_GTK2=1 +endif +ifeq ($(FULL_TARGET),arm-linux) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_X11=1 +REQUIRE_PACKAGES_GTK2=1 +endif +ifeq ($(FULL_TARGET),arm-palmos) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_GTK2=1 +endif +ifeq ($(FULL_TARGET),arm-wince) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_GTK2=1 +endif +ifeq ($(FULL_TARGET),arm-gba) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_GTK2=1 +endif +ifeq ($(FULL_TARGET),arm-nds) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_GTK2=1 +endif +ifeq ($(FULL_TARGET),arm-embedded) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_GTK2=1 +endif +ifeq ($(FULL_TARGET),arm-symbian) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_GTK2=1 +endif +ifeq ($(FULL_TARGET),powerpc64-linux) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_X11=1 +REQUIRE_PACKAGES_GTK2=1 +endif +ifeq ($(FULL_TARGET),powerpc64-darwin) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_X11=1 +REQUIRE_PACKAGES_GTK2=1 +endif +ifeq ($(FULL_TARGET),powerpc64-embedded) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_GTK2=1 +endif +ifdef REQUIRE_PACKAGES_RTL +PACKAGEDIR_RTL:=$(firstword $(subst /Makefile.fpc,,$(strip $(wildcard $(addsuffix /rtl/Makefile.fpc,$(PACKAGESDIR)))))) +ifneq ($(PACKAGEDIR_RTL),) +ifneq ($(wildcard $(PACKAGEDIR_RTL)/units/$(TARGETSUFFIX)),) +UNITDIR_RTL=$(PACKAGEDIR_RTL)/units/$(TARGETSUFFIX) +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 +ifdef REQUIRE_PACKAGES_X11 +PACKAGEDIR_X11:=$(firstword $(subst /Makefile.fpc,,$(strip $(wildcard $(addsuffix /x11/Makefile.fpc,$(PACKAGESDIR)))))) +ifneq ($(PACKAGEDIR_X11),) +ifneq ($(wildcard $(PACKAGEDIR_X11)/units/$(TARGETSUFFIX)),) +UNITDIR_X11=$(PACKAGEDIR_X11)/units/$(TARGETSUFFIX) +else +UNITDIR_X11=$(PACKAGEDIR_X11) +endif +ifdef CHECKDEPEND +$(PACKAGEDIR_X11)/$(FPCMADE): + $(MAKE) -C $(PACKAGEDIR_X11) $(FPCMADE) +override ALLDEPENDENCIES+=$(PACKAGEDIR_X11)/$(FPCMADE) +endif +else +PACKAGEDIR_X11= +UNITDIR_X11:=$(subst /Package.fpc,,$(strip $(wildcard $(addsuffix /x11/Package.fpc,$(UNITSDIR))))) +ifneq ($(UNITDIR_X11),) +UNITDIR_X11:=$(firstword $(UNITDIR_X11)) +else +UNITDIR_X11= +endif +endif +ifdef UNITDIR_X11 +override COMPILER_UNITDIR+=$(UNITDIR_X11) +endif +endif +ifdef REQUIRE_PACKAGES_GTK2 +PACKAGEDIR_GTK2:=$(firstword $(subst /Makefile.fpc,,$(strip $(wildcard $(addsuffix /gtk2/Makefile.fpc,$(PACKAGESDIR)))))) +ifneq ($(PACKAGEDIR_GTK2),) +ifneq ($(wildcard $(PACKAGEDIR_GTK2)/units/$(TARGETSUFFIX)),) +UNITDIR_GTK2=$(PACKAGEDIR_GTK2)/units/$(TARGETSUFFIX) +else +UNITDIR_GTK2=$(PACKAGEDIR_GTK2) +endif +ifdef CHECKDEPEND +$(PACKAGEDIR_GTK2)/$(FPCMADE): + $(MAKE) -C $(PACKAGEDIR_GTK2) $(FPCMADE) +override ALLDEPENDENCIES+=$(PACKAGEDIR_GTK2)/$(FPCMADE) +endif +else +PACKAGEDIR_GTK2= +UNITDIR_GTK2:=$(subst /Package.fpc,,$(strip $(wildcard $(addsuffix /gtk2/Package.fpc,$(UNITSDIR))))) +ifneq ($(UNITDIR_GTK2),) +UNITDIR_GTK2:=$(firstword $(UNITDIR_GTK2)) +else +UNITDIR_GTK2= +endif +endif +ifdef UNITDIR_GTK2 +override COMPILER_UNITDIR+=$(UNITDIR_GTK2) +endif +endif +ifndef NOCPUDEF +override FPCOPTDEF=$(CPU_TARGET) +endif +ifneq ($(OS_TARGET),$(OS_SOURCE)) +override FPCOPT+=-T$(OS_TARGET) +endif +ifneq ($(CPU_TARGET),$(CPU_SOURCE)) +override FPCOPT+=-P$(CPU_TARGET) +endif +ifeq ($(OS_SOURCE),openbsd) +override FPCOPT+=-FD$(NEW_BINUTILS_PATH) +endif +ifndef CROSSBOOTSTRAP +ifneq ($(BINUTILSPREFIX),) +override FPCOPT+=-XP$(BINUTILSPREFIX) +endif +ifneq ($(BINUTILSPREFIX),) +override FPCOPT+=-Xr$(RLINKPATH) +endif +endif +ifdef UNITDIR +override FPCOPT+=$(addprefix -Fu,$(UNITDIR)) +endif +ifdef LIBDIR +override FPCOPT+=$(addprefix -Fl,$(LIBDIR)) +endif +ifdef OBJDIR +override FPCOPT+=$(addprefix -Fo,$(OBJDIR)) +endif +ifdef INCDIR +override FPCOPT+=$(addprefix -Fi,$(INCDIR)) +endif +ifdef LINKSMART +override FPCOPT+=-XX +endif +ifdef CREATESMART +override FPCOPT+=-CX +endif +ifdef DEBUG +override FPCOPT+=-gl +override FPCOPTDEF+=DEBUG +endif +ifdef RELEASE +ifneq ($(findstring 2.0.,$(FPC_VERSION)),) +ifeq ($(CPU_TARGET),i386) +FPCCPUOPT:=-OG2p3 +endif +ifeq ($(CPU_TARGET),powerpc) +FPCCPUOPT:=-O1r +endif +else +FPCCPUOPT:=-O2 +endif +override FPCOPT+=-Ur -Xs $(FPCCPUOPT) -n +override FPCOPTDEF+=RELEASE +endif +ifdef STRIP +override FPCOPT+=-Xs +endif +ifdef OPTIMIZE +override FPCOPT+=-O2 +endif +ifdef VERBOSE +override FPCOPT+=-vwni +endif +ifdef COMPILER_OPTIONS +override FPCOPT+=$(COMPILER_OPTIONS) +endif +ifdef COMPILER_UNITDIR +override FPCOPT+=$(addprefix -Fu,$(COMPILER_UNITDIR)) +endif +ifdef COMPILER_LIBRARYDIR +override FPCOPT+=$(addprefix -Fl,$(COMPILER_LIBRARYDIR)) +endif +ifdef COMPILER_OBJECTDIR +override FPCOPT+=$(addprefix -Fo,$(COMPILER_OBJECTDIR)) +endif +ifdef COMPILER_INCLUDEDIR +override FPCOPT+=$(addprefix -Fi,$(COMPILER_INCLUDEDIR)) +endif +ifdef CROSSBINDIR +override FPCOPT+=-FD$(CROSSBINDIR) +endif +ifdef COMPILER_TARGETDIR +override FPCOPT+=-FE$(COMPILER_TARGETDIR) +ifeq ($(COMPILER_TARGETDIR),.) +override TARGETDIRPREFIX= +else +override TARGETDIRPREFIX=$(COMPILER_TARGETDIR)/ +endif +endif +ifdef COMPILER_UNITTARGETDIR +override FPCOPT+=-FU$(COMPILER_UNITTARGETDIR) +ifeq ($(COMPILER_UNITTARGETDIR),.) +override UNITTARGETDIRPREFIX= +else +override UNITTARGETDIRPREFIX=$(COMPILER_UNITTARGETDIR)/ +endif +else +ifdef COMPILER_TARGETDIR +override COMPILER_UNITTARGETDIR=$(COMPILER_TARGETDIR) +override UNITTARGETDIRPREFIX=$(TARGETDIRPREFIX) +endif +endif +ifdef CREATESHARED +override FPCOPT+=-Cg +ifeq ($(CPU_TARGET),i386) +override FPCOPT+=-Aas +endif +endif +ifeq ($(findstring 2.0.,$(FPC_VERSION)),) +ifeq ($(OS_TARGET),linux) +ifeq ($(CPU_TARGET),x86_64) +override FPCOPT+=-Cg +endif +endif +endif +ifdef LINKSHARED +endif +ifdef GCCLIBDIR +override FPCOPT+=-Fl$(GCCLIBDIR) +endif +ifdef OTHERLIBDIR +override FPCOPT+=$(addprefix -Fl,$(OTHERLIBDIR)) +endif +ifdef OPT +override FPCOPT+=$(OPT) +endif +ifdef FPCOPTDEF +override FPCOPT+=$(addprefix -d,$(FPCOPTDEF)) +endif +ifdef CFGFILE +override FPCOPT+=@$(CFGFILE) +endif +ifdef USEENV +override FPCEXTCMD:=$(FPCOPT) +override FPCOPT:=!FPCEXTCMD +export FPCEXTCMD +endif +override AFULL_TARGET=$(CPU_TARGET)-$(OS_TARGET) +override AFULL_SOURCE=$(CPU_SOURCE)-$(OS_SOURCE) +ifneq ($(AFULL_TARGET),$(AFULL_SOURCE)) +override ACROSSCOMPILE=1 +endif +ifdef ACROSSCOMPILE +override FPCOPT+=$(CROSSOPT) +endif +override COMPILER:=$(FPC) $(FPCOPT) +ifeq (,$(findstring -s ,$(COMPILER))) +EXECPPAS= +else +ifeq ($(FULL_SOURCE),$(FULL_TARGET)) +ifdef RUNBATCH +EXECPPAS:=@$(RUNBATCH) $(PPAS) +else +EXECPPAS:=@$(PPAS) +endif +endif +endif +.PHONY: fpc_exes +ifndef CROSSINSTALL +ifneq ($(TARGET_PROGRAMS),) +override EXEFILES=$(addsuffix $(EXEEXT),$(TARGET_PROGRAMS)) +override EXEOFILES:=$(addsuffix $(OEXT),$(TARGET_PROGRAMS)) $(addprefix $(STATICLIBPREFIX),$(addsuffix $(STATICLIBEXT),$(TARGET_PROGRAMS))) $(addprefix $(IMPORTLIBPREFIX),$(addsuffix $(STATICLIBEXT),$(TARGET_PROGRAMS))) +override ALLTARGET+=fpc_exes +override INSTALLEXEFILES+=$(EXEFILES) +override CLEANEXEFILES+=$(EXEFILES) $(EXEOFILES) +ifeq ($(OS_TARGET),os2) +override CLEANEXEFILES+=$(addsuffix $(AOUTEXT),$(TARGET_PROGRAMS)) +endif +ifeq ($(OS_TARGET),emx) +override CLEANEXEFILES+=$(addsuffix $(AOUTEXT),$(TARGET_PROGRAMS)) +endif +endif +endif +fpc_exes: $(COMPILER_TARGETDIR) $(COMPILER_UNITTARGETDIR) $(EXEFILES) +ifdef TARGET_RSTS +override RSTFILES=$(addsuffix $(RSTEXT),$(TARGET_RSTS)) +override CLEANRSTFILES+=$(RSTFILES) +endif +.PHONY: fpc_all fpc_smart fpc_debug fpc_release fpc_shared +$(FPCMADE): $(ALLDEPENDENCIES) $(ALLTARGET) + @$(ECHOREDIR) Compiled > $(FPCMADE) +fpc_all: $(FPCMADE) +fpc_smart: + $(MAKE) all LINKSMART=1 CREATESMART=1 +fpc_debug: + $(MAKE) all DEBUG=1 +fpc_release: + $(MAKE) all RELEASE=1 +.SUFFIXES: $(EXEEXT) $(PPUEXT) $(OEXT) .pas .lpr .dpr .pp .rc .res +$(COMPILER_UNITTARGETDIR): + $(MKDIRTREE) $(COMPILER_UNITTARGETDIR) +$(COMPILER_TARGETDIR): + $(MKDIRTREE) $(COMPILER_TARGETDIR) +%$(PPUEXT): %.pp + $(COMPILER) $< + $(EXECPPAS) +%$(PPUEXT): %.pas + $(COMPILER) $< + $(EXECPPAS) +%$(EXEEXT): %.pp + $(COMPILER) $< + $(EXECPPAS) +%$(EXEEXT): %.pas + $(COMPILER) $< + $(EXECPPAS) +%$(EXEEXT): %.lpr + $(COMPILER) $< + $(EXECPPAS) +%$(EXEEXT): %.dpr + $(COMPILER) $< + $(EXECPPAS) +%.res: %.rc + windres -i $< -o $@ +vpath %.pp $(COMPILER_SOURCEDIR) $(COMPILER_INCLUDEDIR) +vpath %.pas $(COMPILER_SOURCEDIR) $(COMPILER_INCLUDEDIR) +vpath %.lpr $(COMPILER_SOURCEDIR) $(COMPILER_INCLUDEDIR) +vpath %.dpr $(COMPILER_SOURCEDIR) $(COMPILER_INCLUDEDIR) +vpath %.inc $(COMPILER_INCLUDEDIR) +vpath %$(OEXT) $(COMPILER_UNITTARGETDIR) +vpath %$(PPUEXT) $(COMPILER_UNITTARGETDIR) +.PHONY: fpc_shared +override INSTALLTARGET+=fpc_shared_install +ifndef SHARED_LIBVERSION +SHARED_LIBVERSION=$(FPC_VERSION) +endif +ifndef SHARED_LIBNAME +SHARED_LIBNAME=$(PACKAGE_NAME) +endif +ifndef SHARED_FULLNAME +SHARED_FULLNAME=$(SHAREDLIBPREFIX)$(SHARED_LIBNAME)-$(SHARED_LIBVERSION)$(SHAREDLIBEXT) +endif +ifndef SHARED_LIBUNITS +SHARED_LIBUNITS:=$(TARGET_UNITS) $(TARGET_IMPLICITUNITS) +override SHARED_LIBUNITS:=$(filter-out $(INSTALL_BUILDUNIT),$(SHARED_LIBUNITS)) +endif +fpc_shared: +ifdef HASSHAREDLIB + $(MAKE) all CREATESHARED=1 LINKSHARED=1 CREATESMART=1 +ifneq ($(SHARED_BUILD),n) + $(PPUMOVE) -q $(SHARED_LIBUNITS) -i$(COMPILER_UNITTARGETDIR) -o$(SHARED_FULLNAME) -d$(COMPILER_UNITTARGETDIR) +endif +else + @$(ECHO) Shared Libraries not supported +endif +fpc_shared_install: +ifneq ($(SHARED_BUILD),n) +ifneq ($(SHARED_LIBUNITS),) +ifneq ($(wildcard $(COMPILER_UNITTARGETDIR)/$(SHARED_FULLNAME)),) + $(INSTALL) $(COMPILER_UNITTARGETDIR)/$(SHARED_FULLNAME) $(INSTALL_SHAREDDIR) +endif +endif +endif +.PHONY: fpc_install fpc_sourceinstall fpc_exampleinstall +ifdef INSTALL_UNITS +override INSTALLPPUFILES+=$(addsuffix $(PPUEXT),$(INSTALL_UNITS)) +endif +ifdef INSTALL_BUILDUNIT +override INSTALLPPUFILES:=$(filter-out $(INSTALL_BUILDUNIT)$(PPUEXT),$(INSTALLPPUFILES)) +endif +ifdef INSTALLPPUFILES +override INSTALLPPULINKFILES:=$(subst $(PPUEXT),$(OEXT),$(INSTALLPPUFILES)) $(addprefix $(STATICLIBPREFIX),$(subst $(PPUEXT),$(STATICLIBEXT),$(INSTALLPPUFILES))) $(addprefix $(IMPORTLIBPREFIX),$(subst $(PPUEXT),$(STATICLIBEXT),$(INSTALLPPUFILES))) +ifneq ($(UNITTARGETDIRPREFIX),) +override INSTALLPPUFILES:=$(addprefix $(UNITTARGETDIRPREFIX),$(notdir $(INSTALLPPUFILES))) +override INSTALLPPULINKFILES:=$(wildcard $(addprefix $(UNITTARGETDIRPREFIX),$(notdir $(INSTALLPPULINKFILES)))) +endif +override INSTALL_CREATEPACKAGEFPC=1 +endif +ifdef INSTALLEXEFILES +ifneq ($(TARGETDIRPREFIX),) +override INSTALLEXEFILES:=$(addprefix $(TARGETDIRPREFIX),$(notdir $(INSTALLEXEFILES))) +endif +endif +fpc_install: all $(INSTALLTARGET) +ifdef INSTALLEXEFILES + $(MKDIR) $(INSTALL_BINDIR) +ifdef UPXPROG + -$(UPXPROG) $(INSTALLEXEFILES) +endif + $(INSTALLEXE) $(INSTALLEXEFILES) $(INSTALL_BINDIR) +endif +ifdef INSTALL_CREATEPACKAGEFPC +ifdef FPCMAKE +ifdef PACKAGE_VERSION +ifneq ($(wildcard Makefile.fpc),) + $(FPCMAKE) -p -T$(CPU_TARGET)-$(OS_TARGET) Makefile.fpc + $(MKDIR) $(INSTALL_UNITDIR) + $(INSTALL) Package.fpc $(INSTALL_UNITDIR) +endif +endif +endif +endif +ifdef INSTALLPPUFILES + $(MKDIR) $(INSTALL_UNITDIR) + $(INSTALL) $(INSTALLPPUFILES) $(INSTALL_UNITDIR) +ifneq ($(INSTALLPPULINKFILES),) + $(INSTALL) $(INSTALLPPULINKFILES) $(INSTALL_UNITDIR) +endif +ifneq ($(wildcard $(LIB_FULLNAME)),) + $(MKDIR) $(INSTALL_LIBDIR) + $(INSTALL) $(LIB_FULLNAME) $(INSTALL_LIBDIR) +ifdef inUnix + ln -sf $(LIB_FULLNAME) $(INSTALL_LIBDIR)/$(LIB_NAME) +endif +endif +endif +ifdef INSTALL_FILES + $(MKDIR) $(INSTALL_DATADIR) + $(INSTALL) $(INSTALL_FILES) $(INSTALL_DATADIR) +endif +fpc_sourceinstall: distclean + $(MKDIR) $(INSTALL_SOURCEDIR) + $(COPYTREE) $(BASEDIR)/* $(INSTALL_SOURCEDIR) +fpc_exampleinstall: $(addsuffix _distclean,$(TARGET_EXAMPLEDIRS)) +ifdef HASEXAMPLES + $(MKDIR) $(INSTALL_EXAMPLEDIR) +endif +ifdef EXAMPLESOURCEFILES + $(COPY) $(EXAMPLESOURCEFILES) $(INSTALL_EXAMPLEDIR) +endif +ifdef TARGET_EXAMPLEDIRS + $(COPYTREE) $(addsuffix /*,$(TARGET_EXAMPLEDIRS)) $(INSTALL_EXAMPLEDIR) +endif +.PHONY: fpc_clean fpc_cleanall fpc_distclean +ifdef EXEFILES +override CLEANEXEFILES:=$(addprefix $(TARGETDIRPREFIX),$(CLEANEXEFILES)) +endif +ifdef CLEAN_UNITS +override CLEANPPUFILES+=$(addsuffix $(PPUEXT),$(CLEAN_UNITS)) +endif +ifdef CLEANPPUFILES +override CLEANPPULINKFILES:=$(subst $(PPUEXT),$(OEXT),$(CLEANPPUFILES)) $(addprefix $(STATICLIBPREFIX),$(subst $(PPUEXT),$(STATICLIBEXT),$(CLEANPPUFILES))) $(addprefix $(IMPORTLIBPREFIX),$(subst $(PPUEXT),$(STATICLIBEXT),$(CLEANPPUFILES))) +ifdef DEBUGSYMEXT +override CLEANPPULINKFILES+=$(subst $(PPUEXT),$(DEBUGSYMEXT),$(CLEANPPUFILES)) +endif +override CLEANPPUFILES:=$(addprefix $(UNITTARGETDIRPREFIX),$(CLEANPPUFILES)) +override CLEANPPULINKFILES:=$(wildcard $(addprefix $(UNITTARGETDIRPREFIX),$(CLEANPPULINKFILES))) +endif +fpc_clean: $(CLEANTARGET) +ifdef CLEANEXEFILES + -$(DEL) $(CLEANEXEFILES) +endif +ifdef CLEANPPUFILES + -$(DEL) $(CLEANPPUFILES) +endif +ifneq ($(CLEANPPULINKFILES),) + -$(DEL) $(CLEANPPULINKFILES) +endif +ifdef CLEANRSTFILES + -$(DEL) $(addprefix $(UNITTARGETDIRPREFIX),$(CLEANRSTFILES)) +endif +ifdef CLEAN_FILES + -$(DEL) $(CLEAN_FILES) +endif +ifdef LIB_NAME + -$(DEL) $(LIB_NAME) $(LIB_FULLNAME) +endif + -$(DEL) $(FPCMADE) Package.fpc $(PPAS) script.res link.res $(FPCEXTFILE) $(REDIRFILE) + -$(DEL) *$(ASMEXT) *_ppas$(BATCHEXT) +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) *_ppas$(BATCHEXT) +ifdef AOUTEXT + -$(DEL) *$(AOUTEXT) +endif +ifdef DEBUGSYMEXT + -$(DEL) *$(DEBUGSYMEXT) +endif +fpc_distclean: cleanall +.PHONY: fpc_baseinfo +override INFORULES+=fpc_baseinfo +fpc_baseinfo: + @$(ECHO) + @$(ECHO) == Package info == + @$(ECHO) Package Name..... $(PACKAGE_NAME) + @$(ECHO) Package Version.. $(PACKAGE_VERSION) + @$(ECHO) + @$(ECHO) == Configuration info == + @$(ECHO) + @$(ECHO) FPC.......... $(FPC) + @$(ECHO) FPC Version.. $(FPC_VERSION) + @$(ECHO) Source CPU... $(CPU_SOURCE) + @$(ECHO) Target CPU... $(CPU_TARGET) + @$(ECHO) Source OS.... $(OS_SOURCE) + @$(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) + @$(ECHO) Required pkgs... $(REQUIRE_PACKAGES) + @$(ECHO) + @$(ECHO) Basedir......... $(BASEDIR) + @$(ECHO) FPCDir.......... $(FPCDIR) + @$(ECHO) CrossBinDir..... $(CROSSBINDIR) + @$(ECHO) UnitsDir........ $(UNITSDIR) + @$(ECHO) PackagesDir..... $(PACKAGESDIR) + @$(ECHO) + @$(ECHO) GCC library..... $(GCCLIBDIR) + @$(ECHO) Other library... $(OTHERLIBDIR) + @$(ECHO) + @$(ECHO) == Tools info == + @$(ECHO) + @$(ECHO) As........ $(AS) + @$(ECHO) Ld........ $(LD) + @$(ECHO) Ar........ $(AR) + @$(ECHO) Rc........ $(RC) + @$(ECHO) + @$(ECHO) Mv........ $(MVPROG) + @$(ECHO) Cp........ $(CPPROG) + @$(ECHO) Rm........ $(RMPROG) + @$(ECHO) GInstall.. $(GINSTALL) + @$(ECHO) Echo...... $(ECHO) + @$(ECHO) Shell..... $(SHELL) + @$(ECHO) Date...... $(DATE) + @$(ECHO) FPCMake... $(FPCMAKE) + @$(ECHO) PPUMove... $(PPUMOVE) + @$(ECHO) Upx....... $(UPXPROG) + @$(ECHO) Zip....... $(ZIPPROG) + @$(ECHO) + @$(ECHO) == Object info == + @$(ECHO) + @$(ECHO) Target Loaders........ $(TARGET_LOADERS) + @$(ECHO) Target Units.......... $(TARGET_UNITS) + @$(ECHO) Target Implicit Units. $(TARGET_IMPLICITUNITS) + @$(ECHO) Target Programs....... $(TARGET_PROGRAMS) + @$(ECHO) Target Dirs........... $(TARGET_DIRS) + @$(ECHO) Target Examples....... $(TARGET_EXAMPLES) + @$(ECHO) Target ExampleDirs.... $(TARGET_EXAMPLEDIRS) + @$(ECHO) + @$(ECHO) Clean Units......... $(CLEAN_UNITS) + @$(ECHO) Clean Files......... $(CLEAN_FILES) + @$(ECHO) + @$(ECHO) Install Units....... $(INSTALL_UNITS) + @$(ECHO) Install Files....... $(INSTALL_FILES) + @$(ECHO) + @$(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) + @$(ECHO) Install binary dir... $(INSTALL_BINDIR) + @$(ECHO) Install library dir.. $(INSTALL_LIBDIR) + @$(ECHO) Install units dir.... $(INSTALL_UNITDIR) + @$(ECHO) Install source dir... $(INSTALL_SOURCEDIR) + @$(ECHO) Install doc dir...... $(INSTALL_DOCDIR) + @$(ECHO) Install example dir.. $(INSTALL_EXAMPLEDIR) + @$(ECHO) Install data dir..... $(INSTALL_DATADIR) + @$(ECHO) + @$(ECHO) Dist destination dir. $(DIST_DESTDIR) + @$(ECHO) Dist zip name........ $(DIST_ZIPNAME) + @$(ECHO) +.PHONY: fpc_info +fpc_info: $(INFORULES) +.PHONY: fpc_makefile fpc_makefiles fpc_makefile_sub1 fpc_makefile_sub2 \ + fpc_makefile_dirs +fpc_makefile: + $(FPCMAKE) -w -T$(OS_TARGET) Makefile.fpc +fpc_makefile_sub1: +ifdef TARGET_DIRS + $(FPCMAKE) -w -T$(OS_TARGET) $(addsuffix /Makefile.fpc,$(TARGET_DIRS)) +endif +ifdef TARGET_EXAMPLEDIRS + $(FPCMAKE) -w -T$(OS_TARGET) $(addsuffix /Makefile.fpc,$(TARGET_EXAMPLEDIRS)) +endif +fpc_makefile_sub2: $(addsuffix _makefile_dirs,$(TARGET_DIRS) $(TARGET_EXAMPLEDIRS)) +fpc_makefile_dirs: fpc_makefile_sub1 fpc_makefile_sub2 +fpc_makefiles: fpc_makefile fpc_makefile_dirs +all: fpc_all +debug: fpc_debug +smart: fpc_smart +release: fpc_release +units: fpc_units +examples: +shared: fpc_shared +install: fpc_install +sourceinstall: fpc_sourceinstall +exampleinstall: fpc_exampleinstall +distinstall: +zipinstall: +zipsourceinstall: +zipexampleinstall: +zipdistinstall: +clean: fpc_clean +distclean: fpc_distclean +cleanall: fpc_cleanall +info: fpc_info +makefiles: fpc_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 +.NOTPARALLEL: diff --git a/packages/gtk2/examples/helloworld2/Makefile.fpc b/packages/gtk2/examples/helloworld2/Makefile.fpc new file mode 100644 index 0000000000..631e14c8af --- /dev/null +++ b/packages/gtk2/examples/helloworld2/Makefile.fpc @@ -0,0 +1,18 @@ +# +# Makefile.fpc for Free Pascal GTK 2.x.y Examples +# + +[target] +programs=helloworld2 + +[require] +packages=gtk2 + +[install] +fpcpackage=y + +[default] +fpcdir=../../../.. + +[rules] +.NOTPARALLEL: diff --git a/packages/gtk2/examples/helloworld2/helloworld2.pas b/packages/gtk2/examples/helloworld2/helloworld2.pas new file mode 100644 index 0000000000..efff9c4d04 --- /dev/null +++ b/packages/gtk2/examples/helloworld2/helloworld2.pas @@ -0,0 +1,99 @@ +program helloworld2; + +{$mode objfpc} {$H+} + +uses + Glib2, Gdk2, Gtk2; + + +(* Our new improved callback. The data passed to this function + * is printed to stdout. *) +procedure callback (widget : PGtkWidget; + data : gpointer); cdecl; +begin + writeln ('Hello again - ', Pgchar (data), ' was pressed'); +end; + + +(* another callback *) +function delete_event (widget: PGtkWidget; + event : PGdkEvent; + data : gpointer): gboolean; cdecl; +begin + gtk_main_quit; + delete_event := FALSE; +end; + + +var + window, + button, + box1 : PGtkWidget; (* GtkWidget is the storage type for widgets *) + +begin + + (* This is called in all GTK applications. Arguments are parsed + * from the command line and are returned to the application. *) + + gtk_init (@argc, @argv); + + (* Create a new window *) + window := gtk_window_new (GTK_WINDOW_TOPLEVEL); + + (* This is a new call, which just sets the title of our + * new window to "Hello Buttons!" *) + gtk_window_set_title (GTK_WINDOW (window), 'Hello Buttons!'); + + (* Here we just set a handler for delete_event that immediately + * exits GTK. *) + g_signal_connect (G_OBJECT (window), 'delete_event', + G_CALLBACK (@delete_event), NULL); + + (* Sets the border width of the window. *) + gtk_container_set_border_width (GTK_CONTAINER (window), 10); + + (* We create a box to pack widgets into. This is described in detail + * in the "packing" section. The box is not really visible, it + * is just used as a tool to arrange widgets. *) + box1 := gtk_hbox_new (FALSE, 0); + + (* Put the box into the main window. *) + gtk_container_add (GTK_CONTAINER (window), box1); + + (* Creates a new button with the label "Button 1". *) + button := gtk_button_new_with_label ('Button 1'); + + (* Now when the button is clicked, we call the "callback" function + * with a pointer to "button 1" as its argument *) + g_signal_connect (G_OBJECT (button), 'clicked', + G_CALLBACK (@callback), PChar('button 1')); + + (* Instead of gtk_container_add, we pack this button into the invisible + * box, which has been packed into the window. *) + gtk_box_pack_start (GTK_BOX(box1), button, TRUE, TRUE, 0); + + (* Always remember this step, this tells GTK that our preparation for + * this button is complete, and it can now be displayed. *) + gtk_widget_show (button); + + (* Do these same steps again to create a second button *) + button := gtk_button_new_with_label ('Button 2'); + + (* Call the same callback function with a different argument, + * passing a pointer to "button 2" instead. *) + g_signal_connect (G_OBJECT (button), 'clicked', + G_CALLBACK (@callback), PChar('button 2')); + + gtk_box_pack_start(GTK_BOX (box1), button, TRUE, TRUE, 0); + + (* The order in which we show the buttons is not really important, but I + * recommend showing the window last, so it all pops up at once. *) + gtk_widget_show (button); + + gtk_widget_show (box1); + + gtk_widget_show (window); + + (* Rest in gtk_main and wait for the fun to begin! *) + gtk_main (); +end. diff --git a/packages/gtk2/examples/plugins/Makefile b/packages/gtk2/examples/plugins/Makefile new file mode 100644 index 0000000000..ea2b4cadd8 --- /dev/null +++ b/packages/gtk2/examples/plugins/Makefile @@ -0,0 +1,2015 @@ +# +# Don't edit, this file is generated by FPCMake Version 2.0.0 [2008/01/26] +# +default: all +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-darwin i386-emx i386-watcom i386-netwlibc i386-wince i386-embedded i386-symbian m68k-linux m68k-freebsd m68k-netbsd m68k-amiga m68k-atari m68k-openbsd m68k-palmos m68k-embedded powerpc-linux powerpc-netbsd powerpc-amiga powerpc-macos powerpc-darwin powerpc-morphos powerpc-embedded sparc-linux sparc-netbsd sparc-solaris sparc-embedded x86_64-linux x86_64-freebsd x86_64-darwin x86_64-win64 x86_64-embedded arm-linux arm-palmos arm-wince arm-gba arm-nds arm-embedded arm-symbian powerpc64-linux powerpc64-darwin powerpc64-embedded +BSDs = freebsd netbsd openbsd darwin +UNIXs = linux $(BSDs) solaris qnx +LIMIT83fs = go32v2 os2 emx watcom +OSNeedsComspecToRunBatch = go32v2 watcom +FORCE: +.PHONY: FORCE +override PATH:=$(patsubst %/,%,$(subst \,/,$(PATH))) +ifneq ($(findstring darwin,$(OSTYPE)),) +inUnix=1 #darwin +SEARCHPATH:=$(filter-out .,$(subst :, ,$(PATH))) +else +ifeq ($(findstring ;,$(PATH)),) +inUnix=1 +SEARCHPATH:=$(filter-out .,$(subst :, ,$(PATH))) +else +SEARCHPATH:=$(subst ;, ,$(PATH)) +endif +endif +SEARCHPATH+=$(patsubst %/,%,$(subst \,/,$(dir $(MAKE)))) +PWD:=$(strip $(wildcard $(addsuffix /pwd.exe,$(SEARCHPATH)))) +ifeq ($(PWD),) +PWD:=$(strip $(wildcard $(addsuffix /pwd,$(SEARCHPATH)))) +ifeq ($(PWD),) +$(error You need the GNU utils package to use this Makefile) +else +PWD:=$(firstword $(PWD)) +SRCEXEEXT= +endif +else +PWD:=$(firstword $(PWD)) +SRCEXEEXT=.exe +endif +ifndef inUnix +ifeq ($(OS),Windows_NT) +inWinNT=1 +else +ifdef OS2_SHELL +inOS2=1 +endif +endif +else +ifneq ($(findstring cygdrive,$(PATH)),) +inCygWin=1 +endif +endif +ifdef inUnix +SRCBATCHEXT=.sh +else +ifdef inOS2 +SRCBATCHEXT=.cmd +else +SRCBATCHEXT=.bat +endif +endif +ifdef COMSPEC +ifneq ($(findstring $(OS_SOURCE),$(OSNeedsComspecToRunBatch)),) +RUNBATCH=$(COMSPEC) /C +endif +endif +ifdef inUnix +PATHSEP=/ +else +PATHSEP:=$(subst /,\,/) +ifdef inCygWin +PATHSEP=/ +endif +endif +ifdef PWD +BASEDIR:=$(subst \,/,$(shell $(PWD))) +ifdef inCygWin +ifneq ($(findstring /cygdrive/,$(BASEDIR)),) +BASENODIR:=$(patsubst /cygdrive%,%,$(BASEDIR)) +BASEDRIVE:=$(firstword $(subst /, ,$(BASENODIR))) +BASEDIR:=$(subst /cygdrive/$(BASEDRIVE)/,$(BASEDRIVE):/,$(BASEDIR)) +endif +endif +else +BASEDIR=. +endif +ifdef inOS2 +ifndef ECHO +ECHO:=$(strip $(wildcard $(addsuffix /gecho$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(ECHO),) +ECHO:=$(strip $(wildcard $(addsuffix /echo$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(ECHO),) +ECHO=echo +else +ECHO:=$(firstword $(ECHO)) +endif +else +ECHO:=$(firstword $(ECHO)) +endif +endif +export ECHO +endif +override DEFAULT_FPCDIR=../../../.. +ifndef FPC +ifdef PP +FPC=$(PP) +endif +endif +ifndef FPC +FPCPROG:=$(strip $(wildcard $(addsuffix /fpc$(SRCEXEEXT),$(SEARCHPATH)))) +ifneq ($(FPCPROG),) +FPCPROG:=$(firstword $(FPCPROG)) +ifneq ($(CPU_TARGET),) +FPC:=$(shell $(FPCPROG) -P$(CPU_TARGET) -PB) +else +FPC:=$(shell $(FPCPROG) -PB) +endif +ifneq ($(findstring Error,$(FPC)),) +override FPC=$(firstword $(strip $(wildcard $(addsuffix /ppc386$(SRCEXEEXT),$(SEARCHPATH))))) +endif +else +override FPC=$(firstword $(strip $(wildcard $(addsuffix /ppc386$(SRCEXEEXT),$(SEARCHPATH))))) +endif +endif +override FPC:=$(subst $(SRCEXEEXT),,$(FPC)) +override FPC:=$(subst \,/,$(FPC))$(SRCEXEEXT) +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 +unexport CHECKDEPEND ALLDEPENDENCIES +ifndef CPU_TARGET +ifdef CPU_TARGET_DEFAULT +CPU_TARGET=$(CPU_TARGET_DEFAULT) +endif +endif +ifndef OS_TARGET +ifdef OS_TARGET_DEFAULT +OS_TARGET=$(OS_TARGET_DEFAULT) +endif +endif +ifneq ($(words $(FPC_COMPILERINFO)),5) +FPC_COMPILERINFO+=$(shell $(FPC) -iSP) +FPC_COMPILERINFO+=$(shell $(FPC) -iTP) +FPC_COMPILERINFO+=$(shell $(FPC) -iSO) +FPC_COMPILERINFO+=$(shell $(FPC) -iTO) +endif +ifndef CPU_SOURCE +CPU_SOURCE:=$(word 2,$(FPC_COMPILERINFO)) +endif +ifndef CPU_TARGET +CPU_TARGET:=$(word 3,$(FPC_COMPILERINFO)) +endif +ifndef OS_SOURCE +OS_SOURCE:=$(word 4,$(FPC_COMPILERINFO)) +endif +ifndef OS_TARGET +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 $(FULL_TARGET),$(MAKEFILETARGETS)),) +$(error The Makefile doesn't support target $(FULL_TARGET), please run fpcmake first) +endif +endif +ifneq ($(findstring $(OS_TARGET),$(BSDs)),) +BSDhier=1 +endif +ifeq ($(OS_TARGET),linux) +linuxHier=1 +endif +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)),) +override FPCDIR=wrong +endif +else +override FPCDIR=wrong +endif +ifdef DEFAULT_FPCDIR +ifeq ($(FPCDIR),wrong) +override FPCDIR:=$(subst \,/,$(DEFAULT_FPCDIR)) +ifeq ($(wildcard $(addprefix $(FPCDIR)/,rtl units)),) +override FPCDIR=wrong +endif +endif +endif +ifeq ($(FPCDIR),wrong) +ifdef inUnix +override FPCDIR=/usr/local/lib/fpc/$(FPC_VERSION) +ifeq ($(wildcard $(FPCDIR)/units),) +override FPCDIR=/usr/lib/fpc/$(FPC_VERSION) +endif +else +override FPCDIR:=$(subst /$(FPC),,$(firstword $(strip $(wildcard $(addsuffix /$(FPC),$(SEARCHPATH)))))) +override FPCDIR:=$(FPCDIR)/.. +ifeq ($(wildcard $(addprefix $(FPCDIR)/,rtl units)),) +override FPCDIR:=$(FPCDIR)/.. +ifeq ($(wildcard $(addprefix $(FPCDIR)/,rtl units)),) +override FPCDIR:=$(BASEDIR) +ifeq ($(wildcard $(addprefix $(FPCDIR)/,rtl units)),) +override FPCDIR=c:/pp +endif +endif +endif +endif +endif +ifndef CROSSBINDIR +CROSSBINDIR:=$(wildcard $(FPCDIR)/bin/$(TARGETSUFFIX)) +endif +ifndef BINUTILSPREFIX +ifndef CROSSBINDIR +ifdef CROSSCOMPILE +BINUTILSPREFIX=$(CPU_TARGET)-$(OS_TARGET)- +endif +endif +endif +UNITSDIR:=$(wildcard $(FPCDIR)/units/$(TARGETSUFFIX)) +ifeq ($(UNITSDIR),) +UNITSDIR:=$(wildcard $(FPCDIR)/units/$(OS_TARGET)) +endif +PACKAGESDIR:=$(wildcard $(FPCDIR) $(FPCDIR)/packages $(FPCDIR)/packages/base $(FPCDIR)/packages/extra) +ifeq ($(FULL_TARGET),i386-linux) +override TARGET_PROGRAMS+=plugin main +endif +ifeq ($(FULL_TARGET),i386-go32v2) +override TARGET_PROGRAMS+=plugin main +endif +ifeq ($(FULL_TARGET),i386-win32) +override TARGET_PROGRAMS+=plugin main +endif +ifeq ($(FULL_TARGET),i386-os2) +override TARGET_PROGRAMS+=plugin main +endif +ifeq ($(FULL_TARGET),i386-freebsd) +override TARGET_PROGRAMS+=plugin main +endif +ifeq ($(FULL_TARGET),i386-beos) +override TARGET_PROGRAMS+=plugin main +endif +ifeq ($(FULL_TARGET),i386-netbsd) +override TARGET_PROGRAMS+=plugin main +endif +ifeq ($(FULL_TARGET),i386-solaris) +override TARGET_PROGRAMS+=plugin main +endif +ifeq ($(FULL_TARGET),i386-qnx) +override TARGET_PROGRAMS+=plugin main +endif +ifeq ($(FULL_TARGET),i386-netware) +override TARGET_PROGRAMS+=plugin main +endif +ifeq ($(FULL_TARGET),i386-openbsd) +override TARGET_PROGRAMS+=plugin main +endif +ifeq ($(FULL_TARGET),i386-wdosx) +override TARGET_PROGRAMS+=plugin main +endif +ifeq ($(FULL_TARGET),i386-darwin) +override TARGET_PROGRAMS+=plugin main +endif +ifeq ($(FULL_TARGET),i386-emx) +override TARGET_PROGRAMS+=plugin main +endif +ifeq ($(FULL_TARGET),i386-watcom) +override TARGET_PROGRAMS+=plugin main +endif +ifeq ($(FULL_TARGET),i386-netwlibc) +override TARGET_PROGRAMS+=plugin main +endif +ifeq ($(FULL_TARGET),i386-wince) +override TARGET_PROGRAMS+=plugin main +endif +ifeq ($(FULL_TARGET),i386-embedded) +override TARGET_PROGRAMS+=plugin main +endif +ifeq ($(FULL_TARGET),i386-symbian) +override TARGET_PROGRAMS+=plugin main +endif +ifeq ($(FULL_TARGET),m68k-linux) +override TARGET_PROGRAMS+=plugin main +endif +ifeq ($(FULL_TARGET),m68k-freebsd) +override TARGET_PROGRAMS+=plugin main +endif +ifeq ($(FULL_TARGET),m68k-netbsd) +override TARGET_PROGRAMS+=plugin main +endif +ifeq ($(FULL_TARGET),m68k-amiga) +override TARGET_PROGRAMS+=plugin main +endif +ifeq ($(FULL_TARGET),m68k-atari) +override TARGET_PROGRAMS+=plugin main +endif +ifeq ($(FULL_TARGET),m68k-openbsd) +override TARGET_PROGRAMS+=plugin main +endif +ifeq ($(FULL_TARGET),m68k-palmos) +override TARGET_PROGRAMS+=plugin main +endif +ifeq ($(FULL_TARGET),m68k-embedded) +override TARGET_PROGRAMS+=plugin main +endif +ifeq ($(FULL_TARGET),powerpc-linux) +override TARGET_PROGRAMS+=plugin main +endif +ifeq ($(FULL_TARGET),powerpc-netbsd) +override TARGET_PROGRAMS+=plugin main +endif +ifeq ($(FULL_TARGET),powerpc-amiga) +override TARGET_PROGRAMS+=plugin main +endif +ifeq ($(FULL_TARGET),powerpc-macos) +override TARGET_PROGRAMS+=plugin main +endif +ifeq ($(FULL_TARGET),powerpc-darwin) +override TARGET_PROGRAMS+=plugin main +endif +ifeq ($(FULL_TARGET),powerpc-morphos) +override TARGET_PROGRAMS+=plugin main +endif +ifeq ($(FULL_TARGET),powerpc-embedded) +override TARGET_PROGRAMS+=plugin main +endif +ifeq ($(FULL_TARGET),sparc-linux) +override TARGET_PROGRAMS+=plugin main +endif +ifeq ($(FULL_TARGET),sparc-netbsd) +override TARGET_PROGRAMS+=plugin main +endif +ifeq ($(FULL_TARGET),sparc-solaris) +override TARGET_PROGRAMS+=plugin main +endif +ifeq ($(FULL_TARGET),sparc-embedded) +override TARGET_PROGRAMS+=plugin main +endif +ifeq ($(FULL_TARGET),x86_64-linux) +override TARGET_PROGRAMS+=plugin main +endif +ifeq ($(FULL_TARGET),x86_64-freebsd) +override TARGET_PROGRAMS+=plugin main +endif +ifeq ($(FULL_TARGET),x86_64-darwin) +override TARGET_PROGRAMS+=plugin main +endif +ifeq ($(FULL_TARGET),x86_64-win64) +override TARGET_PROGRAMS+=plugin main +endif +ifeq ($(FULL_TARGET),x86_64-embedded) +override TARGET_PROGRAMS+=plugin main +endif +ifeq ($(FULL_TARGET),arm-linux) +override TARGET_PROGRAMS+=plugin main +endif +ifeq ($(FULL_TARGET),arm-palmos) +override TARGET_PROGRAMS+=plugin main +endif +ifeq ($(FULL_TARGET),arm-wince) +override TARGET_PROGRAMS+=plugin main +endif +ifeq ($(FULL_TARGET),arm-gba) +override TARGET_PROGRAMS+=plugin main +endif +ifeq ($(FULL_TARGET),arm-nds) +override TARGET_PROGRAMS+=plugin main +endif +ifeq ($(FULL_TARGET),arm-embedded) +override TARGET_PROGRAMS+=plugin main +endif +ifeq ($(FULL_TARGET),arm-symbian) +override TARGET_PROGRAMS+=plugin main +endif +ifeq ($(FULL_TARGET),powerpc64-linux) +override TARGET_PROGRAMS+=plugin main +endif +ifeq ($(FULL_TARGET),powerpc64-darwin) +override TARGET_PROGRAMS+=plugin main +endif +ifeq ($(FULL_TARGET),powerpc64-embedded) +override TARGET_PROGRAMS+=plugin main +endif +override INSTALL_FPCPACKAGE=y +ifdef REQUIRE_UNITSDIR +override UNITSDIR+=$(REQUIRE_UNITSDIR) +endif +ifdef REQUIRE_PACKAGESDIR +override PACKAGESDIR+=$(REQUIRE_PACKAGESDIR) +endif +ifdef ZIPINSTALL +ifneq ($(findstring $(OS_TARGET),$(UNIXs)),) +UNIXHier=1 +endif +else +ifneq ($(findstring $(OS_SOURCE),$(UNIXs)),) +UNIXHier=1 +endif +endif +ifndef INSTALL_PREFIX +ifdef PREFIX +INSTALL_PREFIX=$(PREFIX) +endif +endif +ifndef INSTALL_PREFIX +ifdef UNIXHier +INSTALL_PREFIX=/usr/local +else +ifdef INSTALL_FPCPACKAGE +INSTALL_BASEDIR:=/pp +else +INSTALL_BASEDIR:=/$(PACKAGE_NAME) +endif +endif +endif +export INSTALL_PREFIX +ifdef INSTALL_FPCSUBDIR +export INSTALL_FPCSUBDIR +endif +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 +INSTALL_BASEDIR:=$(INSTALL_PREFIX)/lib/fpc/$(FPC_VERSION) +else +INSTALL_BASEDIR:=$(INSTALL_PREFIX)/lib/$(PACKAGE_NAME) +endif +else +INSTALL_BASEDIR:=$(INSTALL_PREFIX) +endif +endif +ifndef INSTALL_BINDIR +ifdef UNIXHier +INSTALL_BINDIR:=$(INSTALL_PREFIX)/bin +else +INSTALL_BINDIR:=$(INSTALL_BASEDIR)/bin +ifdef INSTALL_FPCPACKAGE +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 +INSTALL_UNITDIR:=$(INSTALL_BASEDIR)/units/$(TARGETSUFFIX) +ifdef INSTALL_FPCPACKAGE +ifdef PACKAGE_NAME +INSTALL_UNITDIR:=$(INSTALL_UNITDIR)/$(PACKAGE_NAME) +endif +endif +endif +ifndef INSTALL_LIBDIR +ifdef UNIXHier +INSTALL_LIBDIR:=$(INSTALL_PREFIX)/lib +else +INSTALL_LIBDIR:=$(INSTALL_UNITDIR) +endif +endif +ifndef INSTALL_SOURCEDIR +ifdef UNIXHier +ifdef BSDhier +SRCPREFIXDIR=share/src +else +ifdef linuxHier +SRCPREFIXDIR=share/src +else +SRCPREFIXDIR=src +endif +endif +ifdef INSTALL_FPCPACKAGE +ifdef INSTALL_FPCSUBDIR +INSTALL_SOURCEDIR:=$(INSTALL_PREFIX)/$(SRCPREFIXDIR)/fpc-$(FPC_VERSION)/$(INSTALL_FPCSUBDIR)/$(PACKAGE_NAME) +else +INSTALL_SOURCEDIR:=$(INSTALL_PREFIX)/$(SRCPREFIXDIR)/fpc-$(FPC_VERSION)/$(PACKAGE_NAME) +endif +else +INSTALL_SOURCEDIR:=$(INSTALL_PREFIX)/$(SRCPREFIXDIR)/$(PACKAGE_NAME)-$(PACKAGE_VERSION) +endif +else +ifdef INSTALL_FPCPACKAGE +ifdef INSTALL_FPCSUBDIR +INSTALL_SOURCEDIR:=$(INSTALL_BASEDIR)/source/$(INSTALL_FPCSUBDIR)/$(PACKAGE_NAME) +else +INSTALL_SOURCEDIR:=$(INSTALL_BASEDIR)/source/$(PACKAGE_NAME) +endif +else +INSTALL_SOURCEDIR:=$(INSTALL_BASEDIR)/source +endif +endif +endif +ifndef INSTALL_DOCDIR +ifdef UNIXHier +ifdef BSDhier +DOCPREFIXDIR=share/doc +else +ifdef linuxHier +DOCPREFIXDIR=share/doc +else +DOCPREFIXDIR=doc +endif +endif +ifdef INSTALL_FPCPACKAGE +INSTALL_DOCDIR:=$(INSTALL_PREFIX)/$(DOCPREFIXDIR)/fpc-$(FPC_VERSION)/$(PACKAGE_NAME) +else +INSTALL_DOCDIR:=$(INSTALL_PREFIX)/$(DOCPREFIXDIR)/$(PACKAGE_NAME)-$(PACKAGE_VERSION) +endif +else +ifdef INSTALL_FPCPACKAGE +INSTALL_DOCDIR:=$(INSTALL_BASEDIR)/doc/$(PACKAGE_NAME) +else +INSTALL_DOCDIR:=$(INSTALL_BASEDIR)/doc +endif +endif +endif +ifndef INSTALL_EXAMPLEDIR +ifdef UNIXHier +ifdef INSTALL_FPCPACKAGE +ifdef BSDhier +INSTALL_EXAMPLEDIR:=$(INSTALL_PREFIX)/share/examples/fpc-$(FPC_VERSION)/$(PACKAGE_NAME) +else +ifdef linuxHier +INSTALL_EXAMPLEDIR:=$(INSTALL_DOCDIR)/examples +else +INSTALL_EXAMPLEDIR:=$(INSTALL_PREFIX)/doc/fpc-$(FPC_VERSION)/examples/$(PACKAGE_NAME) +endif +endif +else +ifdef BSDhier +INSTALL_EXAMPLEDIR:=$(INSTALL_PREFIX)/share/examples/$(PACKAGE_NAME)-$(PACKAGE_VERSION) +else +ifdef linuxHier +INSTALL_EXAMPLEDIR:=$(INSTALL_DOCDIR)/examples/$(PACKAGE_NAME)-$(PACKAGE_VERSION) +else +INSTALL_EXAMPLEDIR:=$(INSTALL_PREFIX)/doc/$(PACKAGE_NAME)-$(PACKAGE_VERSION) +endif +endif +endif +else +ifdef INSTALL_FPCPACKAGE +INSTALL_EXAMPLEDIR:=$(INSTALL_BASEDIR)/examples/$(PACKAGE_NAME) +else +INSTALL_EXAMPLEDIR:=$(INSTALL_BASEDIR)/examples +endif +endif +endif +ifndef INSTALL_DATADIR +INSTALL_DATADIR=$(INSTALL_BASEDIR) +endif +ifndef INSTALL_SHAREDDIR +INSTALL_SHAREDDIR=$(INSTALL_PREFIX)/lib +endif +ifdef CROSSCOMPILE +ifndef CROSSBINDIR +CROSSBINDIR:=$(wildcard $(CROSSTARGETDIR)/bin/$(SOURCESUFFIX)) +ifeq ($(CROSSBINDIR),) +CROSSBINDIR:=$(wildcard $(INSTALL_BASEDIR)/cross/$(TARGETSUFFIX)/bin/$(FULL_SOURCE)) +endif +endif +else +CROSSBINDIR= +endif +ifeq ($(OS_SOURCE),linux) +ifndef GCCLIBDIR +ifeq ($(CPU_TARGET),i386) +ifneq ($(findstring x86_64,$(shell uname -a)),) +ifeq ($(BINUTILSPREFIX),) +GCCLIBDIR:=$(shell dirname `gcc -m32 -print-libgcc-file-name`) +endif +endif +endif +ifeq ($(CPU_TARGET),powerpc64) +ifeq ($(BINUTILSPREFIX),) +GCCLIBDIR:=$(shell dirname `gcc -m64 -print-libgcc-file-name`) +endif +endif +endif +ifndef GCCLIBDIR +CROSSGCC=$(strip $(wildcard $(addsuffix /$(BINUTILSPREFIX)gcc$(SRCEXEEXT),$(SEARCHPATH)))) +ifneq ($(CROSSGCC),) +GCCLIBDIR:=$(shell dirname `$(CROSSGCC) -print-libgcc-file-name`) +endif +endif +ifndef OTHERLIBDIR +OTHERLIBDIR:=$(shell grep -v "^\#" /etc/ld.so.conf | awk '{ ORS=" "; print $1 }') +endif +endif +ifdef inUnix +ifeq ($(OS_SOURCE),netbsd) +OTHERLIBDIR+=/usr/pkg/lib +endif +export GCCLIBDIR OTHERLIB +endif +BATCHEXT=.bat +LOADEREXT=.as +EXEEXT=.exe +PPLEXT=.ppl +PPUEXT=.ppu +OEXT=.o +ASMEXT=.s +SMARTEXT=.sl +STATICLIBEXT=.a +SHAREDLIBEXT=.so +SHAREDLIBPREFIX=libfp +STATICLIBPREFIX=libp +IMPORTLIBPREFIX=libimp +RSTEXT=.rst +ifeq ($(findstring 1.0.,$(FPC_VERSION)),) +ifeq ($(OS_TARGET),go32v1) +STATICLIBPREFIX= +SHORTSUFFIX=v1 +endif +ifeq ($(OS_TARGET),go32v2) +STATICLIBPREFIX= +SHORTSUFFIX=dos +endif +ifeq ($(OS_TARGET),watcom) +STATICLIBPREFIX= +OEXT=.obj +ASMEXT=.asm +SHAREDLIBEXT=.dll +SHORTSUFFIX=wat +endif +ifeq ($(OS_TARGET),linux) +BATCHEXT=.sh +EXEEXT= +HASSHAREDLIB=1 +SHORTSUFFIX=lnx +endif +ifeq ($(OS_TARGET),freebsd) +BATCHEXT=.sh +EXEEXT= +HASSHAREDLIB=1 +SHORTSUFFIX=fbs +endif +ifeq ($(OS_TARGET),netbsd) +BATCHEXT=.sh +EXEEXT= +HASSHAREDLIB=1 +SHORTSUFFIX=nbs +endif +ifeq ($(OS_TARGET),openbsd) +BATCHEXT=.sh +EXEEXT= +HASSHAREDLIB=1 +SHORTSUFFIX=obs +endif +ifeq ($(OS_TARGET),win32) +SHAREDLIBEXT=.dll +SHORTSUFFIX=w32 +endif +ifeq ($(OS_TARGET),os2) +BATCHEXT=.cmd +AOUTEXT=.out +STATICLIBPREFIX= +SHAREDLIBEXT=.dll +SHORTSUFFIX=os2 +ECHO=echo +endif +ifeq ($(OS_TARGET),emx) +BATCHEXT=.cmd +AOUTEXT=.out +STATICLIBPREFIX= +SHAREDLIBEXT=.dll +SHORTSUFFIX=emx +ECHO=echo +endif +ifeq ($(OS_TARGET),amiga) +EXEEXT= +SHAREDLIBEXT=.library +SHORTSUFFIX=amg +endif +ifeq ($(OS_TARGET),morphos) +EXEEXT= +SHAREDLIBEXT=.library +SHORTSUFFIX=mos +endif +ifeq ($(OS_TARGET),atari) +EXEEXT=.ttp +SHORTSUFFIX=ata +endif +ifeq ($(OS_TARGET),beos) +BATCHEXT=.sh +EXEEXT= +SHORTSUFFIX=be +endif +ifeq ($(OS_TARGET),solaris) +BATCHEXT=.sh +EXEEXT= +SHORTSUFFIX=sun +endif +ifeq ($(OS_TARGET),qnx) +BATCHEXT=.sh +EXEEXT= +SHORTSUFFIX=qnx +endif +ifeq ($(OS_TARGET),netware) +EXEEXT=.nlm +STATICLIBPREFIX= +SHORTSUFFIX=nw +endif +ifeq ($(OS_TARGET),netwlibc) +EXEEXT=.nlm +STATICLIBPREFIX= +SHORTSUFFIX=nwl +endif +ifeq ($(OS_TARGET),macos) +BATCHEXT= +EXEEXT= +DEBUGSYMEXT=.xcoff +SHORTSUFFIX=mac +endif +ifeq ($(OS_TARGET),darwin) +BATCHEXT=.sh +EXEEXT= +HASSHAREDLIB=1 +SHORTSUFFIX=dwn +endif +ifeq ($(OS_TARGET),gba) +EXEEXT=.gba +SHAREDLIBEXT=.so +SHORTSUFFIX=gba +endif +ifeq ($(OS_TARGET),symbian) +SHAREDLIBEXT=.dll +SHORTSUFFIX=symbian +endif +else +ifeq ($(OS_TARGET),go32v1) +PPUEXT=.pp1 +OEXT=.o1 +ASMEXT=.s1 +SMARTEXT=.sl1 +STATICLIBEXT=.a1 +SHAREDLIBEXT=.so1 +STATICLIBPREFIX= +SHORTSUFFIX=v1 +endif +ifeq ($(OS_TARGET),go32v2) +STATICLIBPREFIX= +SHORTSUFFIX=dos +endif +ifeq ($(OS_TARGET),watcom) +STATICLIBPREFIX= +SHORTSUFFIX=wat +endif +ifeq ($(OS_TARGET),linux) +BATCHEXT=.sh +EXEEXT= +HASSHAREDLIB=1 +SHORTSUFFIX=lnx +endif +ifeq ($(OS_TARGET),freebsd) +BATCHEXT=.sh +EXEEXT= +HASSHAREDLIB=1 +SHORTSUFFIX=fbs +endif +ifeq ($(OS_TARGET),netbsd) +BATCHEXT=.sh +EXEEXT= +HASSHAREDLIB=1 +SHORTSUFFIX=nbs +endif +ifeq ($(OS_TARGET),openbsd) +BATCHEXT=.sh +EXEEXT= +HASSHAREDLIB=1 +SHORTSUFFIX=obs +endif +ifeq ($(OS_TARGET),win32) +PPUEXT=.ppw +OEXT=.ow +ASMEXT=.sw +SMARTEXT=.slw +STATICLIBEXT=.aw +SHAREDLIBEXT=.dll +SHORTSUFFIX=w32 +endif +ifeq ($(OS_TARGET),os2) +BATCHEXT=.cmd +PPUEXT=.ppo +ASMEXT=.so2 +OEXT=.oo2 +AOUTEXT=.out +SMARTEXT=.sl2 +STATICLIBPREFIX= +STATICLIBEXT=.ao2 +SHAREDLIBEXT=.dll +SHORTSUFFIX=os2 +ECHO=echo +endif +ifeq ($(OS_TARGET),amiga) +EXEEXT= +PPUEXT=.ppu +ASMEXT=.s +OEXT=.o +SMARTEXT=.sl +STATICLIBEXT=.a +SHAREDLIBEXT=.library +SHORTSUFFIX=amg +endif +ifeq ($(OS_TARGET),atari) +PPUEXT=.ppu +ASMEXT=.s +OEXT=.o +SMARTEXT=.sl +STATICLIBEXT=.a +EXEEXT=.ttp +SHORTSUFFIX=ata +endif +ifeq ($(OS_TARGET),beos) +BATCHEXT=.sh +PPUEXT=.ppu +ASMEXT=.s +OEXT=.o +SMARTEXT=.sl +STATICLIBEXT=.a +EXEEXT= +SHORTSUFFIX=be +endif +ifeq ($(OS_TARGET),solaris) +BATCHEXT=.sh +PPUEXT=.ppu +ASMEXT=.s +OEXT=.o +SMARTEXT=.sl +STATICLIBEXT=.a +EXEEXT= +SHORTSUFFIX=sun +endif +ifeq ($(OS_TARGET),qnx) +BATCHEXT=.sh +PPUEXT=.ppu +ASMEXT=.s +OEXT=.o +SMARTEXT=.sl +STATICLIBEXT=.a +EXEEXT= +SHORTSUFFIX=qnx +endif +ifeq ($(OS_TARGET),netware) +STATICLIBPREFIX= +PPUEXT=.ppu +OEXT=.o +ASMEXT=.s +SMARTEXT=.sl +STATICLIBEXT=.a +SHAREDLIBEXT=.nlm +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= +PPUEXT=.ppu +ASMEXT=.s +OEXT=.o +SMARTEXT=.sl +STATICLIBEXT=.a +EXEEXT= +DEBUGSYMEXT=.xcoff +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 +ECHO:=$(strip $(wildcard $(addsuffix /gecho$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(ECHO),) +ECHO:=$(strip $(wildcard $(addsuffix /echo$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(ECHO),) +ECHO= __missing_command_ECHO +else +ECHO:=$(firstword $(ECHO)) +endif +else +ECHO:=$(firstword $(ECHO)) +endif +endif +export ECHO +ifndef DATE +DATE:=$(strip $(wildcard $(addsuffix /gdate$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(DATE),) +DATE:=$(strip $(wildcard $(addsuffix /date$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(DATE),) +DATE= __missing_command_DATE +else +DATE:=$(firstword $(DATE)) +endif +else +DATE:=$(firstword $(DATE)) +endif +endif +export DATE +ifndef GINSTALL +GINSTALL:=$(strip $(wildcard $(addsuffix /ginstall$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(GINSTALL),) +GINSTALL:=$(strip $(wildcard $(addsuffix /install$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(GINSTALL),) +GINSTALL= __missing_command_GINSTALL +else +GINSTALL:=$(firstword $(GINSTALL)) +endif +else +GINSTALL:=$(firstword $(GINSTALL)) +endif +endif +export GINSTALL +ifndef CPPROG +CPPROG:=$(strip $(wildcard $(addsuffix /cp$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(CPPROG),) +CPPROG= __missing_command_CPPROG +else +CPPROG:=$(firstword $(CPPROG)) +endif +endif +export CPPROG +ifndef RMPROG +RMPROG:=$(strip $(wildcard $(addsuffix /rm$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(RMPROG),) +RMPROG= __missing_command_RMPROG +else +RMPROG:=$(firstword $(RMPROG)) +endif +endif +export RMPROG +ifndef MVPROG +MVPROG:=$(strip $(wildcard $(addsuffix /mv$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(MVPROG),) +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 +else +ECHOREDIR=$(ECHO) +endif +endif +ifndef COPY +COPY:=$(CPPROG) -fp +endif +ifndef COPYTREE +COPYTREE:=$(CPPROG) -Rfp +endif +ifndef MKDIRTREE +MKDIRTREE:=$(MKDIRPROG) -p +endif +ifndef MOVE +MOVE:=$(MVPROG) -f +endif +ifndef DEL +DEL:=$(RMPROG) -f +endif +ifndef DELTREE +DELTREE:=$(RMPROG) -rf +endif +ifndef INSTALL +ifdef inUnix +INSTALL:=$(GINSTALL) -c -m 644 +else +INSTALL:=$(COPY) +endif +endif +ifndef INSTALLEXE +ifdef inUnix +INSTALLEXE:=$(GINSTALL) -c -m 755 +else +INSTALLEXE:=$(COPY) +endif +endif +ifndef MKDIR +MKDIR:=$(GINSTALL) -m 755 -d +endif +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 +else +PPUMOVE:=$(firstword $(PPUMOVE)) +endif +endif +export PPUMOVE +ifndef FPCMAKE +FPCMAKE:=$(strip $(wildcard $(addsuffix /fpcmake$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(FPCMAKE),) +FPCMAKE= __missing_command_FPCMAKE +else +FPCMAKE:=$(firstword $(FPCMAKE)) +endif +endif +export FPCMAKE +ifndef ZIPPROG +ZIPPROG:=$(strip $(wildcard $(addsuffix /zip$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(ZIPPROG),) +ZIPPROG= __missing_command_ZIPPROG +else +ZIPPROG:=$(firstword $(ZIPPROG)) +endif +endif +export ZIPPROG +ifndef TARPROG +TARPROG:=$(strip $(wildcard $(addsuffix /gtar$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(TARPROG),) +TARPROG:=$(strip $(wildcard $(addsuffix /tar$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(TARPROG),) +TARPROG= __missing_command_TARPROG +else +TARPROG:=$(firstword $(TARPROG)) +endif +else +TARPROG:=$(firstword $(TARPROG)) +endif +endif +export TARPROG +ASNAME=$(BINUTILSPREFIX)as +LDNAME=$(BINUTILSPREFIX)ld +ARNAME=$(BINUTILSPREFIX)ar +RCNAME=$(BINUTILSPREFIX)rc +ifneq ($(findstring 1.0.,$(FPC_VERSION)),) +ifeq ($(OS_TARGET),win32) +ifeq ($(CROSSBINDIR),) +ASNAME=asw +LDNAME=ldw +ARNAME=arw +endif +endif +endif +ifndef ASPROG +ifdef CROSSBINDIR +ASPROG=$(CROSSBINDIR)/$(ASNAME)$(SRCEXEEXT) +else +ASPROG=$(ASNAME) +endif +endif +ifndef LDPROG +ifdef CROSSBINDIR +LDPROG=$(CROSSBINDIR)/$(LDNAME)$(SRCEXEEXT) +else +LDPROG=$(LDNAME) +endif +endif +ifndef RCPROG +ifdef CROSSBINDIR +RCPROG=$(CROSSBINDIR)/$(RCNAME)$(SRCEXEEXT) +else +RCPROG=$(RCNAME) +endif +endif +ifndef ARPROG +ifdef CROSSBINDIR +ARPROG=$(CROSSBINDIR)/$(ARNAME)$(SRCEXEEXT) +else +ARPROG=$(ARNAME) +endif +endif +AS=$(ASPROG) +LD=$(LDPROG) +RC=$(RCPROG) +AR=$(ARPROG) +PPAS=ppas$(SRCBATCHEXT) +ifdef inUnix +LDCONFIG=ldconfig +else +LDCONFIG= +endif +ifdef DATE +DATESTR:=$(shell $(DATE) +%Y%m%d) +else +DATESTR= +endif +ifndef UPXPROG +ifeq ($(OS_TARGET),go32v2) +UPXPROG:=1 +endif +ifeq ($(OS_TARGET),win32) +UPXPROG:=1 +endif +ifdef UPXPROG +UPXPROG:=$(strip $(wildcard $(addsuffix /upx$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(UPXPROG),) +UPXPROG= +else +UPXPROG:=$(firstword $(UPXPROG)) +endif +else +UPXPROG= +endif +endif +export UPXPROG +ZIPOPT=-9 +ZIPEXT=.zip +ifeq ($(USETAR),bz2) +TAROPT=vj +TAREXT=.tar.bz2 +else +TAROPT=vz +TAREXT=.tar.gz +endif +override REQUIRE_PACKAGES=rtl gtk2 +ifeq ($(FULL_TARGET),i386-linux) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_X11=1 +REQUIRE_PACKAGES_GTK2=1 +endif +ifeq ($(FULL_TARGET),i386-go32v2) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_GTK2=1 +endif +ifeq ($(FULL_TARGET),i386-win32) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_GTK2=1 +endif +ifeq ($(FULL_TARGET),i386-os2) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_GTK2=1 +endif +ifeq ($(FULL_TARGET),i386-freebsd) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_X11=1 +REQUIRE_PACKAGES_GTK2=1 +endif +ifeq ($(FULL_TARGET),i386-beos) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_GTK2=1 +endif +ifeq ($(FULL_TARGET),i386-netbsd) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_X11=1 +REQUIRE_PACKAGES_GTK2=1 +endif +ifeq ($(FULL_TARGET),i386-solaris) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_X11=1 +REQUIRE_PACKAGES_GTK2=1 +endif +ifeq ($(FULL_TARGET),i386-qnx) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_GTK2=1 +endif +ifeq ($(FULL_TARGET),i386-netware) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_GTK2=1 +endif +ifeq ($(FULL_TARGET),i386-openbsd) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_X11=1 +REQUIRE_PACKAGES_GTK2=1 +endif +ifeq ($(FULL_TARGET),i386-wdosx) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_GTK2=1 +endif +ifeq ($(FULL_TARGET),i386-darwin) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_X11=1 +REQUIRE_PACKAGES_GTK2=1 +endif +ifeq ($(FULL_TARGET),i386-emx) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_GTK2=1 +endif +ifeq ($(FULL_TARGET),i386-watcom) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_GTK2=1 +endif +ifeq ($(FULL_TARGET),i386-netwlibc) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_GTK2=1 +endif +ifeq ($(FULL_TARGET),i386-wince) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_GTK2=1 +endif +ifeq ($(FULL_TARGET),i386-embedded) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_GTK2=1 +endif +ifeq ($(FULL_TARGET),i386-symbian) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_GTK2=1 +endif +ifeq ($(FULL_TARGET),m68k-linux) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_X11=1 +REQUIRE_PACKAGES_GTK2=1 +endif +ifeq ($(FULL_TARGET),m68k-freebsd) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_X11=1 +REQUIRE_PACKAGES_GTK2=1 +endif +ifeq ($(FULL_TARGET),m68k-netbsd) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_X11=1 +REQUIRE_PACKAGES_GTK2=1 +endif +ifeq ($(FULL_TARGET),m68k-amiga) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_GTK2=1 +endif +ifeq ($(FULL_TARGET),m68k-atari) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_GTK2=1 +endif +ifeq ($(FULL_TARGET),m68k-openbsd) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_X11=1 +REQUIRE_PACKAGES_GTK2=1 +endif +ifeq ($(FULL_TARGET),m68k-palmos) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_GTK2=1 +endif +ifeq ($(FULL_TARGET),m68k-embedded) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_GTK2=1 +endif +ifeq ($(FULL_TARGET),powerpc-linux) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_X11=1 +REQUIRE_PACKAGES_GTK2=1 +endif +ifeq ($(FULL_TARGET),powerpc-netbsd) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_X11=1 +REQUIRE_PACKAGES_GTK2=1 +endif +ifeq ($(FULL_TARGET),powerpc-amiga) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_GTK2=1 +endif +ifeq ($(FULL_TARGET),powerpc-macos) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_GTK2=1 +endif +ifeq ($(FULL_TARGET),powerpc-darwin) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_X11=1 +REQUIRE_PACKAGES_GTK2=1 +endif +ifeq ($(FULL_TARGET),powerpc-morphos) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_GTK2=1 +endif +ifeq ($(FULL_TARGET),powerpc-embedded) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_GTK2=1 +endif +ifeq ($(FULL_TARGET),sparc-linux) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_X11=1 +REQUIRE_PACKAGES_GTK2=1 +endif +ifeq ($(FULL_TARGET),sparc-netbsd) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_X11=1 +REQUIRE_PACKAGES_GTK2=1 +endif +ifeq ($(FULL_TARGET),sparc-solaris) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_X11=1 +REQUIRE_PACKAGES_GTK2=1 +endif +ifeq ($(FULL_TARGET),sparc-embedded) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_GTK2=1 +endif +ifeq ($(FULL_TARGET),x86_64-linux) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_X11=1 +REQUIRE_PACKAGES_GTK2=1 +endif +ifeq ($(FULL_TARGET),x86_64-freebsd) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_X11=1 +REQUIRE_PACKAGES_GTK2=1 +endif +ifeq ($(FULL_TARGET),x86_64-darwin) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_X11=1 +REQUIRE_PACKAGES_GTK2=1 +endif +ifeq ($(FULL_TARGET),x86_64-win64) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_GTK2=1 +endif +ifeq ($(FULL_TARGET),x86_64-embedded) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_GTK2=1 +endif +ifeq ($(FULL_TARGET),arm-linux) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_X11=1 +REQUIRE_PACKAGES_GTK2=1 +endif +ifeq ($(FULL_TARGET),arm-palmos) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_GTK2=1 +endif +ifeq ($(FULL_TARGET),arm-wince) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_GTK2=1 +endif +ifeq ($(FULL_TARGET),arm-gba) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_GTK2=1 +endif +ifeq ($(FULL_TARGET),arm-nds) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_GTK2=1 +endif +ifeq ($(FULL_TARGET),arm-embedded) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_GTK2=1 +endif +ifeq ($(FULL_TARGET),arm-symbian) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_GTK2=1 +endif +ifeq ($(FULL_TARGET),powerpc64-linux) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_X11=1 +REQUIRE_PACKAGES_GTK2=1 +endif +ifeq ($(FULL_TARGET),powerpc64-darwin) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_X11=1 +REQUIRE_PACKAGES_GTK2=1 +endif +ifeq ($(FULL_TARGET),powerpc64-embedded) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_GTK2=1 +endif +ifdef REQUIRE_PACKAGES_RTL +PACKAGEDIR_RTL:=$(firstword $(subst /Makefile.fpc,,$(strip $(wildcard $(addsuffix /rtl/Makefile.fpc,$(PACKAGESDIR)))))) +ifneq ($(PACKAGEDIR_RTL),) +ifneq ($(wildcard $(PACKAGEDIR_RTL)/units/$(TARGETSUFFIX)),) +UNITDIR_RTL=$(PACKAGEDIR_RTL)/units/$(TARGETSUFFIX) +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 +ifdef REQUIRE_PACKAGES_X11 +PACKAGEDIR_X11:=$(firstword $(subst /Makefile.fpc,,$(strip $(wildcard $(addsuffix /x11/Makefile.fpc,$(PACKAGESDIR)))))) +ifneq ($(PACKAGEDIR_X11),) +ifneq ($(wildcard $(PACKAGEDIR_X11)/units/$(TARGETSUFFIX)),) +UNITDIR_X11=$(PACKAGEDIR_X11)/units/$(TARGETSUFFIX) +else +UNITDIR_X11=$(PACKAGEDIR_X11) +endif +ifdef CHECKDEPEND +$(PACKAGEDIR_X11)/$(FPCMADE): + $(MAKE) -C $(PACKAGEDIR_X11) $(FPCMADE) +override ALLDEPENDENCIES+=$(PACKAGEDIR_X11)/$(FPCMADE) +endif +else +PACKAGEDIR_X11= +UNITDIR_X11:=$(subst /Package.fpc,,$(strip $(wildcard $(addsuffix /x11/Package.fpc,$(UNITSDIR))))) +ifneq ($(UNITDIR_X11),) +UNITDIR_X11:=$(firstword $(UNITDIR_X11)) +else +UNITDIR_X11= +endif +endif +ifdef UNITDIR_X11 +override COMPILER_UNITDIR+=$(UNITDIR_X11) +endif +endif +ifdef REQUIRE_PACKAGES_GTK2 +PACKAGEDIR_GTK2:=$(firstword $(subst /Makefile.fpc,,$(strip $(wildcard $(addsuffix /gtk2/Makefile.fpc,$(PACKAGESDIR)))))) +ifneq ($(PACKAGEDIR_GTK2),) +ifneq ($(wildcard $(PACKAGEDIR_GTK2)/units/$(TARGETSUFFIX)),) +UNITDIR_GTK2=$(PACKAGEDIR_GTK2)/units/$(TARGETSUFFIX) +else +UNITDIR_GTK2=$(PACKAGEDIR_GTK2) +endif +ifdef CHECKDEPEND +$(PACKAGEDIR_GTK2)/$(FPCMADE): + $(MAKE) -C $(PACKAGEDIR_GTK2) $(FPCMADE) +override ALLDEPENDENCIES+=$(PACKAGEDIR_GTK2)/$(FPCMADE) +endif +else +PACKAGEDIR_GTK2= +UNITDIR_GTK2:=$(subst /Package.fpc,,$(strip $(wildcard $(addsuffix /gtk2/Package.fpc,$(UNITSDIR))))) +ifneq ($(UNITDIR_GTK2),) +UNITDIR_GTK2:=$(firstword $(UNITDIR_GTK2)) +else +UNITDIR_GTK2= +endif +endif +ifdef UNITDIR_GTK2 +override COMPILER_UNITDIR+=$(UNITDIR_GTK2) +endif +endif +ifndef NOCPUDEF +override FPCOPTDEF=$(CPU_TARGET) +endif +ifneq ($(OS_TARGET),$(OS_SOURCE)) +override FPCOPT+=-T$(OS_TARGET) +endif +ifneq ($(CPU_TARGET),$(CPU_SOURCE)) +override FPCOPT+=-P$(CPU_TARGET) +endif +ifeq ($(OS_SOURCE),openbsd) +override FPCOPT+=-FD$(NEW_BINUTILS_PATH) +endif +ifndef CROSSBOOTSTRAP +ifneq ($(BINUTILSPREFIX),) +override FPCOPT+=-XP$(BINUTILSPREFIX) +endif +ifneq ($(BINUTILSPREFIX),) +override FPCOPT+=-Xr$(RLINKPATH) +endif +endif +ifdef UNITDIR +override FPCOPT+=$(addprefix -Fu,$(UNITDIR)) +endif +ifdef LIBDIR +override FPCOPT+=$(addprefix -Fl,$(LIBDIR)) +endif +ifdef OBJDIR +override FPCOPT+=$(addprefix -Fo,$(OBJDIR)) +endif +ifdef INCDIR +override FPCOPT+=$(addprefix -Fi,$(INCDIR)) +endif +ifdef LINKSMART +override FPCOPT+=-XX +endif +ifdef CREATESMART +override FPCOPT+=-CX +endif +ifdef DEBUG +override FPCOPT+=-gl +override FPCOPTDEF+=DEBUG +endif +ifdef RELEASE +ifneq ($(findstring 2.0.,$(FPC_VERSION)),) +ifeq ($(CPU_TARGET),i386) +FPCCPUOPT:=-OG2p3 +endif +ifeq ($(CPU_TARGET),powerpc) +FPCCPUOPT:=-O1r +endif +else +FPCCPUOPT:=-O2 +endif +override FPCOPT+=-Ur -Xs $(FPCCPUOPT) -n +override FPCOPTDEF+=RELEASE +endif +ifdef STRIP +override FPCOPT+=-Xs +endif +ifdef OPTIMIZE +override FPCOPT+=-O2 +endif +ifdef VERBOSE +override FPCOPT+=-vwni +endif +ifdef COMPILER_OPTIONS +override FPCOPT+=$(COMPILER_OPTIONS) +endif +ifdef COMPILER_UNITDIR +override FPCOPT+=$(addprefix -Fu,$(COMPILER_UNITDIR)) +endif +ifdef COMPILER_LIBRARYDIR +override FPCOPT+=$(addprefix -Fl,$(COMPILER_LIBRARYDIR)) +endif +ifdef COMPILER_OBJECTDIR +override FPCOPT+=$(addprefix -Fo,$(COMPILER_OBJECTDIR)) +endif +ifdef COMPILER_INCLUDEDIR +override FPCOPT+=$(addprefix -Fi,$(COMPILER_INCLUDEDIR)) +endif +ifdef CROSSBINDIR +override FPCOPT+=-FD$(CROSSBINDIR) +endif +ifdef COMPILER_TARGETDIR +override FPCOPT+=-FE$(COMPILER_TARGETDIR) +ifeq ($(COMPILER_TARGETDIR),.) +override TARGETDIRPREFIX= +else +override TARGETDIRPREFIX=$(COMPILER_TARGETDIR)/ +endif +endif +ifdef COMPILER_UNITTARGETDIR +override FPCOPT+=-FU$(COMPILER_UNITTARGETDIR) +ifeq ($(COMPILER_UNITTARGETDIR),.) +override UNITTARGETDIRPREFIX= +else +override UNITTARGETDIRPREFIX=$(COMPILER_UNITTARGETDIR)/ +endif +else +ifdef COMPILER_TARGETDIR +override COMPILER_UNITTARGETDIR=$(COMPILER_TARGETDIR) +override UNITTARGETDIRPREFIX=$(TARGETDIRPREFIX) +endif +endif +ifdef CREATESHARED +override FPCOPT+=-Cg +ifeq ($(CPU_TARGET),i386) +override FPCOPT+=-Aas +endif +endif +ifeq ($(findstring 2.0.,$(FPC_VERSION)),) +ifeq ($(OS_TARGET),linux) +ifeq ($(CPU_TARGET),x86_64) +override FPCOPT+=-Cg +endif +endif +endif +ifdef LINKSHARED +endif +ifdef GCCLIBDIR +override FPCOPT+=-Fl$(GCCLIBDIR) +endif +ifdef OTHERLIBDIR +override FPCOPT+=$(addprefix -Fl,$(OTHERLIBDIR)) +endif +ifdef OPT +override FPCOPT+=$(OPT) +endif +ifdef FPCOPTDEF +override FPCOPT+=$(addprefix -d,$(FPCOPTDEF)) +endif +ifdef CFGFILE +override FPCOPT+=@$(CFGFILE) +endif +ifdef USEENV +override FPCEXTCMD:=$(FPCOPT) +override FPCOPT:=!FPCEXTCMD +export FPCEXTCMD +endif +override AFULL_TARGET=$(CPU_TARGET)-$(OS_TARGET) +override AFULL_SOURCE=$(CPU_SOURCE)-$(OS_SOURCE) +ifneq ($(AFULL_TARGET),$(AFULL_SOURCE)) +override ACROSSCOMPILE=1 +endif +ifdef ACROSSCOMPILE +override FPCOPT+=$(CROSSOPT) +endif +override COMPILER:=$(FPC) $(FPCOPT) +ifeq (,$(findstring -s ,$(COMPILER))) +EXECPPAS= +else +ifeq ($(FULL_SOURCE),$(FULL_TARGET)) +ifdef RUNBATCH +EXECPPAS:=@$(RUNBATCH) $(PPAS) +else +EXECPPAS:=@$(PPAS) +endif +endif +endif +.PHONY: fpc_exes +ifndef CROSSINSTALL +ifneq ($(TARGET_PROGRAMS),) +override EXEFILES=$(addsuffix $(EXEEXT),$(TARGET_PROGRAMS)) +override EXEOFILES:=$(addsuffix $(OEXT),$(TARGET_PROGRAMS)) $(addprefix $(STATICLIBPREFIX),$(addsuffix $(STATICLIBEXT),$(TARGET_PROGRAMS))) $(addprefix $(IMPORTLIBPREFIX),$(addsuffix $(STATICLIBEXT),$(TARGET_PROGRAMS))) +override ALLTARGET+=fpc_exes +override INSTALLEXEFILES+=$(EXEFILES) +override CLEANEXEFILES+=$(EXEFILES) $(EXEOFILES) +ifeq ($(OS_TARGET),os2) +override CLEANEXEFILES+=$(addsuffix $(AOUTEXT),$(TARGET_PROGRAMS)) +endif +ifeq ($(OS_TARGET),emx) +override CLEANEXEFILES+=$(addsuffix $(AOUTEXT),$(TARGET_PROGRAMS)) +endif +endif +endif +fpc_exes: $(COMPILER_TARGETDIR) $(COMPILER_UNITTARGETDIR) $(EXEFILES) +ifdef TARGET_RSTS +override RSTFILES=$(addsuffix $(RSTEXT),$(TARGET_RSTS)) +override CLEANRSTFILES+=$(RSTFILES) +endif +.PHONY: fpc_all fpc_smart fpc_debug fpc_release fpc_shared +$(FPCMADE): $(ALLDEPENDENCIES) $(ALLTARGET) + @$(ECHOREDIR) Compiled > $(FPCMADE) +fpc_all: $(FPCMADE) +fpc_smart: + $(MAKE) all LINKSMART=1 CREATESMART=1 +fpc_debug: + $(MAKE) all DEBUG=1 +fpc_release: + $(MAKE) all RELEASE=1 +.SUFFIXES: $(EXEEXT) $(PPUEXT) $(OEXT) .pas .lpr .dpr .pp .rc .res +$(COMPILER_UNITTARGETDIR): + $(MKDIRTREE) $(COMPILER_UNITTARGETDIR) +$(COMPILER_TARGETDIR): + $(MKDIRTREE) $(COMPILER_TARGETDIR) +%$(PPUEXT): %.pp + $(COMPILER) $< + $(EXECPPAS) +%$(PPUEXT): %.pas + $(COMPILER) $< + $(EXECPPAS) +%$(EXEEXT): %.pp + $(COMPILER) $< + $(EXECPPAS) +%$(EXEEXT): %.pas + $(COMPILER) $< + $(EXECPPAS) +%$(EXEEXT): %.lpr + $(COMPILER) $< + $(EXECPPAS) +%$(EXEEXT): %.dpr + $(COMPILER) $< + $(EXECPPAS) +%.res: %.rc + windres -i $< -o $@ +vpath %.pp $(COMPILER_SOURCEDIR) $(COMPILER_INCLUDEDIR) +vpath %.pas $(COMPILER_SOURCEDIR) $(COMPILER_INCLUDEDIR) +vpath %.lpr $(COMPILER_SOURCEDIR) $(COMPILER_INCLUDEDIR) +vpath %.dpr $(COMPILER_SOURCEDIR) $(COMPILER_INCLUDEDIR) +vpath %.inc $(COMPILER_INCLUDEDIR) +vpath %$(OEXT) $(COMPILER_UNITTARGETDIR) +vpath %$(PPUEXT) $(COMPILER_UNITTARGETDIR) +.PHONY: fpc_shared +override INSTALLTARGET+=fpc_shared_install +ifndef SHARED_LIBVERSION +SHARED_LIBVERSION=$(FPC_VERSION) +endif +ifndef SHARED_LIBNAME +SHARED_LIBNAME=$(PACKAGE_NAME) +endif +ifndef SHARED_FULLNAME +SHARED_FULLNAME=$(SHAREDLIBPREFIX)$(SHARED_LIBNAME)-$(SHARED_LIBVERSION)$(SHAREDLIBEXT) +endif +ifndef SHARED_LIBUNITS +SHARED_LIBUNITS:=$(TARGET_UNITS) $(TARGET_IMPLICITUNITS) +override SHARED_LIBUNITS:=$(filter-out $(INSTALL_BUILDUNIT),$(SHARED_LIBUNITS)) +endif +fpc_shared: +ifdef HASSHAREDLIB + $(MAKE) all CREATESHARED=1 LINKSHARED=1 CREATESMART=1 +ifneq ($(SHARED_BUILD),n) + $(PPUMOVE) -q $(SHARED_LIBUNITS) -i$(COMPILER_UNITTARGETDIR) -o$(SHARED_FULLNAME) -d$(COMPILER_UNITTARGETDIR) +endif +else + @$(ECHO) Shared Libraries not supported +endif +fpc_shared_install: +ifneq ($(SHARED_BUILD),n) +ifneq ($(SHARED_LIBUNITS),) +ifneq ($(wildcard $(COMPILER_UNITTARGETDIR)/$(SHARED_FULLNAME)),) + $(INSTALL) $(COMPILER_UNITTARGETDIR)/$(SHARED_FULLNAME) $(INSTALL_SHAREDDIR) +endif +endif +endif +.PHONY: fpc_install fpc_sourceinstall fpc_exampleinstall +ifdef INSTALL_UNITS +override INSTALLPPUFILES+=$(addsuffix $(PPUEXT),$(INSTALL_UNITS)) +endif +ifdef INSTALL_BUILDUNIT +override INSTALLPPUFILES:=$(filter-out $(INSTALL_BUILDUNIT)$(PPUEXT),$(INSTALLPPUFILES)) +endif +ifdef INSTALLPPUFILES +override INSTALLPPULINKFILES:=$(subst $(PPUEXT),$(OEXT),$(INSTALLPPUFILES)) $(addprefix $(STATICLIBPREFIX),$(subst $(PPUEXT),$(STATICLIBEXT),$(INSTALLPPUFILES))) $(addprefix $(IMPORTLIBPREFIX),$(subst $(PPUEXT),$(STATICLIBEXT),$(INSTALLPPUFILES))) +ifneq ($(UNITTARGETDIRPREFIX),) +override INSTALLPPUFILES:=$(addprefix $(UNITTARGETDIRPREFIX),$(notdir $(INSTALLPPUFILES))) +override INSTALLPPULINKFILES:=$(wildcard $(addprefix $(UNITTARGETDIRPREFIX),$(notdir $(INSTALLPPULINKFILES)))) +endif +override INSTALL_CREATEPACKAGEFPC=1 +endif +ifdef INSTALLEXEFILES +ifneq ($(TARGETDIRPREFIX),) +override INSTALLEXEFILES:=$(addprefix $(TARGETDIRPREFIX),$(notdir $(INSTALLEXEFILES))) +endif +endif +fpc_install: all $(INSTALLTARGET) +ifdef INSTALLEXEFILES + $(MKDIR) $(INSTALL_BINDIR) +ifdef UPXPROG + -$(UPXPROG) $(INSTALLEXEFILES) +endif + $(INSTALLEXE) $(INSTALLEXEFILES) $(INSTALL_BINDIR) +endif +ifdef INSTALL_CREATEPACKAGEFPC +ifdef FPCMAKE +ifdef PACKAGE_VERSION +ifneq ($(wildcard Makefile.fpc),) + $(FPCMAKE) -p -T$(CPU_TARGET)-$(OS_TARGET) Makefile.fpc + $(MKDIR) $(INSTALL_UNITDIR) + $(INSTALL) Package.fpc $(INSTALL_UNITDIR) +endif +endif +endif +endif +ifdef INSTALLPPUFILES + $(MKDIR) $(INSTALL_UNITDIR) + $(INSTALL) $(INSTALLPPUFILES) $(INSTALL_UNITDIR) +ifneq ($(INSTALLPPULINKFILES),) + $(INSTALL) $(INSTALLPPULINKFILES) $(INSTALL_UNITDIR) +endif +ifneq ($(wildcard $(LIB_FULLNAME)),) + $(MKDIR) $(INSTALL_LIBDIR) + $(INSTALL) $(LIB_FULLNAME) $(INSTALL_LIBDIR) +ifdef inUnix + ln -sf $(LIB_FULLNAME) $(INSTALL_LIBDIR)/$(LIB_NAME) +endif +endif +endif +ifdef INSTALL_FILES + $(MKDIR) $(INSTALL_DATADIR) + $(INSTALL) $(INSTALL_FILES) $(INSTALL_DATADIR) +endif +fpc_sourceinstall: distclean + $(MKDIR) $(INSTALL_SOURCEDIR) + $(COPYTREE) $(BASEDIR)/* $(INSTALL_SOURCEDIR) +fpc_exampleinstall: $(addsuffix _distclean,$(TARGET_EXAMPLEDIRS)) +ifdef HASEXAMPLES + $(MKDIR) $(INSTALL_EXAMPLEDIR) +endif +ifdef EXAMPLESOURCEFILES + $(COPY) $(EXAMPLESOURCEFILES) $(INSTALL_EXAMPLEDIR) +endif +ifdef TARGET_EXAMPLEDIRS + $(COPYTREE) $(addsuffix /*,$(TARGET_EXAMPLEDIRS)) $(INSTALL_EXAMPLEDIR) +endif +.PHONY: fpc_clean fpc_cleanall fpc_distclean +ifdef EXEFILES +override CLEANEXEFILES:=$(addprefix $(TARGETDIRPREFIX),$(CLEANEXEFILES)) +endif +ifdef CLEAN_UNITS +override CLEANPPUFILES+=$(addsuffix $(PPUEXT),$(CLEAN_UNITS)) +endif +ifdef CLEANPPUFILES +override CLEANPPULINKFILES:=$(subst $(PPUEXT),$(OEXT),$(CLEANPPUFILES)) $(addprefix $(STATICLIBPREFIX),$(subst $(PPUEXT),$(STATICLIBEXT),$(CLEANPPUFILES))) $(addprefix $(IMPORTLIBPREFIX),$(subst $(PPUEXT),$(STATICLIBEXT),$(CLEANPPUFILES))) +ifdef DEBUGSYMEXT +override CLEANPPULINKFILES+=$(subst $(PPUEXT),$(DEBUGSYMEXT),$(CLEANPPUFILES)) +endif +override CLEANPPUFILES:=$(addprefix $(UNITTARGETDIRPREFIX),$(CLEANPPUFILES)) +override CLEANPPULINKFILES:=$(wildcard $(addprefix $(UNITTARGETDIRPREFIX),$(CLEANPPULINKFILES))) +endif +fpc_clean: $(CLEANTARGET) +ifdef CLEANEXEFILES + -$(DEL) $(CLEANEXEFILES) +endif +ifdef CLEANPPUFILES + -$(DEL) $(CLEANPPUFILES) +endif +ifneq ($(CLEANPPULINKFILES),) + -$(DEL) $(CLEANPPULINKFILES) +endif +ifdef CLEANRSTFILES + -$(DEL) $(addprefix $(UNITTARGETDIRPREFIX),$(CLEANRSTFILES)) +endif +ifdef CLEAN_FILES + -$(DEL) $(CLEAN_FILES) +endif +ifdef LIB_NAME + -$(DEL) $(LIB_NAME) $(LIB_FULLNAME) +endif + -$(DEL) $(FPCMADE) Package.fpc $(PPAS) script.res link.res $(FPCEXTFILE) $(REDIRFILE) + -$(DEL) *$(ASMEXT) *_ppas$(BATCHEXT) +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) *_ppas$(BATCHEXT) +ifdef AOUTEXT + -$(DEL) *$(AOUTEXT) +endif +ifdef DEBUGSYMEXT + -$(DEL) *$(DEBUGSYMEXT) +endif +fpc_distclean: cleanall +.PHONY: fpc_baseinfo +override INFORULES+=fpc_baseinfo +fpc_baseinfo: + @$(ECHO) + @$(ECHO) == Package info == + @$(ECHO) Package Name..... $(PACKAGE_NAME) + @$(ECHO) Package Version.. $(PACKAGE_VERSION) + @$(ECHO) + @$(ECHO) == Configuration info == + @$(ECHO) + @$(ECHO) FPC.......... $(FPC) + @$(ECHO) FPC Version.. $(FPC_VERSION) + @$(ECHO) Source CPU... $(CPU_SOURCE) + @$(ECHO) Target CPU... $(CPU_TARGET) + @$(ECHO) Source OS.... $(OS_SOURCE) + @$(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) + @$(ECHO) Required pkgs... $(REQUIRE_PACKAGES) + @$(ECHO) + @$(ECHO) Basedir......... $(BASEDIR) + @$(ECHO) FPCDir.......... $(FPCDIR) + @$(ECHO) CrossBinDir..... $(CROSSBINDIR) + @$(ECHO) UnitsDir........ $(UNITSDIR) + @$(ECHO) PackagesDir..... $(PACKAGESDIR) + @$(ECHO) + @$(ECHO) GCC library..... $(GCCLIBDIR) + @$(ECHO) Other library... $(OTHERLIBDIR) + @$(ECHO) + @$(ECHO) == Tools info == + @$(ECHO) + @$(ECHO) As........ $(AS) + @$(ECHO) Ld........ $(LD) + @$(ECHO) Ar........ $(AR) + @$(ECHO) Rc........ $(RC) + @$(ECHO) + @$(ECHO) Mv........ $(MVPROG) + @$(ECHO) Cp........ $(CPPROG) + @$(ECHO) Rm........ $(RMPROG) + @$(ECHO) GInstall.. $(GINSTALL) + @$(ECHO) Echo...... $(ECHO) + @$(ECHO) Shell..... $(SHELL) + @$(ECHO) Date...... $(DATE) + @$(ECHO) FPCMake... $(FPCMAKE) + @$(ECHO) PPUMove... $(PPUMOVE) + @$(ECHO) Upx....... $(UPXPROG) + @$(ECHO) Zip....... $(ZIPPROG) + @$(ECHO) + @$(ECHO) == Object info == + @$(ECHO) + @$(ECHO) Target Loaders........ $(TARGET_LOADERS) + @$(ECHO) Target Units.......... $(TARGET_UNITS) + @$(ECHO) Target Implicit Units. $(TARGET_IMPLICITUNITS) + @$(ECHO) Target Programs....... $(TARGET_PROGRAMS) + @$(ECHO) Target Dirs........... $(TARGET_DIRS) + @$(ECHO) Target Examples....... $(TARGET_EXAMPLES) + @$(ECHO) Target ExampleDirs.... $(TARGET_EXAMPLEDIRS) + @$(ECHO) + @$(ECHO) Clean Units......... $(CLEAN_UNITS) + @$(ECHO) Clean Files......... $(CLEAN_FILES) + @$(ECHO) + @$(ECHO) Install Units....... $(INSTALL_UNITS) + @$(ECHO) Install Files....... $(INSTALL_FILES) + @$(ECHO) + @$(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) + @$(ECHO) Install binary dir... $(INSTALL_BINDIR) + @$(ECHO) Install library dir.. $(INSTALL_LIBDIR) + @$(ECHO) Install units dir.... $(INSTALL_UNITDIR) + @$(ECHO) Install source dir... $(INSTALL_SOURCEDIR) + @$(ECHO) Install doc dir...... $(INSTALL_DOCDIR) + @$(ECHO) Install example dir.. $(INSTALL_EXAMPLEDIR) + @$(ECHO) Install data dir..... $(INSTALL_DATADIR) + @$(ECHO) + @$(ECHO) Dist destination dir. $(DIST_DESTDIR) + @$(ECHO) Dist zip name........ $(DIST_ZIPNAME) + @$(ECHO) +.PHONY: fpc_info +fpc_info: $(INFORULES) +.PHONY: fpc_makefile fpc_makefiles fpc_makefile_sub1 fpc_makefile_sub2 \ + fpc_makefile_dirs +fpc_makefile: + $(FPCMAKE) -w -T$(OS_TARGET) Makefile.fpc +fpc_makefile_sub1: +ifdef TARGET_DIRS + $(FPCMAKE) -w -T$(OS_TARGET) $(addsuffix /Makefile.fpc,$(TARGET_DIRS)) +endif +ifdef TARGET_EXAMPLEDIRS + $(FPCMAKE) -w -T$(OS_TARGET) $(addsuffix /Makefile.fpc,$(TARGET_EXAMPLEDIRS)) +endif +fpc_makefile_sub2: $(addsuffix _makefile_dirs,$(TARGET_DIRS) $(TARGET_EXAMPLEDIRS)) +fpc_makefile_dirs: fpc_makefile_sub1 fpc_makefile_sub2 +fpc_makefiles: fpc_makefile fpc_makefile_dirs +all: fpc_all +debug: fpc_debug +smart: fpc_smart +release: fpc_release +units: fpc_units +examples: +shared: fpc_shared +install: fpc_install +sourceinstall: fpc_sourceinstall +exampleinstall: fpc_exampleinstall +distinstall: +zipinstall: +zipsourceinstall: +zipexampleinstall: +zipdistinstall: +clean: fpc_clean +distclean: fpc_distclean +cleanall: fpc_cleanall +info: fpc_info +makefiles: fpc_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 +.NOTPARALLEL: diff --git a/packages/gtk2/examples/plugins/Makefile.fpc b/packages/gtk2/examples/plugins/Makefile.fpc new file mode 100644 index 0000000000..7c4cb5f152 --- /dev/null +++ b/packages/gtk2/examples/plugins/Makefile.fpc @@ -0,0 +1,18 @@ +# +# Makefile.fpc for Free Pascal GTK 2.x.y Examples +# + +[target] +programs=plugin main + +[require] +packages=gtk2 + +[install] +fpcpackage=y + +[default] +fpcdir=../../../.. + +[rules] +.NOTPARALLEL: diff --git a/packages/gtk2/examples/plugins/main.pas b/packages/gtk2/examples/plugins/main.pas new file mode 100644 index 0000000000..f4f94e0f23 --- /dev/null +++ b/packages/gtk2/examples/plugins/main.pas @@ -0,0 +1,46 @@ +program plugin_test; + +uses + glib2; + +const + PLUGIN_NAME = 'plugin'; + SYMBOL_NAME = 'get_plugin_info'; + +var + module : PGModule; + func : function : pgchar; + id : pgchar; + filename : pgchar; + +begin + if not g_module_supported then + begin + g_error ('No GModule support on this platform.'#13#10); + exit; + end; + filename := g_module_build_path ('.',PLUGIN_NAME); + g_print ('Trying to locate module; using %s as filename'#13#10, + [filename]); + + module := g_module_open (filename, G_MODULE_BIND_MASK); + + if module = NULL then + begin + g_error ('Couldn''t find Module %s!'#13#10, [PLUGIN_NAME]); + exit; + end; + + if not g_module_symbol (module, SYMBOL_NAME, @func) then + begin + g_error ('No symbol %s in %s found!'#13#10, [SYMBOL_NAME, PLUGIN_NAME]); + g_module_close (module); + exit; + end; + + id := func(); + + g_print ('Plugin defined itself as "%s"'#13#10, [id]); + + g_module_close (module); +end. diff --git a/packages/gtk2/examples/plugins/plugin.pas b/packages/gtk2/examples/plugins/plugin.pas new file mode 100644 index 0000000000..ff519a3dfc --- /dev/null +++ b/packages/gtk2/examples/plugins/plugin.pas @@ -0,0 +1,12 @@ +library some_plugin; + +function get_plugin_info: pchar; export; cdecl; +begin + get_plugin_info:= 'GLib2 Plugin-Test Plugin'; +end; + +exports + get_plugin_info; + +begin +end. diff --git a/packages/gtk2/examples/scribble_simple/Makefile b/packages/gtk2/examples/scribble_simple/Makefile new file mode 100644 index 0000000000..52e49f67ef --- /dev/null +++ b/packages/gtk2/examples/scribble_simple/Makefile @@ -0,0 +1,2015 @@ +# +# Don't edit, this file is generated by FPCMake Version 2.0.0 [2008/01/26] +# +default: all +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-darwin i386-emx i386-watcom i386-netwlibc i386-wince i386-embedded i386-symbian m68k-linux m68k-freebsd m68k-netbsd m68k-amiga m68k-atari m68k-openbsd m68k-palmos m68k-embedded powerpc-linux powerpc-netbsd powerpc-amiga powerpc-macos powerpc-darwin powerpc-morphos powerpc-embedded sparc-linux sparc-netbsd sparc-solaris sparc-embedded x86_64-linux x86_64-freebsd x86_64-darwin x86_64-win64 x86_64-embedded arm-linux arm-palmos arm-wince arm-gba arm-nds arm-embedded arm-symbian powerpc64-linux powerpc64-darwin powerpc64-embedded +BSDs = freebsd netbsd openbsd darwin +UNIXs = linux $(BSDs) solaris qnx +LIMIT83fs = go32v2 os2 emx watcom +OSNeedsComspecToRunBatch = go32v2 watcom +FORCE: +.PHONY: FORCE +override PATH:=$(patsubst %/,%,$(subst \,/,$(PATH))) +ifneq ($(findstring darwin,$(OSTYPE)),) +inUnix=1 #darwin +SEARCHPATH:=$(filter-out .,$(subst :, ,$(PATH))) +else +ifeq ($(findstring ;,$(PATH)),) +inUnix=1 +SEARCHPATH:=$(filter-out .,$(subst :, ,$(PATH))) +else +SEARCHPATH:=$(subst ;, ,$(PATH)) +endif +endif +SEARCHPATH+=$(patsubst %/,%,$(subst \,/,$(dir $(MAKE)))) +PWD:=$(strip $(wildcard $(addsuffix /pwd.exe,$(SEARCHPATH)))) +ifeq ($(PWD),) +PWD:=$(strip $(wildcard $(addsuffix /pwd,$(SEARCHPATH)))) +ifeq ($(PWD),) +$(error You need the GNU utils package to use this Makefile) +else +PWD:=$(firstword $(PWD)) +SRCEXEEXT= +endif +else +PWD:=$(firstword $(PWD)) +SRCEXEEXT=.exe +endif +ifndef inUnix +ifeq ($(OS),Windows_NT) +inWinNT=1 +else +ifdef OS2_SHELL +inOS2=1 +endif +endif +else +ifneq ($(findstring cygdrive,$(PATH)),) +inCygWin=1 +endif +endif +ifdef inUnix +SRCBATCHEXT=.sh +else +ifdef inOS2 +SRCBATCHEXT=.cmd +else +SRCBATCHEXT=.bat +endif +endif +ifdef COMSPEC +ifneq ($(findstring $(OS_SOURCE),$(OSNeedsComspecToRunBatch)),) +RUNBATCH=$(COMSPEC) /C +endif +endif +ifdef inUnix +PATHSEP=/ +else +PATHSEP:=$(subst /,\,/) +ifdef inCygWin +PATHSEP=/ +endif +endif +ifdef PWD +BASEDIR:=$(subst \,/,$(shell $(PWD))) +ifdef inCygWin +ifneq ($(findstring /cygdrive/,$(BASEDIR)),) +BASENODIR:=$(patsubst /cygdrive%,%,$(BASEDIR)) +BASEDRIVE:=$(firstword $(subst /, ,$(BASENODIR))) +BASEDIR:=$(subst /cygdrive/$(BASEDRIVE)/,$(BASEDRIVE):/,$(BASEDIR)) +endif +endif +else +BASEDIR=. +endif +ifdef inOS2 +ifndef ECHO +ECHO:=$(strip $(wildcard $(addsuffix /gecho$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(ECHO),) +ECHO:=$(strip $(wildcard $(addsuffix /echo$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(ECHO),) +ECHO=echo +else +ECHO:=$(firstword $(ECHO)) +endif +else +ECHO:=$(firstword $(ECHO)) +endif +endif +export ECHO +endif +override DEFAULT_FPCDIR=../../../.. +ifndef FPC +ifdef PP +FPC=$(PP) +endif +endif +ifndef FPC +FPCPROG:=$(strip $(wildcard $(addsuffix /fpc$(SRCEXEEXT),$(SEARCHPATH)))) +ifneq ($(FPCPROG),) +FPCPROG:=$(firstword $(FPCPROG)) +ifneq ($(CPU_TARGET),) +FPC:=$(shell $(FPCPROG) -P$(CPU_TARGET) -PB) +else +FPC:=$(shell $(FPCPROG) -PB) +endif +ifneq ($(findstring Error,$(FPC)),) +override FPC=$(firstword $(strip $(wildcard $(addsuffix /ppc386$(SRCEXEEXT),$(SEARCHPATH))))) +endif +else +override FPC=$(firstword $(strip $(wildcard $(addsuffix /ppc386$(SRCEXEEXT),$(SEARCHPATH))))) +endif +endif +override FPC:=$(subst $(SRCEXEEXT),,$(FPC)) +override FPC:=$(subst \,/,$(FPC))$(SRCEXEEXT) +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 +unexport CHECKDEPEND ALLDEPENDENCIES +ifndef CPU_TARGET +ifdef CPU_TARGET_DEFAULT +CPU_TARGET=$(CPU_TARGET_DEFAULT) +endif +endif +ifndef OS_TARGET +ifdef OS_TARGET_DEFAULT +OS_TARGET=$(OS_TARGET_DEFAULT) +endif +endif +ifneq ($(words $(FPC_COMPILERINFO)),5) +FPC_COMPILERINFO+=$(shell $(FPC) -iSP) +FPC_COMPILERINFO+=$(shell $(FPC) -iTP) +FPC_COMPILERINFO+=$(shell $(FPC) -iSO) +FPC_COMPILERINFO+=$(shell $(FPC) -iTO) +endif +ifndef CPU_SOURCE +CPU_SOURCE:=$(word 2,$(FPC_COMPILERINFO)) +endif +ifndef CPU_TARGET +CPU_TARGET:=$(word 3,$(FPC_COMPILERINFO)) +endif +ifndef OS_SOURCE +OS_SOURCE:=$(word 4,$(FPC_COMPILERINFO)) +endif +ifndef OS_TARGET +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 $(FULL_TARGET),$(MAKEFILETARGETS)),) +$(error The Makefile doesn't support target $(FULL_TARGET), please run fpcmake first) +endif +endif +ifneq ($(findstring $(OS_TARGET),$(BSDs)),) +BSDhier=1 +endif +ifeq ($(OS_TARGET),linux) +linuxHier=1 +endif +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)),) +override FPCDIR=wrong +endif +else +override FPCDIR=wrong +endif +ifdef DEFAULT_FPCDIR +ifeq ($(FPCDIR),wrong) +override FPCDIR:=$(subst \,/,$(DEFAULT_FPCDIR)) +ifeq ($(wildcard $(addprefix $(FPCDIR)/,rtl units)),) +override FPCDIR=wrong +endif +endif +endif +ifeq ($(FPCDIR),wrong) +ifdef inUnix +override FPCDIR=/usr/local/lib/fpc/$(FPC_VERSION) +ifeq ($(wildcard $(FPCDIR)/units),) +override FPCDIR=/usr/lib/fpc/$(FPC_VERSION) +endif +else +override FPCDIR:=$(subst /$(FPC),,$(firstword $(strip $(wildcard $(addsuffix /$(FPC),$(SEARCHPATH)))))) +override FPCDIR:=$(FPCDIR)/.. +ifeq ($(wildcard $(addprefix $(FPCDIR)/,rtl units)),) +override FPCDIR:=$(FPCDIR)/.. +ifeq ($(wildcard $(addprefix $(FPCDIR)/,rtl units)),) +override FPCDIR:=$(BASEDIR) +ifeq ($(wildcard $(addprefix $(FPCDIR)/,rtl units)),) +override FPCDIR=c:/pp +endif +endif +endif +endif +endif +ifndef CROSSBINDIR +CROSSBINDIR:=$(wildcard $(FPCDIR)/bin/$(TARGETSUFFIX)) +endif +ifndef BINUTILSPREFIX +ifndef CROSSBINDIR +ifdef CROSSCOMPILE +BINUTILSPREFIX=$(CPU_TARGET)-$(OS_TARGET)- +endif +endif +endif +UNITSDIR:=$(wildcard $(FPCDIR)/units/$(TARGETSUFFIX)) +ifeq ($(UNITSDIR),) +UNITSDIR:=$(wildcard $(FPCDIR)/units/$(OS_TARGET)) +endif +PACKAGESDIR:=$(wildcard $(FPCDIR) $(FPCDIR)/packages $(FPCDIR)/packages/base $(FPCDIR)/packages/extra) +ifeq ($(FULL_TARGET),i386-linux) +override TARGET_PROGRAMS+=scribble_simple +endif +ifeq ($(FULL_TARGET),i386-go32v2) +override TARGET_PROGRAMS+=scribble_simple +endif +ifeq ($(FULL_TARGET),i386-win32) +override TARGET_PROGRAMS+=scribble_simple +endif +ifeq ($(FULL_TARGET),i386-os2) +override TARGET_PROGRAMS+=scribble_simple +endif +ifeq ($(FULL_TARGET),i386-freebsd) +override TARGET_PROGRAMS+=scribble_simple +endif +ifeq ($(FULL_TARGET),i386-beos) +override TARGET_PROGRAMS+=scribble_simple +endif +ifeq ($(FULL_TARGET),i386-netbsd) +override TARGET_PROGRAMS+=scribble_simple +endif +ifeq ($(FULL_TARGET),i386-solaris) +override TARGET_PROGRAMS+=scribble_simple +endif +ifeq ($(FULL_TARGET),i386-qnx) +override TARGET_PROGRAMS+=scribble_simple +endif +ifeq ($(FULL_TARGET),i386-netware) +override TARGET_PROGRAMS+=scribble_simple +endif +ifeq ($(FULL_TARGET),i386-openbsd) +override TARGET_PROGRAMS+=scribble_simple +endif +ifeq ($(FULL_TARGET),i386-wdosx) +override TARGET_PROGRAMS+=scribble_simple +endif +ifeq ($(FULL_TARGET),i386-darwin) +override TARGET_PROGRAMS+=scribble_simple +endif +ifeq ($(FULL_TARGET),i386-emx) +override TARGET_PROGRAMS+=scribble_simple +endif +ifeq ($(FULL_TARGET),i386-watcom) +override TARGET_PROGRAMS+=scribble_simple +endif +ifeq ($(FULL_TARGET),i386-netwlibc) +override TARGET_PROGRAMS+=scribble_simple +endif +ifeq ($(FULL_TARGET),i386-wince) +override TARGET_PROGRAMS+=scribble_simple +endif +ifeq ($(FULL_TARGET),i386-embedded) +override TARGET_PROGRAMS+=scribble_simple +endif +ifeq ($(FULL_TARGET),i386-symbian) +override TARGET_PROGRAMS+=scribble_simple +endif +ifeq ($(FULL_TARGET),m68k-linux) +override TARGET_PROGRAMS+=scribble_simple +endif +ifeq ($(FULL_TARGET),m68k-freebsd) +override TARGET_PROGRAMS+=scribble_simple +endif +ifeq ($(FULL_TARGET),m68k-netbsd) +override TARGET_PROGRAMS+=scribble_simple +endif +ifeq ($(FULL_TARGET),m68k-amiga) +override TARGET_PROGRAMS+=scribble_simple +endif +ifeq ($(FULL_TARGET),m68k-atari) +override TARGET_PROGRAMS+=scribble_simple +endif +ifeq ($(FULL_TARGET),m68k-openbsd) +override TARGET_PROGRAMS+=scribble_simple +endif +ifeq ($(FULL_TARGET),m68k-palmos) +override TARGET_PROGRAMS+=scribble_simple +endif +ifeq ($(FULL_TARGET),m68k-embedded) +override TARGET_PROGRAMS+=scribble_simple +endif +ifeq ($(FULL_TARGET),powerpc-linux) +override TARGET_PROGRAMS+=scribble_simple +endif +ifeq ($(FULL_TARGET),powerpc-netbsd) +override TARGET_PROGRAMS+=scribble_simple +endif +ifeq ($(FULL_TARGET),powerpc-amiga) +override TARGET_PROGRAMS+=scribble_simple +endif +ifeq ($(FULL_TARGET),powerpc-macos) +override TARGET_PROGRAMS+=scribble_simple +endif +ifeq ($(FULL_TARGET),powerpc-darwin) +override TARGET_PROGRAMS+=scribble_simple +endif +ifeq ($(FULL_TARGET),powerpc-morphos) +override TARGET_PROGRAMS+=scribble_simple +endif +ifeq ($(FULL_TARGET),powerpc-embedded) +override TARGET_PROGRAMS+=scribble_simple +endif +ifeq ($(FULL_TARGET),sparc-linux) +override TARGET_PROGRAMS+=scribble_simple +endif +ifeq ($(FULL_TARGET),sparc-netbsd) +override TARGET_PROGRAMS+=scribble_simple +endif +ifeq ($(FULL_TARGET),sparc-solaris) +override TARGET_PROGRAMS+=scribble_simple +endif +ifeq ($(FULL_TARGET),sparc-embedded) +override TARGET_PROGRAMS+=scribble_simple +endif +ifeq ($(FULL_TARGET),x86_64-linux) +override TARGET_PROGRAMS+=scribble_simple +endif +ifeq ($(FULL_TARGET),x86_64-freebsd) +override TARGET_PROGRAMS+=scribble_simple +endif +ifeq ($(FULL_TARGET),x86_64-darwin) +override TARGET_PROGRAMS+=scribble_simple +endif +ifeq ($(FULL_TARGET),x86_64-win64) +override TARGET_PROGRAMS+=scribble_simple +endif +ifeq ($(FULL_TARGET),x86_64-embedded) +override TARGET_PROGRAMS+=scribble_simple +endif +ifeq ($(FULL_TARGET),arm-linux) +override TARGET_PROGRAMS+=scribble_simple +endif +ifeq ($(FULL_TARGET),arm-palmos) +override TARGET_PROGRAMS+=scribble_simple +endif +ifeq ($(FULL_TARGET),arm-wince) +override TARGET_PROGRAMS+=scribble_simple +endif +ifeq ($(FULL_TARGET),arm-gba) +override TARGET_PROGRAMS+=scribble_simple +endif +ifeq ($(FULL_TARGET),arm-nds) +override TARGET_PROGRAMS+=scribble_simple +endif +ifeq ($(FULL_TARGET),arm-embedded) +override TARGET_PROGRAMS+=scribble_simple +endif +ifeq ($(FULL_TARGET),arm-symbian) +override TARGET_PROGRAMS+=scribble_simple +endif +ifeq ($(FULL_TARGET),powerpc64-linux) +override TARGET_PROGRAMS+=scribble_simple +endif +ifeq ($(FULL_TARGET),powerpc64-darwin) +override TARGET_PROGRAMS+=scribble_simple +endif +ifeq ($(FULL_TARGET),powerpc64-embedded) +override TARGET_PROGRAMS+=scribble_simple +endif +override INSTALL_FPCPACKAGE=y +ifdef REQUIRE_UNITSDIR +override UNITSDIR+=$(REQUIRE_UNITSDIR) +endif +ifdef REQUIRE_PACKAGESDIR +override PACKAGESDIR+=$(REQUIRE_PACKAGESDIR) +endif +ifdef ZIPINSTALL +ifneq ($(findstring $(OS_TARGET),$(UNIXs)),) +UNIXHier=1 +endif +else +ifneq ($(findstring $(OS_SOURCE),$(UNIXs)),) +UNIXHier=1 +endif +endif +ifndef INSTALL_PREFIX +ifdef PREFIX +INSTALL_PREFIX=$(PREFIX) +endif +endif +ifndef INSTALL_PREFIX +ifdef UNIXHier +INSTALL_PREFIX=/usr/local +else +ifdef INSTALL_FPCPACKAGE +INSTALL_BASEDIR:=/pp +else +INSTALL_BASEDIR:=/$(PACKAGE_NAME) +endif +endif +endif +export INSTALL_PREFIX +ifdef INSTALL_FPCSUBDIR +export INSTALL_FPCSUBDIR +endif +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 +INSTALL_BASEDIR:=$(INSTALL_PREFIX)/lib/fpc/$(FPC_VERSION) +else +INSTALL_BASEDIR:=$(INSTALL_PREFIX)/lib/$(PACKAGE_NAME) +endif +else +INSTALL_BASEDIR:=$(INSTALL_PREFIX) +endif +endif +ifndef INSTALL_BINDIR +ifdef UNIXHier +INSTALL_BINDIR:=$(INSTALL_PREFIX)/bin +else +INSTALL_BINDIR:=$(INSTALL_BASEDIR)/bin +ifdef INSTALL_FPCPACKAGE +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 +INSTALL_UNITDIR:=$(INSTALL_BASEDIR)/units/$(TARGETSUFFIX) +ifdef INSTALL_FPCPACKAGE +ifdef PACKAGE_NAME +INSTALL_UNITDIR:=$(INSTALL_UNITDIR)/$(PACKAGE_NAME) +endif +endif +endif +ifndef INSTALL_LIBDIR +ifdef UNIXHier +INSTALL_LIBDIR:=$(INSTALL_PREFIX)/lib +else +INSTALL_LIBDIR:=$(INSTALL_UNITDIR) +endif +endif +ifndef INSTALL_SOURCEDIR +ifdef UNIXHier +ifdef BSDhier +SRCPREFIXDIR=share/src +else +ifdef linuxHier +SRCPREFIXDIR=share/src +else +SRCPREFIXDIR=src +endif +endif +ifdef INSTALL_FPCPACKAGE +ifdef INSTALL_FPCSUBDIR +INSTALL_SOURCEDIR:=$(INSTALL_PREFIX)/$(SRCPREFIXDIR)/fpc-$(FPC_VERSION)/$(INSTALL_FPCSUBDIR)/$(PACKAGE_NAME) +else +INSTALL_SOURCEDIR:=$(INSTALL_PREFIX)/$(SRCPREFIXDIR)/fpc-$(FPC_VERSION)/$(PACKAGE_NAME) +endif +else +INSTALL_SOURCEDIR:=$(INSTALL_PREFIX)/$(SRCPREFIXDIR)/$(PACKAGE_NAME)-$(PACKAGE_VERSION) +endif +else +ifdef INSTALL_FPCPACKAGE +ifdef INSTALL_FPCSUBDIR +INSTALL_SOURCEDIR:=$(INSTALL_BASEDIR)/source/$(INSTALL_FPCSUBDIR)/$(PACKAGE_NAME) +else +INSTALL_SOURCEDIR:=$(INSTALL_BASEDIR)/source/$(PACKAGE_NAME) +endif +else +INSTALL_SOURCEDIR:=$(INSTALL_BASEDIR)/source +endif +endif +endif +ifndef INSTALL_DOCDIR +ifdef UNIXHier +ifdef BSDhier +DOCPREFIXDIR=share/doc +else +ifdef linuxHier +DOCPREFIXDIR=share/doc +else +DOCPREFIXDIR=doc +endif +endif +ifdef INSTALL_FPCPACKAGE +INSTALL_DOCDIR:=$(INSTALL_PREFIX)/$(DOCPREFIXDIR)/fpc-$(FPC_VERSION)/$(PACKAGE_NAME) +else +INSTALL_DOCDIR:=$(INSTALL_PREFIX)/$(DOCPREFIXDIR)/$(PACKAGE_NAME)-$(PACKAGE_VERSION) +endif +else +ifdef INSTALL_FPCPACKAGE +INSTALL_DOCDIR:=$(INSTALL_BASEDIR)/doc/$(PACKAGE_NAME) +else +INSTALL_DOCDIR:=$(INSTALL_BASEDIR)/doc +endif +endif +endif +ifndef INSTALL_EXAMPLEDIR +ifdef UNIXHier +ifdef INSTALL_FPCPACKAGE +ifdef BSDhier +INSTALL_EXAMPLEDIR:=$(INSTALL_PREFIX)/share/examples/fpc-$(FPC_VERSION)/$(PACKAGE_NAME) +else +ifdef linuxHier +INSTALL_EXAMPLEDIR:=$(INSTALL_DOCDIR)/examples +else +INSTALL_EXAMPLEDIR:=$(INSTALL_PREFIX)/doc/fpc-$(FPC_VERSION)/examples/$(PACKAGE_NAME) +endif +endif +else +ifdef BSDhier +INSTALL_EXAMPLEDIR:=$(INSTALL_PREFIX)/share/examples/$(PACKAGE_NAME)-$(PACKAGE_VERSION) +else +ifdef linuxHier +INSTALL_EXAMPLEDIR:=$(INSTALL_DOCDIR)/examples/$(PACKAGE_NAME)-$(PACKAGE_VERSION) +else +INSTALL_EXAMPLEDIR:=$(INSTALL_PREFIX)/doc/$(PACKAGE_NAME)-$(PACKAGE_VERSION) +endif +endif +endif +else +ifdef INSTALL_FPCPACKAGE +INSTALL_EXAMPLEDIR:=$(INSTALL_BASEDIR)/examples/$(PACKAGE_NAME) +else +INSTALL_EXAMPLEDIR:=$(INSTALL_BASEDIR)/examples +endif +endif +endif +ifndef INSTALL_DATADIR +INSTALL_DATADIR=$(INSTALL_BASEDIR) +endif +ifndef INSTALL_SHAREDDIR +INSTALL_SHAREDDIR=$(INSTALL_PREFIX)/lib +endif +ifdef CROSSCOMPILE +ifndef CROSSBINDIR +CROSSBINDIR:=$(wildcard $(CROSSTARGETDIR)/bin/$(SOURCESUFFIX)) +ifeq ($(CROSSBINDIR),) +CROSSBINDIR:=$(wildcard $(INSTALL_BASEDIR)/cross/$(TARGETSUFFIX)/bin/$(FULL_SOURCE)) +endif +endif +else +CROSSBINDIR= +endif +ifeq ($(OS_SOURCE),linux) +ifndef GCCLIBDIR +ifeq ($(CPU_TARGET),i386) +ifneq ($(findstring x86_64,$(shell uname -a)),) +ifeq ($(BINUTILSPREFIX),) +GCCLIBDIR:=$(shell dirname `gcc -m32 -print-libgcc-file-name`) +endif +endif +endif +ifeq ($(CPU_TARGET),powerpc64) +ifeq ($(BINUTILSPREFIX),) +GCCLIBDIR:=$(shell dirname `gcc -m64 -print-libgcc-file-name`) +endif +endif +endif +ifndef GCCLIBDIR +CROSSGCC=$(strip $(wildcard $(addsuffix /$(BINUTILSPREFIX)gcc$(SRCEXEEXT),$(SEARCHPATH)))) +ifneq ($(CROSSGCC),) +GCCLIBDIR:=$(shell dirname `$(CROSSGCC) -print-libgcc-file-name`) +endif +endif +ifndef OTHERLIBDIR +OTHERLIBDIR:=$(shell grep -v "^\#" /etc/ld.so.conf | awk '{ ORS=" "; print $1 }') +endif +endif +ifdef inUnix +ifeq ($(OS_SOURCE),netbsd) +OTHERLIBDIR+=/usr/pkg/lib +endif +export GCCLIBDIR OTHERLIB +endif +BATCHEXT=.bat +LOADEREXT=.as +EXEEXT=.exe +PPLEXT=.ppl +PPUEXT=.ppu +OEXT=.o +ASMEXT=.s +SMARTEXT=.sl +STATICLIBEXT=.a +SHAREDLIBEXT=.so +SHAREDLIBPREFIX=libfp +STATICLIBPREFIX=libp +IMPORTLIBPREFIX=libimp +RSTEXT=.rst +ifeq ($(findstring 1.0.,$(FPC_VERSION)),) +ifeq ($(OS_TARGET),go32v1) +STATICLIBPREFIX= +SHORTSUFFIX=v1 +endif +ifeq ($(OS_TARGET),go32v2) +STATICLIBPREFIX= +SHORTSUFFIX=dos +endif +ifeq ($(OS_TARGET),watcom) +STATICLIBPREFIX= +OEXT=.obj +ASMEXT=.asm +SHAREDLIBEXT=.dll +SHORTSUFFIX=wat +endif +ifeq ($(OS_TARGET),linux) +BATCHEXT=.sh +EXEEXT= +HASSHAREDLIB=1 +SHORTSUFFIX=lnx +endif +ifeq ($(OS_TARGET),freebsd) +BATCHEXT=.sh +EXEEXT= +HASSHAREDLIB=1 +SHORTSUFFIX=fbs +endif +ifeq ($(OS_TARGET),netbsd) +BATCHEXT=.sh +EXEEXT= +HASSHAREDLIB=1 +SHORTSUFFIX=nbs +endif +ifeq ($(OS_TARGET),openbsd) +BATCHEXT=.sh +EXEEXT= +HASSHAREDLIB=1 +SHORTSUFFIX=obs +endif +ifeq ($(OS_TARGET),win32) +SHAREDLIBEXT=.dll +SHORTSUFFIX=w32 +endif +ifeq ($(OS_TARGET),os2) +BATCHEXT=.cmd +AOUTEXT=.out +STATICLIBPREFIX= +SHAREDLIBEXT=.dll +SHORTSUFFIX=os2 +ECHO=echo +endif +ifeq ($(OS_TARGET),emx) +BATCHEXT=.cmd +AOUTEXT=.out +STATICLIBPREFIX= +SHAREDLIBEXT=.dll +SHORTSUFFIX=emx +ECHO=echo +endif +ifeq ($(OS_TARGET),amiga) +EXEEXT= +SHAREDLIBEXT=.library +SHORTSUFFIX=amg +endif +ifeq ($(OS_TARGET),morphos) +EXEEXT= +SHAREDLIBEXT=.library +SHORTSUFFIX=mos +endif +ifeq ($(OS_TARGET),atari) +EXEEXT=.ttp +SHORTSUFFIX=ata +endif +ifeq ($(OS_TARGET),beos) +BATCHEXT=.sh +EXEEXT= +SHORTSUFFIX=be +endif +ifeq ($(OS_TARGET),solaris) +BATCHEXT=.sh +EXEEXT= +SHORTSUFFIX=sun +endif +ifeq ($(OS_TARGET),qnx) +BATCHEXT=.sh +EXEEXT= +SHORTSUFFIX=qnx +endif +ifeq ($(OS_TARGET),netware) +EXEEXT=.nlm +STATICLIBPREFIX= +SHORTSUFFIX=nw +endif +ifeq ($(OS_TARGET),netwlibc) +EXEEXT=.nlm +STATICLIBPREFIX= +SHORTSUFFIX=nwl +endif +ifeq ($(OS_TARGET),macos) +BATCHEXT= +EXEEXT= +DEBUGSYMEXT=.xcoff +SHORTSUFFIX=mac +endif +ifeq ($(OS_TARGET),darwin) +BATCHEXT=.sh +EXEEXT= +HASSHAREDLIB=1 +SHORTSUFFIX=dwn +endif +ifeq ($(OS_TARGET),gba) +EXEEXT=.gba +SHAREDLIBEXT=.so +SHORTSUFFIX=gba +endif +ifeq ($(OS_TARGET),symbian) +SHAREDLIBEXT=.dll +SHORTSUFFIX=symbian +endif +else +ifeq ($(OS_TARGET),go32v1) +PPUEXT=.pp1 +OEXT=.o1 +ASMEXT=.s1 +SMARTEXT=.sl1 +STATICLIBEXT=.a1 +SHAREDLIBEXT=.so1 +STATICLIBPREFIX= +SHORTSUFFIX=v1 +endif +ifeq ($(OS_TARGET),go32v2) +STATICLIBPREFIX= +SHORTSUFFIX=dos +endif +ifeq ($(OS_TARGET),watcom) +STATICLIBPREFIX= +SHORTSUFFIX=wat +endif +ifeq ($(OS_TARGET),linux) +BATCHEXT=.sh +EXEEXT= +HASSHAREDLIB=1 +SHORTSUFFIX=lnx +endif +ifeq ($(OS_TARGET),freebsd) +BATCHEXT=.sh +EXEEXT= +HASSHAREDLIB=1 +SHORTSUFFIX=fbs +endif +ifeq ($(OS_TARGET),netbsd) +BATCHEXT=.sh +EXEEXT= +HASSHAREDLIB=1 +SHORTSUFFIX=nbs +endif +ifeq ($(OS_TARGET),openbsd) +BATCHEXT=.sh +EXEEXT= +HASSHAREDLIB=1 +SHORTSUFFIX=obs +endif +ifeq ($(OS_TARGET),win32) +PPUEXT=.ppw +OEXT=.ow +ASMEXT=.sw +SMARTEXT=.slw +STATICLIBEXT=.aw +SHAREDLIBEXT=.dll +SHORTSUFFIX=w32 +endif +ifeq ($(OS_TARGET),os2) +BATCHEXT=.cmd +PPUEXT=.ppo +ASMEXT=.so2 +OEXT=.oo2 +AOUTEXT=.out +SMARTEXT=.sl2 +STATICLIBPREFIX= +STATICLIBEXT=.ao2 +SHAREDLIBEXT=.dll +SHORTSUFFIX=os2 +ECHO=echo +endif +ifeq ($(OS_TARGET),amiga) +EXEEXT= +PPUEXT=.ppu +ASMEXT=.s +OEXT=.o +SMARTEXT=.sl +STATICLIBEXT=.a +SHAREDLIBEXT=.library +SHORTSUFFIX=amg +endif +ifeq ($(OS_TARGET),atari) +PPUEXT=.ppu +ASMEXT=.s +OEXT=.o +SMARTEXT=.sl +STATICLIBEXT=.a +EXEEXT=.ttp +SHORTSUFFIX=ata +endif +ifeq ($(OS_TARGET),beos) +BATCHEXT=.sh +PPUEXT=.ppu +ASMEXT=.s +OEXT=.o +SMARTEXT=.sl +STATICLIBEXT=.a +EXEEXT= +SHORTSUFFIX=be +endif +ifeq ($(OS_TARGET),solaris) +BATCHEXT=.sh +PPUEXT=.ppu +ASMEXT=.s +OEXT=.o +SMARTEXT=.sl +STATICLIBEXT=.a +EXEEXT= +SHORTSUFFIX=sun +endif +ifeq ($(OS_TARGET),qnx) +BATCHEXT=.sh +PPUEXT=.ppu +ASMEXT=.s +OEXT=.o +SMARTEXT=.sl +STATICLIBEXT=.a +EXEEXT= +SHORTSUFFIX=qnx +endif +ifeq ($(OS_TARGET),netware) +STATICLIBPREFIX= +PPUEXT=.ppu +OEXT=.o +ASMEXT=.s +SMARTEXT=.sl +STATICLIBEXT=.a +SHAREDLIBEXT=.nlm +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= +PPUEXT=.ppu +ASMEXT=.s +OEXT=.o +SMARTEXT=.sl +STATICLIBEXT=.a +EXEEXT= +DEBUGSYMEXT=.xcoff +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 +ECHO:=$(strip $(wildcard $(addsuffix /gecho$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(ECHO),) +ECHO:=$(strip $(wildcard $(addsuffix /echo$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(ECHO),) +ECHO= __missing_command_ECHO +else +ECHO:=$(firstword $(ECHO)) +endif +else +ECHO:=$(firstword $(ECHO)) +endif +endif +export ECHO +ifndef DATE +DATE:=$(strip $(wildcard $(addsuffix /gdate$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(DATE),) +DATE:=$(strip $(wildcard $(addsuffix /date$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(DATE),) +DATE= __missing_command_DATE +else +DATE:=$(firstword $(DATE)) +endif +else +DATE:=$(firstword $(DATE)) +endif +endif +export DATE +ifndef GINSTALL +GINSTALL:=$(strip $(wildcard $(addsuffix /ginstall$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(GINSTALL),) +GINSTALL:=$(strip $(wildcard $(addsuffix /install$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(GINSTALL),) +GINSTALL= __missing_command_GINSTALL +else +GINSTALL:=$(firstword $(GINSTALL)) +endif +else +GINSTALL:=$(firstword $(GINSTALL)) +endif +endif +export GINSTALL +ifndef CPPROG +CPPROG:=$(strip $(wildcard $(addsuffix /cp$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(CPPROG),) +CPPROG= __missing_command_CPPROG +else +CPPROG:=$(firstword $(CPPROG)) +endif +endif +export CPPROG +ifndef RMPROG +RMPROG:=$(strip $(wildcard $(addsuffix /rm$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(RMPROG),) +RMPROG= __missing_command_RMPROG +else +RMPROG:=$(firstword $(RMPROG)) +endif +endif +export RMPROG +ifndef MVPROG +MVPROG:=$(strip $(wildcard $(addsuffix /mv$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(MVPROG),) +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 +else +ECHOREDIR=$(ECHO) +endif +endif +ifndef COPY +COPY:=$(CPPROG) -fp +endif +ifndef COPYTREE +COPYTREE:=$(CPPROG) -Rfp +endif +ifndef MKDIRTREE +MKDIRTREE:=$(MKDIRPROG) -p +endif +ifndef MOVE +MOVE:=$(MVPROG) -f +endif +ifndef DEL +DEL:=$(RMPROG) -f +endif +ifndef DELTREE +DELTREE:=$(RMPROG) -rf +endif +ifndef INSTALL +ifdef inUnix +INSTALL:=$(GINSTALL) -c -m 644 +else +INSTALL:=$(COPY) +endif +endif +ifndef INSTALLEXE +ifdef inUnix +INSTALLEXE:=$(GINSTALL) -c -m 755 +else +INSTALLEXE:=$(COPY) +endif +endif +ifndef MKDIR +MKDIR:=$(GINSTALL) -m 755 -d +endif +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 +else +PPUMOVE:=$(firstword $(PPUMOVE)) +endif +endif +export PPUMOVE +ifndef FPCMAKE +FPCMAKE:=$(strip $(wildcard $(addsuffix /fpcmake$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(FPCMAKE),) +FPCMAKE= __missing_command_FPCMAKE +else +FPCMAKE:=$(firstword $(FPCMAKE)) +endif +endif +export FPCMAKE +ifndef ZIPPROG +ZIPPROG:=$(strip $(wildcard $(addsuffix /zip$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(ZIPPROG),) +ZIPPROG= __missing_command_ZIPPROG +else +ZIPPROG:=$(firstword $(ZIPPROG)) +endif +endif +export ZIPPROG +ifndef TARPROG +TARPROG:=$(strip $(wildcard $(addsuffix /gtar$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(TARPROG),) +TARPROG:=$(strip $(wildcard $(addsuffix /tar$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(TARPROG),) +TARPROG= __missing_command_TARPROG +else +TARPROG:=$(firstword $(TARPROG)) +endif +else +TARPROG:=$(firstword $(TARPROG)) +endif +endif +export TARPROG +ASNAME=$(BINUTILSPREFIX)as +LDNAME=$(BINUTILSPREFIX)ld +ARNAME=$(BINUTILSPREFIX)ar +RCNAME=$(BINUTILSPREFIX)rc +ifneq ($(findstring 1.0.,$(FPC_VERSION)),) +ifeq ($(OS_TARGET),win32) +ifeq ($(CROSSBINDIR),) +ASNAME=asw +LDNAME=ldw +ARNAME=arw +endif +endif +endif +ifndef ASPROG +ifdef CROSSBINDIR +ASPROG=$(CROSSBINDIR)/$(ASNAME)$(SRCEXEEXT) +else +ASPROG=$(ASNAME) +endif +endif +ifndef LDPROG +ifdef CROSSBINDIR +LDPROG=$(CROSSBINDIR)/$(LDNAME)$(SRCEXEEXT) +else +LDPROG=$(LDNAME) +endif +endif +ifndef RCPROG +ifdef CROSSBINDIR +RCPROG=$(CROSSBINDIR)/$(RCNAME)$(SRCEXEEXT) +else +RCPROG=$(RCNAME) +endif +endif +ifndef ARPROG +ifdef CROSSBINDIR +ARPROG=$(CROSSBINDIR)/$(ARNAME)$(SRCEXEEXT) +else +ARPROG=$(ARNAME) +endif +endif +AS=$(ASPROG) +LD=$(LDPROG) +RC=$(RCPROG) +AR=$(ARPROG) +PPAS=ppas$(SRCBATCHEXT) +ifdef inUnix +LDCONFIG=ldconfig +else +LDCONFIG= +endif +ifdef DATE +DATESTR:=$(shell $(DATE) +%Y%m%d) +else +DATESTR= +endif +ifndef UPXPROG +ifeq ($(OS_TARGET),go32v2) +UPXPROG:=1 +endif +ifeq ($(OS_TARGET),win32) +UPXPROG:=1 +endif +ifdef UPXPROG +UPXPROG:=$(strip $(wildcard $(addsuffix /upx$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(UPXPROG),) +UPXPROG= +else +UPXPROG:=$(firstword $(UPXPROG)) +endif +else +UPXPROG= +endif +endif +export UPXPROG +ZIPOPT=-9 +ZIPEXT=.zip +ifeq ($(USETAR),bz2) +TAROPT=vj +TAREXT=.tar.bz2 +else +TAROPT=vz +TAREXT=.tar.gz +endif +override REQUIRE_PACKAGES=rtl gtk2 +ifeq ($(FULL_TARGET),i386-linux) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_X11=1 +REQUIRE_PACKAGES_GTK2=1 +endif +ifeq ($(FULL_TARGET),i386-go32v2) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_GTK2=1 +endif +ifeq ($(FULL_TARGET),i386-win32) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_GTK2=1 +endif +ifeq ($(FULL_TARGET),i386-os2) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_GTK2=1 +endif +ifeq ($(FULL_TARGET),i386-freebsd) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_X11=1 +REQUIRE_PACKAGES_GTK2=1 +endif +ifeq ($(FULL_TARGET),i386-beos) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_GTK2=1 +endif +ifeq ($(FULL_TARGET),i386-netbsd) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_X11=1 +REQUIRE_PACKAGES_GTK2=1 +endif +ifeq ($(FULL_TARGET),i386-solaris) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_X11=1 +REQUIRE_PACKAGES_GTK2=1 +endif +ifeq ($(FULL_TARGET),i386-qnx) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_GTK2=1 +endif +ifeq ($(FULL_TARGET),i386-netware) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_GTK2=1 +endif +ifeq ($(FULL_TARGET),i386-openbsd) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_X11=1 +REQUIRE_PACKAGES_GTK2=1 +endif +ifeq ($(FULL_TARGET),i386-wdosx) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_GTK2=1 +endif +ifeq ($(FULL_TARGET),i386-darwin) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_X11=1 +REQUIRE_PACKAGES_GTK2=1 +endif +ifeq ($(FULL_TARGET),i386-emx) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_GTK2=1 +endif +ifeq ($(FULL_TARGET),i386-watcom) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_GTK2=1 +endif +ifeq ($(FULL_TARGET),i386-netwlibc) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_GTK2=1 +endif +ifeq ($(FULL_TARGET),i386-wince) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_GTK2=1 +endif +ifeq ($(FULL_TARGET),i386-embedded) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_GTK2=1 +endif +ifeq ($(FULL_TARGET),i386-symbian) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_GTK2=1 +endif +ifeq ($(FULL_TARGET),m68k-linux) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_X11=1 +REQUIRE_PACKAGES_GTK2=1 +endif +ifeq ($(FULL_TARGET),m68k-freebsd) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_X11=1 +REQUIRE_PACKAGES_GTK2=1 +endif +ifeq ($(FULL_TARGET),m68k-netbsd) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_X11=1 +REQUIRE_PACKAGES_GTK2=1 +endif +ifeq ($(FULL_TARGET),m68k-amiga) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_GTK2=1 +endif +ifeq ($(FULL_TARGET),m68k-atari) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_GTK2=1 +endif +ifeq ($(FULL_TARGET),m68k-openbsd) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_X11=1 +REQUIRE_PACKAGES_GTK2=1 +endif +ifeq ($(FULL_TARGET),m68k-palmos) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_GTK2=1 +endif +ifeq ($(FULL_TARGET),m68k-embedded) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_GTK2=1 +endif +ifeq ($(FULL_TARGET),powerpc-linux) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_X11=1 +REQUIRE_PACKAGES_GTK2=1 +endif +ifeq ($(FULL_TARGET),powerpc-netbsd) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_X11=1 +REQUIRE_PACKAGES_GTK2=1 +endif +ifeq ($(FULL_TARGET),powerpc-amiga) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_GTK2=1 +endif +ifeq ($(FULL_TARGET),powerpc-macos) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_GTK2=1 +endif +ifeq ($(FULL_TARGET),powerpc-darwin) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_X11=1 +REQUIRE_PACKAGES_GTK2=1 +endif +ifeq ($(FULL_TARGET),powerpc-morphos) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_GTK2=1 +endif +ifeq ($(FULL_TARGET),powerpc-embedded) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_GTK2=1 +endif +ifeq ($(FULL_TARGET),sparc-linux) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_X11=1 +REQUIRE_PACKAGES_GTK2=1 +endif +ifeq ($(FULL_TARGET),sparc-netbsd) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_X11=1 +REQUIRE_PACKAGES_GTK2=1 +endif +ifeq ($(FULL_TARGET),sparc-solaris) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_X11=1 +REQUIRE_PACKAGES_GTK2=1 +endif +ifeq ($(FULL_TARGET),sparc-embedded) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_GTK2=1 +endif +ifeq ($(FULL_TARGET),x86_64-linux) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_X11=1 +REQUIRE_PACKAGES_GTK2=1 +endif +ifeq ($(FULL_TARGET),x86_64-freebsd) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_X11=1 +REQUIRE_PACKAGES_GTK2=1 +endif +ifeq ($(FULL_TARGET),x86_64-darwin) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_X11=1 +REQUIRE_PACKAGES_GTK2=1 +endif +ifeq ($(FULL_TARGET),x86_64-win64) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_GTK2=1 +endif +ifeq ($(FULL_TARGET),x86_64-embedded) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_GTK2=1 +endif +ifeq ($(FULL_TARGET),arm-linux) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_X11=1 +REQUIRE_PACKAGES_GTK2=1 +endif +ifeq ($(FULL_TARGET),arm-palmos) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_GTK2=1 +endif +ifeq ($(FULL_TARGET),arm-wince) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_GTK2=1 +endif +ifeq ($(FULL_TARGET),arm-gba) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_GTK2=1 +endif +ifeq ($(FULL_TARGET),arm-nds) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_GTK2=1 +endif +ifeq ($(FULL_TARGET),arm-embedded) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_GTK2=1 +endif +ifeq ($(FULL_TARGET),arm-symbian) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_GTK2=1 +endif +ifeq ($(FULL_TARGET),powerpc64-linux) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_X11=1 +REQUIRE_PACKAGES_GTK2=1 +endif +ifeq ($(FULL_TARGET),powerpc64-darwin) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_X11=1 +REQUIRE_PACKAGES_GTK2=1 +endif +ifeq ($(FULL_TARGET),powerpc64-embedded) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_GTK2=1 +endif +ifdef REQUIRE_PACKAGES_RTL +PACKAGEDIR_RTL:=$(firstword $(subst /Makefile.fpc,,$(strip $(wildcard $(addsuffix /rtl/Makefile.fpc,$(PACKAGESDIR)))))) +ifneq ($(PACKAGEDIR_RTL),) +ifneq ($(wildcard $(PACKAGEDIR_RTL)/units/$(TARGETSUFFIX)),) +UNITDIR_RTL=$(PACKAGEDIR_RTL)/units/$(TARGETSUFFIX) +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 +ifdef REQUIRE_PACKAGES_X11 +PACKAGEDIR_X11:=$(firstword $(subst /Makefile.fpc,,$(strip $(wildcard $(addsuffix /x11/Makefile.fpc,$(PACKAGESDIR)))))) +ifneq ($(PACKAGEDIR_X11),) +ifneq ($(wildcard $(PACKAGEDIR_X11)/units/$(TARGETSUFFIX)),) +UNITDIR_X11=$(PACKAGEDIR_X11)/units/$(TARGETSUFFIX) +else +UNITDIR_X11=$(PACKAGEDIR_X11) +endif +ifdef CHECKDEPEND +$(PACKAGEDIR_X11)/$(FPCMADE): + $(MAKE) -C $(PACKAGEDIR_X11) $(FPCMADE) +override ALLDEPENDENCIES+=$(PACKAGEDIR_X11)/$(FPCMADE) +endif +else +PACKAGEDIR_X11= +UNITDIR_X11:=$(subst /Package.fpc,,$(strip $(wildcard $(addsuffix /x11/Package.fpc,$(UNITSDIR))))) +ifneq ($(UNITDIR_X11),) +UNITDIR_X11:=$(firstword $(UNITDIR_X11)) +else +UNITDIR_X11= +endif +endif +ifdef UNITDIR_X11 +override COMPILER_UNITDIR+=$(UNITDIR_X11) +endif +endif +ifdef REQUIRE_PACKAGES_GTK2 +PACKAGEDIR_GTK2:=$(firstword $(subst /Makefile.fpc,,$(strip $(wildcard $(addsuffix /gtk2/Makefile.fpc,$(PACKAGESDIR)))))) +ifneq ($(PACKAGEDIR_GTK2),) +ifneq ($(wildcard $(PACKAGEDIR_GTK2)/units/$(TARGETSUFFIX)),) +UNITDIR_GTK2=$(PACKAGEDIR_GTK2)/units/$(TARGETSUFFIX) +else +UNITDIR_GTK2=$(PACKAGEDIR_GTK2) +endif +ifdef CHECKDEPEND +$(PACKAGEDIR_GTK2)/$(FPCMADE): + $(MAKE) -C $(PACKAGEDIR_GTK2) $(FPCMADE) +override ALLDEPENDENCIES+=$(PACKAGEDIR_GTK2)/$(FPCMADE) +endif +else +PACKAGEDIR_GTK2= +UNITDIR_GTK2:=$(subst /Package.fpc,,$(strip $(wildcard $(addsuffix /gtk2/Package.fpc,$(UNITSDIR))))) +ifneq ($(UNITDIR_GTK2),) +UNITDIR_GTK2:=$(firstword $(UNITDIR_GTK2)) +else +UNITDIR_GTK2= +endif +endif +ifdef UNITDIR_GTK2 +override COMPILER_UNITDIR+=$(UNITDIR_GTK2) +endif +endif +ifndef NOCPUDEF +override FPCOPTDEF=$(CPU_TARGET) +endif +ifneq ($(OS_TARGET),$(OS_SOURCE)) +override FPCOPT+=-T$(OS_TARGET) +endif +ifneq ($(CPU_TARGET),$(CPU_SOURCE)) +override FPCOPT+=-P$(CPU_TARGET) +endif +ifeq ($(OS_SOURCE),openbsd) +override FPCOPT+=-FD$(NEW_BINUTILS_PATH) +endif +ifndef CROSSBOOTSTRAP +ifneq ($(BINUTILSPREFIX),) +override FPCOPT+=-XP$(BINUTILSPREFIX) +endif +ifneq ($(BINUTILSPREFIX),) +override FPCOPT+=-Xr$(RLINKPATH) +endif +endif +ifdef UNITDIR +override FPCOPT+=$(addprefix -Fu,$(UNITDIR)) +endif +ifdef LIBDIR +override FPCOPT+=$(addprefix -Fl,$(LIBDIR)) +endif +ifdef OBJDIR +override FPCOPT+=$(addprefix -Fo,$(OBJDIR)) +endif +ifdef INCDIR +override FPCOPT+=$(addprefix -Fi,$(INCDIR)) +endif +ifdef LINKSMART +override FPCOPT+=-XX +endif +ifdef CREATESMART +override FPCOPT+=-CX +endif +ifdef DEBUG +override FPCOPT+=-gl +override FPCOPTDEF+=DEBUG +endif +ifdef RELEASE +ifneq ($(findstring 2.0.,$(FPC_VERSION)),) +ifeq ($(CPU_TARGET),i386) +FPCCPUOPT:=-OG2p3 +endif +ifeq ($(CPU_TARGET),powerpc) +FPCCPUOPT:=-O1r +endif +else +FPCCPUOPT:=-O2 +endif +override FPCOPT+=-Ur -Xs $(FPCCPUOPT) -n +override FPCOPTDEF+=RELEASE +endif +ifdef STRIP +override FPCOPT+=-Xs +endif +ifdef OPTIMIZE +override FPCOPT+=-O2 +endif +ifdef VERBOSE +override FPCOPT+=-vwni +endif +ifdef COMPILER_OPTIONS +override FPCOPT+=$(COMPILER_OPTIONS) +endif +ifdef COMPILER_UNITDIR +override FPCOPT+=$(addprefix -Fu,$(COMPILER_UNITDIR)) +endif +ifdef COMPILER_LIBRARYDIR +override FPCOPT+=$(addprefix -Fl,$(COMPILER_LIBRARYDIR)) +endif +ifdef COMPILER_OBJECTDIR +override FPCOPT+=$(addprefix -Fo,$(COMPILER_OBJECTDIR)) +endif +ifdef COMPILER_INCLUDEDIR +override FPCOPT+=$(addprefix -Fi,$(COMPILER_INCLUDEDIR)) +endif +ifdef CROSSBINDIR +override FPCOPT+=-FD$(CROSSBINDIR) +endif +ifdef COMPILER_TARGETDIR +override FPCOPT+=-FE$(COMPILER_TARGETDIR) +ifeq ($(COMPILER_TARGETDIR),.) +override TARGETDIRPREFIX= +else +override TARGETDIRPREFIX=$(COMPILER_TARGETDIR)/ +endif +endif +ifdef COMPILER_UNITTARGETDIR +override FPCOPT+=-FU$(COMPILER_UNITTARGETDIR) +ifeq ($(COMPILER_UNITTARGETDIR),.) +override UNITTARGETDIRPREFIX= +else +override UNITTARGETDIRPREFIX=$(COMPILER_UNITTARGETDIR)/ +endif +else +ifdef COMPILER_TARGETDIR +override COMPILER_UNITTARGETDIR=$(COMPILER_TARGETDIR) +override UNITTARGETDIRPREFIX=$(TARGETDIRPREFIX) +endif +endif +ifdef CREATESHARED +override FPCOPT+=-Cg +ifeq ($(CPU_TARGET),i386) +override FPCOPT+=-Aas +endif +endif +ifeq ($(findstring 2.0.,$(FPC_VERSION)),) +ifeq ($(OS_TARGET),linux) +ifeq ($(CPU_TARGET),x86_64) +override FPCOPT+=-Cg +endif +endif +endif +ifdef LINKSHARED +endif +ifdef GCCLIBDIR +override FPCOPT+=-Fl$(GCCLIBDIR) +endif +ifdef OTHERLIBDIR +override FPCOPT+=$(addprefix -Fl,$(OTHERLIBDIR)) +endif +ifdef OPT +override FPCOPT+=$(OPT) +endif +ifdef FPCOPTDEF +override FPCOPT+=$(addprefix -d,$(FPCOPTDEF)) +endif +ifdef CFGFILE +override FPCOPT+=@$(CFGFILE) +endif +ifdef USEENV +override FPCEXTCMD:=$(FPCOPT) +override FPCOPT:=!FPCEXTCMD +export FPCEXTCMD +endif +override AFULL_TARGET=$(CPU_TARGET)-$(OS_TARGET) +override AFULL_SOURCE=$(CPU_SOURCE)-$(OS_SOURCE) +ifneq ($(AFULL_TARGET),$(AFULL_SOURCE)) +override ACROSSCOMPILE=1 +endif +ifdef ACROSSCOMPILE +override FPCOPT+=$(CROSSOPT) +endif +override COMPILER:=$(FPC) $(FPCOPT) +ifeq (,$(findstring -s ,$(COMPILER))) +EXECPPAS= +else +ifeq ($(FULL_SOURCE),$(FULL_TARGET)) +ifdef RUNBATCH +EXECPPAS:=@$(RUNBATCH) $(PPAS) +else +EXECPPAS:=@$(PPAS) +endif +endif +endif +.PHONY: fpc_exes +ifndef CROSSINSTALL +ifneq ($(TARGET_PROGRAMS),) +override EXEFILES=$(addsuffix $(EXEEXT),$(TARGET_PROGRAMS)) +override EXEOFILES:=$(addsuffix $(OEXT),$(TARGET_PROGRAMS)) $(addprefix $(STATICLIBPREFIX),$(addsuffix $(STATICLIBEXT),$(TARGET_PROGRAMS))) $(addprefix $(IMPORTLIBPREFIX),$(addsuffix $(STATICLIBEXT),$(TARGET_PROGRAMS))) +override ALLTARGET+=fpc_exes +override INSTALLEXEFILES+=$(EXEFILES) +override CLEANEXEFILES+=$(EXEFILES) $(EXEOFILES) +ifeq ($(OS_TARGET),os2) +override CLEANEXEFILES+=$(addsuffix $(AOUTEXT),$(TARGET_PROGRAMS)) +endif +ifeq ($(OS_TARGET),emx) +override CLEANEXEFILES+=$(addsuffix $(AOUTEXT),$(TARGET_PROGRAMS)) +endif +endif +endif +fpc_exes: $(COMPILER_TARGETDIR) $(COMPILER_UNITTARGETDIR) $(EXEFILES) +ifdef TARGET_RSTS +override RSTFILES=$(addsuffix $(RSTEXT),$(TARGET_RSTS)) +override CLEANRSTFILES+=$(RSTFILES) +endif +.PHONY: fpc_all fpc_smart fpc_debug fpc_release fpc_shared +$(FPCMADE): $(ALLDEPENDENCIES) $(ALLTARGET) + @$(ECHOREDIR) Compiled > $(FPCMADE) +fpc_all: $(FPCMADE) +fpc_smart: + $(MAKE) all LINKSMART=1 CREATESMART=1 +fpc_debug: + $(MAKE) all DEBUG=1 +fpc_release: + $(MAKE) all RELEASE=1 +.SUFFIXES: $(EXEEXT) $(PPUEXT) $(OEXT) .pas .lpr .dpr .pp .rc .res +$(COMPILER_UNITTARGETDIR): + $(MKDIRTREE) $(COMPILER_UNITTARGETDIR) +$(COMPILER_TARGETDIR): + $(MKDIRTREE) $(COMPILER_TARGETDIR) +%$(PPUEXT): %.pp + $(COMPILER) $< + $(EXECPPAS) +%$(PPUEXT): %.pas + $(COMPILER) $< + $(EXECPPAS) +%$(EXEEXT): %.pp + $(COMPILER) $< + $(EXECPPAS) +%$(EXEEXT): %.pas + $(COMPILER) $< + $(EXECPPAS) +%$(EXEEXT): %.lpr + $(COMPILER) $< + $(EXECPPAS) +%$(EXEEXT): %.dpr + $(COMPILER) $< + $(EXECPPAS) +%.res: %.rc + windres -i $< -o $@ +vpath %.pp $(COMPILER_SOURCEDIR) $(COMPILER_INCLUDEDIR) +vpath %.pas $(COMPILER_SOURCEDIR) $(COMPILER_INCLUDEDIR) +vpath %.lpr $(COMPILER_SOURCEDIR) $(COMPILER_INCLUDEDIR) +vpath %.dpr $(COMPILER_SOURCEDIR) $(COMPILER_INCLUDEDIR) +vpath %.inc $(COMPILER_INCLUDEDIR) +vpath %$(OEXT) $(COMPILER_UNITTARGETDIR) +vpath %$(PPUEXT) $(COMPILER_UNITTARGETDIR) +.PHONY: fpc_shared +override INSTALLTARGET+=fpc_shared_install +ifndef SHARED_LIBVERSION +SHARED_LIBVERSION=$(FPC_VERSION) +endif +ifndef SHARED_LIBNAME +SHARED_LIBNAME=$(PACKAGE_NAME) +endif +ifndef SHARED_FULLNAME +SHARED_FULLNAME=$(SHAREDLIBPREFIX)$(SHARED_LIBNAME)-$(SHARED_LIBVERSION)$(SHAREDLIBEXT) +endif +ifndef SHARED_LIBUNITS +SHARED_LIBUNITS:=$(TARGET_UNITS) $(TARGET_IMPLICITUNITS) +override SHARED_LIBUNITS:=$(filter-out $(INSTALL_BUILDUNIT),$(SHARED_LIBUNITS)) +endif +fpc_shared: +ifdef HASSHAREDLIB + $(MAKE) all CREATESHARED=1 LINKSHARED=1 CREATESMART=1 +ifneq ($(SHARED_BUILD),n) + $(PPUMOVE) -q $(SHARED_LIBUNITS) -i$(COMPILER_UNITTARGETDIR) -o$(SHARED_FULLNAME) -d$(COMPILER_UNITTARGETDIR) +endif +else + @$(ECHO) Shared Libraries not supported +endif +fpc_shared_install: +ifneq ($(SHARED_BUILD),n) +ifneq ($(SHARED_LIBUNITS),) +ifneq ($(wildcard $(COMPILER_UNITTARGETDIR)/$(SHARED_FULLNAME)),) + $(INSTALL) $(COMPILER_UNITTARGETDIR)/$(SHARED_FULLNAME) $(INSTALL_SHAREDDIR) +endif +endif +endif +.PHONY: fpc_install fpc_sourceinstall fpc_exampleinstall +ifdef INSTALL_UNITS +override INSTALLPPUFILES+=$(addsuffix $(PPUEXT),$(INSTALL_UNITS)) +endif +ifdef INSTALL_BUILDUNIT +override INSTALLPPUFILES:=$(filter-out $(INSTALL_BUILDUNIT)$(PPUEXT),$(INSTALLPPUFILES)) +endif +ifdef INSTALLPPUFILES +override INSTALLPPULINKFILES:=$(subst $(PPUEXT),$(OEXT),$(INSTALLPPUFILES)) $(addprefix $(STATICLIBPREFIX),$(subst $(PPUEXT),$(STATICLIBEXT),$(INSTALLPPUFILES))) $(addprefix $(IMPORTLIBPREFIX),$(subst $(PPUEXT),$(STATICLIBEXT),$(INSTALLPPUFILES))) +ifneq ($(UNITTARGETDIRPREFIX),) +override INSTALLPPUFILES:=$(addprefix $(UNITTARGETDIRPREFIX),$(notdir $(INSTALLPPUFILES))) +override INSTALLPPULINKFILES:=$(wildcard $(addprefix $(UNITTARGETDIRPREFIX),$(notdir $(INSTALLPPULINKFILES)))) +endif +override INSTALL_CREATEPACKAGEFPC=1 +endif +ifdef INSTALLEXEFILES +ifneq ($(TARGETDIRPREFIX),) +override INSTALLEXEFILES:=$(addprefix $(TARGETDIRPREFIX),$(notdir $(INSTALLEXEFILES))) +endif +endif +fpc_install: all $(INSTALLTARGET) +ifdef INSTALLEXEFILES + $(MKDIR) $(INSTALL_BINDIR) +ifdef UPXPROG + -$(UPXPROG) $(INSTALLEXEFILES) +endif + $(INSTALLEXE) $(INSTALLEXEFILES) $(INSTALL_BINDIR) +endif +ifdef INSTALL_CREATEPACKAGEFPC +ifdef FPCMAKE +ifdef PACKAGE_VERSION +ifneq ($(wildcard Makefile.fpc),) + $(FPCMAKE) -p -T$(CPU_TARGET)-$(OS_TARGET) Makefile.fpc + $(MKDIR) $(INSTALL_UNITDIR) + $(INSTALL) Package.fpc $(INSTALL_UNITDIR) +endif +endif +endif +endif +ifdef INSTALLPPUFILES + $(MKDIR) $(INSTALL_UNITDIR) + $(INSTALL) $(INSTALLPPUFILES) $(INSTALL_UNITDIR) +ifneq ($(INSTALLPPULINKFILES),) + $(INSTALL) $(INSTALLPPULINKFILES) $(INSTALL_UNITDIR) +endif +ifneq ($(wildcard $(LIB_FULLNAME)),) + $(MKDIR) $(INSTALL_LIBDIR) + $(INSTALL) $(LIB_FULLNAME) $(INSTALL_LIBDIR) +ifdef inUnix + ln -sf $(LIB_FULLNAME) $(INSTALL_LIBDIR)/$(LIB_NAME) +endif +endif +endif +ifdef INSTALL_FILES + $(MKDIR) $(INSTALL_DATADIR) + $(INSTALL) $(INSTALL_FILES) $(INSTALL_DATADIR) +endif +fpc_sourceinstall: distclean + $(MKDIR) $(INSTALL_SOURCEDIR) + $(COPYTREE) $(BASEDIR)/* $(INSTALL_SOURCEDIR) +fpc_exampleinstall: $(addsuffix _distclean,$(TARGET_EXAMPLEDIRS)) +ifdef HASEXAMPLES + $(MKDIR) $(INSTALL_EXAMPLEDIR) +endif +ifdef EXAMPLESOURCEFILES + $(COPY) $(EXAMPLESOURCEFILES) $(INSTALL_EXAMPLEDIR) +endif +ifdef TARGET_EXAMPLEDIRS + $(COPYTREE) $(addsuffix /*,$(TARGET_EXAMPLEDIRS)) $(INSTALL_EXAMPLEDIR) +endif +.PHONY: fpc_clean fpc_cleanall fpc_distclean +ifdef EXEFILES +override CLEANEXEFILES:=$(addprefix $(TARGETDIRPREFIX),$(CLEANEXEFILES)) +endif +ifdef CLEAN_UNITS +override CLEANPPUFILES+=$(addsuffix $(PPUEXT),$(CLEAN_UNITS)) +endif +ifdef CLEANPPUFILES +override CLEANPPULINKFILES:=$(subst $(PPUEXT),$(OEXT),$(CLEANPPUFILES)) $(addprefix $(STATICLIBPREFIX),$(subst $(PPUEXT),$(STATICLIBEXT),$(CLEANPPUFILES))) $(addprefix $(IMPORTLIBPREFIX),$(subst $(PPUEXT),$(STATICLIBEXT),$(CLEANPPUFILES))) +ifdef DEBUGSYMEXT +override CLEANPPULINKFILES+=$(subst $(PPUEXT),$(DEBUGSYMEXT),$(CLEANPPUFILES)) +endif +override CLEANPPUFILES:=$(addprefix $(UNITTARGETDIRPREFIX),$(CLEANPPUFILES)) +override CLEANPPULINKFILES:=$(wildcard $(addprefix $(UNITTARGETDIRPREFIX),$(CLEANPPULINKFILES))) +endif +fpc_clean: $(CLEANTARGET) +ifdef CLEANEXEFILES + -$(DEL) $(CLEANEXEFILES) +endif +ifdef CLEANPPUFILES + -$(DEL) $(CLEANPPUFILES) +endif +ifneq ($(CLEANPPULINKFILES),) + -$(DEL) $(CLEANPPULINKFILES) +endif +ifdef CLEANRSTFILES + -$(DEL) $(addprefix $(UNITTARGETDIRPREFIX),$(CLEANRSTFILES)) +endif +ifdef CLEAN_FILES + -$(DEL) $(CLEAN_FILES) +endif +ifdef LIB_NAME + -$(DEL) $(LIB_NAME) $(LIB_FULLNAME) +endif + -$(DEL) $(FPCMADE) Package.fpc $(PPAS) script.res link.res $(FPCEXTFILE) $(REDIRFILE) + -$(DEL) *$(ASMEXT) *_ppas$(BATCHEXT) +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) *_ppas$(BATCHEXT) +ifdef AOUTEXT + -$(DEL) *$(AOUTEXT) +endif +ifdef DEBUGSYMEXT + -$(DEL) *$(DEBUGSYMEXT) +endif +fpc_distclean: cleanall +.PHONY: fpc_baseinfo +override INFORULES+=fpc_baseinfo +fpc_baseinfo: + @$(ECHO) + @$(ECHO) == Package info == + @$(ECHO) Package Name..... $(PACKAGE_NAME) + @$(ECHO) Package Version.. $(PACKAGE_VERSION) + @$(ECHO) + @$(ECHO) == Configuration info == + @$(ECHO) + @$(ECHO) FPC.......... $(FPC) + @$(ECHO) FPC Version.. $(FPC_VERSION) + @$(ECHO) Source CPU... $(CPU_SOURCE) + @$(ECHO) Target CPU... $(CPU_TARGET) + @$(ECHO) Source OS.... $(OS_SOURCE) + @$(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) + @$(ECHO) Required pkgs... $(REQUIRE_PACKAGES) + @$(ECHO) + @$(ECHO) Basedir......... $(BASEDIR) + @$(ECHO) FPCDir.......... $(FPCDIR) + @$(ECHO) CrossBinDir..... $(CROSSBINDIR) + @$(ECHO) UnitsDir........ $(UNITSDIR) + @$(ECHO) PackagesDir..... $(PACKAGESDIR) + @$(ECHO) + @$(ECHO) GCC library..... $(GCCLIBDIR) + @$(ECHO) Other library... $(OTHERLIBDIR) + @$(ECHO) + @$(ECHO) == Tools info == + @$(ECHO) + @$(ECHO) As........ $(AS) + @$(ECHO) Ld........ $(LD) + @$(ECHO) Ar........ $(AR) + @$(ECHO) Rc........ $(RC) + @$(ECHO) + @$(ECHO) Mv........ $(MVPROG) + @$(ECHO) Cp........ $(CPPROG) + @$(ECHO) Rm........ $(RMPROG) + @$(ECHO) GInstall.. $(GINSTALL) + @$(ECHO) Echo...... $(ECHO) + @$(ECHO) Shell..... $(SHELL) + @$(ECHO) Date...... $(DATE) + @$(ECHO) FPCMake... $(FPCMAKE) + @$(ECHO) PPUMove... $(PPUMOVE) + @$(ECHO) Upx....... $(UPXPROG) + @$(ECHO) Zip....... $(ZIPPROG) + @$(ECHO) + @$(ECHO) == Object info == + @$(ECHO) + @$(ECHO) Target Loaders........ $(TARGET_LOADERS) + @$(ECHO) Target Units.......... $(TARGET_UNITS) + @$(ECHO) Target Implicit Units. $(TARGET_IMPLICITUNITS) + @$(ECHO) Target Programs....... $(TARGET_PROGRAMS) + @$(ECHO) Target Dirs........... $(TARGET_DIRS) + @$(ECHO) Target Examples....... $(TARGET_EXAMPLES) + @$(ECHO) Target ExampleDirs.... $(TARGET_EXAMPLEDIRS) + @$(ECHO) + @$(ECHO) Clean Units......... $(CLEAN_UNITS) + @$(ECHO) Clean Files......... $(CLEAN_FILES) + @$(ECHO) + @$(ECHO) Install Units....... $(INSTALL_UNITS) + @$(ECHO) Install Files....... $(INSTALL_FILES) + @$(ECHO) + @$(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) + @$(ECHO) Install binary dir... $(INSTALL_BINDIR) + @$(ECHO) Install library dir.. $(INSTALL_LIBDIR) + @$(ECHO) Install units dir.... $(INSTALL_UNITDIR) + @$(ECHO) Install source dir... $(INSTALL_SOURCEDIR) + @$(ECHO) Install doc dir...... $(INSTALL_DOCDIR) + @$(ECHO) Install example dir.. $(INSTALL_EXAMPLEDIR) + @$(ECHO) Install data dir..... $(INSTALL_DATADIR) + @$(ECHO) + @$(ECHO) Dist destination dir. $(DIST_DESTDIR) + @$(ECHO) Dist zip name........ $(DIST_ZIPNAME) + @$(ECHO) +.PHONY: fpc_info +fpc_info: $(INFORULES) +.PHONY: fpc_makefile fpc_makefiles fpc_makefile_sub1 fpc_makefile_sub2 \ + fpc_makefile_dirs +fpc_makefile: + $(FPCMAKE) -w -T$(OS_TARGET) Makefile.fpc +fpc_makefile_sub1: +ifdef TARGET_DIRS + $(FPCMAKE) -w -T$(OS_TARGET) $(addsuffix /Makefile.fpc,$(TARGET_DIRS)) +endif +ifdef TARGET_EXAMPLEDIRS + $(FPCMAKE) -w -T$(OS_TARGET) $(addsuffix /Makefile.fpc,$(TARGET_EXAMPLEDIRS)) +endif +fpc_makefile_sub2: $(addsuffix _makefile_dirs,$(TARGET_DIRS) $(TARGET_EXAMPLEDIRS)) +fpc_makefile_dirs: fpc_makefile_sub1 fpc_makefile_sub2 +fpc_makefiles: fpc_makefile fpc_makefile_dirs +all: fpc_all +debug: fpc_debug +smart: fpc_smart +release: fpc_release +units: fpc_units +examples: +shared: fpc_shared +install: fpc_install +sourceinstall: fpc_sourceinstall +exampleinstall: fpc_exampleinstall +distinstall: +zipinstall: +zipsourceinstall: +zipexampleinstall: +zipdistinstall: +clean: fpc_clean +distclean: fpc_distclean +cleanall: fpc_cleanall +info: fpc_info +makefiles: fpc_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 +.NOTPARALLEL: diff --git a/packages/gtk2/examples/scribble_simple/Makefile.fpc b/packages/gtk2/examples/scribble_simple/Makefile.fpc new file mode 100644 index 0000000000..cbfe93a334 --- /dev/null +++ b/packages/gtk2/examples/scribble_simple/Makefile.fpc @@ -0,0 +1,18 @@ +# +# Makefile.fpc for Free Pascal GTK 2.x.y Examples +# + +[target] +programs=scribble_simple + +[require] +packages=gtk2 + +[install] +fpcpackage=y + +[default] +fpcdir=../../../.. + +[rules] +.NOTPARALLEL: diff --git a/packages/gtk2/examples/scribble_simple/scribble_simple.pas b/packages/gtk2/examples/scribble_simple/scribble_simple.pas new file mode 100644 index 0000000000..7f43717689 --- /dev/null +++ b/packages/gtk2/examples/scribble_simple/scribble_simple.pas @@ -0,0 +1,170 @@ +program scribble_simple; + +{$mode objfpc} {$H+} + +uses glib2, gtk2, gdk2; + +var + pixmap : PGdkPixmap; (* Backing pixmap for drawing area *) + + + +(* Create a new backing pixmap of the appropriate size *) + +function configure_event ( widget : PGtkWidget; + event : PGdkEventConfigure): gboolean; cdecl; +begin + + if pixmap <> nil then + g_object_unref (pixmap); + + pixmap := gdk_pixmap_new (widget^.window, + widget^.allocation.width, + widget^.allocation.height, + -1); + gdk_draw_rectangle (pixmap, + widget^.style^.white_gc, + gTRUE, + 0, 0, + widget^.allocation.width, + widget^.allocation.height); + + configure_event := TRUE; +end; + +(* Redraw the screen from the backing pixmap *) +function expose_event ( widget : PGtkWidget; + event : PGdkEventExpose) : gboolean; cdecl; +begin + gdk_draw_drawable (widget^.window, + widget^.style^.fg_gc[GTK_WIDGET_STATE (widget)], + pixmap, + event^.area.x, event^.area.y, + event^.area.x, event^.area.y, + event^.area.width, event^.area.height); + + expose_event := FALSE; +end; + + +(* Draw a rectangle on the screen *) +procedure draw_brush (widget : PGtkWidget; + x, y : gdouble); cdecl; +var + update_rect : TGdkRectangle; + +begin + update_rect.x := round (x - 5.0); + update_rect.y := round (y - 5.0); + update_rect.width := 10; + update_rect.height := 10; + + gdk_draw_rectangle (pixmap, + widget^.style^.black_gc, + gTRUE, + update_rect.x, update_rect.y, + update_rect.width, update_rect.height); + + gtk_widget_queue_draw_area (widget, + update_rect.x, update_rect.y, + update_rect.width, update_rect.height); +end; + +function button_press_event ( widget : PGtkWidget; + event : PGdkEventbutton): gboolean; cdecl; +begin + if (event^.button = 1) and (pixmap <> NULL) then + draw_brush (widget, event^.x, event^.y); + + button_press_event := TRUE; +end; + +function motion_notify_event ( widget: PGtkWidget; + event : PGdkEventMotion): gboolean; cdecl; +var + x, y : gint; + state : TGdkModifierType; + +begin + if event^.is_hint = gTRUE then + gdk_window_get_pointer (event^.window, @x, @y, @state) + else begin + x := round (event^.x); + y := round (event^.y); + state := event^.state; + end; + + if ((state and GDK_BUTTON1_MASK) <> 0) and (pixmap <> NULL) then + draw_brush (widget, x, y); + + motion_notify_event := TRUE; +end; + +procedure quit; +begin + halt; +end; + +var + window, + drawing_area, + vbox : PGtkWidget; + + button : PGtkWidget; + +begin + gtk_init (@argc, @argv); + + window := gtk_window_new (GTK_WINDOW_TOPLEVEL); + gtk_widget_set_name (window, 'Test Input'); + + vbox := gtk_vbox_new (FALSE, 0); + gtk_container_add (GTK_CONTAINER (window), vbox); + gtk_widget_show (vbox); + + g_signal_connect (G_OBJECT (window), 'destroy', + G_CALLBACK (@quit), NULL); + + (* Create the drawing area *) + + drawing_area := gtk_drawing_area_new (); + gtk_widget_set_size_request (GTK_WIDGET (drawing_area), 200, 200); + gtk_box_pack_start (GTK_BOX (vbox), drawing_area, TRUE, TRUE, 0); + + gtk_widget_show (drawing_area); + + (* Signals used to handle backing pixmap *) + + g_signal_connect (G_OBJECT (drawing_area), 'expose_event', + G_CALLBACK (@expose_event), NULL); + + g_signal_connect (G_OBJECT (drawing_area),'configure_event', + G_CALLBACK (@configure_event), NULL); + + (* Event signals *) + + g_signal_connect (G_OBJECT (drawing_area), 'motion_notify_event', + G_CALLBACK (@motion_notify_event), NULL); + + g_signal_connect (G_OBJECT (drawing_area), 'button_press_event', + G_CALLBACK (@button_press_event), NULL); + + gtk_widget_set_events (drawing_area, GDK_EXPOSURE_MASK + or GDK_LEAVE_NOTIFY_MASK + or GDK_BUTTON_PRESS_MASK + or GDK_POINTER_MOTION_MASK + or GDK_POINTER_MOTION_HINT_MASK); + + (* .. And a quit button *) + button := gtk_button_new_with_label ('Quit'); + gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0); + + g_signal_connect_swapped (G_OBJECT (button), 'clicked', + G_CALLBACK (@gtk_widget_destroy), + window); + gtk_widget_show (button); + + gtk_widget_show (window); + + gtk_main (); +end. |