From 17b5939905ee3c624f1117bdfb89da7ab84ac61e Mon Sep 17 00:00:00 2001 From: lazarus Date: Mon, 13 Aug 2001 23:34:05 +0000 Subject: [PATCH] MWE: Made makefile.fpc files compatible with new fpcmake util. git-svn-id: trunk@331 - --- Makefile | 1951 ++++++++++++++--------------- Makefile.fpc | 73 +- components/Makefile | 1313 +++++++------------ components/Makefile.fpc | 31 +- components/synedit/Makefile | 1588 +++++++++++------------ components/synedit/Makefile.fpc | 48 +- examples/Makefile | 1443 ++++++++------------- examples/Makefile.fpc | 45 +- lcl/Makefile | 1468 +++++++++------------- lcl/Makefile.fpc | 67 +- lcl/interfaces/Makefile | 1334 +++++++------------- lcl/interfaces/Makefile.fpc | 33 +- lcl/interfaces/gtk/Makefile | 1698 ++++++++++++------------- lcl/interfaces/gtk/Makefile.fpc | 53 +- lcl/interfaces/win32/Makefile | 204 ++- lcl/interfaces/win32/Makefile.fpc | 33 +- tools/Makefile | 1244 +++++++----------- tools/Makefile.fpc | 28 +- tools/apiwizz/Makefile | 1596 +++++++++++------------ tools/apiwizz/Makefile.fpc | 31 +- 20 files changed, 6073 insertions(+), 8208 deletions(-) diff --git a/Makefile b/Makefile index 0a0429c325..127c3da0da 100644 --- a/Makefile +++ b/Makefile @@ -1,38 +1,30 @@ # -# Makefile generated by fpcmake v1.00 [2000/12/30] +# Don't edit, this file is generated by FPCMake Version 1.1 [2001/08/08] # - -defaultrule: all - -##################################################################### -# Autodetect OS (Linux or Dos or Windows NT or OS/2) -# define inUnix when running under Unix (Linux,FreeBSD) -# define inWinNT when running under WinNT -# define inOS2 when running under OS/2 -##################################################################### - -# We need only / in the path +default: all override PATH:=$(subst \,/,$(PATH)) - -# Search for PWD and determine also if we are under linux -PWD:=$(strip $(wildcard $(addsuffix /pwd.exe,$(subst ;, ,$(PATH))))) +ifeq ($(findstring ;,$(PATH)),) +inUnix=1 +SEARCHPATH:=$(filter-out .,$(subst :, ,$(PATH))) +else +SEARCHPATH:=$(subst ;, ,$(PATH)) +endif +PWD:=$(strip $(wildcard $(addsuffix /pwd.exe,$(SEARCHPATH)))) ifeq ($(PWD),) -PWD:=$(strip $(wildcard $(addsuffix /pwd,$(subst :, ,$(PATH))))) +PWD:=$(strip $(wildcard $(addsuffix /pwd,$(SEARCHPATH)))) ifeq ($(PWD),) nopwd: @echo You need the GNU utils package to use this Makefile! @echo Get ftp://ftp.freepascal.org/pub/fpc/dist/go32v2/utilgo32.zip @exit else -inUnix=1 PWD:=$(firstword $(PWD)) +SRCEXEEXT= endif else PWD:=$(firstword $(PWD)) +SRCEXEEXT=.exe endif - -# Detect NT - NT sets OS to Windows_NT -# Detect OS/2 - OS/2 has OS2_SHELL defined ifndef inUnix ifeq ($(OS),Windows_NT) inWinNT=1 @@ -41,97 +33,79 @@ ifdef OS2_SHELL inOS2=1 endif endif -endif - -# The extension of executables -ifdef inUnix -SRCEXEEXT= else -SRCEXEEXT=.exe +ifneq ($(findstring cygwin,$(MACHTYPE)),) +inCygWin=1 +endif endif - -# The path which is searched separated by spaces ifdef inUnix -SEARCHPATH=$(subst :, ,$(PATH)) +BATCHEXT=.sh else -SEARCHPATH=$(subst ;, ,$(PATH)) +ifdef inOS2 +BATCHEXT=.cmd +else +BATCHEXT=.bat +endif +endif +ifdef inUnix +PATHSEP=/ +else +PATHSEP:=$(subst /,\,/) endif - -# Base dir ifdef PWD -BASEDIR:=$(shell $(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 - -##################################################################### -# FPC version/target Detection -##################################################################### - -# What compiler to use ? ifndef FPC -# Compatibility with old makefiles ifdef PP FPC=$(PP) else +ifdef inUnix +CPU_SOURCE=$(shell uname -m) +ifeq (m68k,$(CPU_SOURCE)) +FPC=ppc68k +else +FPC=ppc386 +endif +else FPC=ppc386 endif endif +endif override FPC:=$(subst $(SRCEXEEXT),,$(FPC)) override FPC:=$(subst \,/,$(FPC))$(SRCEXEEXT) - -# Target OS ifndef OS_TARGET OS_TARGET:=$(shell $(FPC) -iTO) endif - -# Source OS ifndef OS_SOURCE OS_SOURCE:=$(shell $(FPC) -iSO) endif - -# Target CPU ifndef CPU_TARGET CPU_TARGET:=$(shell $(FPC) -iTP) endif - -# Source CPU ifndef CPU_SOURCE CPU_SOURCE:=$(shell $(FPC) -iSP) endif - -# FPC version ifndef FPC_VERSION FPC_VERSION:=$(shell $(FPC) -iV) endif - export FPC OS_TARGET OS_SOURCE CPU_TARGET CPU_SOURCE FPC_VERSION - -##################################################################### -# Pre Settings -##################################################################### - -ifndef LCLPLATFORM -LCLPLATFORM=gtk -export LCLPLATFORM -endif -##################################################################### -# FPCDIR Setting -##################################################################### - -# Test FPCDIR to look if the RTL dir exists ifdef FPCDIR override FPCDIR:=$(subst \,/,$(FPCDIR)) -ifeq ($(wildcard $(FPCDIR)/rtl),) -ifeq ($(wildcard $(FPCDIR)/units),) +ifeq ($(wildcard $(addprefix $(FPCDIR)/,rtl units)),) override FPCDIR=wrong endif -endif else override FPCDIR=wrong endif - -# Detect FPCDIR ifeq ($(FPCDIR),wrong) ifdef inUnix override FPCDIR=/usr/local/lib/fpc/$(FPC_VERSION) @@ -141,184 +115,135 @@ endif else override FPCDIR:=$(subst /$(FPC),,$(firstword $(strip $(wildcard $(addsuffix /$(FPC),$(SEARCHPATH)))))) override FPCDIR:=$(FPCDIR)/.. -ifeq ($(wildcard $(FPCDIR)/rtl),) -ifeq ($(wildcard $(FPCDIR)/units),) +ifeq ($(wildcard $(addprefix $(FPCDIR)/,rtl units)),) override FPCDIR:=$(FPCDIR)/.. -ifeq ($(wildcard $(FPCDIR)/rtl),) -ifeq ($(wildcard $(FPCDIR)/units),) +ifeq ($(wildcard $(addprefix $(FPCDIR)/,rtl units)),) override FPCDIR=c:/pp endif endif endif endif +UNITSDIR:=$(wildcard $(FPCDIR)/units/$(OS_TARGET)) +PACKAGESDIR:=$(wildcard $(FPCDIR) $(FPCDIR)/packages) +override PACKAGE_NAME=lazarus +override PACKAGE_VERSION=0.7a +DIST_DESTDIR=$(BASEDIR)/dist +ifndef LCLPLATFORM +LCLPLATFORM=gtk +export LCLPLATFORM endif -endif - -ifndef PACKAGESDIR -PACKAGESDIR=$(FPCDIR)/packages -endif -ifndef TOOLKITSDIR -TOOLKITSDIR= -endif -ifndef COMPONENTSDIR -COMPONENTSDIR= -endif - -# Create units dir -ifneq ($(FPCDIR),.) -UNITSDIR=$(FPCDIR)/units/$(OS_TARGET) -endif - -##################################################################### -# User Settings -##################################################################### - - -# Targets - -override DIROBJECTS+=$(wildcard lcl components) -override EXEOBJECTS+=lazarus -override EXAMPLEDIROBJECTS+=examples - -# Clean - -override EXTRACLEANUNITS+=$(basename $(wildcard *$(PPUEXT))) $(basename $(wildcard ./designer/*$(PPUEXT))) $(basename $(wildcard ./debugger/*$(PPUEXT))) -override EXTRACLEANFILES+=$(wildcard ./designer/*$(OEXT)) - -# Install - -PACKAGENAME=lazarus -ZIPTARGET=install - -# Defaults - -override NEEDOPT=-gl - -# Directories - -override NEEDUNITDIR=. ./lcl/units ./lcl/units/$(LCLPLATFORM) ./components/units ./designer ./debugger -override NEEDINCDIR=. ./include ./include/$(OS_TARGET) - -# Packages - -override PACKAGES+=rtl fcl gtk - -# Libraries - - -# Info - -INFOTARGET=fpc_infocfg fpc_infoobjects fpc_infoinstall - -##################################################################### -# Shell tools -##################################################################### - -# echo +override TARGET_DIRS+=lcl components tools +override TARGET_PROGRAMS+=lazarus +override TARGET_EXAMPLEDIRS+=examples +override INSTALL_BASEDIR=lib/lazarus +override COMPILER_OPTIONS+=-gl +override COMPILER_INCLUDEDIR+=. ./include ./include/$(OS_TARGET) +override COMPILER_UNITDIR+=. ./lcl/units ./lcl/units/$(LCLPLATFORM) ./components/units ./designer ./debugger ifndef ECHO -ECHO:=$(strip $(wildcard $(addsuffix /gecho$(EXEEXT),$(SEARCHPATH)))) +ECHO:=$(strip $(wildcard $(addsuffix /gecho$(SRCEXEEXT),$(SEARCHPATH)))) ifeq ($(ECHO),) ECHO:=$(strip $(wildcard $(addsuffix /echo$(SRCEXEEXT),$(SEARCHPATH)))) ifeq ($(ECHO),) -ECHO:=echo -ECHOE:=echo +ECHO= else ECHO:=$(firstword $(ECHO)) -ECHOE=$(ECHO) -E endif else ECHO:=$(firstword $(ECHO)) -ECHOE=$(ECHO) -E endif endif - -# To copy pograms +export ECHO +ifndef DATE +DATE:=$(strip $(wildcard $(addsuffix /gdate$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(DATE),) +DATE:=$(strip $(wildcard $(addsuffix /date$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(DATE),) +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= +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= +else +CPPROG:=$(firstword $(CPPROG)) +endif +endif +export CPPROG +ifndef RMPROG +RMPROG:=$(strip $(wildcard $(addsuffix /rm$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(RMPROG),) +RMPROG= +else +RMPROG:=$(firstword $(RMPROG)) +endif +endif +export RMPROG +ifndef MVPROG +MVPROG:=$(strip $(wildcard $(addsuffix /mv$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(MVPROG),) +MVPROG= +else +MVPROG:=$(firstword $(MVPROG)) +endif +endif +export MVPROG +ifndef ECHOREDIR +ECHOREDIR:=$(subst /,$(PATHSEP),$(ECHO)) +endif ifndef COPY -COPY:=cp -fp +COPY:=$(CPPROG) -fp endif - -# Copy a whole tree ifndef COPYTREE -COPYTREE:=cp -rfp +COPYTREE:=$(CPPROG) -rfp endif - -# To move pograms ifndef MOVE -MOVE:=mv -f +MOVE:=$(MVPROG) -f endif - -# Check delete program ifndef DEL -DEL:=rm -f +DEL:=$(RMPROG) -f endif - -# Check deltree program ifndef DELTREE -DELTREE:=rm -rf +DELTREE:=$(RMPROG) -rf endif - -# To install files ifndef INSTALL ifdef inUnix -INSTALL:=install -c -m 644 +INSTALL:=$(GINSTALL) -c -m 644 else INSTALL:=$(COPY) endif endif - -# To install programs ifndef INSTALLEXE ifdef inUnix -INSTALLEXE:=install -c -m 755 +INSTALLEXE:=$(GINSTALL) -c -m 755 else INSTALLEXE:=$(COPY) endif endif - -# To make a directory. ifndef MKDIR -ifdef inUnix -MKDIR:=install -m 755 -d -else -MKDIR:=ginstall -m 755 -d +MKDIR:=$(GINSTALL) -m 755 -d endif -endif - -export ECHO ECHOE COPY COPYTREE MOVE DEL DELTREE INSTALL INSTALLEXE MKDIR - -##################################################################### -# Default Tools -##################################################################### - -# assembler, redefine it if cross compiling -ifndef AS -AS=as -endif - -# linker, but probably not used -ifndef LD -LD=ld -endif - -# ppas.bat / ppas.sh -ifdef inUnix -PPAS=ppas.sh -else -ifdef inOS2 -PPAS=ppas.cmd -else -PPAS=ppas.bat -endif -endif - -# ldconfig to rebuild .so cache -ifdef inUnix -LDCONFIG=ldconfig -else -LDCONFIG= -endif - -# ppumove +export ECHOREDIR COPY COPYTREE MOVE DEL DELTREE INSTALL INSTALLEXE MKDIR ifndef PPUMOVE PPUMOVE:=$(strip $(wildcard $(addsuffix /ppumove$(SRCEXEEXT),$(SEARCHPATH)))) ifeq ($(PPUMOVE),) @@ -328,20 +253,53 @@ PPUMOVE:=$(firstword $(PPUMOVE)) endif endif export PPUMOVE - -# ppufiles -ifndef PPUFILES -PPUFILES:=$(strip $(wildcard $(addsuffix /ppufiles$(SRCEXEEXT),$(SEARCHPATH)))) -ifeq ($(PPUFILES),) -PPUFILES= +ifndef FPCMAKE +FPCMAKE:=$(strip $(wildcard $(addsuffix /fpcmake$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(FPCMAKE),) +FPCMAKE= else -PPUFILES:=$(firstword $(PPUFILES)) +FPCMAKE:=$(firstword $(FPCMAKE)) endif endif -export PPUFILES - -# Look if UPX is found for go32v2 and win32. We can't use $UPX becuase -# upx uses that one itself (PFV) +export FPCMAKE +ifndef ZIPPROG +ZIPPROG:=$(strip $(wildcard $(addsuffix /zip$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(ZIPPROG),) +ZIPPROG= +else +ZIPPROG:=$(firstword $(ZIPPROG)) +endif +endif +export ZIPPROG +ifndef TARPROG +TARPROG:=$(strip $(wildcard $(addsuffix /tar$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(TARPROG),) +TARPROG= +else +TARPROG:=$(firstword $(TARPROG)) +endif +endif +export TARPROG +ifndef AS +AS=as +endif +ifndef LD +LD=ld +endif +ifndef RC +RC=rc +endif +PPAS=ppas$(BATCHEXT) +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 @@ -361,32 +319,8 @@ UPXPROG= endif endif export UPXPROG - -# ZipProg, you can't use Zip as the var name (PFV) -ifndef ZIPPROG -ZIPPROG:=$(strip $(wildcard $(addsuffix /zip$(SRCEXEEXT),$(SEARCHPATH)))) -ifeq ($(ZIPPROG),) -ZIPPROG= -else -ZIPPROG:=$(firstword $(ZIPPROG)) -endif -endif -export ZIPPROG - ZIPOPT=-9 ZIPEXT=.zip - -# Tar -ifndef TARPROG -TARPROG:=$(strip $(wildcard $(addsuffix /tar$(SRCEXEEXT),$(SEARCHPATH)))) -ifeq ($(TARPROG),) -TARPROG= -else -TARPROG:=$(firstword $(TARPROG)) -endif -endif -export TARPROG - ifeq ($(USETAR),bz2) TAROPT=vI TAREXT=.tar.bz2 @@ -394,12 +328,6 @@ else TAROPT=vz TAREXT=.tar.gz endif - -##################################################################### -# Default extensions -##################################################################### - -# Default needed extensions (Go32v2,Linux) LOADEREXT=.as EXEEXT=.exe PPLEXT=.ppl @@ -409,10 +337,9 @@ ASMEXT=.s SMARTEXT=.sl STATICLIBEXT=.a SHAREDLIBEXT=.so +STATICLIBPREFIX=libp RSTEXT=.rst FPCMADE=fpcmade - -# Go32v1 ifeq ($(OS_TARGET),go32v1) PPUEXT=.pp1 OEXT=.o1 @@ -420,29 +347,27 @@ ASMEXT=.s1 SMARTEXT=.sl1 STATICLIBEXT=.a1 SHAREDLIBEXT=.so1 +STATICLIBPREFIX= FPCMADE=fpcmade.v1 +PACKAGESUFFIX=v1 endif - -# Go32v2 ifeq ($(OS_TARGET),go32v2) +STATICLIBPREFIX= FPCMADE=fpcmade.dos +ZIPSUFFIX=go32 endif - -# Linux ifeq ($(OS_TARGET),linux) EXEEXT= HASSHAREDLIB=1 FPCMADE=fpcmade.lnx +ZIPSUFFIX=linux endif - -# Linux ifeq ($(OS_TARGET),freebsd) EXEEXT= HASSHAREDLIB=1 FPCMADE=fpcmade.freebsd +ZIPSUFFIX=freebsd endif - -# Win32 ifeq ($(OS_TARGET),win32) PPUEXT=.ppw OEXT=.ow @@ -451,162 +376,45 @@ SMARTEXT=.slw STATICLIBEXT=.aw SHAREDLIBEXT=.dll FPCMADE=fpcmade.w32 +ZIPSUFFIX=w32 endif - -# OS/2 ifeq ($(OS_TARGET),os2) PPUEXT=.ppo ASMEXT=.so2 OEXT=.oo2 +AOUTEXT=.out SMARTEXT=.so STATICLIBEXT=.ao2 SHAREDLIBEXT=.dll FPCMADE=fpcmade.os2 +ZIPSUFFIX=emx endif - -# library prefix -LIBPREFIX=lib -ifeq ($(OS_TARGET),go32v2) -LIBPREFIX= +ifeq ($(OS_TARGET),amiga) +EXEEXT= +PPUEXT=.ppa +ASMEXT=.asm +OEXT=.o +SMARTEXT=.sl +STATICLIBEXT=.a +SHAREDLIBEXT=.library +FPCMADE=fpcmade.amg endif -ifeq ($(OS_TARGET),go32v1) -LIBPREFIX= +ifeq ($(OS_TARGET),atari) +PPUEXT=.ppt +ASMEXT=.s +OEXT=.o +SMARTEXT=.sl +STATICLIBEXT=.a +EXEEXT=.ttp +FPCMADE=fpcmade.ata endif - -# determine which .pas extension is used -ifndef PASEXT -ifdef EXEOBJECTS -override TESTPAS:=$(strip $(wildcard $(addsuffix .pas,$(firstword $(EXEOBJECTS))))) -else -override TESTPAS:=$(strip $(wildcard $(addsuffix .pas,$(firstword $(UNITOBJECTS))))) +ifdef REQUIRE_UNITSDIR +override UNITSDIR+=$(REQUIRE_UNITSDIR) endif -ifeq ($(TESTPAS),) -PASEXT=.pp -else -PASEXT=.pas +ifdef REQUIRE_PACKAGESDIR +override PACKAGESDIR+=$(REQUIRE_PACKAGESDIR) endif -endif - - -# Check if the dirs really exists, else turn it off -ifeq ($(wildcard $(UNITSDIR)),) -UNITSDIR= -endif -ifeq ($(wildcard $(TOOLKITSDIR)),) -TOOLKITSDIR= -endif -ifeq ($(wildcard $(PACKAGESDIR)),) -PACKAGESDIR= -endif -ifeq ($(wildcard $(COMPONENTSDIR)),) -COMPONENTSDIR= -endif - - -# PACKAGESDIR packages - -PACKAGERTL=1 -PACKAGEFCL=1 -PACKAGEGTK=1 - -ifdef PACKAGERTL -ifneq ($(wildcard $(FPCDIR)/rtl),) -ifneq ($(wildcard $(FPCDIR)/rtl/$(OS_TARGET)),) -PACKAGEDIR_RTL=$(FPCDIR)/rtl/$(OS_TARGET) -else -PACKAGEDIR_RTL=$(FPCDIR)/rtl -endif -ifeq ($(wildcard $(PACKAGEDIR_RTL)/$(FPCMADE)),) -override COMPILEPACKAGES+=package_rtl -package_rtl: - $(MAKE) -C $(PACKAGEDIR_RTL) all -endif -UNITDIR_RTL=$(PACKAGEDIR_RTL) -else -PACKAGEDIR_RTL= -ifneq ($(wildcard $(UNITSDIR)/rtl),) -ifneq ($(wildcard $(UNITSDIR)/rtl/$(OS_TARGET)),) -UNITDIR_RTL=$(UNITSDIR)/rtl/$(OS_TARGET) -else -UNITDIR_RTL=$(UNITSDIR)/rtl -endif -else -UNITDIR_RTL= -endif -endif -ifdef UNITDIR_RTL -override NEEDUNITDIR+=$(UNITDIR_RTL) -endif -endif -ifdef PACKAGEFCL -ifneq ($(wildcard $(FPCDIR)/fcl),) -ifneq ($(wildcard $(FPCDIR)/fcl/$(OS_TARGET)),) -PACKAGEDIR_FCL=$(FPCDIR)/fcl/$(OS_TARGET) -else -PACKAGEDIR_FCL=$(FPCDIR)/fcl -endif -ifeq ($(wildcard $(PACKAGEDIR_FCL)/$(FPCMADE)),) -override COMPILEPACKAGES+=package_fcl -package_fcl: - $(MAKE) -C $(PACKAGEDIR_FCL) all -endif -UNITDIR_FCL=$(PACKAGEDIR_FCL) -else -PACKAGEDIR_FCL= -ifneq ($(wildcard $(UNITSDIR)/fcl),) -ifneq ($(wildcard $(UNITSDIR)/fcl/$(OS_TARGET)),) -UNITDIR_FCL=$(UNITSDIR)/fcl/$(OS_TARGET) -else -UNITDIR_FCL=$(UNITSDIR)/fcl -endif -else -UNITDIR_FCL= -endif -endif -ifdef UNITDIR_FCL -override NEEDUNITDIR+=$(UNITDIR_FCL) -endif -endif -ifdef PACKAGEGTK -ifneq ($(wildcard $(PACKAGESDIR)/gtk),) -ifneq ($(wildcard $(PACKAGESDIR)/gtk/$(OS_TARGET)),) -PACKAGEDIR_GTK=$(PACKAGESDIR)/gtk/$(OS_TARGET) -else -PACKAGEDIR_GTK=$(PACKAGESDIR)/gtk -endif -ifeq ($(wildcard $(PACKAGEDIR_GTK)/$(FPCMADE)),) -override COMPILEPACKAGES+=package_gtk -package_gtk: - $(MAKE) -C $(PACKAGEDIR_GTK) all -endif -UNITDIR_GTK=$(PACKAGEDIR_GTK) -else -PACKAGEDIR_GTK= -ifneq ($(wildcard $(UNITSDIR)/gtk),) -ifneq ($(wildcard $(UNITSDIR)/gtk/$(OS_TARGET)),) -UNITDIR_GTK=$(UNITSDIR)/gtk/$(OS_TARGET) -else -UNITDIR_GTK=$(UNITSDIR)/gtk -endif -else -UNITDIR_GTK= -endif -endif -ifdef UNITDIR_GTK -override NEEDUNITDIR+=$(UNITDIR_GTK) -endif -endif - - -##################################################################### -# Default Directories -##################################################################### - -# Linux and freebsd use unix dirs with /usr/bin, /usr/lib -# When zipping use the target as default, when normal install then -# use the source os as default -ifdef ZIPNAME -# Zipinstall +ifdef ZIPINSTALL ifeq ($(OS_TARGET),linux) UNIXINSTALLDIR=1 endif @@ -614,7 +422,6 @@ ifeq ($(OS_TARGET),freebsd) UNIXINSTALLDIR=1 endif else -# Normal install ifeq ($(OS_SOURCE),linux) UNIXINSTALLDIR=1 endif @@ -622,132 +429,429 @@ ifeq ($(OS_SOURCE),freebsd) UNIXINSTALLDIR=1 endif endif - -# set the prefix directory where to install everything -ifndef PREFIXINSTALLDIR +ifndef INSTALL_PREFIX ifdef UNIXINSTALLDIR -PREFIXINSTALLDIR=/usr +INSTALL_PREFIX=/usr/local else -PREFIXINSTALLDIR=/pp +ifdef INSTALL_FPCPACKAGE +INSTALL_BASEDIR:=/pp +else +INSTALL_BASEDIR:=/$(PACKAGE_NAME) endif endif -export PREFIXINSTALLDIR - -# Where to place the resulting zip files -ifndef DESTZIPDIR -DESTZIPDIR:=$(BASEDIR) endif -export DESTZIPDIR - -##################################################################### -# Install Directories -##################################################################### - -# set the base directory where to install everything -ifndef BASEINSTALLDIR +export INSTALL_PREFIX +ifndef DIST_DESTDIR +DIST_DESTDIR:=$(BASEDIR) +endif +export DIST_DESTDIR +ifndef INSTALL_BASEDIR ifdef UNIXINSTALLDIR -BASEINSTALLDIR=$(PREFIXINSTALLDIR)/lib/fpc/$(FPC_VERSION) +ifdef INSTALL_FPCPACKAGE +INSTALL_BASEDIR:=$(INSTALL_PREFIX)/lib/fpc/$(FPC_VERSION) else -BASEINSTALLDIR=$(PREFIXINSTALLDIR) +INSTALL_BASEDIR:=$(INSTALL_PREFIX)/lib/$(PACKAGE_NAME) +endif +else +INSTALL_BASEDIR:=$(INSTALL_PREFIX) endif endif - -# set the directory where to install the binaries -ifndef BININSTALLDIR +ifndef INSTALL_BINDIR ifdef UNIXINSTALLDIR -BININSTALLDIR=$(PREFIXINSTALLDIR)/bin +INSTALL_BINDIR:=$(INSTALL_PREFIX)/bin else -BININSTALLDIR=$(BASEINSTALLDIR)/bin/$(OS_TARGET) +INSTALL_BINDIR:=$(INSTALL_BASEDIR)/bin +ifdef INSTALL_FPCPACKAGE +INSTALL_BINDIR:=$(INSTALL_BINDIR)/$(OS_TARGET) endif endif - -# set the directory where to install the units. -ifndef UNITINSTALLDIR -UNITINSTALLDIR=$(BASEINSTALLDIR)/units/$(OS_TARGET) -ifdef UNITSUBDIR -UNITINSTALLDIR:=$(UNITINSTALLDIR)/$(UNITSUBDIR) +endif +ifndef INSTALL_UNITDIR +INSTALL_UNITDIR:=$(INSTALL_BASEDIR)/units/$(OS_TARGET) +ifdef INSTALL_FPCPACKAGE +ifdef PACKAGE_NAME +INSTALL_UNITDIR:=$(INSTALL_UNITDIR)/$(PACKAGE_NAME) endif endif - -# Where to install shared libraries -ifndef LIBINSTALLDIR +endif +ifndef INSTALL_LIBDIR ifdef UNIXINSTALLDIR -LIBINSTALLDIR=$(PREFIXINSTALLDIR)/lib +INSTALL_LIBDIR:=$(INSTALL_PREFIX)/lib else -LIBINSTALLDIR=$(UNITINSTALLDIR) +INSTALL_LIBDIR:=$(INSTALL_UNITDIR) endif endif - -# Where the source files will be stored -ifndef SOURCEINSTALLDIR +ifndef INSTALL_SOURCEDIR ifdef UNIXINSTALLDIR -SOURCEINSTALLDIR=$(PREFIXINSTALLDIR)/src/fpc-$(FPC_VERSION) +ifdef INSTALL_FPCPACKAGE +INSTALL_SOURCEDIR:=$(INSTALL_PREFIX)/src/fpc-$(FPC_VERSION)/$(PACKAGE_NAME) else -SOURCEINSTALLDIR=$(BASEINSTALLDIR)/source +INSTALL_SOURCEDIR:=$(INSTALL_PREFIX)/src/$(PACKAGE_NAME)-$(PACKAGE_VERSION) endif -ifdef SOURCESUBDIR -SOURCEINSTALLDIR:=$(SOURCEINSTALLDIR)/$(SOURCESUBDIR) +else +ifdef INSTALL_FPCPACKAGE +INSTALL_SOURCEDIR:=$(INSTALL_BASEDIR)/source/$(PACKAGE_NAME) +else +INSTALL_SOURCEDIRL:=$(INSTALL_BASEDIR)/source endif endif - -# Where the doc files will be stored -ifndef DOCINSTALLDIR +endif +ifndef INSTALL_DOCDIR ifdef UNIXINSTALLDIR -DOCINSTALLDIR=$(PREFIXINSTALLDIR)/doc/fpc-$(FPC_VERSION) +ifdef INSTALL_FPCPACKAGE +INSTALL_DOCDIR:=$(INSTALL_PREFIX)/doc/fpc-$(FPC_VERSION)/$(PACKAGE_NAME) else -DOCINSTALLDIR=$(BASEINSTALLDIR)/doc +INSTALL_DOCDIR:=$(INSTALL_PREFIX)/doc/$(PACKAGE_NAME)-$(PACKAGE_VERSION) +endif +else +ifdef INSTALL_FPCPACKAGE +INSTALL_DOCDIR:=$(INSTALL_BASEDIR)/doc/$(PACKAGE_NAME) +else +INSTALL_DOCDIR:=$(INSTALL_BASEDIR)/doc endif endif - -# Where to install the examples, under linux we use the doc dir -# because the copytree command will create a subdir itself -ifndef EXAMPLEINSTALLDIR +endif +ifndef INSTALL_EXAMPLEDIR ifdef UNIXINSTALLDIR -EXAMPLEINSTALLDIR=$(DOCINSTALLDIR)/examples +ifdef INSTALL_FPCPACKAGE +INSTALL_EXAMPLEDIR:=$(INSTALL_PREFIX)/doc/fpc-$(FPC_VERSION)/examples/$(PACKAGE_NAME) else -EXAMPLEINSTALLDIR=$(BASEINSTALLDIR)/examples +INSTALL_EXAMPLEDIR:=$(INSTALL_PREFIX)/doc/$(PACKAGE_NAME)-$(PACKAGE_VERSION) endif -ifdef EXAMPLESUBDIR -EXAMPLEINSTALLDIR:=$(EXAMPLEINSTALLDIR)/$(EXAMPLESUBDIR) +else +ifdef INSTALL_FPCPACKAGE +INSTALL_EXAMPLEDIR:=$(INSTALL_BASEDIR)/examples/$(PACKAGE_NAME) +else +INSTALL_EXAMPLEDIR:=$(INSTALL_BASEDIR)/examples endif endif - -# Where the some extra (data)files will be stored -ifndef DATAINSTALLDIR -DATAINSTALLDIR=$(BASEINSTALLDIR) endif - -##################################################################### -# Redirection -##################################################################### - -ifndef REDIRFILE -REDIRFILE=log +ifndef INSTALL_DATADIR +INSTALL_DATADIR=$(INSTALL_BASEDIR) endif - -ifdef REDIR -ifndef inUnix -override FPC=redir -eo $(FPC) +ifdef inUnix +ifndef GCCLIBDIR +GCCLIBDIR:=$(shell dirname `(gcc -v 2>&1)| head -n 1| awk '{ print $$4 } '`) endif -# set the verbosity to max -override FPCOPT+=-va -override REDIR:= >> $(REDIRFILE) +ifndef OTHERLIBDIR +OTHERLIBDIR:=$(shell grep -v "^\#" /etc/ld.so.conf | awk '{ ORS=" "; print $1 }') endif - - -##################################################################### -# Compiler Command Line -##################################################################### - -# Load commandline OPTDEF and add FPC_CPU define -override FPCOPTDEF:=-d$(CPU_TARGET) - -# Load commandline OPT and add target and unit dir to be sure +export GCCLIBDIR OTHERLIB +endif +ifeq ($(OS_TARGET),linux) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_PASZLIB=1 +REQUIRE_PACKAGES_INET=1 +REQUIRE_PACKAGES_FCL=1 +REQUIRE_PACKAGES_GTK=1 +REQUIRE_PACKAGES_MYSQL=1 +REQUIRE_PACKAGES_IBASE=1 +REQUIRE_PACKAGES_X11=1 +REQUIRE_PACKAGES_OPENGL=1 +endif +ifeq ($(OS_TARGET),go32v2) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_PASZLIB=1 +REQUIRE_PACKAGES_FCL=1 +REQUIRE_PACKAGES_GTK=1 +REQUIRE_PACKAGES_OPENGL=1 +endif +ifeq ($(OS_TARGET),win32) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_PASZLIB=1 +REQUIRE_PACKAGES_FCL=1 +REQUIRE_PACKAGES_GTK=1 +REQUIRE_PACKAGES_MYSQL=1 +REQUIRE_PACKAGES_IBASE=1 +REQUIRE_PACKAGES_OPENGL=1 +endif +ifeq ($(OS_TARGET),os2) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_PASZLIB=1 +REQUIRE_PACKAGES_FCL=1 +REQUIRE_PACKAGES_GTK=1 +REQUIRE_PACKAGES_OPENGL=1 +endif +ifeq ($(OS_TARGET),freebsd) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_PASZLIB=1 +REQUIRE_PACKAGES_INET=1 +REQUIRE_PACKAGES_FCL=1 +REQUIRE_PACKAGES_GTK=1 +REQUIRE_PACKAGES_MYSQL=1 +REQUIRE_PACKAGES_IBASE=1 +REQUIRE_PACKAGES_X11=1 +REQUIRE_PACKAGES_OPENGL=1 +endif +ifeq ($(OS_TARGET),beos) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_PASZLIB=1 +REQUIRE_PACKAGES_FCL=1 +REQUIRE_PACKAGES_GTK=1 +REQUIRE_PACKAGES_OPENGL=1 +endif +ifeq ($(OS_TARGET),amiga) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_PASZLIB=1 +REQUIRE_PACKAGES_FCL=1 +REQUIRE_PACKAGES_GTK=1 +REQUIRE_PACKAGES_OPENGL=1 +endif +ifeq ($(OS_TARGET),atari) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_PASZLIB=1 +REQUIRE_PACKAGES_FCL=1 +REQUIRE_PACKAGES_GTK=1 +REQUIRE_PACKAGES_OPENGL=1 +endif +ifdef REQUIRE_PACKAGES_RTL +PACKAGEDIR_RTL:=$(subst /Makefile.fpc,,$(strip $(wildcard $(addsuffix /rtl/Makefile.fpc,$(PACKAGESDIR))))) +ifneq ($(PACKAGEDIR_RTL),) +PACKAGEDIR_RTL:=$(firstword $(PACKAGEDIR_RTL)) +ifeq ($(wildcard $(PACKAGEDIR_RTL)/$(FPCMADE)),) +override COMPILEPACKAGES+=package_rtl +package_rtl: + $(MAKE) -C $(PACKAGEDIR_RTL) all +endif +ifneq ($(wildcard $(PACKAGEDIR_RTL)/$(OS_TARGET)),) +UNITDIR_RTL=$(PACKAGEDIR_RTL)/$(OS_TARGET) +else +UNITDIR_RTL=$(PACKAGEDIR_RTL) +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_PASZLIB +PACKAGEDIR_PASZLIB:=$(subst /Makefile.fpc,,$(strip $(wildcard $(addsuffix /paszlib/Makefile.fpc,$(PACKAGESDIR))))) +ifneq ($(PACKAGEDIR_PASZLIB),) +PACKAGEDIR_PASZLIB:=$(firstword $(PACKAGEDIR_PASZLIB)) +ifeq ($(wildcard $(PACKAGEDIR_PASZLIB)/$(FPCMADE)),) +override COMPILEPACKAGES+=package_paszlib +package_paszlib: + $(MAKE) -C $(PACKAGEDIR_PASZLIB) all +endif +ifneq ($(wildcard $(PACKAGEDIR_PASZLIB)/$(OS_TARGET)),) +UNITDIR_PASZLIB=$(PACKAGEDIR_PASZLIB)/$(OS_TARGET) +else +UNITDIR_PASZLIB=$(PACKAGEDIR_PASZLIB) +endif +else +PACKAGEDIR_PASZLIB= +UNITDIR_PASZLIB:=$(subst /Package.fpc,,$(strip $(wildcard $(addsuffix /paszlib/Package.fpc,$(UNITSDIR))))) +ifneq ($(UNITDIR_PASZLIB),) +UNITDIR_PASZLIB:=$(firstword $(UNITDIR_PASZLIB)) +else +UNITDIR_PASZLIB= +endif +endif +ifdef UNITDIR_PASZLIB +override COMPILER_UNITDIR+=$(UNITDIR_PASZLIB) +endif +endif +ifdef REQUIRE_PACKAGES_INET +PACKAGEDIR_INET:=$(subst /Makefile.fpc,,$(strip $(wildcard $(addsuffix /inet/Makefile.fpc,$(PACKAGESDIR))))) +ifneq ($(PACKAGEDIR_INET),) +PACKAGEDIR_INET:=$(firstword $(PACKAGEDIR_INET)) +ifeq ($(wildcard $(PACKAGEDIR_INET)/$(FPCMADE)),) +override COMPILEPACKAGES+=package_inet +package_inet: + $(MAKE) -C $(PACKAGEDIR_INET) all +endif +ifneq ($(wildcard $(PACKAGEDIR_INET)/$(OS_TARGET)),) +UNITDIR_INET=$(PACKAGEDIR_INET)/$(OS_TARGET) +else +UNITDIR_INET=$(PACKAGEDIR_INET) +endif +else +PACKAGEDIR_INET= +UNITDIR_INET:=$(subst /Package.fpc,,$(strip $(wildcard $(addsuffix /inet/Package.fpc,$(UNITSDIR))))) +ifneq ($(UNITDIR_INET),) +UNITDIR_INET:=$(firstword $(UNITDIR_INET)) +else +UNITDIR_INET= +endif +endif +ifdef UNITDIR_INET +override COMPILER_UNITDIR+=$(UNITDIR_INET) +endif +endif +ifdef REQUIRE_PACKAGES_FCL +PACKAGEDIR_FCL:=$(subst /Makefile.fpc,,$(strip $(wildcard $(addsuffix /fcl/Makefile.fpc,$(PACKAGESDIR))))) +ifneq ($(PACKAGEDIR_FCL),) +PACKAGEDIR_FCL:=$(firstword $(PACKAGEDIR_FCL)) +ifeq ($(wildcard $(PACKAGEDIR_FCL)/$(FPCMADE)),) +override COMPILEPACKAGES+=package_fcl +package_fcl: + $(MAKE) -C $(PACKAGEDIR_FCL) all +endif +ifneq ($(wildcard $(PACKAGEDIR_FCL)/$(OS_TARGET)),) +UNITDIR_FCL=$(PACKAGEDIR_FCL)/$(OS_TARGET) +else +UNITDIR_FCL=$(PACKAGEDIR_FCL) +endif +else +PACKAGEDIR_FCL= +UNITDIR_FCL:=$(subst /Package.fpc,,$(strip $(wildcard $(addsuffix /fcl/Package.fpc,$(UNITSDIR))))) +ifneq ($(UNITDIR_FCL),) +UNITDIR_FCL:=$(firstword $(UNITDIR_FCL)) +else +UNITDIR_FCL= +endif +endif +ifdef UNITDIR_FCL +override COMPILER_UNITDIR+=$(UNITDIR_FCL) +endif +endif +ifdef REQUIRE_PACKAGES_GTK +PACKAGEDIR_GTK:=$(subst /Makefile.fpc,,$(strip $(wildcard $(addsuffix /gtk/Makefile.fpc,$(PACKAGESDIR))))) +ifneq ($(PACKAGEDIR_GTK),) +PACKAGEDIR_GTK:=$(firstword $(PACKAGEDIR_GTK)) +ifeq ($(wildcard $(PACKAGEDIR_GTK)/$(FPCMADE)),) +override COMPILEPACKAGES+=package_gtk +package_gtk: + $(MAKE) -C $(PACKAGEDIR_GTK) all +endif +ifneq ($(wildcard $(PACKAGEDIR_GTK)/$(OS_TARGET)),) +UNITDIR_GTK=$(PACKAGEDIR_GTK)/$(OS_TARGET) +else +UNITDIR_GTK=$(PACKAGEDIR_GTK) +endif +else +PACKAGEDIR_GTK= +UNITDIR_GTK:=$(subst /Package.fpc,,$(strip $(wildcard $(addsuffix /gtk/Package.fpc,$(UNITSDIR))))) +ifneq ($(UNITDIR_GTK),) +UNITDIR_GTK:=$(firstword $(UNITDIR_GTK)) +else +UNITDIR_GTK= +endif +endif +ifdef UNITDIR_GTK +override COMPILER_UNITDIR+=$(UNITDIR_GTK) +endif +endif +ifdef REQUIRE_PACKAGES_MYSQL +PACKAGEDIR_MYSQL:=$(subst /Makefile.fpc,,$(strip $(wildcard $(addsuffix /mysql/Makefile.fpc,$(PACKAGESDIR))))) +ifneq ($(PACKAGEDIR_MYSQL),) +PACKAGEDIR_MYSQL:=$(firstword $(PACKAGEDIR_MYSQL)) +ifeq ($(wildcard $(PACKAGEDIR_MYSQL)/$(FPCMADE)),) +override COMPILEPACKAGES+=package_mysql +package_mysql: + $(MAKE) -C $(PACKAGEDIR_MYSQL) all +endif +ifneq ($(wildcard $(PACKAGEDIR_MYSQL)/$(OS_TARGET)),) +UNITDIR_MYSQL=$(PACKAGEDIR_MYSQL)/$(OS_TARGET) +else +UNITDIR_MYSQL=$(PACKAGEDIR_MYSQL) +endif +else +PACKAGEDIR_MYSQL= +UNITDIR_MYSQL:=$(subst /Package.fpc,,$(strip $(wildcard $(addsuffix /mysql/Package.fpc,$(UNITSDIR))))) +ifneq ($(UNITDIR_MYSQL),) +UNITDIR_MYSQL:=$(firstword $(UNITDIR_MYSQL)) +else +UNITDIR_MYSQL= +endif +endif +ifdef UNITDIR_MYSQL +override COMPILER_UNITDIR+=$(UNITDIR_MYSQL) +endif +endif +ifdef REQUIRE_PACKAGES_IBASE +PACKAGEDIR_IBASE:=$(subst /Makefile.fpc,,$(strip $(wildcard $(addsuffix /ibase/Makefile.fpc,$(PACKAGESDIR))))) +ifneq ($(PACKAGEDIR_IBASE),) +PACKAGEDIR_IBASE:=$(firstword $(PACKAGEDIR_IBASE)) +ifeq ($(wildcard $(PACKAGEDIR_IBASE)/$(FPCMADE)),) +override COMPILEPACKAGES+=package_ibase +package_ibase: + $(MAKE) -C $(PACKAGEDIR_IBASE) all +endif +ifneq ($(wildcard $(PACKAGEDIR_IBASE)/$(OS_TARGET)),) +UNITDIR_IBASE=$(PACKAGEDIR_IBASE)/$(OS_TARGET) +else +UNITDIR_IBASE=$(PACKAGEDIR_IBASE) +endif +else +PACKAGEDIR_IBASE= +UNITDIR_IBASE:=$(subst /Package.fpc,,$(strip $(wildcard $(addsuffix /ibase/Package.fpc,$(UNITSDIR))))) +ifneq ($(UNITDIR_IBASE),) +UNITDIR_IBASE:=$(firstword $(UNITDIR_IBASE)) +else +UNITDIR_IBASE= +endif +endif +ifdef UNITDIR_IBASE +override COMPILER_UNITDIR+=$(UNITDIR_IBASE) +endif +endif +ifdef REQUIRE_PACKAGES_X11 +PACKAGEDIR_X11:=$(subst /Makefile.fpc,,$(strip $(wildcard $(addsuffix /x11/Makefile.fpc,$(PACKAGESDIR))))) +ifneq ($(PACKAGEDIR_X11),) +PACKAGEDIR_X11:=$(firstword $(PACKAGEDIR_X11)) +ifeq ($(wildcard $(PACKAGEDIR_X11)/$(FPCMADE)),) +override COMPILEPACKAGES+=package_x11 +package_x11: + $(MAKE) -C $(PACKAGEDIR_X11) all +endif +ifneq ($(wildcard $(PACKAGEDIR_X11)/$(OS_TARGET)),) +UNITDIR_X11=$(PACKAGEDIR_X11)/$(OS_TARGET) +else +UNITDIR_X11=$(PACKAGEDIR_X11) +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_OPENGL +PACKAGEDIR_OPENGL:=$(subst /Makefile.fpc,,$(strip $(wildcard $(addsuffix /opengl/Makefile.fpc,$(PACKAGESDIR))))) +ifneq ($(PACKAGEDIR_OPENGL),) +PACKAGEDIR_OPENGL:=$(firstword $(PACKAGEDIR_OPENGL)) +ifeq ($(wildcard $(PACKAGEDIR_OPENGL)/$(FPCMADE)),) +override COMPILEPACKAGES+=package_opengl +package_opengl: + $(MAKE) -C $(PACKAGEDIR_OPENGL) all +endif +ifneq ($(wildcard $(PACKAGEDIR_OPENGL)/$(OS_TARGET)),) +UNITDIR_OPENGL=$(PACKAGEDIR_OPENGL)/$(OS_TARGET) +else +UNITDIR_OPENGL=$(PACKAGEDIR_OPENGL) +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 +.PHONY: package_rtl package_paszlib package_inet package_fcl package_gtk package_mysql package_ibase package_x11 package_opengl +override FPCOPTDEF=$(CPU_TARGET) ifneq ($(OS_TARGET),$(OS_SOURCE)) override FPCOPT+=-T$(OS_TARGET) endif - -# User dirs should be first, so they are looked at first ifdef UNITDIR override FPCOPT+=$(addprefix -Fu,$(UNITDIR)) endif @@ -760,119 +864,86 @@ endif ifdef INCDIR override FPCOPT+=$(addprefix -Fi,$(INCDIR)) endif - -# Smartlinking ifdef LINKSMART override FPCOPT+=-XX endif - -# Smartlinking creation ifdef CREATESMART override FPCOPT+=-CX endif - -# Debug ifdef DEBUG -override FPCOPT+=-gl -dDEBUG +override FPCOPT+=-gl +override FPCOPTDEF+=DEBUG endif - -# Release mode (strip, optimize and don't load ppc386.cfg) -# 0.99.12b has a bug in the optimizer so don't use it by default ifdef RELEASE -ifeq ($(FPC_VERSION),0.99.12) -override FPCOPT+=-Xs -OGp3 -n -else override FPCOPT+=-Xs -OG2p3 -n +override FPCOPTDEF+=RELEASE endif -endif - -# Strip ifdef STRIP override FPCOPT+=-Xs endif - -# Optimizer ifdef OPTIMIZE override FPCOPT+=-OG2p3 endif - -# Verbose settings (warning,note,info) ifdef VERBOSE override FPCOPT+=-vwni endif - -ifdef NEEDOPT -override FPCOPT+=$(NEEDOPT) +ifdef COMPILER_OPTIONS +override FPCOPT+=$(COMPILER_OPTIONS) endif - -ifdef NEEDUNITDIR -override FPCOPT+=$(addprefix -Fu,$(NEEDUNITDIR)) +ifdef COMPILER_UNITDIR +override FPCOPT+=$(addprefix -Fu,$(COMPILER_UNITDIR)) endif - -ifdef UNITSDIR -override FPCOPT+=-Fu$(UNITSDIR) +ifdef COMPILER_LIBRARYDIR +override FPCOPT+=$(addprefix -Fl,$(COMPILER_LIBRARYDIR)) endif - -ifdef NEEDINCDIR -override FPCOPT+=$(addprefix -Fi,$(NEEDINCDIR)) +ifdef COMPILER_OBJECTDIR +override FPCOPT+=$(addprefix -Fo,$(COMPILER_OBJECTDIR)) endif - - -# Target dirs and the prefix to use for clean/install -ifdef TARGETDIR -override FPCOPT+=-FE$(TARGETDIR) -ifeq ($(TARGETDIR),.) +ifdef COMPILER_INCLUDEDIR +override FPCOPT+=$(addprefix -Fi,$(COMPILER_INCLUDEDIR)) +endif +ifdef COMPILER_TARGETDIR +override FPCOPT+=-FE$(COMPILER_TARGETDIR) +ifeq ($(COMPILER_TARGETDIR),.) override TARGETDIRPREFIX= else -override TARGETDIRPREFIX=$(TARGETDIR)/ +override TARGETDIRPREFIX=$(COMPILER_TARGETDIR)/ endif endif -ifdef UNITTARGETDIR -override FPCOPT+=-FU$(UNITTARGETDIR) -ifeq ($(UNITTARGETDIR),.) +ifdef COMPILER_UNITTARGETDIR +override FPCOPT+=-FU$(COMPILER_UNITTARGETDIR) +ifeq ($(COMPILER_UNITTARGETDIR),.) override UNITTARGETDIRPREFIX= else -override UNITTARGETDIRPREFIX=$(TARGETDIR)/ +override UNITTARGETDIRPREFIX=$(COMPILER_UNITTARGETDIR)/ endif else -ifdef TARGETDIR -override UNITTARGETDIR=$(TARGETDIR) +ifdef COMPILER_TARGETDIR +override COMPILER_UNITTARGETDIR=$(COMPILER_TARGETDIR) override UNITTARGETDIRPREFIX=$(TARGETDIRPREFIX) endif endif - -# Add commandline options last so they can override +ifdef GCCLIBDIR +override FPCOPT+=-Fl$(GCCLIBDIR) +endif +ifdef OTHERLIBDIR +override FPCOPT+=$(addprefix -Fl,$(OTHERLIBDIR)) +endif ifdef OPT override FPCOPT+=$(OPT) endif - -# Add defines from FPCOPTDEF to FPCOPT ifdef FPCOPTDEF -override FPCOPT+=$(FPCOPTDEF) +override FPCOPT+=$(addprefix -d,$(FPCOPTDEF)) endif - -# Error file ? -ifdef ERRORFILE -override FPCOPT+=-Fr$(ERRORFILE) -endif - -# Was a config file specified ? ifdef CFGFILE override FPCOPT+=@$(CFGFILE) endif - -# For win32 the options are passed using the environment FPCEXTCMD -ifeq ($(OS_SOURCE),win32) +ifdef USEENV override FPCEXTCMD:=$(FPCOPT) override FPCOPT:=!FPCEXTCMD export FPCEXTCMD endif - -# Compiler commandline override COMPILER:=$(FPC) $(FPCOPT) - -# also call ppas if with command option -s -# but only if the OS_SOURCE and OS_TARGE are equal ifeq (,$(findstring -s ,$(COMPILER))) EXECPPAS= else @@ -880,352 +951,215 @@ ifeq ($(OS_SOURCE),$(OS_TARGET)) EXECPPAS:=@$(PPAS) endif endif - -##################################################################### -# Standard rules -##################################################################### - -debug: fpc_debug $(addsuffix _debug,$(DIROBJECTS)) - -test: fpc_test - -smart: fpc_smart $(addsuffix _smart,$(DIROBJECTS)) - -shared: fpc_shared $(addsuffix _shared,$(DIROBJECTS)) - -showinstall: fpc_showinstall $(addsuffix _showinstall,$(DIROBJECTS)) - -install: fpc_install $(addsuffix _install,$(DIROBJECTS)) - -sourceinstall: fpc_sourceinstall - -exampleinstall: fpc_exampleinstall - -zipinstall: fpc_zipinstall - -zipsourceinstall: fpc_zipsourceinstall - -zipexampleinstall: fpc_zipexampleinstall - -clean: fpc_clean $(addsuffix _clean,$(DIROBJECTS)) $(addsuffix _clean,$(EXAMPLEDIROBJECTS)) - -distclean: fpc_distclean $(addsuffix _distclean,$(DIROBJECTS)) - -cleanall: fpc_cleanall $(addsuffix _cleanall,$(DIROBJECTS)) - -require: $(addsuffix _require,$(DIROBJECTS)) - -info: fpc_info - -.PHONY: debug test smart shared showinstall install sourceinstall exampleinstall zipinstall zipsourceinstall zipexampleinstall clean distclean cleanall require info - -##################################################################### -# Exes -##################################################################### - .PHONY: fpc_exes - -ifdef EXEOBJECTS -override EXEFILES=$(addsuffix $(EXEEXT),$(EXEOBJECTS)) -override EXEOFILES:=$(addsuffix $(OEXT),$(EXEOBJECTS)) $(addprefix $(LIBPREFIX),$(addsuffix $(STATICLIBEXT),$(EXEOBJECTS))) - +ifdef TARGET_PROGRAMS +override EXEFILES=$(addsuffix $(EXEEXT),$(TARGET_PROGRAMS)) +override EXEOFILES:=$(addsuffix $(OEXT),$(TARGET_PROGRAMS)) $(addprefix $(STATICLIBPREFIX),$(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 endif - fpc_exes: $(EXEFILES) - -##################################################################### -# Examples -##################################################################### - -.PHONY: fpc_examples fpc_test - -ifdef EXAMPLEOBJECTS -override EXAMPLESOURCEFILES:=$(addsuffix $(PASEXT),$(EXAMPLEOBJECTS)) -override EXAMPLEFILES:=$(addsuffix $(EXEEXT),$(EXAMPLEOBJECTS)) -override EXAMPLEOFILES:=$(addsuffix $(OEXT),$(EXAMPLEOBJECTS)) $(addprefix $(LIBPREFIX),$(addsuffix $(STATICLIBEXT),$(EXAMPLEOBJECTS))) - +ifdef TARGET_RSTS +override RSTFILES=$(addsuffix $(RSTEXT),$(TARGET_RSTS)) +override CLEANRSTFILES+=$(RSTFILES) +endif +.PHONY: fpc_examples +ifdef TARGET_EXAMPLES +HASEXAMPLES=1 +override EXAMPLESOURCEFILES:=$(wildcard $(addsuffix .pp,$(TARGET_EXAMPLES)) $(addsuffix .pas,$(TARGET_EXAMPLES))) +override EXAMPLEFILES:=$(addsuffix $(EXEEXT),$(TARGET_EXAMPLES)) +override EXAMPLEOFILES:=$(addsuffix $(OEXT),$(TARGET_EXAMPLES)) $(addprefix $(STATICLIBPREFIX),$(addsuffix $(STATICLIBEXT),$(TARGET_EXAMPLES))) override CLEANEXEFILES+=$(EXAMPLEFILES) $(EXAMPLEOFILES) +ifeq ($(OS_TARGET),os2) +override CLEANEXEFILES+=$(addsuffix $(AOUTEXT),$(TARGET_EXAMPLES)) endif - -fpc_examples: all $(EXAMPLEFILES) $(addsuffix _all,$(EXAMPLEDIROBJECTS)) - -fpc_test: examples - -##################################################################### -# General compile rules -##################################################################### - -.PHONY: fpc_packages fpc_all fpc_debug - +endif +ifdef TARGET_EXAMPLEDIRS +HASEXAMPLES=1 +endif +fpc_examples: all $(EXAMPLEFILES) $(addsuffix _all,$(TARGET_EXAMPLEDIRS)) +.PHONY: fpc_packages fpc_all fpc_smart fpc_debug $(FPCMADE): $(ALLTARGET) - @$(ECHO) Compiled > $(FPCMADE) - + @$(ECHOREDIR) Compiled > $(FPCMADE) fpc_packages: $(COMPILEPACKAGES) - fpc_all: fpc_packages $(FPCMADE) - -fpc_debug: - $(MAKE) all DEBUG=1 - -# Search paths for .ppu if targetdir is set -ifdef UNITTARGETDIR -vpath %$(PPUEXT) $(UNITTARGETDIR) -endif - -# General compile rules, available for both possible PASEXT - -.SUFFIXES: $(EXEEXT) $(PPUEXT) $(OEXT) .pas .pp - -%$(PPUEXT): %.pp - $(COMPILER) $< $(REDIR) - $(EXECPPAS) - -%$(PPUEXT): %.pas - $(COMPILER) $< $(REDIR) - $(EXECPPAS) - -%$(EXEEXT): %.pp - $(COMPILER) $< $(REDIR) - $(EXECPPAS) - -%$(EXEEXT): %.pas - $(COMPILER) $< $(REDIR) - $(EXECPPAS) - -##################################################################### -# Library -##################################################################### - -.PHONY: fpc_smart fpc_shared - -ifdef LIBVERSION -LIBFULLNAME=$(LIBNAME).$(LIBVERSION) -else -LIBFULLNAME=$(LIBNAME) -endif - -# Default sharedlib units are all unit objects -ifndef SHAREDLIBUNITOBJECTS -SHAREDLIBUNITOBJECTS:=$(UNITOBJECTS) -endif - fpc_smart: $(MAKE) all LINKSMART=1 CREATESMART=1 - -fpc_shared: all -ifdef HASSHAREDLIB -ifndef LIBNAME - @$(ECHO) "LIBNAME not set" -else - $(PPUMOVE) $(SHAREDLIBUNITOBJECTS) -o$(LIBFULLNAME) +fpc_debug: + $(MAKE) all DEBUG=1 +.SUFFIXES: $(EXEEXT) $(PPUEXT) $(OEXT) .pas .pp +%$(PPUEXT): %.pp + $(COMPILER) $< + $(EXECPPAS) +%$(PPUEXT): %.pas + $(COMPILER) $< + $(EXECPPAS) +%$(EXEEXT): %.pp + $(COMPILER) $< + $(EXECPPAS) +%$(EXEEXT): %.pas + $(COMPILER) $< + $(EXECPPAS) +vpath %.pp $(COMPILER_SOURCEDIR) $(COMPILER_INCLUDEDIR) +vpath %.pas $(COMPILER_SOURCEDIR) $(COMPILER_INCLUDEDIR) +vpath %$(PPUEXT) $(COMPILER_UNITTARGETDIR) +.PHONY: fpc_install fpc_sourceinstall fpc_exampleinstall +ifdef INSTALL_UNITS +override INSTALLPPUFILES+=$(addsuffix $(PPUEXT),$(INSTALL_UNITS)) endif -else - @$(ECHO) "Shared Libraries not supported" -endif - -##################################################################### -# Install rules -##################################################################### - -.PHONY: fpc_showinstall fpc_install - -ifdef EXTRAINSTALLUNITS -override INSTALLPPUFILES+=$(addsuffix $(PPUEXT),$(EXTRAINSTALLUNITS)) -endif - ifdef INSTALLPPUFILES +override INSTALLPPULINKFILES:=$(subst $(PPUEXT),$(OEXT),$(INSTALLPPUFILES)) $(addprefix $(STATICLIBPREFIX),$(subst $(PPUEXT),$(STATICLIBEXT),$(INSTALLPPUFILES))) override INSTALLPPUFILES:=$(addprefix $(UNITTARGETDIRPREFIX),$(INSTALLPPUFILES)) -ifdef PPUFILES -INSTALLPPULINKFILES:=$(shell $(PPUFILES) -S -O $(INSTALLPPUFILES)) -else -INSTALLPPULINKFILES:=$(wildcard $(subst $(PPUEXT),$(OEXT),$(INSTALLPPUFILES)) $(addprefix $(LIBPREFIX),$(subst $(PPUEXT),$(STATICLIBEXT),$(INSTALLPPUFILES)))) +override INSTALLPPULINKFILES:=$(wildcard $(addprefix $(UNITTARGETDIRPREFIX),$(INSTALLPPULINKFILES))) +override INSTALL_CREATEPACKAGEFPC=1 endif -override INSTALLPPULINKFILES:=$(addprefix $(UNITTARGETDIRPREFIX),$(INSTALLPPULINKFILES)) -endif - ifdef INSTALLEXEFILES override INSTALLEXEFILES:=$(addprefix $(TARGETDIRPREFIX),$(INSTALLEXEFILES)) endif - -fpc_showinstall: $(SHOWINSTALLTARGET) -ifdef INSTALLEXEFILES - @$(ECHO) -e $(addprefix "\n"$(BININSTALLDIR)/,$(INSTALLEXEFILES)) -endif -ifdef INSTALLPPUFILES - @$(ECHO) -e $(addprefix "\n"$(UNITINSTALLDIR)/,$(INSTALLPPUFILES)) -ifneq ($(INSTALLPPULINKFILES),) - @$(ECHO) -e $(addprefix "\n"$(UNITINSTALLDIR)/,$(INSTALLPPULINKFILES)) -endif -ifneq ($(wildcard $(LIBFULLNAME)),) - @$(ECHO) $(LIBINSTALLDIR)/$(LIBFULLNAME) -ifdef HASSHAREDLIB - @$(ECHO) $(LIBINSTALLDIR)/$(LIBNAME) -endif -endif -endif -ifdef EXTRAINSTALLFILES - @$(ECHO) -e $(addprefix "\n"$(DATAINSTALLDIR)/,$(EXTRAINSTALLFILES)) -endif - fpc_install: $(INSTALLTARGET) -# Create UnitInstallFiles ifdef INSTALLEXEFILES - $(MKDIR) $(BININSTALLDIR) -# Compress the exes if upx is defined + $(MKDIR) $(INSTALL_BINDIR) ifdef UPXPROG -$(UPXPROG) $(INSTALLEXEFILES) endif - $(INSTALLEXE) $(INSTALLEXEFILES) $(BININSTALLDIR) + $(INSTALLEXE) $(INSTALLEXEFILES) $(INSTALL_BINDIR) +endif +ifdef INSTALL_CREATEPACKAGEFPC +ifdef FPCMAKE +ifdef PACKAGE_VERSION +ifneq ($(wildcard Makefile.fpc),) + $(FPCMAKE) -p Makefile.fpc + $(MKDIR) $(INSTALL_UNITDIR) + $(INSTALL) Package.fpc $(INSTALL_UNITDIR) +endif +endif +endif endif ifdef INSTALLPPUFILES - $(MKDIR) $(UNITINSTALLDIR) - $(INSTALL) $(INSTALLPPUFILES) $(UNITINSTALLDIR) + $(MKDIR) $(INSTALL_UNITDIR) + $(INSTALL) $(INSTALLPPUFILES) $(INSTALL_UNITDIR) ifneq ($(INSTALLPPULINKFILES),) - $(INSTALL) $(INSTALLPPULINKFILES) $(UNITINSTALLDIR) + $(INSTALL) $(INSTALLPPULINKFILES) $(INSTALL_UNITDIR) endif -ifneq ($(wildcard $(LIBFULLNAME)),) - $(MKDIR) $(LIBINSTALLDIR) - $(INSTALL) $(LIBFULLNAME) $(LIBINSTALLDIR) +ifneq ($(wildcard $(LIB_FULLNAME)),) + $(MKDIR) $(INSTALL_LIBDIR) + $(INSTALL) $(LIB_FULLNAME) $(INSTALL_LIBDIR) ifdef inUnix - ln -sf $(LIBFULLNAME) $(LIBINSTALLDIR)/$(LIBNAME) + ln -sf $(LIB_FULLNAME) $(INSTALL_LIBDIR)/$(LIB_NAME) endif endif endif -ifdef EXTRAINSTALLFILES - $(MKDIR) $(DATAINSTALLDIR) - $(INSTALL) $(EXTRAINSTALLFILES) $(DATAINSTALLDIR) +ifdef INSTALL_FILES + $(MKDIR) $(INSTALL_DATADIR) + $(INSTALL) $(INSTALL_FILES) $(INSTALL_DATADIR) endif - -##################################################################### -# SourceInstall rules -##################################################################### - -.PHONY: fpc_sourceinstall - -ifndef SOURCETOPDIR -SOURCETOPDIR=$(BASEDIR) +fpc_sourceinstall: distclean + $(MKDIR) $(INSTALL_SOURCEDIR) + $(COPYTREE) $(BASEDIR) $(INSTALL_SOURCEDIR) +fpc_exampleinstall: $(addsuffix _distclean,$(TARGET_EXAMPLEDIRS)) +ifdef HASEXAMPLES + $(MKDIR) $(INSTALL_EXAMPLEDIR) endif - -fpc_sourceinstall: clean - $(MKDIR) $(SOURCEINSTALLDIR) - $(COPYTREE) $(SOURCETOPDIR) $(SOURCEINSTALLDIR) - -##################################################################### -# exampleinstall rules -##################################################################### - -.PHONY: fpc_exampleinstall - -fpc_exampleinstall: $(addsuffix _clean,$(EXAMPLEDIROBJECTS)) ifdef EXAMPLESOURCEFILES - $(MKDIR) $(EXAMPLEINSTALLDIR) - $(COPY) $(EXAMPLESOURCEFILES) $(EXAMPLEINSTALLDIR) + $(COPY) $(EXAMPLESOURCEFILES) $(INSTALL_EXAMPLEDIR) endif -ifdef EXAMPLEDIROBJECTS -ifndef EXAMPLESOURCEFILES - $(MKDIR) $(EXAMPLEINSTALLDIR) +ifdef TARGET_EXAMPLEDIRS + $(COPYTREE) $(addsuffix /*,$(TARGET_EXAMPLEDIRS)) $(INSTALL_EXAMPLEDIR) endif - $(COPYTREE) $(addsuffix /*,$(EXAMPLEDIROBJECTS)) $(EXAMPLEINSTALLDIR) -endif - -##################################################################### -# Zip -##################################################################### - -.PHONY: fpc_zipinstall - -# Create suffix to add -ifndef PACKAGESUFFIX -PACKAGESUFFIX=$(OS_TARGET) -ifeq ($(OS_TARGET),go32v2) -PACKAGESUFFIX=go32 -endif -ifeq ($(OS_TARGET),win32) -PACKAGESUFFIX=w32 -endif -ifeq ($(OS_TARGET),os2) -PACKAGESUFFIX=emx -endif -endif - -# Temporary path to pack a file +.PHONY: fpc_distinstall +fpc_distinstall: install exampleinstall +.PHONY: fpc_zipinstall fpc_zipsourceinstall fpc_zipexampleinstall ifndef PACKDIR ifndef inUnix -PACKDIR=$(BASEDIR)/pack_tmp +PACKDIR=$(BASEDIR)/../fpc-pack else PACKDIR=/tmp/fpc-pack endif endif - -# Maybe create default zipname from packagename ifndef ZIPNAME -ifdef PACKAGENAME -ZIPNAME=$(PACKAGEPREFIX)$(PACKAGENAME)$(PACKAGESUFFIX) +ifdef DIST_ZIPNAME +ZIPNAME=$(DIST_ZIPNAME) +else +ZIPNAME=$(ZIPPREFIX)$(PACKAGE_NAME)$(ZIPSUFFIX) +endif +endif +ifndef ZIPTARGET +ifdef DIST_ZIPTARGET +ZIPTARGET=DIST_ZIPTARGET +else +ZIPTARGET=install endif endif - -# Use tar by default under linux ifndef USEZIP ifdef inUnix USETAR=1 endif endif - -fpc_zipinstall: -ifndef ZIPNAME - @$(ECHO) "Please specify ZIPNAME!" - @exit 1 +ifndef inUnix +USEZIPWRAPPER=1 +endif +ifdef USEZIPWRAPPER +ZIPPATHSEP=$(PATHSEP) +ZIPWRAPPER=$(subst /,$(PATHSEP),$(DIST_DESTDIR)/fpczip$(BATCHEXT)) else - $(MAKE) $(ZIPTARGET) PREFIXINSTALLDIR=$(PACKDIR) +ZIPPATHSEP=/ +endif +ZIPCMD_CDPACK:=cd $(subst /,$(ZIPPATHSEP),$(PACKDIR)) +ZIPCMD_CDBASE:=cd $(subst /,$(ZIPPATHSEP),$(BASEDIR)) ifdef USETAR - $(DEL) $(DESTZIPDIR)/$(ZIPNAME)$(TAREXT) - cd $(PACKDIR) ; $(TARPROG) cf$(TAROPT) $(DESTZIPDIR)/$(ZIPNAME)$(TAREXT) * ; cd $(BASEDIR) +ZIPDESTFILE:=$(DIST_DESTDIR)/$(ZIPNAME)$(TAREXT) +ZIPCMD_ZIP:=$(TARPROG) cf$(TAROPT) $(ZIPDESTFILE) * else - $(DEL) $(DESTZIPDIR)/$(ZIPNAME)$(ZIPEXT) - cd $(PACKDIR) ; $(ZIPPROG) -Dr $(ZIPOPT) $(DESTZIPDIR)/$(ZIPNAME)$(ZIPEXT) * ; cd $(BASEDIR) +ZIPDESTFILE:=$(DIST_DESTDIR)/$(ZIPNAME)$(ZIPEXT) +ZIPCMD_ZIP:=$(subst /,$(ZIPPATHSEP),$(ZIPPROG)) -Dr $(ZIPOPT) $(ZIPDESTFILE) * +endif +fpc_zipinstall: + $(MAKE) $(ZIPTARGET) INSTALL_PREFIX=$(PACKDIR) ZIPINSTALL=1 + $(DEL) $(ZIPDESTFILE) +ifdef USEZIPWRAPPER +ifneq ($(ECHOREDIR),echo) + $(ECHOREDIR) -e "$(subst \,\\,$(ZIPCMD_CDPACK))" > $(ZIPWRAPPER) + $(ECHOREDIR) -e "$(subst \,\\,$(ZIPCMD_ZIP))" >> $(ZIPWRAPPER) + $(ECHOREDIR) -e "$(subst \,\\,$(ZIPCMD_CDBASE))" >> $(ZIPWRAPPER) +else + echo $(ZIPCMD_CDPACK) > $(ZIPWRAPPER) + echo $(ZIPCMD_ZIP) >> $(ZIPWRAPPER) + echo $(ZIPCMD_CDBASE) >> $(ZIPWRAPPER) +endif +ifdef inUnix + /bin/sh $(ZIPWRAPPER) +else + $(ZIPWRAPPER) +endif + $(DEL) $(ZIPWRAPPER) +else + $(ZIPCMD_CDPACK) ; $(ZIPCMD_ZIP) ; $(ZIPCMD_CDBASE) endif $(DELTREE) $(PACKDIR) -endif - -.PHONY: fpc_zipsourceinstall - fpc_zipsourceinstall: - $(MAKE) fpc_zipinstall ZIPTARGET=sourceinstall PACKAGESUFFIX=src - -.PHONY: fpc_zipexampleinstall - + $(MAKE) fpc_zipinstall ZIPTARGET=sourceinstall ZIPSUFFIX=src fpc_zipexampleinstall: - $(MAKE) fpc_zipinstall ZIPTARGET=exampleinstall PACKAGESUFFIX=exm - -##################################################################### -# Clean rules -##################################################################### - +ifdef HASEXAMPLES + $(MAKE) fpc_zipinstall ZIPTARGET=exampleinstall ZIPSUFFIX=exm +endif +fpc_zipdistinstall: + $(MAKE) fpc_zipinstall ZIPTARGET=distinstall .PHONY: fpc_clean fpc_cleanall fpc_distclean - ifdef EXEFILES override CLEANEXEFILES:=$(addprefix $(TARGETDIRPREFIX),$(CLEANEXEFILES)) endif - -ifdef EXTRACLEANUNITS -override CLEANPPUFILES+=$(addsuffix $(PPUEXT),$(EXTRACLEANUNITS)) +ifdef CLEAN_UNITS +override CLEANPPUFILES+=$(addsuffix $(PPUEXT),$(CLEAN_UNITS)) endif - ifdef CLEANPPUFILES +override CLEANPPULINKFILES:=$(subst $(PPUEXT),$(OEXT),$(CLEANPPUFILES)) $(addprefix $(STATICLIBPREFIX),$(subst $(PPUEXT),$(STATICLIBEXT),$(CLEANPPUFILES))) override CLEANPPUFILES:=$(addprefix $(UNITTARGETDIRPREFIX),$(CLEANPPUFILES)) -# Get the .o and .a files created for the units -ifdef PPUFILES -CLEANPPULINKFILES:=$(shell $(PPUFILES) $(CLEANPPUFILES)) -else -CLEANPPULINKFILES:=$(wildcard $(subst $(PPUEXT),$(OEXT),$(CLEANPPUFILES)) $(addprefix $(LIBPREFIX),$(subst $(PPUEXT),$(STATICLIBEXT),$(CLEANPPUFILES)))) +override CLEANPPULINKFILES:=$(wildcard $(addprefix $(UNITTARGETDIRPREFIX),$(CLEANPPULINKFILES))) endif -override CLEANPPULINKFILES:=$(addprefix $(UNITTARGETDIRPREFIX),$(CLEANPPULINKFILES)) -endif - fpc_clean: $(CLEANTARGET) ifdef CLEANEXEFILES -$(DEL) $(CLEANEXEFILES) @@ -1239,22 +1173,17 @@ endif ifdef CLEANRSTFILES -$(DEL) $(addprefix $(UNITTARGETDIRPREFIX),$(CLEANRSTFILES)) endif -ifdef EXTRACLEANFILES - -$(DEL) $(EXTRACLEANFILES) +ifdef CLEAN_FILES + -$(DEL) $(CLEAN_FILES) endif -ifdef LIBNAME - -$(DEL) $(LIBNAME) $(LIBFULLNAME) +ifdef LIB_NAME + -$(DEL) $(LIB_NAME) $(LIB_FULLNAME) endif - -$(DEL) $(FPCMADE) $(PPAS) link.res $(FPCEXTFILE) $(REDIRFILE) - -fpc_distclean: fpc_clean - -# Also run clean first if targetdir is set. Unittargetdir is always -# set if targetdir or unittargetdir is specified -ifdef UNITTARGETDIR + -$(DEL) $(FPCMADE) Package.fpc $(PPAS) link.res $(FPCEXTFILE) $(REDIRFILE) +fpc_distclean: clean +ifdef COMPILER_UNITTARGETDIR TARGETDIRCLEAN=fpc_clean endif - fpc_cleanall: $(CLEANTARGET) $(TARGETDIRCLEAN) ifdef CLEANEXEFILES -$(DEL) $(CLEANEXEFILES) @@ -1262,291 +1191,279 @@ endif -$(DEL) *$(OEXT) *$(PPUEXT) *$(RSTEXT) *$(ASMEXT) *$(STATICLIBEXT) *$(SHAREDLIBEXT) *$(PPLEXT) -$(DELTREE) *$(SMARTEXT) -$(DEL) $(FPCMADE) $(PPAS) link.res $(FPCEXTFILE) $(REDIRFILE) - -##################################################################### -# Info rules -##################################################################### - -.PHONY: fpc_info fpc_cfginfo fpc_objectinfo fpc_toolsinfo fpc_installinfo \ - fpc_dirinfo - -fpc_info: $(INFOTARGET) - -fpc_infocfg: +ifdef AOUTEXT + -$(DEL) *$(AOUTEXT) +endif +.PHONY: fpc_info +fpc_info: + @$(ECHO) + @$(ECHO) == Package info == + @$(ECHO) Package Name..... $(PACKAGE_NAME) + @$(ECHO) Package Version.. $(PACKAGE_VERSION) @$(ECHO) @$(ECHO) == Configuration info == @$(ECHO) - @$(ECHO) FPC....... $(FPC) - @$(ECHO) Version... $(FPC_VERSION) - @$(ECHO) CPU....... $(CPU_TARGET) - @$(ECHO) Source.... $(OS_SOURCE) - @$(ECHO) Target.... $(OS_TARGET) + @$(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) - -fpc_infoobjects: + @$(ECHO) == Directory info == + @$(ECHO) + @$(ECHO) Basedir......... $(BASEDIR) + @$(ECHO) FPCDir.......... $(FPCDIR) + @$(ECHO) UnitsDir........ $(UNITSDIR) + @$(ECHO) PackagesDir..... $(PACKAGESDIR) + @$(ECHO) + @$(ECHO) GCC library..... $(GCCLIBDIR) + @$(ECHO) Other library... $(OTHERLIBDIR) + @$(ECHO) + @$(ECHO) == Tools info == + @$(ECHO) + @$(ECHO) Pwd....... $(PWD) + @$(ECHO) Mv........ $(MVPROG) + @$(ECHO) Cp........ $(CPPROG) + @$(ECHO) Rm........ $(RMPROG) + @$(ECHO) GInstall.. $(GINSTALL) + @$(ECHO) Echo...... $(ECHO) + @$(ECHO) Date...... $(DATE) + @$(ECHO) FPCMake... $(FPCMAKE) + @$(ECHO) PPUMove... $(PPUMOVE) + @$(ECHO) Upx....... $(UPXPROG) + @$(ECHO) Zip....... $(ZIPPROG) @$(ECHO) @$(ECHO) == Object info == @$(ECHO) - @$(ECHO) LoaderObjects..... $(LOADEROBJECTS) - @$(ECHO) UnitObjects....... $(UNITOBJECTS) - @$(ECHO) ExeObjects........ $(EXEOBJECTS) + @$(ECHO) Target Loaders...... $(TARGET_LOADERS) + @$(ECHO) Target Units........ $(TARGET_UNITS) + @$(ECHO) Target Programs..... $(TARGET_PROGRAMS) + @$(ECHO) Target Dirs......... $(TARGET_DIRS) + @$(ECHO) Target Examples..... $(TARGET_EXAMPLES) + @$(ECHO) Target ExampleDirs.. $(TARGET_EXAMPLEDIRS) @$(ECHO) - @$(ECHO) ExtraCleanUnits... $(EXTRACLEANUNITS) - @$(ECHO) ExtraCleanFiles... $(EXTRACLEANFILES) + @$(ECHO) Clean Units......... $(CLEAN_UNITS) + @$(ECHO) Clean Files......... $(CLEAN_FILES) @$(ECHO) - @$(ECHO) ExtraInstallUnits. $(EXTRAINSTALLUNITS) - @$(ECHO) ExtraInstallFiles. $(EXTRAINSTALLFILES) - @$(ECHO) - -fpc_infoinstall: + @$(ECHO) Install Units....... $(INSTALL_UNITS) + @$(ECHO) Install Files....... $(INSTALL_FILES) @$(ECHO) @$(ECHO) == Install info == @$(ECHO) -ifdef DATE @$(ECHO) DateStr.............. $(DATESTR) -endif -ifdef PACKAGEPREFIX - @$(ECHO) PackagePrefix........ $(PACKAGEPREFIX) -endif -ifdef PACKAGENAME - @$(ECHO) PackageName.......... $(PACKAGENAME) -endif - @$(ECHO) PackageSuffix........ $(PACKAGESUFFIX) + @$(ECHO) ZipPrefix............ $(ZIPPREFIX) + @$(ECHO) ZipSuffix............ $(ZIPSUFFIX) + @$(ECHO) Install FPC Package.. $(INSTALL_FPCPACKAGE) @$(ECHO) - @$(ECHO) BaseInstallDir....... $(BASEINSTALLDIR) - @$(ECHO) BinInstallDir........ $(BININSTALLDIR) - @$(ECHO) LibInstallDir........ $(LIBINSTALLDIR) - @$(ECHO) UnitInstallDir....... $(UNITINSTALLDIR) - @$(ECHO) SourceInstallDir..... $(SOURCEINSTALLDIR) - @$(ECHO) DocInstallDir........ $(DOCINSTALLDIR) - @$(ECHO) DataInstallDir....... $(DATAINSTALLDIR) + @$(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) DestZipDir........... $(DESTZIPDIR) - @$(ECHO) ZipName.............. $(ZIPNAME) + @$(ECHO) Dist destination dir. $(DIST_DESTDIR) + @$(ECHO) Dist zip name........ $(DIST_ZIPNAME) @$(ECHO) - -##################################################################### -# Directories -##################################################################### - -OBJECTDIRLCL=1 -OBJECTDIRCOMPONENTS=1 - -# Dir lcl - -ifdef OBJECTDIRLCL -.PHONY: lcl_all lcl_debug lcl_examples lcl_test lcl_smart lcl_shared lcl_showinstall lcl_install lcl_sourceinstall lcl_exampleinstall lcl_zipinstall lcl_zipsourceinstall lcl_zipexampleinstall lcl_clean lcl_distclean lcl_cleanall lcl_require lcl_info - +TARGET_DIRS_LCL=1 +TARGET_DIRS_COMPONENTS=1 +TARGET_DIRS_TOOLS=1 +ifdef TARGET_DIRS_LCL lcl_all: $(MAKE) -C lcl all - lcl_debug: $(MAKE) -C lcl debug - -lcl_examples: - $(MAKE) -C lcl examples - -lcl_test: - $(MAKE) -C lcl test - lcl_smart: $(MAKE) -C lcl smart - +lcl_examples: + $(MAKE) -C lcl examples lcl_shared: $(MAKE) -C lcl shared - -lcl_showinstall: - $(MAKE) -C lcl showinstall - lcl_install: $(MAKE) -C lcl install - lcl_sourceinstall: $(MAKE) -C lcl sourceinstall - lcl_exampleinstall: $(MAKE) -C lcl exampleinstall - +lcl_distinstall: + $(MAKE) -C lcl distinstall lcl_zipinstall: $(MAKE) -C lcl zipinstall - lcl_zipsourceinstall: $(MAKE) -C lcl zipsourceinstall - lcl_zipexampleinstall: $(MAKE) -C lcl zipexampleinstall - +lcl_zipdistinstall: + $(MAKE) -C lcl zipdistinstall lcl_clean: $(MAKE) -C lcl clean - lcl_distclean: $(MAKE) -C lcl distclean - lcl_cleanall: $(MAKE) -C lcl cleanall - -lcl_require: - $(MAKE) -C lcl require - lcl_info: $(MAKE) -C lcl info +lcl: + $(MAKE) -C lcl all +.PHONY: lcl_all lcl_debug lcl_smart lcl_examples lcl_shared lcl_install lcl_sourceinstall lcl_exampleinstall lcl_distinstall lcl_zipinstall lcl_zipsourceinstall lcl_zipexampleinstall lcl_zipdistinstall lcl_clean lcl_distclean lcl_cleanall lcl_info lcl endif - -# Dir components - -ifdef OBJECTDIRCOMPONENTS -.PHONY: components_all components_debug components_examples components_test components_smart components_shared components_showinstall components_install components_sourceinstall components_exampleinstall components_zipinstall components_zipsourceinstall components_zipexampleinstall components_clean components_distclean components_cleanall components_require components_info - +ifdef TARGET_DIRS_COMPONENTS components_all: $(MAKE) -C components all - components_debug: $(MAKE) -C components debug - -components_examples: - $(MAKE) -C components examples - -components_test: - $(MAKE) -C components test - components_smart: $(MAKE) -C components smart - +components_examples: + $(MAKE) -C components examples components_shared: $(MAKE) -C components shared - -components_showinstall: - $(MAKE) -C components showinstall - components_install: $(MAKE) -C components install - components_sourceinstall: $(MAKE) -C components sourceinstall - components_exampleinstall: $(MAKE) -C components exampleinstall - +components_distinstall: + $(MAKE) -C components distinstall components_zipinstall: $(MAKE) -C components zipinstall - components_zipsourceinstall: $(MAKE) -C components zipsourceinstall - components_zipexampleinstall: $(MAKE) -C components zipexampleinstall - +components_zipdistinstall: + $(MAKE) -C components zipdistinstall components_clean: $(MAKE) -C components clean - components_distclean: $(MAKE) -C components distclean - components_cleanall: $(MAKE) -C components cleanall - -components_require: - $(MAKE) -C components require - components_info: $(MAKE) -C components info +components: + $(MAKE) -C components all +.PHONY: components_all components_debug components_smart components_examples components_shared components_install components_sourceinstall components_exampleinstall components_distinstall components_zipinstall components_zipsourceinstall components_zipexampleinstall components_zipdistinstall components_clean components_distclean components_cleanall components_info components endif -EXAMPLEDIREXAMPLES=1 - -# Dir examples - -ifdef EXAMPLEDIREXAMPLES -.PHONY: examples_all examples_debug examples_examples examples_test examples_smart examples_shared examples_showinstall examples_install examples_sourceinstall examples_exampleinstall examples_zipinstall examples_zipsourceinstall examples_zipexampleinstall examples_clean examples_distclean examples_cleanall examples_require examples_info - +ifdef TARGET_DIRS_TOOLS +tools_all: + $(MAKE) -C tools all +tools_debug: + $(MAKE) -C tools debug +tools_smart: + $(MAKE) -C tools smart +tools_examples: + $(MAKE) -C tools examples +tools_shared: + $(MAKE) -C tools shared +tools_install: + $(MAKE) -C tools install +tools_sourceinstall: + $(MAKE) -C tools sourceinstall +tools_exampleinstall: + $(MAKE) -C tools exampleinstall +tools_distinstall: + $(MAKE) -C tools distinstall +tools_zipinstall: + $(MAKE) -C tools zipinstall +tools_zipsourceinstall: + $(MAKE) -C tools zipsourceinstall +tools_zipexampleinstall: + $(MAKE) -C tools zipexampleinstall +tools_zipdistinstall: + $(MAKE) -C tools zipdistinstall +tools_clean: + $(MAKE) -C tools clean +tools_distclean: + $(MAKE) -C tools distclean +tools_cleanall: + $(MAKE) -C tools cleanall +tools_info: + $(MAKE) -C tools info +tools: + $(MAKE) -C tools all +.PHONY: tools_all tools_debug tools_smart tools_examples tools_shared tools_install tools_sourceinstall tools_exampleinstall tools_distinstall tools_zipinstall tools_zipsourceinstall tools_zipexampleinstall tools_zipdistinstall tools_clean tools_distclean tools_cleanall tools_info tools +endif +TARGET_EXAMPLEDIRS_EXAMPLES=1 +ifdef TARGET_EXAMPLEDIRS_EXAMPLES examples_all: $(MAKE) -C examples all - examples_debug: $(MAKE) -C examples debug - -examples_examples: - $(MAKE) -C examples examples - -examples_test: - $(MAKE) -C examples test - examples_smart: $(MAKE) -C examples smart - +examples_examples: + $(MAKE) -C examples examples examples_shared: $(MAKE) -C examples shared - -examples_showinstall: - $(MAKE) -C examples showinstall - examples_install: $(MAKE) -C examples install - examples_sourceinstall: $(MAKE) -C examples sourceinstall - examples_exampleinstall: $(MAKE) -C examples exampleinstall - +examples_distinstall: + $(MAKE) -C examples distinstall examples_zipinstall: $(MAKE) -C examples zipinstall - examples_zipsourceinstall: $(MAKE) -C examples zipsourceinstall - examples_zipexampleinstall: $(MAKE) -C examples zipexampleinstall - +examples_zipdistinstall: + $(MAKE) -C examples zipdistinstall examples_clean: $(MAKE) -C examples clean - examples_distclean: $(MAKE) -C examples distclean - examples_cleanall: $(MAKE) -C examples cleanall - -examples_require: - $(MAKE) -C examples require - examples_info: $(MAKE) -C examples info +examples: + $(MAKE) -C examples all +.PHONY: examples_all examples_debug examples_smart examples_examples examples_shared examples_install examples_sourceinstall examples_exampleinstall examples_distinstall examples_zipinstall examples_zipsourceinstall examples_zipexampleinstall examples_zipdistinstall examples_clean examples_distclean examples_cleanall examples_info examples endif - -##################################################################### -# Local Makefile -##################################################################### - +debug: fpc_debug +smart: fpc_smart +shared: $(addsuffix _shared,$(TARGET_DIRS)) +install: fpc_install $(addsuffix _install,$(TARGET_DIRS)) +sourceinstall: fpc_sourceinstall +exampleinstall: fpc_exampleinstall $(addsuffix _exampleinstall,$(TARGET_DIRS)) +distinstall: fpc_distinstall +zipinstall: fpc_zipinstall +zipsourceinstall: fpc_zipsourceinstall +zipexampleinstall: fpc_zipexampleinstall $(addsuffix _zipexampleinstall,$(TARGET_DIRS)) +zipdistinstall: fpc_zipdistinstall $(addsuffix _zipdistinstall,$(TARGET_DIRS)) +clean: fpc_clean $(addsuffix _clean,$(TARGET_DIRS)) $(addsuffix _clean,$(TARGET_EXAMPLEDIRS)) +distclean: fpc_distclean $(addsuffix _distclean,$(TARGET_DIRS)) +cleanall: fpc_cleanall $(addsuffix _cleanall,$(TARGET_DIRS)) +info: fpc_info +.PHONY: debug smart shared install sourceinstall exampleinstall distinstall zipinstall zipsourceinstall zipexampleinstall zipdistinstall clean distclean cleanall info ifneq ($(wildcard fpcmake.loc),) include fpcmake.loc endif - -##################################################################### -# Users rules -##################################################################### - -.PHONY: examples lcl components ide tools - +.SUFFIXES: .rc .res +%.res: %.rc + windres -i $< -o $@ +.PHONY: examples lcl components ide tools all win32 lcl: lcl_all - -examples: lcl - $(MAKE) -C examples - +examples: lcl examples_all components: lcl components_all - ide: $(MAKE) --assume-new=lazarus.pp lazarus$(EXEEXT) - -tools: lcl components - $(MAKE) -C tools - +tools: lcl components tools_all all: lcl components ide - -# Win32-specific rules win32: $(MAKE) lazarus.res - $(MAKE) -k all examples tools LCLPLATFORM=win32 OPT=-dSUPPORTS_RESOURCES - -lazarus.res: lazarus.rc - windres -i lazarus.rc -o lazarus.res - + $(MAKE) all LCLPLATFORM=win32 OPT=-dSUPPORTS_RESOURCES +makefile: Makefile.fpc + -$(FPCMAKE) -w +makefiles: makefile + $(MAKE) -C components makefiles + $(MAKE) -C lcl makefiles + $(MAKE) -C tools makefiles diff --git a/Makefile.fpc b/Makefile.fpc index 8b2af777fd..4d38268289 100644 --- a/Makefile.fpc +++ b/Makefile.fpc @@ -2,58 +2,75 @@ # Makefile.fpc for Lazarus for Free Pascal # -[targets] -programs=lazarus -dirs=lcl components -exampledirs=examples - -[clean] -units=$(basename $(wildcard *$(PPUEXT))) $(basename $(wildcard ./designer/*$(PPUEXT))) $(basename $(wildcard ./debugger/*$(PPUEXT))) -files=$(wildcard ./designer/*$(OEXT)) +[package] +name=lazarus +version=0.7a [require] -rtl=1 -options=-gl -packages=fcl gtk +#rtl=1 +#options=-gl +packages=rtl fcl gtk -[dirs] -# not with the lazarusmake.ini -# targetdir=. +[target] +programs=lazarus +dirs=lcl components tools +exampledirs=examples + +[compiler] +options=-gl unitdir=. ./lcl/units ./lcl/units/$(LCLPLATFORM) ./components/units ./designer ./debugger -incdir=. ./include ./include/$(OS_TARGET) +includedir=. ./include ./include/$(OS_TARGET) + +[clean] +#units=$(basename $(wildcard *$(PPUEXT))) $(basename $(wildcard ./designer/*$(PPUEXT))) $(basename $(wildcard ./debugger/*$(PPUEXT))) +#files=$(wildcard ./designer/*$(OEXT)) [install] -packagename=lazarus +basedir=lib/lazarus +#prefixdir=/usr + +[prerules] +DIST_DESTDIR=$(BASEDIR)/dist -[presettings] ifndef LCLPLATFORM LCLPLATFORM=gtk export LCLPLATFORM endif - [rules] -.PHONY: examples lcl components ide tools +.SUFFIXES: .rc .res +%.res: %.rc + windres -i $< -o $@ + + +.PHONY: examples lcl components ide tools all win32 lcl: lcl_all -examples: lcl - $(MAKE) -C examples +examples: lcl examples_all components: lcl components_all ide: $(MAKE) --assume-new=lazarus.pp lazarus$(EXEEXT) -tools: lcl components - $(MAKE) -C tools +tools: lcl components tools_all all: lcl components ide -# Win32-specific rules win32: - $(MAKE) lazarus.res - $(MAKE) .PHONY LCLPLATFORM=win32 OPT=-dSUPPORTS_RESOURCES + $(MAKE) lazarus.res + $(MAKE) all LCLPLATFORM=win32 OPT=-dSUPPORTS_RESOURCES + +# MWE: moved to a more generic rule +#lazarus.res: lazarus.rc +# windres -i lazarus.rc -o lazarus.res + +makefile: Makefile.fpc + -$(FPCMAKE) -w + +makefiles: makefile + $(MAKE) -C components makefiles + $(MAKE) -C lcl makefiles + $(MAKE) -C tools makefiles -lazarus.res: lazarus.rc - windres -i lazarus.rc -o lazarus.res diff --git a/components/Makefile b/components/Makefile index dd9ba213ae..013639d2f2 100644 --- a/components/Makefile +++ b/components/Makefile @@ -1,38 +1,30 @@ # -# Makefile generated by fpcmake v1.00 [2001/01/09] +# Don't edit, this file is generated by FPCMake Version 1.1 [2001/08/08] # - -defaultrule: all - -##################################################################### -# Autodetect OS (Linux or Dos or Windows NT or OS/2) -# define inUnix when running under Unix (Linux,FreeBSD) -# define inWinNT when running under WinNT -# define inOS2 when running under OS/2 -##################################################################### - -# We need only / in the path +default: all override PATH:=$(subst \,/,$(PATH)) - -# Search for PWD and determine also if we are under linux -PWD:=$(strip $(wildcard $(addsuffix /pwd.exe,$(subst ;, ,$(PATH))))) +ifeq ($(findstring ;,$(PATH)),) +inUnix=1 +SEARCHPATH:=$(filter-out .,$(subst :, ,$(PATH))) +else +SEARCHPATH:=$(subst ;, ,$(PATH)) +endif +PWD:=$(strip $(wildcard $(addsuffix /pwd.exe,$(SEARCHPATH)))) ifeq ($(PWD),) -PWD:=$(strip $(wildcard $(addsuffix /pwd,$(subst :, ,$(PATH))))) +PWD:=$(strip $(wildcard $(addsuffix /pwd,$(SEARCHPATH)))) ifeq ($(PWD),) nopwd: @echo You need the GNU utils package to use this Makefile! @echo Get ftp://ftp.freepascal.org/pub/fpc/dist/go32v2/utilgo32.zip @exit else -inUnix=1 PWD:=$(firstword $(PWD)) +SRCEXEEXT= endif else PWD:=$(firstword $(PWD)) +SRCEXEEXT=.exe endif - -# Detect NT - NT sets OS to Windows_NT -# Detect OS/2 - OS/2 has OS2_SHELL defined ifndef inUnix ifeq ($(OS),Windows_NT) inWinNT=1 @@ -41,16 +33,11 @@ ifdef OS2_SHELL inOS2=1 endif endif -endif - -# The extension of executables -ifdef inUnix -SRCEXEEXT= else -SRCEXEEXT=.exe +ifneq ($(findstring cygwin,$(MACHTYPE)),) +inCygWin=1 +endif endif - -# The extension of batch files / scripts ifdef inUnix BATCHEXT=.sh else @@ -60,97 +47,65 @@ else BATCHEXT=.bat endif endif - -# Path Separator, the subst trick is necessary for the \ that can't exists -# at the end of a line ifdef inUnix PATHSEP=/ else -PATHSEP=$(subst /,\,/) +PATHSEP:=$(subst /,\,/) endif - -# The path which is searched separated by spaces -ifdef inUnix -SEARCHPATH=$(subst :, ,$(PATH)) -else -SEARCHPATH=$(subst ;, ,$(PATH)) -endif - -# Base dir ifdef PWD -BASEDIR:=$(shell $(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 - -##################################################################### -# FPC version/target Detection -##################################################################### - -# What compiler to use ? ifndef FPC -# Compatibility with old makefiles ifdef PP FPC=$(PP) else +ifdef inUnix +CPU_SOURCE=$(shell uname -m) +ifeq (m68k,$(CPU_SOURCE)) +FPC=ppc68k +else +FPC=ppc386 +endif +else FPC=ppc386 endif endif +endif override FPC:=$(subst $(SRCEXEEXT),,$(FPC)) override FPC:=$(subst \,/,$(FPC))$(SRCEXEEXT) - -# Target OS ifndef OS_TARGET OS_TARGET:=$(shell $(FPC) -iTO) endif - -# Source OS ifndef OS_SOURCE OS_SOURCE:=$(shell $(FPC) -iSO) endif - -# Target CPU ifndef CPU_TARGET CPU_TARGET:=$(shell $(FPC) -iTP) endif - -# Source CPU ifndef CPU_SOURCE CPU_SOURCE:=$(shell $(FPC) -iSP) endif - -# FPC version ifndef FPC_VERSION FPC_VERSION:=$(shell $(FPC) -iV) endif - export FPC OS_TARGET OS_SOURCE CPU_TARGET CPU_SOURCE FPC_VERSION - -##################################################################### -# Pre Settings -##################################################################### - -ifndef LCLPLATFORM -LCLPLATFORM=gtk -export LCLPLATFORM -endif -##################################################################### -# FPCDIR Setting -##################################################################### - -# Test FPCDIR to look if the RTL dir exists ifdef FPCDIR override FPCDIR:=$(subst \,/,$(FPCDIR)) -ifeq ($(wildcard $(FPCDIR)/rtl),) -ifeq ($(wildcard $(FPCDIR)/units),) +ifeq ($(wildcard $(addprefix $(FPCDIR)/,rtl units)),) override FPCDIR=wrong endif -endif else override FPCDIR=wrong endif - -# Detect FPCDIR ifeq ($(FPCDIR),wrong) ifdef inUnix override FPCDIR=/usr/local/lib/fpc/$(FPC_VERSION) @@ -160,157 +115,129 @@ endif else override FPCDIR:=$(subst /$(FPC),,$(firstword $(strip $(wildcard $(addsuffix /$(FPC),$(SEARCHPATH)))))) override FPCDIR:=$(FPCDIR)/.. -ifeq ($(wildcard $(FPCDIR)/rtl),) -ifeq ($(wildcard $(FPCDIR)/units),) +ifeq ($(wildcard $(addprefix $(FPCDIR)/,rtl units)),) override FPCDIR:=$(FPCDIR)/.. -ifeq ($(wildcard $(FPCDIR)/rtl),) -ifeq ($(wildcard $(FPCDIR)/units),) +ifeq ($(wildcard $(addprefix $(FPCDIR)/,rtl units)),) override FPCDIR=c:/pp endif endif endif endif +UNITSDIR:=$(wildcard $(FPCDIR)/units/$(OS_TARGET)) +PACKAGESDIR:=$(wildcard $(FPCDIR) $(FPCDIR)/packages) +override PACKAGE_NAME=lazarus-components +override PACKAGE_VERSION=0.7a +DIST_DESTDIR=$(BASEDIR)/../dist +ifndef LCLPLATFORM +LCLPLATFORM=gtk +export LCLPLATFORM endif -endif - -##################################################################### -# User Settings -##################################################################### - - -# Targets - -override DIROBJECTS+=$(wildcard synedit mwedit) - -# Clean - - -# Install - -override EXTRAINSTALLUNITS+=$(notdir $(basename $(wildcard $(UNITTARGETDIR)/*$(PPUEXT)))) -PACKAGENAME=components -ZIPTARGET=install - -# Defaults - - -# Directories - -ifndef UNITTARGETDIR -UNITTARGETDIR=./units -endif - -# Packages - - -# Libraries - - -# Info - -INFOTARGET=fpc_infocfg fpc_infoobjects fpc_infoinstall - -##################################################################### -# Shell tools -##################################################################### - -# echo +override TARGET_DIRS+=synedit ifndef ECHO -ECHO:=$(strip $(wildcard $(addsuffix /gecho$(EXEEXT),$(SEARCHPATH)))) +ECHO:=$(strip $(wildcard $(addsuffix /gecho$(SRCEXEEXT),$(SEARCHPATH)))) ifeq ($(ECHO),) ECHO:=$(strip $(wildcard $(addsuffix /echo$(SRCEXEEXT),$(SEARCHPATH)))) ifeq ($(ECHO),) -ECHO:=echo -ECHOE:=echo +ECHO= else ECHO:=$(firstword $(ECHO)) -ECHOE=$(ECHO) -E endif else ECHO:=$(firstword $(ECHO)) -ECHOE=$(ECHO) -E endif endif - -# To copy pograms +export ECHO +ifndef DATE +DATE:=$(strip $(wildcard $(addsuffix /gdate$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(DATE),) +DATE:=$(strip $(wildcard $(addsuffix /date$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(DATE),) +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= +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= +else +CPPROG:=$(firstword $(CPPROG)) +endif +endif +export CPPROG +ifndef RMPROG +RMPROG:=$(strip $(wildcard $(addsuffix /rm$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(RMPROG),) +RMPROG= +else +RMPROG:=$(firstword $(RMPROG)) +endif +endif +export RMPROG +ifndef MVPROG +MVPROG:=$(strip $(wildcard $(addsuffix /mv$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(MVPROG),) +MVPROG= +else +MVPROG:=$(firstword $(MVPROG)) +endif +endif +export MVPROG +ifndef ECHOREDIR +ECHOREDIR:=$(subst /,$(PATHSEP),$(ECHO)) +endif ifndef COPY -COPY:=cp -fp +COPY:=$(CPPROG) -fp endif - -# Copy a whole tree ifndef COPYTREE -COPYTREE:=cp -rfp +COPYTREE:=$(CPPROG) -rfp endif - -# To move pograms ifndef MOVE -MOVE:=mv -f +MOVE:=$(MVPROG) -f endif - -# Check delete program ifndef DEL -DEL:=rm -f +DEL:=$(RMPROG) -f endif - -# Check deltree program ifndef DELTREE -DELTREE:=rm -rf +DELTREE:=$(RMPROG) -rf endif - -# To install files ifndef INSTALL ifdef inUnix -INSTALL:=install -c -m 644 +INSTALL:=$(GINSTALL) -c -m 644 else INSTALL:=$(COPY) endif endif - -# To install programs ifndef INSTALLEXE ifdef inUnix -INSTALLEXE:=install -c -m 755 +INSTALLEXE:=$(GINSTALL) -c -m 755 else INSTALLEXE:=$(COPY) endif endif - -# To make a directory. ifndef MKDIR -ifdef inUnix -MKDIR:=install -m 755 -d -else -MKDIR:=ginstall -m 755 -d +MKDIR:=$(GINSTALL) -m 755 -d endif -endif - -export ECHO ECHOE COPY COPYTREE MOVE DEL DELTREE INSTALL INSTALLEXE MKDIR - -##################################################################### -# Default Tools -##################################################################### - -# assembler, redefine it if cross compiling -ifndef AS -AS=as -endif - -# linker, but probably not used -ifndef LD -LD=ld -endif - -# ppas.bat / ppas.sh -PPAS=ppas$(BATCHEXT) - -# ldconfig to rebuild .so cache -ifdef inUnix -LDCONFIG=ldconfig -else -LDCONFIG= -endif - -# ppumove +export ECHOREDIR COPY COPYTREE MOVE DEL DELTREE INSTALL INSTALLEXE MKDIR ifndef PPUMOVE PPUMOVE:=$(strip $(wildcard $(addsuffix /ppumove$(SRCEXEEXT),$(SEARCHPATH)))) ifeq ($(PPUMOVE),) @@ -320,20 +247,53 @@ PPUMOVE:=$(firstword $(PPUMOVE)) endif endif export PPUMOVE - -# ppufiles -ifndef PPUFILES -PPUFILES:=$(strip $(wildcard $(addsuffix /ppufiles$(SRCEXEEXT),$(SEARCHPATH)))) -ifeq ($(PPUFILES),) -PPUFILES= +ifndef FPCMAKE +FPCMAKE:=$(strip $(wildcard $(addsuffix /fpcmake$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(FPCMAKE),) +FPCMAKE= else -PPUFILES:=$(firstword $(PPUFILES)) +FPCMAKE:=$(firstword $(FPCMAKE)) endif endif -export PPUFILES - -# Look if UPX is found for go32v2 and win32. We can't use $UPX becuase -# upx uses that one itself (PFV) +export FPCMAKE +ifndef ZIPPROG +ZIPPROG:=$(strip $(wildcard $(addsuffix /zip$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(ZIPPROG),) +ZIPPROG= +else +ZIPPROG:=$(firstword $(ZIPPROG)) +endif +endif +export ZIPPROG +ifndef TARPROG +TARPROG:=$(strip $(wildcard $(addsuffix /tar$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(TARPROG),) +TARPROG= +else +TARPROG:=$(firstword $(TARPROG)) +endif +endif +export TARPROG +ifndef AS +AS=as +endif +ifndef LD +LD=ld +endif +ifndef RC +RC=rc +endif +PPAS=ppas$(BATCHEXT) +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 @@ -353,32 +313,8 @@ UPXPROG= endif endif export UPXPROG - -# ZipProg, you can't use Zip as the var name (PFV) -ifndef ZIPPROG -ZIPPROG:=$(strip $(wildcard $(addsuffix /zip$(SRCEXEEXT),$(SEARCHPATH)))) -ifeq ($(ZIPPROG),) -ZIPPROG= -else -ZIPPROG:=$(firstword $(ZIPPROG)) -endif -endif -export ZIPPROG - ZIPOPT=-9 ZIPEXT=.zip - -# Tar -ifndef TARPROG -TARPROG:=$(strip $(wildcard $(addsuffix /tar$(SRCEXEEXT),$(SEARCHPATH)))) -ifeq ($(TARPROG),) -TARPROG= -else -TARPROG:=$(firstword $(TARPROG)) -endif -endif -export TARPROG - ifeq ($(USETAR),bz2) TAROPT=vI TAREXT=.tar.bz2 @@ -386,12 +322,6 @@ else TAROPT=vz TAREXT=.tar.gz endif - -##################################################################### -# Default extensions -##################################################################### - -# Default needed extensions (Go32v2,Linux) LOADEREXT=.as EXEEXT=.exe PPLEXT=.ppl @@ -401,10 +331,9 @@ ASMEXT=.s SMARTEXT=.sl STATICLIBEXT=.a SHAREDLIBEXT=.so +STATICLIBPREFIX=libp RSTEXT=.rst FPCMADE=fpcmade - -# Go32v1 ifeq ($(OS_TARGET),go32v1) PPUEXT=.pp1 OEXT=.o1 @@ -412,29 +341,27 @@ ASMEXT=.s1 SMARTEXT=.sl1 STATICLIBEXT=.a1 SHAREDLIBEXT=.so1 +STATICLIBPREFIX= FPCMADE=fpcmade.v1 +PACKAGESUFFIX=v1 endif - -# Go32v2 ifeq ($(OS_TARGET),go32v2) +STATICLIBPREFIX= FPCMADE=fpcmade.dos +ZIPSUFFIX=go32 endif - -# Linux ifeq ($(OS_TARGET),linux) EXEEXT= HASSHAREDLIB=1 FPCMADE=fpcmade.lnx +ZIPSUFFIX=linux endif - -# Linux ifeq ($(OS_TARGET),freebsd) EXEEXT= HASSHAREDLIB=1 FPCMADE=fpcmade.freebsd +ZIPSUFFIX=freebsd endif - -# Win32 ifeq ($(OS_TARGET),win32) PPUEXT=.ppw OEXT=.ow @@ -443,53 +370,45 @@ SMARTEXT=.slw STATICLIBEXT=.aw SHAREDLIBEXT=.dll FPCMADE=fpcmade.w32 +ZIPSUFFIX=w32 endif - -# OS/2 ifeq ($(OS_TARGET),os2) PPUEXT=.ppo ASMEXT=.so2 OEXT=.oo2 +AOUTEXT=.out SMARTEXT=.so STATICLIBEXT=.ao2 SHAREDLIBEXT=.dll FPCMADE=fpcmade.os2 +ZIPSUFFIX=emx endif - -# library prefix -LIBPREFIX=lib -ifeq ($(OS_TARGET),go32v2) -LIBPREFIX= +ifeq ($(OS_TARGET),amiga) +EXEEXT= +PPUEXT=.ppa +ASMEXT=.asm +OEXT=.o +SMARTEXT=.sl +STATICLIBEXT=.a +SHAREDLIBEXT=.library +FPCMADE=fpcmade.amg endif -ifeq ($(OS_TARGET),go32v1) -LIBPREFIX= +ifeq ($(OS_TARGET),atari) +PPUEXT=.ppt +ASMEXT=.s +OEXT=.o +SMARTEXT=.sl +STATICLIBEXT=.a +EXEEXT=.ttp +FPCMADE=fpcmade.ata endif - -# determine which .pas extension is used -ifndef PASEXT -ifdef EXEOBJECTS -override TESTPAS:=$(strip $(wildcard $(addsuffix .pas,$(firstword $(EXEOBJECTS))))) -else -override TESTPAS:=$(strip $(wildcard $(addsuffix .pas,$(firstword $(UNITOBJECTS))))) +ifdef REQUIRE_UNITSDIR +override UNITSDIR+=$(REQUIRE_UNITSDIR) endif -ifeq ($(TESTPAS),) -PASEXT=.pp -else -PASEXT=.pas +ifdef REQUIRE_PACKAGESDIR +override PACKAGESDIR+=$(REQUIRE_PACKAGESDIR) endif -endif - - - -##################################################################### -# Default Directories -##################################################################### - -# Linux and freebsd use unix dirs with /usr/bin, /usr/lib -# When zipping use the target as default, when normal install then -# use the source os as default -ifdef ZIPNAME -# Zipinstall +ifdef ZIPINSTALL ifeq ($(OS_TARGET),linux) UNIXINSTALLDIR=1 endif @@ -497,7 +416,6 @@ ifeq ($(OS_TARGET),freebsd) UNIXINSTALLDIR=1 endif else -# Normal install ifeq ($(OS_SOURCE),linux) UNIXINSTALLDIR=1 endif @@ -505,132 +423,110 @@ ifeq ($(OS_SOURCE),freebsd) UNIXINSTALLDIR=1 endif endif - -# set the prefix directory where to install everything -ifndef PREFIXINSTALLDIR +ifndef INSTALL_PREFIX ifdef UNIXINSTALLDIR -PREFIXINSTALLDIR=/usr +INSTALL_PREFIX=/usr/local else -PREFIXINSTALLDIR=/pp +ifdef INSTALL_FPCPACKAGE +INSTALL_BASEDIR:=/pp +else +INSTALL_BASEDIR:=/$(PACKAGE_NAME) endif endif -export PREFIXINSTALLDIR - -# Where to place the resulting zip files -ifndef DESTZIPDIR -DESTZIPDIR:=$(BASEDIR) endif -export DESTZIPDIR - -##################################################################### -# Install Directories -##################################################################### - -# set the base directory where to install everything -ifndef BASEINSTALLDIR +export INSTALL_PREFIX +ifndef DIST_DESTDIR +DIST_DESTDIR:=$(BASEDIR) +endif +export DIST_DESTDIR +ifndef INSTALL_BASEDIR ifdef UNIXINSTALLDIR -BASEINSTALLDIR=$(PREFIXINSTALLDIR)/lib/lazarus/$(FPC_VERSION) +ifdef INSTALL_FPCPACKAGE +INSTALL_BASEDIR:=$(INSTALL_PREFIX)/lib/fpc/$(FPC_VERSION) else -BASEINSTALLDIR=$(PREFIXINSTALLDIR) +INSTALL_BASEDIR:=$(INSTALL_PREFIX)/lib/$(PACKAGE_NAME) +endif +else +INSTALL_BASEDIR:=$(INSTALL_PREFIX) endif endif - -# set the directory where to install the binaries -ifndef BININSTALLDIR +ifndef INSTALL_BINDIR ifdef UNIXINSTALLDIR -BININSTALLDIR=$(PREFIXINSTALLDIR)/bin +INSTALL_BINDIR:=$(INSTALL_PREFIX)/bin else -BININSTALLDIR=$(BASEINSTALLDIR)/bin/$(OS_TARGET) +INSTALL_BINDIR:=$(INSTALL_BASEDIR)/bin +ifdef INSTALL_FPCPACKAGE +INSTALL_BINDIR:=$(INSTALL_BINDIR)/$(OS_TARGET) endif endif - -# set the directory where to install the units. -ifndef UNITINSTALLDIR -UNITINSTALLDIR=$(BASEINSTALLDIR)/units/$(OS_TARGET) -ifdef UNITSUBDIR -UNITINSTALLDIR:=$(UNITINSTALLDIR)/$(UNITSUBDIR) +endif +ifndef INSTALL_UNITDIR +INSTALL_UNITDIR:=$(INSTALL_BASEDIR)/units/$(OS_TARGET) +ifdef INSTALL_FPCPACKAGE +ifdef PACKAGE_NAME +INSTALL_UNITDIR:=$(INSTALL_UNITDIR)/$(PACKAGE_NAME) endif endif - -# Where to install shared libraries -ifndef LIBINSTALLDIR +endif +ifndef INSTALL_LIBDIR ifdef UNIXINSTALLDIR -LIBINSTALLDIR=$(PREFIXINSTALLDIR)/lib +INSTALL_LIBDIR:=$(INSTALL_PREFIX)/lib else -LIBINSTALLDIR=$(UNITINSTALLDIR) +INSTALL_LIBDIR:=$(INSTALL_UNITDIR) endif endif - -# Where the source files will be stored -ifndef SOURCEINSTALLDIR +ifndef INSTALL_SOURCEDIR ifdef UNIXINSTALLDIR -SOURCEINSTALLDIR=$(PREFIXINSTALLDIR)/src/lazarus-$(FPC_VERSION) +ifdef INSTALL_FPCPACKAGE +INSTALL_SOURCEDIR:=$(INSTALL_PREFIX)/src/fpc-$(FPC_VERSION)/$(PACKAGE_NAME) else -SOURCEINSTALLDIR=$(BASEINSTALLDIR)/source +INSTALL_SOURCEDIR:=$(INSTALL_PREFIX)/src/$(PACKAGE_NAME)-$(PACKAGE_VERSION) endif -ifdef SOURCESUBDIR -SOURCEINSTALLDIR:=$(SOURCEINSTALLDIR)/$(SOURCESUBDIR) +else +ifdef INSTALL_FPCPACKAGE +INSTALL_SOURCEDIR:=$(INSTALL_BASEDIR)/source/$(PACKAGE_NAME) +else +INSTALL_SOURCEDIRL:=$(INSTALL_BASEDIR)/source endif endif - -# Where the doc files will be stored -ifndef DOCINSTALLDIR +endif +ifndef INSTALL_DOCDIR ifdef UNIXINSTALLDIR -DOCINSTALLDIR=$(PREFIXINSTALLDIR)/doc/lazarus-$(FPC_VERSION) +ifdef INSTALL_FPCPACKAGE +INSTALL_DOCDIR:=$(INSTALL_PREFIX)/doc/fpc-$(FPC_VERSION)/$(PACKAGE_NAME) else -DOCINSTALLDIR=$(BASEINSTALLDIR)/doc +INSTALL_DOCDIR:=$(INSTALL_PREFIX)/doc/$(PACKAGE_NAME)-$(PACKAGE_VERSION) +endif +else +ifdef INSTALL_FPCPACKAGE +INSTALL_DOCDIR:=$(INSTALL_BASEDIR)/doc/$(PACKAGE_NAME) +else +INSTALL_DOCDIR:=$(INSTALL_BASEDIR)/doc endif endif - -# Where to install the examples, under linux we use the doc dir -# because the copytree command will create a subdir itself -ifndef EXAMPLEINSTALLDIR +endif +ifndef INSTALL_EXAMPLEDIR ifdef UNIXINSTALLDIR -EXAMPLEINSTALLDIR=$(DOCINSTALLDIR)/examples +ifdef INSTALL_FPCPACKAGE +INSTALL_EXAMPLEDIR:=$(INSTALL_PREFIX)/doc/fpc-$(FPC_VERSION)/examples/$(PACKAGE_NAME) else -EXAMPLEINSTALLDIR=$(BASEINSTALLDIR)/examples +INSTALL_EXAMPLEDIR:=$(INSTALL_PREFIX)/doc/$(PACKAGE_NAME)-$(PACKAGE_VERSION) endif -ifdef EXAMPLESUBDIR -EXAMPLEINSTALLDIR:=$(EXAMPLEINSTALLDIR)/$(EXAMPLESUBDIR) +else +ifdef INSTALL_FPCPACKAGE +INSTALL_EXAMPLEDIR:=$(INSTALL_BASEDIR)/examples/$(PACKAGE_NAME) +else +INSTALL_EXAMPLEDIR:=$(INSTALL_BASEDIR)/examples endif endif - -# Where the some extra (data)files will be stored -ifndef DATAINSTALLDIR -DATAINSTALLDIR=$(BASEINSTALLDIR) endif - -##################################################################### -# Redirection -##################################################################### - -ifndef REDIRFILE -REDIRFILE=log +ifndef INSTALL_DATADIR +INSTALL_DATADIR=$(INSTALL_BASEDIR) endif - -ifdef REDIR -ifndef inUnix -override FPC=redir -eo $(FPC) -endif -# set the verbosity to max -override FPCOPT+=-va -override REDIR:= >> $(REDIRFILE) -endif - - -##################################################################### -# Compiler Command Line -##################################################################### - -# Load commandline OPTDEF and add FPC_CPU define -override FPCOPTDEF:=-d$(CPU_TARGET) - -# Load commandline OPT and add target and unit dir to be sure +override FPCOPTDEF=$(CPU_TARGET) ifneq ($(OS_TARGET),$(OS_SOURCE)) override FPCOPT+=-T$(OS_TARGET) endif - -# User dirs should be first, so they are looked at first ifdef UNITDIR override FPCOPT+=$(addprefix -Fu,$(UNITDIR)) endif @@ -643,106 +539,80 @@ endif ifdef INCDIR override FPCOPT+=$(addprefix -Fi,$(INCDIR)) endif - -# Smartlinking ifdef LINKSMART override FPCOPT+=-XX endif - -# Smartlinking creation ifdef CREATESMART override FPCOPT+=-CX endif - -# Debug ifdef DEBUG -override FPCOPT+=-gl -dDEBUG +override FPCOPT+=-gl +override FPCOPTDEF+=DEBUG endif - -# Release mode (strip, optimize and don't load ppc386.cfg) -# 0.99.12b has a bug in the optimizer so don't use it by default ifdef RELEASE -ifeq ($(FPC_VERSION),0.99.12) -override FPCOPT+=-Xs -OGp3 -n -else override FPCOPT+=-Xs -OG2p3 -n +override FPCOPTDEF+=RELEASE endif -endif - -# Strip ifdef STRIP override FPCOPT+=-Xs endif - -# Optimizer ifdef OPTIMIZE override FPCOPT+=-OG2p3 endif - -# Verbose settings (warning,note,info) ifdef VERBOSE override FPCOPT+=-vwni endif - -ifdef UNITSDIR -override FPCOPT+=-Fu$(UNITSDIR) +ifdef COMPILER_OPTIONS +override FPCOPT+=$(COMPILER_OPTIONS) endif - -# Target dirs and the prefix to use for clean/install -ifdef TARGETDIR -override FPCOPT+=-FE$(TARGETDIR) -ifeq ($(TARGETDIR),.) +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 COMPILER_TARGETDIR +override FPCOPT+=-FE$(COMPILER_TARGETDIR) +ifeq ($(COMPILER_TARGETDIR),.) override TARGETDIRPREFIX= else -override TARGETDIRPREFIX=$(TARGETDIR)/ +override TARGETDIRPREFIX=$(COMPILER_TARGETDIR)/ endif endif -ifdef UNITTARGETDIR -override FPCOPT+=-FU$(UNITTARGETDIR) -ifeq ($(UNITTARGETDIR),.) +ifdef COMPILER_UNITTARGETDIR +override FPCOPT+=-FU$(COMPILER_UNITTARGETDIR) +ifeq ($(COMPILER_UNITTARGETDIR),.) override UNITTARGETDIRPREFIX= else -override UNITTARGETDIRPREFIX=$(UNITTARGETDIR)/ +override UNITTARGETDIRPREFIX=$(COMPILER_UNITTARGETDIR)/ endif else -ifdef TARGETDIR -override UNITTARGETDIR=$(TARGETDIR) +ifdef COMPILER_TARGETDIR +override COMPILER_UNITTARGETDIR=$(COMPILER_TARGETDIR) override UNITTARGETDIRPREFIX=$(TARGETDIRPREFIX) endif endif - -# Add commandline options last so they can override ifdef OPT override FPCOPT+=$(OPT) endif - -# Add defines from FPCOPTDEF to FPCOPT ifdef FPCOPTDEF -override FPCOPT+=$(FPCOPTDEF) +override FPCOPT+=$(addprefix -d,$(FPCOPTDEF)) endif - -# Error file ? -ifdef ERRORFILE -override FPCOPT+=-Fr$(ERRORFILE) -endif - -# Was a config file specified ? ifdef CFGFILE override FPCOPT+=@$(CFGFILE) endif - -# For win32 the options are passed using the environment FPCEXTCMD -ifeq ($(OS_SOURCE),win32) +ifdef USEENV override FPCEXTCMD:=$(FPCOPT) override FPCOPT:=!FPCEXTCMD export FPCEXTCMD endif - -# Compiler commandline override COMPILER:=$(FPC) $(FPCOPT) - -# also call ppas if with command option -s -# but only if the OS_SOURCE and OS_TARGE are equal ifeq (,$(findstring -s ,$(COMPILER))) EXECPPAS= else @@ -750,299 +620,69 @@ ifeq ($(OS_SOURCE),$(OS_TARGET)) EXECPPAS:=@$(PPAS) endif endif - -##################################################################### -# Standard rules -##################################################################### - -all: fpc_all $(addsuffix _all,$(DIROBJECTS)) - -debug: fpc_debug $(addsuffix _debug,$(DIROBJECTS)) - -smart: fpc_smart $(addsuffix _smart,$(DIROBJECTS)) - -shared: fpc_shared $(addsuffix _shared,$(DIROBJECTS)) - -showinstall: fpc_showinstall $(addsuffix _showinstall,$(DIROBJECTS)) - -install: fpc_install $(addsuffix _install,$(DIROBJECTS)) - -sourceinstall: fpc_sourceinstall - -exampleinstall: fpc_exampleinstall - -zipinstall: fpc_zipinstall - -zipsourceinstall: fpc_zipsourceinstall - -zipexampleinstall: fpc_zipexampleinstall - -clean: fpc_clean $(addsuffix _clean,$(DIROBJECTS)) - -distclean: fpc_distclean $(addsuffix _distclean,$(DIROBJECTS)) - -cleanall: fpc_cleanall $(addsuffix _cleanall,$(DIROBJECTS)) - -require: $(addsuffix _require,$(DIROBJECTS)) - -info: fpc_info - -.PHONY: all debug smart shared showinstall install sourceinstall exampleinstall zipinstall zipsourceinstall zipexampleinstall clean distclean cleanall require info - -##################################################################### -# General compile rules -##################################################################### - -.PHONY: fpc_packages fpc_all fpc_debug - -$(FPCMADE): $(ALLTARGET) - @$(ECHO) Compiled > $(FPCMADE) - -fpc_packages: $(COMPILEPACKAGES) - -fpc_all: fpc_packages $(FPCMADE) - -fpc_debug: - $(MAKE) all DEBUG=1 - -# Search paths for .ppu if targetdir is set -ifdef UNITTARGETDIR -vpath %$(PPUEXT) $(UNITTARGETDIR) +ifdef TARGET_RSTS +override RSTFILES=$(addsuffix $(RSTEXT),$(TARGET_RSTS)) +override CLEANRSTFILES+=$(RSTFILES) endif - -# General compile rules, available for both possible PASEXT - -.SUFFIXES: $(EXEEXT) $(PPUEXT) $(OEXT) .pas .pp - -%$(PPUEXT): %.pp - $(COMPILER) $< $(REDIR) - $(EXECPPAS) - -%$(PPUEXT): %.pas - $(COMPILER) $< $(REDIR) - $(EXECPPAS) - -%$(EXEEXT): %.pp - $(COMPILER) $< $(REDIR) - $(EXECPPAS) - -%$(EXEEXT): %.pas - $(COMPILER) $< $(REDIR) - $(EXECPPAS) - -##################################################################### -# Library -##################################################################### - -.PHONY: fpc_smart fpc_shared - -ifdef LIBVERSION -LIBFULLNAME=$(LIBNAME).$(LIBVERSION) -else -LIBFULLNAME=$(LIBNAME) -endif - -# Default sharedlib units are all unit objects -ifndef SHAREDLIBUNITOBJECTS -SHAREDLIBUNITOBJECTS:=$(UNITOBJECTS) -endif - -fpc_smart: - $(MAKE) all LINKSMART=1 CREATESMART=1 - -fpc_shared: all -ifdef HASSHAREDLIB -ifndef LIBNAME - @$(ECHO) "LIBNAME not set" -else - $(PPUMOVE) $(SHAREDLIBUNITOBJECTS) -o$(LIBFULLNAME) -endif -else - @$(ECHO) "Shared Libraries not supported" -endif - -##################################################################### -# Install rules -##################################################################### - -.PHONY: fpc_showinstall fpc_install - -ifdef EXTRAINSTALLUNITS -override INSTALLPPUFILES+=$(addsuffix $(PPUEXT),$(EXTRAINSTALLUNITS)) -endif - -ifdef INSTALLPPUFILES -override INSTALLPPUFILES:=$(addprefix $(UNITTARGETDIRPREFIX),$(INSTALLPPUFILES)) -ifdef PPUFILES -INSTALLPPULINKFILES:=$(addprefix $(UNITTARGETDIRPREFIX),$(shell $(PPUFILES) -S -O $(INSTALLPPUFILES))) -else -INSTALLPPULINKFILES:=$(wildcard $(subst $(PPUEXT),$(OEXT),$(INSTALLPPUFILES)) $(addprefix $(LIBPREFIX),$(subst $(PPUEXT),$(STATICLIBEXT),$(INSTALLPPUFILES)))) -endif -# MWE: not here UNITTARGETDIRPREFIX is already added when no PPUFILES -# override INSTALLPPULINKFILES:=$(addprefix $(UNITTARGETDIRPREFIX),$(INSTALLPPULINKFILES)) -endif - -ifdef INSTALLEXEFILES -override INSTALLEXEFILES:=$(addprefix $(TARGETDIRPREFIX),$(INSTALLEXEFILES)) -endif - -fpc_showinstall: $(SHOWINSTALLTARGET) -ifdef INSTALLEXEFILES - @$(ECHO) -e $(addprefix "\n"$(BININSTALLDIR)/,$(INSTALLEXEFILES)) -endif -ifdef INSTALLPPUFILES - @$(ECHO) -e $(addprefix "\n"$(UNITINSTALLDIR)/,$(INSTALLPPUFILES)) -ifneq ($(INSTALLPPULINKFILES),) - @$(ECHO) -e $(addprefix "\n"$(UNITINSTALLDIR)/,$(INSTALLPPULINKFILES)) -endif -ifneq ($(wildcard $(LIBFULLNAME)),) - @$(ECHO) $(LIBINSTALLDIR)/$(LIBFULLNAME) -ifdef HASSHAREDLIB - @$(ECHO) $(LIBINSTALLDIR)/$(LIBNAME) -endif -endif -endif -ifdef EXTRAINSTALLFILES - @$(ECHO) -e $(addprefix "\n"$(DATAINSTALLDIR)/,$(EXTRAINSTALLFILES)) -endif - -fpc_install: $(INSTALLTARGET) -# Create UnitInstallFiles -ifdef INSTALLEXEFILES - $(MKDIR) $(BININSTALLDIR) -# Compress the exes if upx is defined -ifdef UPXPROG - -$(UPXPROG) $(INSTALLEXEFILES) -endif - $(INSTALLEXE) $(INSTALLEXEFILES) $(BININSTALLDIR) -endif -ifdef INSTALLPPUFILES - $(MKDIR) $(UNITINSTALLDIR) - $(INSTALL) $(INSTALLPPUFILES) $(UNITINSTALLDIR) -ifneq ($(INSTALLPPULINKFILES),) - $(INSTALL) $(INSTALLPPULINKFILES) $(UNITINSTALLDIR) -endif -ifneq ($(wildcard $(LIBFULLNAME)),) - $(MKDIR) $(LIBINSTALLDIR) - $(INSTALL) $(LIBFULLNAME) $(LIBINSTALLDIR) -ifdef inUnix - ln -sf $(LIBFULLNAME) $(LIBINSTALLDIR)/$(LIBNAME) -endif -endif -endif -ifdef EXTRAINSTALLFILES - $(MKDIR) $(DATAINSTALLDIR) - $(INSTALL) $(EXTRAINSTALLFILES) $(DATAINSTALLDIR) -endif - -##################################################################### -# SourceInstall rules -##################################################################### - -.PHONY: fpc_sourceinstall - -ifndef SOURCETOPDIR -SOURCETOPDIR=$(BASEDIR) -endif - -fpc_sourceinstall: clean - $(MKDIR) $(SOURCEINSTALLDIR) - $(COPYTREE) $(SOURCETOPDIR) $(SOURCEINSTALLDIR) - -##################################################################### -# exampleinstall rules -##################################################################### - -.PHONY: fpc_exampleinstall - -fpc_exampleinstall: $(addsuffix _clean,$(EXAMPLEDIROBJECTS)) -ifdef EXAMPLESOURCEFILES - $(MKDIR) $(EXAMPLEINSTALLDIR) - $(COPY) $(EXAMPLESOURCEFILES) $(EXAMPLEINSTALLDIR) -endif -ifdef EXAMPLEDIROBJECTS -ifndef EXAMPLESOURCEFILES - $(MKDIR) $(EXAMPLEINSTALLDIR) -endif - $(COPYTREE) $(addsuffix /*,$(EXAMPLEDIROBJECTS)) $(EXAMPLEINSTALLDIR) -endif - -##################################################################### -# Zip -##################################################################### - -.PHONY: fpc_zipinstall - -# Create suffix to add -ifndef PACKAGESUFFIX -PACKAGESUFFIX=$(OS_TARGET) -ifeq ($(OS_TARGET),go32v2) -PACKAGESUFFIX=go32 -endif -ifeq ($(OS_TARGET),win32) -PACKAGESUFFIX=w32 -endif -ifeq ($(OS_TARGET),os2) -PACKAGESUFFIX=emx -endif -endif - -# Temporary path to pack a file +.PHONY: fpc_distinstall +fpc_distinstall: install exampleinstall +.PHONY: fpc_zipinstall fpc_zipsourceinstall fpc_zipexampleinstall ifndef PACKDIR ifndef inUnix -PACKDIR=$(BASEDIR)/pack_tmp +PACKDIR=$(BASEDIR)/../fpc-pack else -PACKDIR=/tmp/lazarus-pack +PACKDIR=/tmp/fpc-pack endif endif - -# Maybe create default zipname from packagename ifndef ZIPNAME -ifdef PACKAGENAME -ZIPNAME=$(PACKAGEPREFIX)$(PACKAGENAME)$(PACKAGESUFFIX) +ifdef DIST_ZIPNAME +ZIPNAME=$(DIST_ZIPNAME) +else +ZIPNAME=$(ZIPPREFIX)$(PACKAGE_NAME)$(ZIPSUFFIX) +endif +endif +ifndef ZIPTARGET +ifdef DIST_ZIPTARGET +ZIPTARGET=DIST_ZIPTARGET +else +ZIPTARGET=install endif endif - -# Use tar by default under linux ifndef USEZIP ifdef inUnix USETAR=1 endif endif - -# Use a wrapper script by default for OS/2 -ifdef inOS2 +ifndef inUnix USEZIPWRAPPER=1 endif - -# Create commands to create the zip/tar file -ZIPWRAPPER=$(DESTZIPDIR)/fpczip$(BATCHEXT) -ZIPCMD_CDPACK:=cd $(subst /,$(PATHSEP),$(PACKDIR)) -ZIPCMD_CDBASE:=cd $(subst /,$(PATHSEP),$(BASEDIR)) +ifdef USEZIPWRAPPER +ZIPPATHSEP=$(PATHSEP) +ZIPWRAPPER=$(subst /,$(PATHSEP),$(DIST_DESTDIR)/fpczip$(BATCHEXT)) +else +ZIPPATHSEP=/ +endif +ZIPCMD_CDPACK:=cd $(subst /,$(ZIPPATHSEP),$(PACKDIR)) +ZIPCMD_CDBASE:=cd $(subst /,$(ZIPPATHSEP),$(BASEDIR)) ifdef USETAR -ZIPDESTFILE:=$(DESTZIPDIR)/$(ZIPNAME)$(TAREXT) +ZIPDESTFILE:=$(DIST_DESTDIR)/$(ZIPNAME)$(TAREXT) ZIPCMD_ZIP:=$(TARPROG) cf$(TAROPT) $(ZIPDESTFILE) * else -ZIPDESTFILE:=$(DESTZIPDIR)/$(ZIPNAME)$(ZIPEXT) -ZIPCMD_ZIP:=$(subst /,$(PATHSEP),$(ZIPPROG)) -Dr $(ZIPOPT) $(ZIPDESTFILE) * +ZIPDESTFILE:=$(DIST_DESTDIR)/$(ZIPNAME)$(ZIPEXT) +ZIPCMD_ZIP:=$(subst /,$(ZIPPATHSEP),$(ZIPPROG)) -Dr $(ZIPOPT) $(ZIPDESTFILE) * endif - fpc_zipinstall: -ifndef ZIPNAME - @$(ECHO) "Please specify ZIPNAME!" - @exit 1 -else - $(MAKE) $(ZIPTARGET) PREFIXINSTALLDIR=$(PACKDIR) + $(MAKE) $(ZIPTARGET) INSTALL_PREFIX=$(PACKDIR) ZIPINSTALL=1 $(DEL) $(ZIPDESTFILE) ifdef USEZIPWRAPPER -ifneq ($(ECHO),echo) - $(ECHO) "$(ZIPCMD_CDPACK)" > $(ZIPWRAPPER) - $(ECHO) "$(ZIPCMD_ZIP)" >> $(ZIPWRAPPER) - $(ECHO) "$(ZIPCMD_CDBASE)" >> $(ZIPWRAPPER) +ifneq ($(ECHOREDIR),echo) + $(ECHOREDIR) -e "$(subst \,\\,$(ZIPCMD_CDPACK))" > $(ZIPWRAPPER) + $(ECHOREDIR) -e "$(subst \,\\,$(ZIPCMD_ZIP))" >> $(ZIPWRAPPER) + $(ECHOREDIR) -e "$(subst \,\\,$(ZIPCMD_CDBASE))" >> $(ZIPWRAPPER) else - $(ECHO) $(ZIPCMD_CDPACK) > $(ZIPWRAPPER) - $(ECHO) $(ZIPCMD_ZIP) >> $(ZIPWRAPPER) - $(ECHO) $(ZIPCMD_CDBASE) >> $(ZIPWRAPPER) + echo $(ZIPCMD_CDPACK) > $(ZIPWRAPPER) + echo $(ZIPCMD_ZIP) >> $(ZIPWRAPPER) + echo $(ZIPCMD_CDBASE) >> $(ZIPWRAPPER) endif ifdef inUnix /bin/sh $(ZIPWRAPPER) @@ -1054,44 +694,26 @@ else $(ZIPCMD_CDPACK) ; $(ZIPCMD_ZIP) ; $(ZIPCMD_CDBASE) endif $(DELTREE) $(PACKDIR) -endif - -.PHONY: fpc_zipsourceinstall - fpc_zipsourceinstall: - $(MAKE) fpc_zipinstall ZIPTARGET=sourceinstall PACKAGESUFFIX=src - -.PHONY: fpc_zipexampleinstall - + $(MAKE) fpc_zipinstall ZIPTARGET=sourceinstall ZIPSUFFIX=src fpc_zipexampleinstall: - $(MAKE) fpc_zipinstall ZIPTARGET=exampleinstall PACKAGESUFFIX=exm - -##################################################################### -# Clean rules -##################################################################### - +ifdef HASEXAMPLES + $(MAKE) fpc_zipinstall ZIPTARGET=exampleinstall ZIPSUFFIX=exm +endif +fpc_zipdistinstall: + $(MAKE) fpc_zipinstall ZIPTARGET=distinstall .PHONY: fpc_clean fpc_cleanall fpc_distclean - ifdef EXEFILES override CLEANEXEFILES:=$(addprefix $(TARGETDIRPREFIX),$(CLEANEXEFILES)) endif - -ifdef EXTRACLEANUNITS -override CLEANPPUFILES+=$(addsuffix $(PPUEXT),$(EXTRACLEANUNITS)) +ifdef CLEAN_UNITS +override CLEANPPUFILES+=$(addsuffix $(PPUEXT),$(CLEAN_UNITS)) endif - ifdef CLEANPPUFILES +override CLEANPPULINKFILES:=$(subst $(PPUEXT),$(OEXT),$(CLEANPPUFILES)) $(addprefix $(STATICLIBPREFIX),$(subst $(PPUEXT),$(STATICLIBEXT),$(CLEANPPUFILES))) override CLEANPPUFILES:=$(addprefix $(UNITTARGETDIRPREFIX),$(CLEANPPUFILES)) -# Get the .o and .a files created for the units -ifdef PPUFILES -CLEANPPULINKFILES:=$(addprefix $(UNITTARGETDIRPREFIX),$(shell $(PPUFILES) $(CLEANPPUFILES))) -else -CLEANPPULINKFILES:=$(wildcard $(subst $(PPUEXT),$(OEXT),$(CLEANPPUFILES)) $(addprefix $(LIBPREFIX),$(subst $(PPUEXT),$(STATICLIBEXT),$(CLEANPPUFILES)))) +override CLEANPPULINKFILES:=$(wildcard $(addprefix $(UNITTARGETDIRPREFIX),$(CLEANPPULINKFILES))) endif -# MWE: not here UNITTARGETDIRPREFIX is already added when no PPUFILES -# override CLEANPPULINKFILES:=$(addprefix $(UNITTARGETDIRPREFIX),$(CLEANPPULINKFILES)) -endif - fpc_clean: $(CLEANTARGET) ifdef CLEANEXEFILES -$(DEL) $(CLEANEXEFILES) @@ -1105,22 +727,17 @@ endif ifdef CLEANRSTFILES -$(DEL) $(addprefix $(UNITTARGETDIRPREFIX),$(CLEANRSTFILES)) endif -ifdef EXTRACLEANFILES - -$(DEL) $(EXTRACLEANFILES) +ifdef CLEAN_FILES + -$(DEL) $(CLEAN_FILES) endif -ifdef LIBNAME - -$(DEL) $(LIBNAME) $(LIBFULLNAME) +ifdef LIB_NAME + -$(DEL) $(LIB_NAME) $(LIB_FULLNAME) endif - -$(DEL) $(FPCMADE) $(PPAS) link.res $(FPCEXTFILE) $(REDIRFILE) - -fpc_distclean: fpc_clean - -# Also run clean first if targetdir is set. Unittargetdir is always -# set if targetdir or unittargetdir is specified -ifdef UNITTARGETDIR + -$(DEL) $(FPCMADE) Package.fpc $(PPAS) link.res $(FPCEXTFILE) $(REDIRFILE) +fpc_distclean: clean +ifdef COMPILER_UNITTARGETDIR TARGETDIRCLEAN=fpc_clean endif - fpc_cleanall: $(CLEANTARGET) $(TARGETDIRCLEAN) ifdef CLEANEXEFILES -$(DEL) $(CLEANEXEFILES) @@ -1128,201 +745,147 @@ endif -$(DEL) *$(OEXT) *$(PPUEXT) *$(RSTEXT) *$(ASMEXT) *$(STATICLIBEXT) *$(SHAREDLIBEXT) *$(PPLEXT) -$(DELTREE) *$(SMARTEXT) -$(DEL) $(FPCMADE) $(PPAS) link.res $(FPCEXTFILE) $(REDIRFILE) - -##################################################################### -# Info rules -##################################################################### - -.PHONY: fpc_info fpc_cfginfo fpc_objectinfo fpc_toolsinfo fpc_installinfo \ - fpc_dirinfo - -fpc_info: $(INFOTARGET) - -fpc_infocfg: +ifdef AOUTEXT + -$(DEL) *$(AOUTEXT) +endif +.PHONY: fpc_info +fpc_info: + @$(ECHO) + @$(ECHO) == Package info == + @$(ECHO) Package Name..... $(PACKAGE_NAME) + @$(ECHO) Package Version.. $(PACKAGE_VERSION) @$(ECHO) @$(ECHO) == Configuration info == @$(ECHO) - @$(ECHO) FPC....... $(FPC) - @$(ECHO) Version... $(FPC_VERSION) - @$(ECHO) CPU....... $(CPU_TARGET) - @$(ECHO) Source.... $(OS_SOURCE) - @$(ECHO) Target.... $(OS_TARGET) + @$(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) - -fpc_infoobjects: + @$(ECHO) == Directory info == + @$(ECHO) + @$(ECHO) Basedir......... $(BASEDIR) + @$(ECHO) FPCDir.......... $(FPCDIR) + @$(ECHO) UnitsDir........ $(UNITSDIR) + @$(ECHO) PackagesDir..... $(PACKAGESDIR) + @$(ECHO) + @$(ECHO) GCC library..... $(GCCLIBDIR) + @$(ECHO) Other library... $(OTHERLIBDIR) + @$(ECHO) + @$(ECHO) == Tools info == + @$(ECHO) + @$(ECHO) Pwd....... $(PWD) + @$(ECHO) Mv........ $(MVPROG) + @$(ECHO) Cp........ $(CPPROG) + @$(ECHO) Rm........ $(RMPROG) + @$(ECHO) GInstall.. $(GINSTALL) + @$(ECHO) Echo...... $(ECHO) + @$(ECHO) Date...... $(DATE) + @$(ECHO) FPCMake... $(FPCMAKE) + @$(ECHO) PPUMove... $(PPUMOVE) + @$(ECHO) Upx....... $(UPXPROG) + @$(ECHO) Zip....... $(ZIPPROG) @$(ECHO) @$(ECHO) == Object info == @$(ECHO) - @$(ECHO) LoaderObjects..... $(LOADEROBJECTS) - @$(ECHO) UnitObjects....... $(UNITOBJECTS) - @$(ECHO) ExeObjects........ $(EXEOBJECTS) + @$(ECHO) Target Loaders...... $(TARGET_LOADERS) + @$(ECHO) Target Units........ $(TARGET_UNITS) + @$(ECHO) Target Programs..... $(TARGET_PROGRAMS) + @$(ECHO) Target Dirs......... $(TARGET_DIRS) + @$(ECHO) Target Examples..... $(TARGET_EXAMPLES) + @$(ECHO) Target ExampleDirs.. $(TARGET_EXAMPLEDIRS) @$(ECHO) - @$(ECHO) ExtraCleanUnits... $(EXTRACLEANUNITS) - @$(ECHO) ExtraCleanFiles... $(EXTRACLEANFILES) + @$(ECHO) Clean Units......... $(CLEAN_UNITS) + @$(ECHO) Clean Files......... $(CLEAN_FILES) @$(ECHO) - @$(ECHO) ExtraInstallUnits. $(EXTRAINSTALLUNITS) - @$(ECHO) ExtraInstallFiles. $(EXTRAINSTALLFILES) - @$(ECHO) - -fpc_infoinstall: + @$(ECHO) Install Units....... $(INSTALL_UNITS) + @$(ECHO) Install Files....... $(INSTALL_FILES) @$(ECHO) @$(ECHO) == Install info == @$(ECHO) -ifdef DATE @$(ECHO) DateStr.............. $(DATESTR) -endif -ifdef PACKAGEPREFIX - @$(ECHO) PackagePrefix........ $(PACKAGEPREFIX) -endif -ifdef PACKAGENAME - @$(ECHO) PackageName.......... $(PACKAGENAME) -endif - @$(ECHO) PackageSuffix........ $(PACKAGESUFFIX) + @$(ECHO) ZipPrefix............ $(ZIPPREFIX) + @$(ECHO) ZipSuffix............ $(ZIPSUFFIX) + @$(ECHO) Install FPC Package.. $(INSTALL_FPCPACKAGE) @$(ECHO) - @$(ECHO) BaseInstallDir....... $(BASEINSTALLDIR) - @$(ECHO) BinInstallDir........ $(BININSTALLDIR) - @$(ECHO) LibInstallDir........ $(LIBINSTALLDIR) - @$(ECHO) UnitInstallDir....... $(UNITINSTALLDIR) - @$(ECHO) SourceInstallDir..... $(SOURCEINSTALLDIR) - @$(ECHO) DocInstallDir........ $(DOCINSTALLDIR) - @$(ECHO) DataInstallDir....... $(DATAINSTALLDIR) + @$(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) DestZipDir........... $(DESTZIPDIR) - @$(ECHO) ZipName.............. $(ZIPNAME) + @$(ECHO) Dist destination dir. $(DIST_DESTDIR) + @$(ECHO) Dist zip name........ $(DIST_ZIPNAME) @$(ECHO) - -##################################################################### -# Directories -##################################################################### - -OBJECTDIRSYNEDIT=1 -OBJECTDIRMWEDIT=1 - -# Dir synedit - -ifdef OBJECTDIRSYNEDIT -.PHONY: synedit_all synedit_debug synedit_examples synedit_test synedit_smart synedit_shared synedit_showinstall synedit_install synedit_sourceinstall synedit_exampleinstall synedit_zipinstall synedit_zipsourceinstall synedit_zipexampleinstall synedit_clean synedit_distclean synedit_cleanall synedit_require synedit_info - +TARGET_DIRS_SYNEDIT=1 +ifdef TARGET_DIRS_SYNEDIT synedit_all: $(MAKE) -C synedit all - synedit_debug: $(MAKE) -C synedit debug - -synedit_examples: - $(MAKE) -C synedit examples - -synedit_test: - $(MAKE) -C synedit test - synedit_smart: $(MAKE) -C synedit smart - +synedit_examples: + $(MAKE) -C synedit examples synedit_shared: $(MAKE) -C synedit shared - -synedit_showinstall: - $(MAKE) -C synedit showinstall - synedit_install: $(MAKE) -C synedit install - synedit_sourceinstall: $(MAKE) -C synedit sourceinstall - synedit_exampleinstall: $(MAKE) -C synedit exampleinstall - +synedit_distinstall: + $(MAKE) -C synedit distinstall synedit_zipinstall: $(MAKE) -C synedit zipinstall - synedit_zipsourceinstall: $(MAKE) -C synedit zipsourceinstall - synedit_zipexampleinstall: $(MAKE) -C synedit zipexampleinstall - +synedit_zipdistinstall: + $(MAKE) -C synedit zipdistinstall synedit_clean: $(MAKE) -C synedit clean - synedit_distclean: $(MAKE) -C synedit distclean - synedit_cleanall: $(MAKE) -C synedit cleanall - -synedit_require: - $(MAKE) -C synedit require - synedit_info: $(MAKE) -C synedit info +synedit: + $(MAKE) -C synedit all +.PHONY: synedit_all synedit_debug synedit_smart synedit_examples synedit_shared synedit_install synedit_sourceinstall synedit_exampleinstall synedit_distinstall synedit_zipinstall synedit_zipsourceinstall synedit_zipexampleinstall synedit_zipdistinstall synedit_clean synedit_distclean synedit_cleanall synedit_info synedit endif - -# Dir mwedit - -ifdef OBJECTDIRMWEDIT -.PHONY: mwedit_all mwedit_debug mwedit_examples mwedit_test mwedit_smart mwedit_shared mwedit_showinstall mwedit_install mwedit_sourceinstall mwedit_exampleinstall mwedit_zipinstall mwedit_zipsourceinstall mwedit_zipexampleinstall mwedit_clean mwedit_distclean mwedit_cleanall mwedit_require mwedit_info - -mwedit_all: - $(MAKE) -C mwedit all - -mwedit_debug: - $(MAKE) -C mwedit debug - -mwedit_examples: - $(MAKE) -C mwedit examples - -mwedit_test: - $(MAKE) -C mwedit test - -mwedit_smart: - $(MAKE) -C mwedit smart - -mwedit_shared: - $(MAKE) -C mwedit shared - -mwedit_showinstall: - $(MAKE) -C mwedit showinstall - -mwedit_install: - $(MAKE) -C mwedit install - -mwedit_sourceinstall: - $(MAKE) -C mwedit sourceinstall - -mwedit_exampleinstall: - $(MAKE) -C mwedit exampleinstall - -mwedit_zipinstall: - $(MAKE) -C mwedit zipinstall - -mwedit_zipsourceinstall: - $(MAKE) -C mwedit zipsourceinstall - -mwedit_zipexampleinstall: - $(MAKE) -C mwedit zipexampleinstall - -mwedit_clean: - $(MAKE) -C mwedit clean - -mwedit_distclean: - $(MAKE) -C mwedit distclean - -mwedit_cleanall: - $(MAKE) -C mwedit cleanall - -mwedit_require: - $(MAKE) -C mwedit require - -mwedit_info: - $(MAKE) -C mwedit info -endif - -##################################################################### -# Local Makefile -##################################################################### - +all: $(addsuffix _all,$(TARGET_DIRS)) +debug: $(addsuffix _debug,$(TARGET_DIRS)) +smart: $(addsuffix _smart,$(TARGET_DIRS)) +examples: $(addsuffix _examples,$(TARGET_DIRS)) +shared: $(addsuffix _shared,$(TARGET_DIRS)) +install: $(addsuffix _install,$(TARGET_DIRS)) +sourceinstall: +exampleinstall: $(addsuffix _exampleinstall,$(TARGET_DIRS)) +distinstall: fpc_distinstall +zipinstall: fpc_zipinstall +zipsourceinstall: fpc_zipsourceinstall +zipexampleinstall: fpc_zipexampleinstall $(addsuffix _zipexampleinstall,$(TARGET_DIRS)) +zipdistinstall: fpc_zipdistinstall $(addsuffix _zipdistinstall,$(TARGET_DIRS)) +clean: $(addsuffix _clean,$(TARGET_DIRS)) +distclean: $(addsuffix _distclean,$(TARGET_DIRS)) +cleanall: $(addsuffix _cleanall,$(TARGET_DIRS)) +info: fpc_info +.PHONY: all debug smart examples shared install sourceinstall exampleinstall distinstall zipinstall zipsourceinstall zipexampleinstall zipdistinstall clean distclean cleanall info ifneq ($(wildcard fpcmake.loc),) include fpcmake.loc endif - +.PHONY: all makefile makefiles +makefile: Makefile.fpc + -$(FPCMAKE) -w +makefiles: makefile + $(MAKE) -C mwedit makefiles + $(MAKE) -C synedit makefiles diff --git a/components/Makefile.fpc b/components/Makefile.fpc index a431e60331..d4fa5d63ff 100644 --- a/components/Makefile.fpc +++ b/components/Makefile.fpc @@ -3,27 +3,30 @@ # Makefile.fpc for Lazarus for Free Pascal # -[targets] -dirs=synedit mwedit +[package] +name=lazarus-components +version=0.7a -[dirs] -# target dir needs to be . or a full path otherwise the -# unittargetdir will be corrupt -# not with the lazarusmake.ini -# targetdir=. -unittargetdir=./units +[target] +#dirs=synedit mwedit +dirs=synedit [install] -units=$(notdir $(basename $(wildcard $(UNITTARGETDIR)/*$(PPUEXT)))) -packagename=components - -[presettings] +[prerules] +DIST_DESTDIR=$(BASEDIR)/../dist ifndef LCLPLATFORM LCLPLATFORM=gtk export LCLPLATFORM endif -[postsettings] - [rules] +.PHONY: all makefile makefiles + +makefile: Makefile.fpc + -$(FPCMAKE) -w + +makefiles: makefile + $(MAKE) -C mwedit makefiles + $(MAKE) -C synedit makefiles + diff --git a/components/synedit/Makefile b/components/synedit/Makefile index 43ed1da5b1..a4df448bc2 100644 --- a/components/synedit/Makefile +++ b/components/synedit/Makefile @@ -1,38 +1,30 @@ # -# Makefile generated by fpcmake v1.00 [2001/01/09] +# Don't edit, this file is generated by FPCMake Version 1.1 [2001/08/08] # - -defaultrule: all - -##################################################################### -# Autodetect OS (Linux or Dos or Windows NT or OS/2) -# define inUnix when running under Unix (Linux,FreeBSD) -# define inWinNT when running under WinNT -# define inOS2 when running under OS/2 -##################################################################### - -# We need only / in the path +default: all override PATH:=$(subst \,/,$(PATH)) - -# Search for PWD and determine also if we are under linux -PWD:=$(strip $(wildcard $(addsuffix /pwd.exe,$(subst ;, ,$(PATH))))) +ifeq ($(findstring ;,$(PATH)),) +inUnix=1 +SEARCHPATH:=$(filter-out .,$(subst :, ,$(PATH))) +else +SEARCHPATH:=$(subst ;, ,$(PATH)) +endif +PWD:=$(strip $(wildcard $(addsuffix /pwd.exe,$(SEARCHPATH)))) ifeq ($(PWD),) -PWD:=$(strip $(wildcard $(addsuffix /pwd,$(subst :, ,$(PATH))))) +PWD:=$(strip $(wildcard $(addsuffix /pwd,$(SEARCHPATH)))) ifeq ($(PWD),) nopwd: @echo You need the GNU utils package to use this Makefile! @echo Get ftp://ftp.freepascal.org/pub/fpc/dist/go32v2/utilgo32.zip @exit else -inUnix=1 PWD:=$(firstword $(PWD)) +SRCEXEEXT= endif else PWD:=$(firstword $(PWD)) +SRCEXEEXT=.exe endif - -# Detect NT - NT sets OS to Windows_NT -# Detect OS/2 - OS/2 has OS2_SHELL defined ifndef inUnix ifeq ($(OS),Windows_NT) inWinNT=1 @@ -41,16 +33,11 @@ ifdef OS2_SHELL inOS2=1 endif endif -endif - -# The extension of executables -ifdef inUnix -SRCEXEEXT= else -SRCEXEEXT=.exe +ifneq ($(findstring cygwin,$(MACHTYPE)),) +inCygWin=1 +endif endif - -# The extension of batch files / scripts ifdef inUnix BATCHEXT=.sh else @@ -60,89 +47,65 @@ else BATCHEXT=.bat endif endif - -# Path Separator, the subst trick is necessary for the \ that can't exists -# at the end of a line ifdef inUnix PATHSEP=/ else -PATHSEP=$(subst /,\,/) +PATHSEP:=$(subst /,\,/) endif - -# The path which is searched separated by spaces -ifdef inUnix -SEARCHPATH=$(subst :, ,$(PATH)) -else -SEARCHPATH=$(subst ;, ,$(PATH)) -endif - -# Base dir ifdef PWD -BASEDIR:=$(shell $(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 - -##################################################################### -# FPC version/target Detection -##################################################################### - -# What compiler to use ? ifndef FPC -# Compatibility with old makefiles ifdef PP FPC=$(PP) else +ifdef inUnix +CPU_SOURCE=$(shell uname -m) +ifeq (m68k,$(CPU_SOURCE)) +FPC=ppc68k +else +FPC=ppc386 +endif +else FPC=ppc386 endif endif +endif override FPC:=$(subst $(SRCEXEEXT),,$(FPC)) override FPC:=$(subst \,/,$(FPC))$(SRCEXEEXT) - -# Target OS ifndef OS_TARGET OS_TARGET:=$(shell $(FPC) -iTO) endif - -# Source OS ifndef OS_SOURCE OS_SOURCE:=$(shell $(FPC) -iSO) endif - -# Target CPU ifndef CPU_TARGET CPU_TARGET:=$(shell $(FPC) -iTP) endif - -# Source CPU ifndef CPU_SOURCE CPU_SOURCE:=$(shell $(FPC) -iSP) endif - -# FPC version ifndef FPC_VERSION FPC_VERSION:=$(shell $(FPC) -iV) endif - export FPC OS_TARGET OS_SOURCE CPU_TARGET CPU_SOURCE FPC_VERSION - -##################################################################### -# FPCDIR Setting -##################################################################### - -# Test FPCDIR to look if the RTL dir exists ifdef FPCDIR override FPCDIR:=$(subst \,/,$(FPCDIR)) -ifeq ($(wildcard $(FPCDIR)/rtl),) -ifeq ($(wildcard $(FPCDIR)/units),) +ifeq ($(wildcard $(addprefix $(FPCDIR)/,rtl units)),) override FPCDIR=wrong endif -endif else override FPCDIR=wrong endif - -# Detect FPCDIR ifeq ($(FPCDIR),wrong) ifdef inUnix override FPCDIR=/usr/local/lib/fpc/$(FPC_VERSION) @@ -152,173 +115,128 @@ endif else override FPCDIR:=$(subst /$(FPC),,$(firstword $(strip $(wildcard $(addsuffix /$(FPC),$(SEARCHPATH)))))) override FPCDIR:=$(FPCDIR)/.. -ifeq ($(wildcard $(FPCDIR)/rtl),) -ifeq ($(wildcard $(FPCDIR)/units),) +ifeq ($(wildcard $(addprefix $(FPCDIR)/,rtl units)),) override FPCDIR:=$(FPCDIR)/.. -ifeq ($(wildcard $(FPCDIR)/rtl),) -ifeq ($(wildcard $(FPCDIR)/units),) +ifeq ($(wildcard $(addprefix $(FPCDIR)/,rtl units)),) override FPCDIR=c:/pp endif endif endif endif -endif -endif - -ifndef PACKAGESDIR -PACKAGESDIR=$(FPCDIR)/packages -endif -ifndef TOOLKITSDIR -TOOLKITSDIR= -endif -ifndef COMPONENTSDIR -COMPONENTSDIR= -endif - -# Create units dir -ifneq ($(FPCDIR),.) -UNITSDIR=$(FPCDIR)/units/$(OS_TARGET) -endif - -##################################################################### -# User Settings -##################################################################### - - -# Targets - - -# Clean - -override EXTRACLEANUNITS+=$(notdir $(basename $(wildcard $(UNITTARGETDIR)/*$(PPUEXT)))) - -# Install - -ZIPTARGET=install - -# Defaults - -override NEEDOPT=-Ca -gl - -# Directories - -override NEEDUNITDIR=$(UNITTARGETDIR) ../../lcl/units ../../lcl/units/$(LCLPLATFORM) -ifndef UNITTARGETDIR -UNITTARGETDIR=../units -endif - -# Packages - -override PACKAGES+=rtl fcl gtk - -# Libraries - - -# Info - -INFOTARGET=fpc_infocfg fpc_infoobjects fpc_infoinstall - -##################################################################### -# Shell tools -##################################################################### - -# echo +UNITSDIR:=$(wildcard $(FPCDIR)/units/$(OS_TARGET)) +PACKAGESDIR:=$(wildcard $(FPCDIR) $(FPCDIR)/packages) +override PACKAGE_NAME=lazarus +override PACKAGE_VERSION=0.7a +override TARGET_UNITS+=syntextdrawer syneditkeycmds synedittypes syneditstrconst syneditsearch syneditmiscprocs syneditmiscclasses synedittextbuffer synedit synedithighlighter synhighlighterpas syncompletion syneditautocomplete synhighlighterhtml synhighlightercpp +override DIST_ZIPNAME=lazarus.synedit.$(ZIPSUFFIX) +override COMPILER_OPTIONS+=-gl +override COMPILER_UNITDIR+=$(COMPILER_UNITTARGETDIR) ../../lcl/units ../../lcl/units/$(LCLPLATFORM) +override COMPILER_UNITTARGETDIR+=../units ifndef ECHO -ECHO:=$(strip $(wildcard $(addsuffix /gecho$(EXEEXT),$(SEARCHPATH)))) +ECHO:=$(strip $(wildcard $(addsuffix /gecho$(SRCEXEEXT),$(SEARCHPATH)))) ifeq ($(ECHO),) ECHO:=$(strip $(wildcard $(addsuffix /echo$(SRCEXEEXT),$(SEARCHPATH)))) ifeq ($(ECHO),) -ECHO:=echo -ECHOE:=echo +ECHO= else ECHO:=$(firstword $(ECHO)) -ECHOE=$(ECHO) -E endif else ECHO:=$(firstword $(ECHO)) -ECHOE=$(ECHO) -E endif endif - -# To copy pograms +export ECHO +ifndef DATE +DATE:=$(strip $(wildcard $(addsuffix /gdate$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(DATE),) +DATE:=$(strip $(wildcard $(addsuffix /date$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(DATE),) +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= +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= +else +CPPROG:=$(firstword $(CPPROG)) +endif +endif +export CPPROG +ifndef RMPROG +RMPROG:=$(strip $(wildcard $(addsuffix /rm$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(RMPROG),) +RMPROG= +else +RMPROG:=$(firstword $(RMPROG)) +endif +endif +export RMPROG +ifndef MVPROG +MVPROG:=$(strip $(wildcard $(addsuffix /mv$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(MVPROG),) +MVPROG= +else +MVPROG:=$(firstword $(MVPROG)) +endif +endif +export MVPROG +ifndef ECHOREDIR +ECHOREDIR:=$(subst /,$(PATHSEP),$(ECHO)) +endif ifndef COPY -COPY:=cp -fp +COPY:=$(CPPROG) -fp endif - -# Copy a whole tree ifndef COPYTREE -COPYTREE:=cp -rfp +COPYTREE:=$(CPPROG) -rfp endif - -# To move pograms ifndef MOVE -MOVE:=mv -f +MOVE:=$(MVPROG) -f endif - -# Check delete program ifndef DEL -DEL:=rm -f +DEL:=$(RMPROG) -f endif - -# Check deltree program ifndef DELTREE -DELTREE:=rm -rf +DELTREE:=$(RMPROG) -rf endif - -# To install files ifndef INSTALL ifdef inUnix -INSTALL:=install -c -m 644 +INSTALL:=$(GINSTALL) -c -m 644 else INSTALL:=$(COPY) endif endif - -# To install programs ifndef INSTALLEXE ifdef inUnix -INSTALLEXE:=install -c -m 755 +INSTALLEXE:=$(GINSTALL) -c -m 755 else INSTALLEXE:=$(COPY) endif endif - -# To make a directory. ifndef MKDIR -ifdef inUnix -MKDIR:=install -m 755 -d -else -MKDIR:=ginstall -m 755 -d +MKDIR:=$(GINSTALL) -m 755 -d endif -endif - -export ECHO ECHOE COPY COPYTREE MOVE DEL DELTREE INSTALL INSTALLEXE MKDIR - -##################################################################### -# Default Tools -##################################################################### - -# assembler, redefine it if cross compiling -ifndef AS -AS=as -endif - -# linker, but probably not used -ifndef LD -LD=ld -endif - -# ppas.bat / ppas.sh -PPAS=ppas$(BATCHEXT) - -# ldconfig to rebuild .so cache -ifdef inUnix -LDCONFIG=ldconfig -else -LDCONFIG= -endif - -# ppumove +export ECHOREDIR COPY COPYTREE MOVE DEL DELTREE INSTALL INSTALLEXE MKDIR ifndef PPUMOVE PPUMOVE:=$(strip $(wildcard $(addsuffix /ppumove$(SRCEXEEXT),$(SEARCHPATH)))) ifeq ($(PPUMOVE),) @@ -328,20 +246,53 @@ PPUMOVE:=$(firstword $(PPUMOVE)) endif endif export PPUMOVE - -# ppufiles -ifndef PPUFILES -PPUFILES:=$(strip $(wildcard $(addsuffix /ppufiles$(SRCEXEEXT),$(SEARCHPATH)))) -ifeq ($(PPUFILES),) -PPUFILES= +ifndef FPCMAKE +FPCMAKE:=$(strip $(wildcard $(addsuffix /fpcmake$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(FPCMAKE),) +FPCMAKE= else -PPUFILES:=$(firstword $(PPUFILES)) +FPCMAKE:=$(firstword $(FPCMAKE)) endif endif -export PPUFILES - -# Look if UPX is found for go32v2 and win32. We can't use $UPX becuase -# upx uses that one itself (PFV) +export FPCMAKE +ifndef ZIPPROG +ZIPPROG:=$(strip $(wildcard $(addsuffix /zip$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(ZIPPROG),) +ZIPPROG= +else +ZIPPROG:=$(firstword $(ZIPPROG)) +endif +endif +export ZIPPROG +ifndef TARPROG +TARPROG:=$(strip $(wildcard $(addsuffix /tar$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(TARPROG),) +TARPROG= +else +TARPROG:=$(firstword $(TARPROG)) +endif +endif +export TARPROG +ifndef AS +AS=as +endif +ifndef LD +LD=ld +endif +ifndef RC +RC=rc +endif +PPAS=ppas$(BATCHEXT) +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 @@ -361,32 +312,8 @@ UPXPROG= endif endif export UPXPROG - -# ZipProg, you can't use Zip as the var name (PFV) -ifndef ZIPPROG -ZIPPROG:=$(strip $(wildcard $(addsuffix /zip$(SRCEXEEXT),$(SEARCHPATH)))) -ifeq ($(ZIPPROG),) -ZIPPROG= -else -ZIPPROG:=$(firstword $(ZIPPROG)) -endif -endif -export ZIPPROG - ZIPOPT=-9 ZIPEXT=.zip - -# Tar -ifndef TARPROG -TARPROG:=$(strip $(wildcard $(addsuffix /tar$(SRCEXEEXT),$(SEARCHPATH)))) -ifeq ($(TARPROG),) -TARPROG= -else -TARPROG:=$(firstword $(TARPROG)) -endif -endif -export TARPROG - ifeq ($(USETAR),bz2) TAROPT=vI TAREXT=.tar.bz2 @@ -394,12 +321,6 @@ else TAROPT=vz TAREXT=.tar.gz endif - -##################################################################### -# Default extensions -##################################################################### - -# Default needed extensions (Go32v2,Linux) LOADEREXT=.as EXEEXT=.exe PPLEXT=.ppl @@ -409,10 +330,9 @@ ASMEXT=.s SMARTEXT=.sl STATICLIBEXT=.a SHAREDLIBEXT=.so +STATICLIBPREFIX=libp RSTEXT=.rst FPCMADE=fpcmade - -# Go32v1 ifeq ($(OS_TARGET),go32v1) PPUEXT=.pp1 OEXT=.o1 @@ -420,29 +340,27 @@ ASMEXT=.s1 SMARTEXT=.sl1 STATICLIBEXT=.a1 SHAREDLIBEXT=.so1 +STATICLIBPREFIX= FPCMADE=fpcmade.v1 +PACKAGESUFFIX=v1 endif - -# Go32v2 ifeq ($(OS_TARGET),go32v2) +STATICLIBPREFIX= FPCMADE=fpcmade.dos +ZIPSUFFIX=go32 endif - -# Linux ifeq ($(OS_TARGET),linux) EXEEXT= HASSHAREDLIB=1 FPCMADE=fpcmade.lnx +ZIPSUFFIX=linux endif - -# Linux ifeq ($(OS_TARGET),freebsd) EXEEXT= HASSHAREDLIB=1 FPCMADE=fpcmade.freebsd +ZIPSUFFIX=freebsd endif - -# Win32 ifeq ($(OS_TARGET),win32) PPUEXT=.ppw OEXT=.ow @@ -451,162 +369,45 @@ SMARTEXT=.slw STATICLIBEXT=.aw SHAREDLIBEXT=.dll FPCMADE=fpcmade.w32 +ZIPSUFFIX=w32 endif - -# OS/2 ifeq ($(OS_TARGET),os2) PPUEXT=.ppo ASMEXT=.so2 OEXT=.oo2 +AOUTEXT=.out SMARTEXT=.so STATICLIBEXT=.ao2 SHAREDLIBEXT=.dll FPCMADE=fpcmade.os2 +ZIPSUFFIX=emx endif - -# library prefix -LIBPREFIX=lib -ifeq ($(OS_TARGET),go32v2) -LIBPREFIX= +ifeq ($(OS_TARGET),amiga) +EXEEXT= +PPUEXT=.ppa +ASMEXT=.asm +OEXT=.o +SMARTEXT=.sl +STATICLIBEXT=.a +SHAREDLIBEXT=.library +FPCMADE=fpcmade.amg endif -ifeq ($(OS_TARGET),go32v1) -LIBPREFIX= +ifeq ($(OS_TARGET),atari) +PPUEXT=.ppt +ASMEXT=.s +OEXT=.o +SMARTEXT=.sl +STATICLIBEXT=.a +EXEEXT=.ttp +FPCMADE=fpcmade.ata endif - -# determine which .pas extension is used -ifndef PASEXT -ifdef EXEOBJECTS -override TESTPAS:=$(strip $(wildcard $(addsuffix .pas,$(firstword $(EXEOBJECTS))))) -else -override TESTPAS:=$(strip $(wildcard $(addsuffix .pas,$(firstword $(UNITOBJECTS))))) +ifdef REQUIRE_UNITSDIR +override UNITSDIR+=$(REQUIRE_UNITSDIR) endif -ifeq ($(TESTPAS),) -PASEXT=.pp -else -PASEXT=.pas +ifdef REQUIRE_PACKAGESDIR +override PACKAGESDIR+=$(REQUIRE_PACKAGESDIR) endif -endif - - -# Check if the dirs really exists, else turn it off -ifeq ($(wildcard $(UNITSDIR)),) -UNITSDIR= -endif -ifeq ($(wildcard $(TOOLKITSDIR)),) -TOOLKITSDIR= -endif -ifeq ($(wildcard $(PACKAGESDIR)),) -PACKAGESDIR= -endif -ifeq ($(wildcard $(COMPONENTSDIR)),) -COMPONENTSDIR= -endif - - -# PACKAGESDIR packages - -PACKAGERTL=1 -PACKAGEFCL=1 -PACKAGEGTK=1 - -ifdef PACKAGERTL -ifneq ($(wildcard $(FPCDIR)/rtl),) -ifneq ($(wildcard $(FPCDIR)/rtl/$(OS_TARGET)),) -PACKAGEDIR_RTL=$(FPCDIR)/rtl/$(OS_TARGET) -else -PACKAGEDIR_RTL=$(FPCDIR)/rtl -endif -ifeq ($(wildcard $(PACKAGEDIR_RTL)/$(FPCMADE)),) -override COMPILEPACKAGES+=package_rtl -package_rtl: - $(MAKE) -C $(PACKAGEDIR_RTL) all -endif -UNITDIR_RTL=$(PACKAGEDIR_RTL) -else -PACKAGEDIR_RTL= -ifneq ($(wildcard $(UNITSDIR)/rtl),) -ifneq ($(wildcard $(UNITSDIR)/rtl/$(OS_TARGET)),) -UNITDIR_RTL=$(UNITSDIR)/rtl/$(OS_TARGET) -else -UNITDIR_RTL=$(UNITSDIR)/rtl -endif -else -UNITDIR_RTL= -endif -endif -ifdef UNITDIR_RTL -override NEEDUNITDIR+=$(UNITDIR_RTL) -endif -endif -ifdef PACKAGEFCL -ifneq ($(wildcard $(FPCDIR)/fcl),) -ifneq ($(wildcard $(FPCDIR)/fcl/$(OS_TARGET)),) -PACKAGEDIR_FCL=$(FPCDIR)/fcl/$(OS_TARGET) -else -PACKAGEDIR_FCL=$(FPCDIR)/fcl -endif -ifeq ($(wildcard $(PACKAGEDIR_FCL)/$(FPCMADE)),) -override COMPILEPACKAGES+=package_fcl -package_fcl: - $(MAKE) -C $(PACKAGEDIR_FCL) all -endif -UNITDIR_FCL=$(PACKAGEDIR_FCL) -else -PACKAGEDIR_FCL= -ifneq ($(wildcard $(UNITSDIR)/fcl),) -ifneq ($(wildcard $(UNITSDIR)/fcl/$(OS_TARGET)),) -UNITDIR_FCL=$(UNITSDIR)/fcl/$(OS_TARGET) -else -UNITDIR_FCL=$(UNITSDIR)/fcl -endif -else -UNITDIR_FCL= -endif -endif -ifdef UNITDIR_FCL -override NEEDUNITDIR+=$(UNITDIR_FCL) -endif -endif -ifdef PACKAGEGTK -ifneq ($(wildcard $(PACKAGESDIR)/gtk),) -ifneq ($(wildcard $(PACKAGESDIR)/gtk/$(OS_TARGET)),) -PACKAGEDIR_GTK=$(PACKAGESDIR)/gtk/$(OS_TARGET) -else -PACKAGEDIR_GTK=$(PACKAGESDIR)/gtk -endif -ifeq ($(wildcard $(PACKAGEDIR_GTK)/$(FPCMADE)),) -override COMPILEPACKAGES+=package_gtk -package_gtk: - $(MAKE) -C $(PACKAGEDIR_GTK) all -endif -UNITDIR_GTK=$(PACKAGEDIR_GTK) -else -PACKAGEDIR_GTK= -ifneq ($(wildcard $(UNITSDIR)/gtk),) -ifneq ($(wildcard $(UNITSDIR)/gtk/$(OS_TARGET)),) -UNITDIR_GTK=$(UNITSDIR)/gtk/$(OS_TARGET) -else -UNITDIR_GTK=$(UNITSDIR)/gtk -endif -else -UNITDIR_GTK= -endif -endif -ifdef UNITDIR_GTK -override NEEDUNITDIR+=$(UNITDIR_GTK) -endif -endif - - -##################################################################### -# Default Directories -##################################################################### - -# Linux and freebsd use unix dirs with /usr/bin, /usr/lib -# When zipping use the target as default, when normal install then -# use the source os as default -ifdef ZIPNAME -# Zipinstall +ifdef ZIPINSTALL ifeq ($(OS_TARGET),linux) UNIXINSTALLDIR=1 endif @@ -614,7 +415,6 @@ ifeq ($(OS_TARGET),freebsd) UNIXINSTALLDIR=1 endif else -# Normal install ifeq ($(OS_SOURCE),linux) UNIXINSTALLDIR=1 endif @@ -622,132 +422,330 @@ ifeq ($(OS_SOURCE),freebsd) UNIXINSTALLDIR=1 endif endif - -# set the prefix directory where to install everything -ifndef PREFIXINSTALLDIR +ifndef INSTALL_PREFIX ifdef UNIXINSTALLDIR -PREFIXINSTALLDIR=/usr +INSTALL_PREFIX=/usr/local else -PREFIXINSTALLDIR=/pp +ifdef INSTALL_FPCPACKAGE +INSTALL_BASEDIR:=/pp +else +INSTALL_BASEDIR:=/$(PACKAGE_NAME) endif endif -export PREFIXINSTALLDIR - -# Where to place the resulting zip files -ifndef DESTZIPDIR -DESTZIPDIR:=$(BASEDIR) endif -export DESTZIPDIR - -##################################################################### -# Install Directories -##################################################################### - -# set the base directory where to install everything -ifndef BASEINSTALLDIR +export INSTALL_PREFIX +ifndef DIST_DESTDIR +DIST_DESTDIR:=$(BASEDIR) +endif +export DIST_DESTDIR +ifndef INSTALL_BASEDIR ifdef UNIXINSTALLDIR -BASEINSTALLDIR=$(PREFIXINSTALLDIR)/lib/lazarus/$(FPC_VERSION) +ifdef INSTALL_FPCPACKAGE +INSTALL_BASEDIR:=$(INSTALL_PREFIX)/lib/fpc/$(FPC_VERSION) else -BASEINSTALLDIR=$(PREFIXINSTALLDIR) +INSTALL_BASEDIR:=$(INSTALL_PREFIX)/lib/$(PACKAGE_NAME) +endif +else +INSTALL_BASEDIR:=$(INSTALL_PREFIX) endif endif - -# set the directory where to install the binaries -ifndef BININSTALLDIR +ifndef INSTALL_BINDIR ifdef UNIXINSTALLDIR -BININSTALLDIR=$(PREFIXINSTALLDIR)/bin +INSTALL_BINDIR:=$(INSTALL_PREFIX)/bin else -BININSTALLDIR=$(BASEINSTALLDIR)/bin/$(OS_TARGET) +INSTALL_BINDIR:=$(INSTALL_BASEDIR)/bin +ifdef INSTALL_FPCPACKAGE +INSTALL_BINDIR:=$(INSTALL_BINDIR)/$(OS_TARGET) endif endif - -# set the directory where to install the units. -ifndef UNITINSTALLDIR -UNITINSTALLDIR=$(BASEINSTALLDIR)/units/$(OS_TARGET) -ifdef UNITSUBDIR -UNITINSTALLDIR:=$(UNITINSTALLDIR)/$(UNITSUBDIR) +endif +ifndef INSTALL_UNITDIR +INSTALL_UNITDIR:=$(INSTALL_BASEDIR)/units/$(OS_TARGET) +ifdef INSTALL_FPCPACKAGE +ifdef PACKAGE_NAME +INSTALL_UNITDIR:=$(INSTALL_UNITDIR)/$(PACKAGE_NAME) endif endif - -# Where to install shared libraries -ifndef LIBINSTALLDIR +endif +ifndef INSTALL_LIBDIR ifdef UNIXINSTALLDIR -LIBINSTALLDIR=$(PREFIXINSTALLDIR)/lib +INSTALL_LIBDIR:=$(INSTALL_PREFIX)/lib else -LIBINSTALLDIR=$(UNITINSTALLDIR) +INSTALL_LIBDIR:=$(INSTALL_UNITDIR) endif endif - -# Where the source files will be stored -ifndef SOURCEINSTALLDIR +ifndef INSTALL_SOURCEDIR ifdef UNIXINSTALLDIR -SOURCEINSTALLDIR=$(PREFIXINSTALLDIR)/src/lazarus-$(FPC_VERSION) +ifdef INSTALL_FPCPACKAGE +INSTALL_SOURCEDIR:=$(INSTALL_PREFIX)/src/fpc-$(FPC_VERSION)/$(PACKAGE_NAME) else -SOURCEINSTALLDIR=$(BASEINSTALLDIR)/source +INSTALL_SOURCEDIR:=$(INSTALL_PREFIX)/src/$(PACKAGE_NAME)-$(PACKAGE_VERSION) endif -ifdef SOURCESUBDIR -SOURCEINSTALLDIR:=$(SOURCEINSTALLDIR)/$(SOURCESUBDIR) +else +ifdef INSTALL_FPCPACKAGE +INSTALL_SOURCEDIR:=$(INSTALL_BASEDIR)/source/$(PACKAGE_NAME) +else +INSTALL_SOURCEDIRL:=$(INSTALL_BASEDIR)/source endif endif - -# Where the doc files will be stored -ifndef DOCINSTALLDIR +endif +ifndef INSTALL_DOCDIR ifdef UNIXINSTALLDIR -DOCINSTALLDIR=$(PREFIXINSTALLDIR)/doc/lazarus-$(FPC_VERSION) +ifdef INSTALL_FPCPACKAGE +INSTALL_DOCDIR:=$(INSTALL_PREFIX)/doc/fpc-$(FPC_VERSION)/$(PACKAGE_NAME) else -DOCINSTALLDIR=$(BASEINSTALLDIR)/doc +INSTALL_DOCDIR:=$(INSTALL_PREFIX)/doc/$(PACKAGE_NAME)-$(PACKAGE_VERSION) +endif +else +ifdef INSTALL_FPCPACKAGE +INSTALL_DOCDIR:=$(INSTALL_BASEDIR)/doc/$(PACKAGE_NAME) +else +INSTALL_DOCDIR:=$(INSTALL_BASEDIR)/doc endif endif - -# Where to install the examples, under linux we use the doc dir -# because the copytree command will create a subdir itself -ifndef EXAMPLEINSTALLDIR +endif +ifndef INSTALL_EXAMPLEDIR ifdef UNIXINSTALLDIR -EXAMPLEINSTALLDIR=$(DOCINSTALLDIR)/examples +ifdef INSTALL_FPCPACKAGE +INSTALL_EXAMPLEDIR:=$(INSTALL_PREFIX)/doc/fpc-$(FPC_VERSION)/examples/$(PACKAGE_NAME) else -EXAMPLEINSTALLDIR=$(BASEINSTALLDIR)/examples +INSTALL_EXAMPLEDIR:=$(INSTALL_PREFIX)/doc/$(PACKAGE_NAME)-$(PACKAGE_VERSION) endif -ifdef EXAMPLESUBDIR -EXAMPLEINSTALLDIR:=$(EXAMPLEINSTALLDIR)/$(EXAMPLESUBDIR) +else +ifdef INSTALL_FPCPACKAGE +INSTALL_EXAMPLEDIR:=$(INSTALL_BASEDIR)/examples/$(PACKAGE_NAME) +else +INSTALL_EXAMPLEDIR:=$(INSTALL_BASEDIR)/examples endif endif - -# Where the some extra (data)files will be stored -ifndef DATAINSTALLDIR -DATAINSTALLDIR=$(BASEINSTALLDIR) endif - -##################################################################### -# Redirection -##################################################################### - -ifndef REDIRFILE -REDIRFILE=log +ifndef INSTALL_DATADIR +INSTALL_DATADIR=$(INSTALL_BASEDIR) endif - -ifdef REDIR -ifndef inUnix -override FPC=redir -eo $(FPC) +ifdef inUnix +ifndef GCCLIBDIR +GCCLIBDIR:=$(shell dirname `(gcc -v 2>&1)| head -n 1| awk '{ print $$4 } '`) endif -# set the verbosity to max -override FPCOPT+=-va -override REDIR:= >> $(REDIRFILE) +ifndef OTHERLIBDIR +OTHERLIBDIR:=$(shell grep -v "^\#" /etc/ld.so.conf | awk '{ ORS=" "; print $1 }') endif - - -##################################################################### -# Compiler Command Line -##################################################################### - -# Load commandline OPTDEF and add FPC_CPU define -override FPCOPTDEF:=-d$(CPU_TARGET) - -# Load commandline OPT and add target and unit dir to be sure +export GCCLIBDIR OTHERLIB +endif +ifeq ($(OS_TARGET),linux) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_PASZLIB=1 +REQUIRE_PACKAGES_INET=1 +REQUIRE_PACKAGES_FCL=1 +REQUIRE_PACKAGES_MYSQL=1 +REQUIRE_PACKAGES_IBASE=1 +endif +ifeq ($(OS_TARGET),go32v2) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_PASZLIB=1 +REQUIRE_PACKAGES_FCL=1 +endif +ifeq ($(OS_TARGET),win32) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_PASZLIB=1 +REQUIRE_PACKAGES_FCL=1 +REQUIRE_PACKAGES_MYSQL=1 +REQUIRE_PACKAGES_IBASE=1 +endif +ifeq ($(OS_TARGET),os2) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_PASZLIB=1 +REQUIRE_PACKAGES_FCL=1 +endif +ifeq ($(OS_TARGET),freebsd) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_PASZLIB=1 +REQUIRE_PACKAGES_INET=1 +REQUIRE_PACKAGES_FCL=1 +REQUIRE_PACKAGES_MYSQL=1 +REQUIRE_PACKAGES_IBASE=1 +endif +ifeq ($(OS_TARGET),beos) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_PASZLIB=1 +REQUIRE_PACKAGES_FCL=1 +endif +ifeq ($(OS_TARGET),amiga) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_PASZLIB=1 +REQUIRE_PACKAGES_FCL=1 +endif +ifeq ($(OS_TARGET),atari) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_PASZLIB=1 +REQUIRE_PACKAGES_FCL=1 +endif +ifdef REQUIRE_PACKAGES_RTL +PACKAGEDIR_RTL:=$(subst /Makefile.fpc,,$(strip $(wildcard $(addsuffix /rtl/Makefile.fpc,$(PACKAGESDIR))))) +ifneq ($(PACKAGEDIR_RTL),) +PACKAGEDIR_RTL:=$(firstword $(PACKAGEDIR_RTL)) +ifeq ($(wildcard $(PACKAGEDIR_RTL)/$(FPCMADE)),) +override COMPILEPACKAGES+=package_rtl +package_rtl: + $(MAKE) -C $(PACKAGEDIR_RTL) all +endif +ifneq ($(wildcard $(PACKAGEDIR_RTL)/$(OS_TARGET)),) +UNITDIR_RTL=$(PACKAGEDIR_RTL)/$(OS_TARGET) +else +UNITDIR_RTL=$(PACKAGEDIR_RTL) +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_PASZLIB +PACKAGEDIR_PASZLIB:=$(subst /Makefile.fpc,,$(strip $(wildcard $(addsuffix /paszlib/Makefile.fpc,$(PACKAGESDIR))))) +ifneq ($(PACKAGEDIR_PASZLIB),) +PACKAGEDIR_PASZLIB:=$(firstword $(PACKAGEDIR_PASZLIB)) +ifeq ($(wildcard $(PACKAGEDIR_PASZLIB)/$(FPCMADE)),) +override COMPILEPACKAGES+=package_paszlib +package_paszlib: + $(MAKE) -C $(PACKAGEDIR_PASZLIB) all +endif +ifneq ($(wildcard $(PACKAGEDIR_PASZLIB)/$(OS_TARGET)),) +UNITDIR_PASZLIB=$(PACKAGEDIR_PASZLIB)/$(OS_TARGET) +else +UNITDIR_PASZLIB=$(PACKAGEDIR_PASZLIB) +endif +else +PACKAGEDIR_PASZLIB= +UNITDIR_PASZLIB:=$(subst /Package.fpc,,$(strip $(wildcard $(addsuffix /paszlib/Package.fpc,$(UNITSDIR))))) +ifneq ($(UNITDIR_PASZLIB),) +UNITDIR_PASZLIB:=$(firstword $(UNITDIR_PASZLIB)) +else +UNITDIR_PASZLIB= +endif +endif +ifdef UNITDIR_PASZLIB +override COMPILER_UNITDIR+=$(UNITDIR_PASZLIB) +endif +endif +ifdef REQUIRE_PACKAGES_INET +PACKAGEDIR_INET:=$(subst /Makefile.fpc,,$(strip $(wildcard $(addsuffix /inet/Makefile.fpc,$(PACKAGESDIR))))) +ifneq ($(PACKAGEDIR_INET),) +PACKAGEDIR_INET:=$(firstword $(PACKAGEDIR_INET)) +ifeq ($(wildcard $(PACKAGEDIR_INET)/$(FPCMADE)),) +override COMPILEPACKAGES+=package_inet +package_inet: + $(MAKE) -C $(PACKAGEDIR_INET) all +endif +ifneq ($(wildcard $(PACKAGEDIR_INET)/$(OS_TARGET)),) +UNITDIR_INET=$(PACKAGEDIR_INET)/$(OS_TARGET) +else +UNITDIR_INET=$(PACKAGEDIR_INET) +endif +else +PACKAGEDIR_INET= +UNITDIR_INET:=$(subst /Package.fpc,,$(strip $(wildcard $(addsuffix /inet/Package.fpc,$(UNITSDIR))))) +ifneq ($(UNITDIR_INET),) +UNITDIR_INET:=$(firstword $(UNITDIR_INET)) +else +UNITDIR_INET= +endif +endif +ifdef UNITDIR_INET +override COMPILER_UNITDIR+=$(UNITDIR_INET) +endif +endif +ifdef REQUIRE_PACKAGES_FCL +PACKAGEDIR_FCL:=$(subst /Makefile.fpc,,$(strip $(wildcard $(addsuffix /fcl/Makefile.fpc,$(PACKAGESDIR))))) +ifneq ($(PACKAGEDIR_FCL),) +PACKAGEDIR_FCL:=$(firstword $(PACKAGEDIR_FCL)) +ifeq ($(wildcard $(PACKAGEDIR_FCL)/$(FPCMADE)),) +override COMPILEPACKAGES+=package_fcl +package_fcl: + $(MAKE) -C $(PACKAGEDIR_FCL) all +endif +ifneq ($(wildcard $(PACKAGEDIR_FCL)/$(OS_TARGET)),) +UNITDIR_FCL=$(PACKAGEDIR_FCL)/$(OS_TARGET) +else +UNITDIR_FCL=$(PACKAGEDIR_FCL) +endif +else +PACKAGEDIR_FCL= +UNITDIR_FCL:=$(subst /Package.fpc,,$(strip $(wildcard $(addsuffix /fcl/Package.fpc,$(UNITSDIR))))) +ifneq ($(UNITDIR_FCL),) +UNITDIR_FCL:=$(firstword $(UNITDIR_FCL)) +else +UNITDIR_FCL= +endif +endif +ifdef UNITDIR_FCL +override COMPILER_UNITDIR+=$(UNITDIR_FCL) +endif +endif +ifdef REQUIRE_PACKAGES_MYSQL +PACKAGEDIR_MYSQL:=$(subst /Makefile.fpc,,$(strip $(wildcard $(addsuffix /mysql/Makefile.fpc,$(PACKAGESDIR))))) +ifneq ($(PACKAGEDIR_MYSQL),) +PACKAGEDIR_MYSQL:=$(firstword $(PACKAGEDIR_MYSQL)) +ifeq ($(wildcard $(PACKAGEDIR_MYSQL)/$(FPCMADE)),) +override COMPILEPACKAGES+=package_mysql +package_mysql: + $(MAKE) -C $(PACKAGEDIR_MYSQL) all +endif +ifneq ($(wildcard $(PACKAGEDIR_MYSQL)/$(OS_TARGET)),) +UNITDIR_MYSQL=$(PACKAGEDIR_MYSQL)/$(OS_TARGET) +else +UNITDIR_MYSQL=$(PACKAGEDIR_MYSQL) +endif +else +PACKAGEDIR_MYSQL= +UNITDIR_MYSQL:=$(subst /Package.fpc,,$(strip $(wildcard $(addsuffix /mysql/Package.fpc,$(UNITSDIR))))) +ifneq ($(UNITDIR_MYSQL),) +UNITDIR_MYSQL:=$(firstword $(UNITDIR_MYSQL)) +else +UNITDIR_MYSQL= +endif +endif +ifdef UNITDIR_MYSQL +override COMPILER_UNITDIR+=$(UNITDIR_MYSQL) +endif +endif +ifdef REQUIRE_PACKAGES_IBASE +PACKAGEDIR_IBASE:=$(subst /Makefile.fpc,,$(strip $(wildcard $(addsuffix /ibase/Makefile.fpc,$(PACKAGESDIR))))) +ifneq ($(PACKAGEDIR_IBASE),) +PACKAGEDIR_IBASE:=$(firstword $(PACKAGEDIR_IBASE)) +ifeq ($(wildcard $(PACKAGEDIR_IBASE)/$(FPCMADE)),) +override COMPILEPACKAGES+=package_ibase +package_ibase: + $(MAKE) -C $(PACKAGEDIR_IBASE) all +endif +ifneq ($(wildcard $(PACKAGEDIR_IBASE)/$(OS_TARGET)),) +UNITDIR_IBASE=$(PACKAGEDIR_IBASE)/$(OS_TARGET) +else +UNITDIR_IBASE=$(PACKAGEDIR_IBASE) +endif +else +PACKAGEDIR_IBASE= +UNITDIR_IBASE:=$(subst /Package.fpc,,$(strip $(wildcard $(addsuffix /ibase/Package.fpc,$(UNITSDIR))))) +ifneq ($(UNITDIR_IBASE),) +UNITDIR_IBASE:=$(firstword $(UNITDIR_IBASE)) +else +UNITDIR_IBASE= +endif +endif +ifdef UNITDIR_IBASE +override COMPILER_UNITDIR+=$(UNITDIR_IBASE) +endif +endif +.PHONY: package_rtl package_paszlib package_inet package_fcl package_mysql package_ibase +override FPCOPTDEF=$(CPU_TARGET) ifneq ($(OS_TARGET),$(OS_SOURCE)) override FPCOPT+=-T$(OS_TARGET) endif - -# User dirs should be first, so they are looked at first ifdef UNITDIR override FPCOPT+=$(addprefix -Fu,$(UNITDIR)) endif @@ -760,114 +758,86 @@ endif ifdef INCDIR override FPCOPT+=$(addprefix -Fi,$(INCDIR)) endif - -# Smartlinking ifdef LINKSMART override FPCOPT+=-XX endif - -# Smartlinking creation ifdef CREATESMART override FPCOPT+=-CX endif - -# Debug ifdef DEBUG -override FPCOPT+=-gl -dDEBUG +override FPCOPT+=-gl +override FPCOPTDEF+=DEBUG endif - -# Release mode (strip, optimize and don't load ppc386.cfg) -# 0.99.12b has a bug in the optimizer so don't use it by default ifdef RELEASE -ifeq ($(FPC_VERSION),0.99.12) -override FPCOPT+=-Xs -OGp3 -n -else override FPCOPT+=-Xs -OG2p3 -n +override FPCOPTDEF+=RELEASE endif -endif - -# Strip ifdef STRIP override FPCOPT+=-Xs endif - -# Optimizer ifdef OPTIMIZE override FPCOPT+=-OG2p3 endif - -# Verbose settings (warning,note,info) ifdef VERBOSE override FPCOPT+=-vwni endif - -ifdef NEEDOPT -override FPCOPT+=$(NEEDOPT) +ifdef COMPILER_OPTIONS +override FPCOPT+=$(COMPILER_OPTIONS) endif - -ifdef NEEDUNITDIR -override FPCOPT+=$(addprefix -Fu,$(NEEDUNITDIR)) +ifdef COMPILER_UNITDIR +override FPCOPT+=$(addprefix -Fu,$(COMPILER_UNITDIR)) endif - -ifdef UNITSDIR -override FPCOPT+=-Fu$(UNITSDIR) +ifdef COMPILER_LIBRARYDIR +override FPCOPT+=$(addprefix -Fl,$(COMPILER_LIBRARYDIR)) endif - -# Target dirs and the prefix to use for clean/install -ifdef TARGETDIR -override FPCOPT+=-FE$(TARGETDIR) -ifeq ($(TARGETDIR),.) +ifdef COMPILER_OBJECTDIR +override FPCOPT+=$(addprefix -Fo,$(COMPILER_OBJECTDIR)) +endif +ifdef COMPILER_INCLUDEDIR +override FPCOPT+=$(addprefix -Fi,$(COMPILER_INCLUDEDIR)) +endif +ifdef COMPILER_TARGETDIR +override FPCOPT+=-FE$(COMPILER_TARGETDIR) +ifeq ($(COMPILER_TARGETDIR),.) override TARGETDIRPREFIX= else -override TARGETDIRPREFIX=$(TARGETDIR)/ +override TARGETDIRPREFIX=$(COMPILER_TARGETDIR)/ endif endif -ifdef UNITTARGETDIR -override FPCOPT+=-FU$(UNITTARGETDIR) -ifeq ($(UNITTARGETDIR),.) +ifdef COMPILER_UNITTARGETDIR +override FPCOPT+=-FU$(COMPILER_UNITTARGETDIR) +ifeq ($(COMPILER_UNITTARGETDIR),.) override UNITTARGETDIRPREFIX= else -override UNITTARGETDIRPREFIX=$(UNITTARGETDIR)/ +override UNITTARGETDIRPREFIX=$(COMPILER_UNITTARGETDIR)/ endif else -ifdef TARGETDIR -override UNITTARGETDIR=$(TARGETDIR) +ifdef COMPILER_TARGETDIR +override COMPILER_UNITTARGETDIR=$(COMPILER_TARGETDIR) override UNITTARGETDIRPREFIX=$(TARGETDIRPREFIX) endif endif - -# Add commandline options last so they can override +ifdef GCCLIBDIR +override FPCOPT+=-Fl$(GCCLIBDIR) +endif +ifdef OTHERLIBDIR +override FPCOPT+=$(addprefix -Fl,$(OTHERLIBDIR)) +endif ifdef OPT override FPCOPT+=$(OPT) endif - -# Add defines from FPCOPTDEF to FPCOPT ifdef FPCOPTDEF -override FPCOPT+=$(FPCOPTDEF) +override FPCOPT+=$(addprefix -d,$(FPCOPTDEF)) endif - -# Error file ? -ifdef ERRORFILE -override FPCOPT+=-Fr$(ERRORFILE) -endif - -# Was a config file specified ? ifdef CFGFILE override FPCOPT+=@$(CFGFILE) endif - -# For win32 the options are passed using the environment FPCEXTCMD -ifeq ($(OS_SOURCE),win32) +ifdef USEENV override FPCEXTCMD:=$(FPCOPT) override FPCOPT:=!FPCEXTCMD export FPCEXTCMD endif - -# Compiler commandline override COMPILER:=$(FPC) $(FPCOPT) - -# also call ppas if with command option -s -# but only if the OS_SOURCE and OS_TARGE are equal ifeq (,$(findstring -s ,$(COMPILER))) EXECPPAS= else @@ -875,295 +845,165 @@ ifeq ($(OS_SOURCE),$(OS_TARGET)) EXECPPAS:=@$(PPAS) endif endif - -##################################################################### -# Standard rules -##################################################################### - -debug: fpc_debug - -smart: fpc_smart - -shared: fpc_shared - -showinstall: fpc_showinstall - -install: fpc_install - -sourceinstall: fpc_sourceinstall - -exampleinstall: fpc_exampleinstall - -zipinstall: fpc_zipinstall - -zipsourceinstall: fpc_zipsourceinstall - -zipexampleinstall: fpc_zipexampleinstall - -clean: fpc_clean - -distclean: fpc_distclean - -cleanall: fpc_cleanall - -info: fpc_info - -.PHONY: debug smart shared showinstall install sourceinstall exampleinstall zipinstall zipsourceinstall zipexampleinstall clean distclean cleanall info - -##################################################################### -# General compile rules -##################################################################### - -.PHONY: fpc_packages fpc_all fpc_debug - +.PHONY: fpc_units +ifdef TARGET_UNITS +override ALLTARGET+=fpc_units +override UNITPPUFILES=$(addsuffix $(PPUEXT),$(TARGET_UNITS)) +override INSTALLPPUFILES+=$(UNITPPUFILES) +override CLEANPPUFILES+=$(UNITPPUFILES) +endif +fpc_units: $(UNITPPUFILES) +ifdef TARGET_RSTS +override RSTFILES=$(addsuffix $(RSTEXT),$(TARGET_RSTS)) +override CLEANRSTFILES+=$(RSTFILES) +endif +.PHONY: fpc_packages fpc_all fpc_smart fpc_debug $(FPCMADE): $(ALLTARGET) - @$(ECHO) Compiled > $(FPCMADE) - + @$(ECHOREDIR) Compiled > $(FPCMADE) fpc_packages: $(COMPILEPACKAGES) - fpc_all: fpc_packages $(FPCMADE) - -fpc_debug: - $(MAKE) all DEBUG=1 - -# Search paths for .ppu if targetdir is set -ifdef UNITTARGETDIR -vpath %$(PPUEXT) $(UNITTARGETDIR) -endif - -# General compile rules, available for both possible PASEXT - -.SUFFIXES: $(EXEEXT) $(PPUEXT) $(OEXT) .pas .pp - -%$(PPUEXT): %.pp - $(COMPILER) $< $(REDIR) - $(EXECPPAS) - -%$(PPUEXT): %.pas - $(COMPILER) $< $(REDIR) - $(EXECPPAS) - -%$(EXEEXT): %.pp - $(COMPILER) $< $(REDIR) - $(EXECPPAS) - -%$(EXEEXT): %.pas - $(COMPILER) $< $(REDIR) - $(EXECPPAS) - -##################################################################### -# Library -##################################################################### - -.PHONY: fpc_smart fpc_shared - -ifdef LIBVERSION -LIBFULLNAME=$(LIBNAME).$(LIBVERSION) -else -LIBFULLNAME=$(LIBNAME) -endif - -# Default sharedlib units are all unit objects -ifndef SHAREDLIBUNITOBJECTS -SHAREDLIBUNITOBJECTS:=$(UNITOBJECTS) -endif - fpc_smart: $(MAKE) all LINKSMART=1 CREATESMART=1 - -fpc_shared: all -ifdef HASSHAREDLIB -ifndef LIBNAME - @$(ECHO) "LIBNAME not set" -else - $(PPUMOVE) $(SHAREDLIBUNITOBJECTS) -o$(LIBFULLNAME) +fpc_debug: + $(MAKE) all DEBUG=1 +.SUFFIXES: $(EXEEXT) $(PPUEXT) $(OEXT) .pas .pp +%$(PPUEXT): %.pp + $(COMPILER) $< + $(EXECPPAS) +%$(PPUEXT): %.pas + $(COMPILER) $< + $(EXECPPAS) +%$(EXEEXT): %.pp + $(COMPILER) $< + $(EXECPPAS) +%$(EXEEXT): %.pas + $(COMPILER) $< + $(EXECPPAS) +vpath %.pp $(COMPILER_SOURCEDIR) $(COMPILER_INCLUDEDIR) +vpath %.pas $(COMPILER_SOURCEDIR) $(COMPILER_INCLUDEDIR) +vpath %$(PPUEXT) $(COMPILER_UNITTARGETDIR) +.PHONY: fpc_install fpc_sourceinstall fpc_exampleinstall +ifdef INSTALL_UNITS +override INSTALLPPUFILES+=$(addsuffix $(PPUEXT),$(INSTALL_UNITS)) endif -else - @$(ECHO) "Shared Libraries not supported" -endif - -##################################################################### -# Install rules -##################################################################### - -.PHONY: fpc_showinstall fpc_install - -ifdef EXTRAINSTALLUNITS -override INSTALLPPUFILES+=$(addsuffix $(PPUEXT),$(EXTRAINSTALLUNITS)) -endif - ifdef INSTALLPPUFILES +override INSTALLPPULINKFILES:=$(subst $(PPUEXT),$(OEXT),$(INSTALLPPUFILES)) $(addprefix $(STATICLIBPREFIX),$(subst $(PPUEXT),$(STATICLIBEXT),$(INSTALLPPUFILES))) override INSTALLPPUFILES:=$(addprefix $(UNITTARGETDIRPREFIX),$(INSTALLPPUFILES)) -ifdef PPUFILES -INSTALLPPULINKFILES:=$(addprefix $(UNITTARGETDIRPREFIX),$(shell $(PPUFILES) -S -O $(INSTALLPPUFILES))) -else -INSTALLPPULINKFILES:=$(wildcard $(subst $(PPUEXT),$(OEXT),$(INSTALLPPUFILES)) $(addprefix $(LIBPREFIX),$(subst $(PPUEXT),$(STATICLIBEXT),$(INSTALLPPUFILES)))) +override INSTALLPPULINKFILES:=$(wildcard $(addprefix $(UNITTARGETDIRPREFIX),$(INSTALLPPULINKFILES))) +override INSTALL_CREATEPACKAGEFPC=1 endif -# MWE: not here UNITTARGETDIRPREFIX is already added when no PPUFILES -# override INSTALLPPULINKFILES:=$(addprefix $(UNITTARGETDIRPREFIX),$(INSTALLPPULINKFILES)) -endif - ifdef INSTALLEXEFILES override INSTALLEXEFILES:=$(addprefix $(TARGETDIRPREFIX),$(INSTALLEXEFILES)) endif - -fpc_showinstall: $(SHOWINSTALLTARGET) -ifdef INSTALLEXEFILES - @$(ECHO) -e $(addprefix "\n"$(BININSTALLDIR)/,$(INSTALLEXEFILES)) -endif -ifdef INSTALLPPUFILES - @$(ECHO) -e $(addprefix "\n"$(UNITINSTALLDIR)/,$(INSTALLPPUFILES)) -ifneq ($(INSTALLPPULINKFILES),) - @$(ECHO) -e $(addprefix "\n"$(UNITINSTALLDIR)/,$(INSTALLPPULINKFILES)) -endif -ifneq ($(wildcard $(LIBFULLNAME)),) - @$(ECHO) $(LIBINSTALLDIR)/$(LIBFULLNAME) -ifdef HASSHAREDLIB - @$(ECHO) $(LIBINSTALLDIR)/$(LIBNAME) -endif -endif -endif -ifdef EXTRAINSTALLFILES - @$(ECHO) -e $(addprefix "\n"$(DATAINSTALLDIR)/,$(EXTRAINSTALLFILES)) -endif - fpc_install: $(INSTALLTARGET) -# Create UnitInstallFiles ifdef INSTALLEXEFILES - $(MKDIR) $(BININSTALLDIR) -# Compress the exes if upx is defined + $(MKDIR) $(INSTALL_BINDIR) ifdef UPXPROG -$(UPXPROG) $(INSTALLEXEFILES) endif - $(INSTALLEXE) $(INSTALLEXEFILES) $(BININSTALLDIR) + $(INSTALLEXE) $(INSTALLEXEFILES) $(INSTALL_BINDIR) +endif +ifdef INSTALL_CREATEPACKAGEFPC +ifdef FPCMAKE +ifdef PACKAGE_VERSION +ifneq ($(wildcard Makefile.fpc),) + $(FPCMAKE) -p Makefile.fpc + $(MKDIR) $(INSTALL_UNITDIR) + $(INSTALL) Package.fpc $(INSTALL_UNITDIR) +endif +endif +endif endif ifdef INSTALLPPUFILES - $(MKDIR) $(UNITINSTALLDIR) - $(INSTALL) $(INSTALLPPUFILES) $(UNITINSTALLDIR) + $(MKDIR) $(INSTALL_UNITDIR) + $(INSTALL) $(INSTALLPPUFILES) $(INSTALL_UNITDIR) ifneq ($(INSTALLPPULINKFILES),) - $(INSTALL) $(INSTALLPPULINKFILES) $(UNITINSTALLDIR) + $(INSTALL) $(INSTALLPPULINKFILES) $(INSTALL_UNITDIR) endif -ifneq ($(wildcard $(LIBFULLNAME)),) - $(MKDIR) $(LIBINSTALLDIR) - $(INSTALL) $(LIBFULLNAME) $(LIBINSTALLDIR) +ifneq ($(wildcard $(LIB_FULLNAME)),) + $(MKDIR) $(INSTALL_LIBDIR) + $(INSTALL) $(LIB_FULLNAME) $(INSTALL_LIBDIR) ifdef inUnix - ln -sf $(LIBFULLNAME) $(LIBINSTALLDIR)/$(LIBNAME) + ln -sf $(LIB_FULLNAME) $(INSTALL_LIBDIR)/$(LIB_NAME) endif endif endif -ifdef EXTRAINSTALLFILES - $(MKDIR) $(DATAINSTALLDIR) - $(INSTALL) $(EXTRAINSTALLFILES) $(DATAINSTALLDIR) +ifdef INSTALL_FILES + $(MKDIR) $(INSTALL_DATADIR) + $(INSTALL) $(INSTALL_FILES) $(INSTALL_DATADIR) endif - -##################################################################### -# SourceInstall rules -##################################################################### - -.PHONY: fpc_sourceinstall - -ifndef SOURCETOPDIR -SOURCETOPDIR=$(BASEDIR) +fpc_sourceinstall: distclean + $(MKDIR) $(INSTALL_SOURCEDIR) + $(COPYTREE) $(BASEDIR) $(INSTALL_SOURCEDIR) +fpc_exampleinstall: $(addsuffix _distclean,$(TARGET_EXAMPLEDIRS)) +ifdef HASEXAMPLES + $(MKDIR) $(INSTALL_EXAMPLEDIR) endif - -fpc_sourceinstall: clean - $(MKDIR) $(SOURCEINSTALLDIR) - $(COPYTREE) $(SOURCETOPDIR) $(SOURCEINSTALLDIR) - -##################################################################### -# exampleinstall rules -##################################################################### - -.PHONY: fpc_exampleinstall - -fpc_exampleinstall: $(addsuffix _clean,$(EXAMPLEDIROBJECTS)) ifdef EXAMPLESOURCEFILES - $(MKDIR) $(EXAMPLEINSTALLDIR) - $(COPY) $(EXAMPLESOURCEFILES) $(EXAMPLEINSTALLDIR) + $(COPY) $(EXAMPLESOURCEFILES) $(INSTALL_EXAMPLEDIR) endif -ifdef EXAMPLEDIROBJECTS -ifndef EXAMPLESOURCEFILES - $(MKDIR) $(EXAMPLEINSTALLDIR) +ifdef TARGET_EXAMPLEDIRS + $(COPYTREE) $(addsuffix /*,$(TARGET_EXAMPLEDIRS)) $(INSTALL_EXAMPLEDIR) endif - $(COPYTREE) $(addsuffix /*,$(EXAMPLEDIROBJECTS)) $(EXAMPLEINSTALLDIR) -endif - -##################################################################### -# Zip -##################################################################### - -.PHONY: fpc_zipinstall - -# Create suffix to add -ifndef PACKAGESUFFIX -PACKAGESUFFIX=$(OS_TARGET) -ifeq ($(OS_TARGET),go32v2) -PACKAGESUFFIX=go32 -endif -ifeq ($(OS_TARGET),win32) -PACKAGESUFFIX=w32 -endif -ifeq ($(OS_TARGET),os2) -PACKAGESUFFIX=emx -endif -endif - -# Temporary path to pack a file +.PHONY: fpc_distinstall +fpc_distinstall: install exampleinstall +.PHONY: fpc_zipinstall fpc_zipsourceinstall fpc_zipexampleinstall ifndef PACKDIR ifndef inUnix -PACKDIR=$(BASEDIR)/pack_tmp +PACKDIR=$(BASEDIR)/../fpc-pack else -PACKDIR=/tmp/lazarus-pack +PACKDIR=/tmp/fpc-pack endif endif - -# Maybe create default zipname from packagename ifndef ZIPNAME -ifdef PACKAGENAME -ZIPNAME=$(PACKAGEPREFIX)$(PACKAGENAME)$(PACKAGESUFFIX) +ifdef DIST_ZIPNAME +ZIPNAME=$(DIST_ZIPNAME) +else +ZIPNAME=$(ZIPPREFIX)$(PACKAGE_NAME)$(ZIPSUFFIX) +endif +endif +ifndef ZIPTARGET +ifdef DIST_ZIPTARGET +ZIPTARGET=DIST_ZIPTARGET +else +ZIPTARGET=install endif endif - -# Use tar by default under linux ifndef USEZIP ifdef inUnix USETAR=1 endif endif - -# Use a wrapper script by default for OS/2 -ifdef inOS2 +ifndef inUnix USEZIPWRAPPER=1 endif - -# Create commands to create the zip/tar file -ZIPWRAPPER=$(DESTZIPDIR)/fpczip$(BATCHEXT) -ZIPCMD_CDPACK:=cd $(subst /,$(PATHSEP),$(PACKDIR)) -ZIPCMD_CDBASE:=cd $(subst /,$(PATHSEP),$(BASEDIR)) +ifdef USEZIPWRAPPER +ZIPPATHSEP=$(PATHSEP) +ZIPWRAPPER=$(subst /,$(PATHSEP),$(DIST_DESTDIR)/fpczip$(BATCHEXT)) +else +ZIPPATHSEP=/ +endif +ZIPCMD_CDPACK:=cd $(subst /,$(ZIPPATHSEP),$(PACKDIR)) +ZIPCMD_CDBASE:=cd $(subst /,$(ZIPPATHSEP),$(BASEDIR)) ifdef USETAR -ZIPDESTFILE:=$(DESTZIPDIR)/$(ZIPNAME)$(TAREXT) +ZIPDESTFILE:=$(DIST_DESTDIR)/$(ZIPNAME)$(TAREXT) ZIPCMD_ZIP:=$(TARPROG) cf$(TAROPT) $(ZIPDESTFILE) * else -ZIPDESTFILE:=$(DESTZIPDIR)/$(ZIPNAME)$(ZIPEXT) -ZIPCMD_ZIP:=$(subst /,$(PATHSEP),$(ZIPPROG)) -Dr $(ZIPOPT) $(ZIPDESTFILE) * +ZIPDESTFILE:=$(DIST_DESTDIR)/$(ZIPNAME)$(ZIPEXT) +ZIPCMD_ZIP:=$(subst /,$(ZIPPATHSEP),$(ZIPPROG)) -Dr $(ZIPOPT) $(ZIPDESTFILE) * endif - fpc_zipinstall: -ifndef ZIPNAME - @$(ECHO) "Please specify ZIPNAME!" - @exit 1 -else - $(MAKE) $(ZIPTARGET) PREFIXINSTALLDIR=$(PACKDIR) + $(MAKE) $(ZIPTARGET) INSTALL_PREFIX=$(PACKDIR) ZIPINSTALL=1 $(DEL) $(ZIPDESTFILE) ifdef USEZIPWRAPPER -ifneq ($(ECHO),echo) - $(ECHO) "$(ZIPCMD_CDPACK)" > $(ZIPWRAPPER) - $(ECHO) "$(ZIPCMD_ZIP)" >> $(ZIPWRAPPER) - $(ECHO) "$(ZIPCMD_CDBASE)" >> $(ZIPWRAPPER) +ifneq ($(ECHOREDIR),echo) + $(ECHOREDIR) -e "$(subst \,\\,$(ZIPCMD_CDPACK))" > $(ZIPWRAPPER) + $(ECHOREDIR) -e "$(subst \,\\,$(ZIPCMD_ZIP))" >> $(ZIPWRAPPER) + $(ECHOREDIR) -e "$(subst \,\\,$(ZIPCMD_CDBASE))" >> $(ZIPWRAPPER) else - $(ECHO) $(ZIPCMD_CDPACK) > $(ZIPWRAPPER) - $(ECHO) $(ZIPCMD_ZIP) >> $(ZIPWRAPPER) - $(ECHO) $(ZIPCMD_CDBASE) >> $(ZIPWRAPPER) + echo $(ZIPCMD_CDPACK) > $(ZIPWRAPPER) + echo $(ZIPCMD_ZIP) >> $(ZIPWRAPPER) + echo $(ZIPCMD_CDBASE) >> $(ZIPWRAPPER) endif ifdef inUnix /bin/sh $(ZIPWRAPPER) @@ -1175,44 +1015,26 @@ else $(ZIPCMD_CDPACK) ; $(ZIPCMD_ZIP) ; $(ZIPCMD_CDBASE) endif $(DELTREE) $(PACKDIR) -endif - -.PHONY: fpc_zipsourceinstall - fpc_zipsourceinstall: - $(MAKE) fpc_zipinstall ZIPTARGET=sourceinstall PACKAGESUFFIX=src - -.PHONY: fpc_zipexampleinstall - + $(MAKE) fpc_zipinstall ZIPTARGET=sourceinstall ZIPSUFFIX=src fpc_zipexampleinstall: - $(MAKE) fpc_zipinstall ZIPTARGET=exampleinstall PACKAGESUFFIX=exm - -##################################################################### -# Clean rules -##################################################################### - +ifdef HASEXAMPLES + $(MAKE) fpc_zipinstall ZIPTARGET=exampleinstall ZIPSUFFIX=exm +endif +fpc_zipdistinstall: + $(MAKE) fpc_zipinstall ZIPTARGET=distinstall .PHONY: fpc_clean fpc_cleanall fpc_distclean - ifdef EXEFILES override CLEANEXEFILES:=$(addprefix $(TARGETDIRPREFIX),$(CLEANEXEFILES)) endif - -ifdef EXTRACLEANUNITS -override CLEANPPUFILES+=$(addsuffix $(PPUEXT),$(EXTRACLEANUNITS)) +ifdef CLEAN_UNITS +override CLEANPPUFILES+=$(addsuffix $(PPUEXT),$(CLEAN_UNITS)) endif - ifdef CLEANPPUFILES +override CLEANPPULINKFILES:=$(subst $(PPUEXT),$(OEXT),$(CLEANPPUFILES)) $(addprefix $(STATICLIBPREFIX),$(subst $(PPUEXT),$(STATICLIBEXT),$(CLEANPPUFILES))) override CLEANPPUFILES:=$(addprefix $(UNITTARGETDIRPREFIX),$(CLEANPPUFILES)) -# Get the .o and .a files created for the units -ifdef PPUFILES -CLEANPPULINKFILES:=$(addprefix $(UNITTARGETDIRPREFIX),$(shell $(PPUFILES) $(CLEANPPUFILES))) -else -CLEANPPULINKFILES:=$(wildcard $(subst $(PPUEXT),$(OEXT),$(CLEANPPUFILES)) $(addprefix $(LIBPREFIX),$(subst $(PPUEXT),$(STATICLIBEXT),$(CLEANPPUFILES)))) +override CLEANPPULINKFILES:=$(wildcard $(addprefix $(UNITTARGETDIRPREFIX),$(CLEANPPULINKFILES))) endif -# MWE: not here UNITTARGETDIRPREFIX is already added when no PPUFILES -# override CLEANPPULINKFILES:=$(addprefix $(UNITTARGETDIRPREFIX),$(CLEANPPULINKFILES)) -endif - fpc_clean: $(CLEANTARGET) ifdef CLEANEXEFILES -$(DEL) $(CLEANEXEFILES) @@ -1226,22 +1048,17 @@ endif ifdef CLEANRSTFILES -$(DEL) $(addprefix $(UNITTARGETDIRPREFIX),$(CLEANRSTFILES)) endif -ifdef EXTRACLEANFILES - -$(DEL) $(EXTRACLEANFILES) +ifdef CLEAN_FILES + -$(DEL) $(CLEAN_FILES) endif -ifdef LIBNAME - -$(DEL) $(LIBNAME) $(LIBFULLNAME) +ifdef LIB_NAME + -$(DEL) $(LIB_NAME) $(LIB_FULLNAME) endif - -$(DEL) $(FPCMADE) $(PPAS) link.res $(FPCEXTFILE) $(REDIRFILE) - -fpc_distclean: fpc_clean - -# Also run clean first if targetdir is set. Unittargetdir is always -# set if targetdir or unittargetdir is specified -ifdef UNITTARGETDIR + -$(DEL) $(FPCMADE) Package.fpc $(PPAS) link.res $(FPCEXTFILE) $(REDIRFILE) +fpc_distclean: clean +ifdef COMPILER_UNITTARGETDIR TARGETDIRCLEAN=fpc_clean endif - fpc_cleanall: $(CLEANTARGET) $(TARGETDIRCLEAN) ifdef CLEANEXEFILES -$(DEL) $(CLEANEXEFILES) @@ -1249,83 +1066,108 @@ endif -$(DEL) *$(OEXT) *$(PPUEXT) *$(RSTEXT) *$(ASMEXT) *$(STATICLIBEXT) *$(SHAREDLIBEXT) *$(PPLEXT) -$(DELTREE) *$(SMARTEXT) -$(DEL) $(FPCMADE) $(PPAS) link.res $(FPCEXTFILE) $(REDIRFILE) - -##################################################################### -# Info rules -##################################################################### - -.PHONY: fpc_info fpc_cfginfo fpc_objectinfo fpc_toolsinfo fpc_installinfo \ - fpc_dirinfo - -fpc_info: $(INFOTARGET) - -fpc_infocfg: +ifdef AOUTEXT + -$(DEL) *$(AOUTEXT) +endif +.PHONY: fpc_info +fpc_info: + @$(ECHO) + @$(ECHO) == Package info == + @$(ECHO) Package Name..... $(PACKAGE_NAME) + @$(ECHO) Package Version.. $(PACKAGE_VERSION) @$(ECHO) @$(ECHO) == Configuration info == @$(ECHO) - @$(ECHO) FPC....... $(FPC) - @$(ECHO) Version... $(FPC_VERSION) - @$(ECHO) CPU....... $(CPU_TARGET) - @$(ECHO) Source.... $(OS_SOURCE) - @$(ECHO) Target.... $(OS_TARGET) + @$(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) - -fpc_infoobjects: + @$(ECHO) == Directory info == + @$(ECHO) + @$(ECHO) Basedir......... $(BASEDIR) + @$(ECHO) FPCDir.......... $(FPCDIR) + @$(ECHO) UnitsDir........ $(UNITSDIR) + @$(ECHO) PackagesDir..... $(PACKAGESDIR) + @$(ECHO) + @$(ECHO) GCC library..... $(GCCLIBDIR) + @$(ECHO) Other library... $(OTHERLIBDIR) + @$(ECHO) + @$(ECHO) == Tools info == + @$(ECHO) + @$(ECHO) Pwd....... $(PWD) + @$(ECHO) Mv........ $(MVPROG) + @$(ECHO) Cp........ $(CPPROG) + @$(ECHO) Rm........ $(RMPROG) + @$(ECHO) GInstall.. $(GINSTALL) + @$(ECHO) Echo...... $(ECHO) + @$(ECHO) Date...... $(DATE) + @$(ECHO) FPCMake... $(FPCMAKE) + @$(ECHO) PPUMove... $(PPUMOVE) + @$(ECHO) Upx....... $(UPXPROG) + @$(ECHO) Zip....... $(ZIPPROG) @$(ECHO) @$(ECHO) == Object info == @$(ECHO) - @$(ECHO) LoaderObjects..... $(LOADEROBJECTS) - @$(ECHO) UnitObjects....... $(UNITOBJECTS) - @$(ECHO) ExeObjects........ $(EXEOBJECTS) + @$(ECHO) Target Loaders...... $(TARGET_LOADERS) + @$(ECHO) Target Units........ $(TARGET_UNITS) + @$(ECHO) Target Programs..... $(TARGET_PROGRAMS) + @$(ECHO) Target Dirs......... $(TARGET_DIRS) + @$(ECHO) Target Examples..... $(TARGET_EXAMPLES) + @$(ECHO) Target ExampleDirs.. $(TARGET_EXAMPLEDIRS) @$(ECHO) - @$(ECHO) ExtraCleanUnits... $(EXTRACLEANUNITS) - @$(ECHO) ExtraCleanFiles... $(EXTRACLEANFILES) + @$(ECHO) Clean Units......... $(CLEAN_UNITS) + @$(ECHO) Clean Files......... $(CLEAN_FILES) @$(ECHO) - @$(ECHO) ExtraInstallUnits. $(EXTRAINSTALLUNITS) - @$(ECHO) ExtraInstallFiles. $(EXTRAINSTALLFILES) - @$(ECHO) - -fpc_infoinstall: + @$(ECHO) Install Units....... $(INSTALL_UNITS) + @$(ECHO) Install Files....... $(INSTALL_FILES) @$(ECHO) @$(ECHO) == Install info == @$(ECHO) -ifdef DATE @$(ECHO) DateStr.............. $(DATESTR) -endif -ifdef PACKAGEPREFIX - @$(ECHO) PackagePrefix........ $(PACKAGEPREFIX) -endif -ifdef PACKAGENAME - @$(ECHO) PackageName.......... $(PACKAGENAME) -endif - @$(ECHO) PackageSuffix........ $(PACKAGESUFFIX) + @$(ECHO) ZipPrefix............ $(ZIPPREFIX) + @$(ECHO) ZipSuffix............ $(ZIPSUFFIX) + @$(ECHO) Install FPC Package.. $(INSTALL_FPCPACKAGE) @$(ECHO) - @$(ECHO) BaseInstallDir....... $(BASEINSTALLDIR) - @$(ECHO) BinInstallDir........ $(BININSTALLDIR) - @$(ECHO) LibInstallDir........ $(LIBINSTALLDIR) - @$(ECHO) UnitInstallDir....... $(UNITINSTALLDIR) - @$(ECHO) SourceInstallDir..... $(SOURCEINSTALLDIR) - @$(ECHO) DocInstallDir........ $(DOCINSTALLDIR) - @$(ECHO) DataInstallDir....... $(DATAINSTALLDIR) + @$(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) DestZipDir........... $(DESTZIPDIR) - @$(ECHO) ZipName.............. $(ZIPNAME) + @$(ECHO) Dist destination dir. $(DIST_DESTDIR) + @$(ECHO) Dist zip name........ $(DIST_ZIPNAME) @$(ECHO) - -##################################################################### -# Local Makefile -##################################################################### - +debug: fpc_debug +smart: fpc_smart +examples: +shared: +install: fpc_install +sourceinstall: fpc_sourceinstall +exampleinstall: fpc_exampleinstall +distinstall: fpc_distinstall +zipinstall: fpc_zipinstall +zipsourceinstall: fpc_zipsourceinstall +zipexampleinstall: fpc_zipexampleinstall +zipdistinstall: fpc_zipdistinstall +clean: fpc_clean +distclean: fpc_distclean +cleanall: fpc_cleanall +info: fpc_info +.PHONY: debug smart examples shared install sourceinstall exampleinstall distinstall zipinstall zipsourceinstall zipexampleinstall zipdistinstall clean distclean cleanall info ifneq ($(wildcard fpcmake.loc),) include fpcmake.loc endif - -##################################################################### -# Users rules -##################################################################### - +.PHONY: cleartarget all makefile makefiles cleartarget: - -$(DEL) $(UNITTARGETDIR)/allunits$(PPUEXT) - + -$(DEL) $(COMPILER_UNITTARGETDIR)/allunits$(PPUEXT) all: cleartarget allunits$(PPUEXT) - -$(DEL) $(UNITTARGETDIR)/allunits$(PPUEXT) + -$(DEL) $(COMPILER_UNITTARGETDIR)/allunits$(PPUEXT) +makefile: Makefile.fpc + -$(FPCMAKE) -w +makefiles: makefile diff --git a/components/synedit/Makefile.fpc b/components/synedit/Makefile.fpc index f77665ae93..7ce521cd85 100644 --- a/components/synedit/Makefile.fpc +++ b/components/synedit/Makefile.fpc @@ -3,33 +3,45 @@ # Makefile.fpc for Lazarus for Free Pascal # -[targets] -# units=allunits +[package] +#name=lazarus-synedit +name=lazarus +version=0.7a + +[target] +units=syntextdrawer syneditkeycmds synedittypes syneditstrconst \ + syneditsearch syneditmiscprocs syneditmiscclasses synedittextbuffer \ + synedit synedithighlighter synhighlighterpas syncompletion \ + syneditautocomplete synhighlighterhtml synhighlightercpp + +[default] + +[compiler] +options=-gl +unittargetdir=../units +unitdir=$(COMPILER_UNITTARGETDIR) ../../lcl/units ../../lcl/units/$(LCLPLATFORM) [require] -rtl=1 -options=-Ca -gl -packages=fcl gtk +packages=rtl fcl [clean] -units=$(notdir $(basename $(wildcard $(UNITTARGETDIR)/*$(PPUEXT)))) -# not with the lazarusmake.ini -# files=$(wildcard $(UNITTARGETDIR)/*$(OEXT)) -[dirs] -# target dir needs to be . or a full path otherwise the -# unittargetdir will be corrupt -# not with the lazarusmake.ini -# targetdir=. -unittargetdir=../units -unitdir=$(UNITTARGETDIR) ../../lcl/units ../../lcl/units/$(LCLPLATFORM) +[install] -[libs] +[dist] +zipname=lazarus.synedit.$(ZIPSUFFIX) [rules] +.PHONY: cleartarget all makefile makefiles + cleartarget: - -$(DEL) $(UNITTARGETDIR)/allunits$(PPUEXT) + -$(DEL) $(COMPILER_UNITTARGETDIR)/allunits$(PPUEXT) all: cleartarget allunits$(PPUEXT) - -$(DEL) $(UNITTARGETDIR)/allunits$(PPUEXT) + -$(DEL) $(COMPILER_UNITTARGETDIR)/allunits$(PPUEXT) + +makefile: Makefile.fpc + -$(FPCMAKE) -w + +makefiles: makefile diff --git a/examples/Makefile b/examples/Makefile index e414661627..b495328480 100644 --- a/examples/Makefile +++ b/examples/Makefile @@ -1,38 +1,30 @@ # -# Makefile generated by fpcmake v1.00 [2001/01/09] +# Don't edit, this file is generated by FPCMake Version 1.1 [2001/08/08] # - -defaultrule: all - -##################################################################### -# Autodetect OS (Linux or Dos or Windows NT or OS/2) -# define inUnix when running under Unix (Linux,FreeBSD) -# define inWinNT when running under WinNT -# define inOS2 when running under OS/2 -##################################################################### - -# We need only / in the path +default: all override PATH:=$(subst \,/,$(PATH)) - -# Search for PWD and determine also if we are under linux -PWD:=$(strip $(wildcard $(addsuffix /pwd.exe,$(subst ;, ,$(PATH))))) +ifeq ($(findstring ;,$(PATH)),) +inUnix=1 +SEARCHPATH:=$(filter-out .,$(subst :, ,$(PATH))) +else +SEARCHPATH:=$(subst ;, ,$(PATH)) +endif +PWD:=$(strip $(wildcard $(addsuffix /pwd.exe,$(SEARCHPATH)))) ifeq ($(PWD),) -PWD:=$(strip $(wildcard $(addsuffix /pwd,$(subst :, ,$(PATH))))) +PWD:=$(strip $(wildcard $(addsuffix /pwd,$(SEARCHPATH)))) ifeq ($(PWD),) nopwd: @echo You need the GNU utils package to use this Makefile! @echo Get ftp://ftp.freepascal.org/pub/fpc/dist/go32v2/utilgo32.zip @exit else -inUnix=1 PWD:=$(firstword $(PWD)) +SRCEXEEXT= endif else PWD:=$(firstword $(PWD)) +SRCEXEEXT=.exe endif - -# Detect NT - NT sets OS to Windows_NT -# Detect OS/2 - OS/2 has OS2_SHELL defined ifndef inUnix ifeq ($(OS),Windows_NT) inWinNT=1 @@ -41,16 +33,11 @@ ifdef OS2_SHELL inOS2=1 endif endif -endif - -# The extension of executables -ifdef inUnix -SRCEXEEXT= else -SRCEXEEXT=.exe +ifneq ($(findstring cygwin,$(MACHTYPE)),) +inCygWin=1 +endif endif - -# The extension of batch files / scripts ifdef inUnix BATCHEXT=.sh else @@ -60,96 +47,65 @@ else BATCHEXT=.bat endif endif - -# Path Separator, the subst trick is necessary for the \ that can't exists -# at the end of a line ifdef inUnix PATHSEP=/ else -PATHSEP=$(subst /,\,/) +PATHSEP:=$(subst /,\,/) endif - -# The path which is searched separated by spaces -ifdef inUnix -SEARCHPATH=$(subst :, ,$(PATH)) -else -SEARCHPATH=$(subst ;, ,$(PATH)) -endif - -# Base dir ifdef PWD -BASEDIR:=$(shell $(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 - -##################################################################### -# FPC version/target Detection -##################################################################### - -# What compiler to use ? ifndef FPC -# Compatibility with old makefiles ifdef PP FPC=$(PP) else +ifdef inUnix +CPU_SOURCE=$(shell uname -m) +ifeq (m68k,$(CPU_SOURCE)) +FPC=ppc68k +else +FPC=ppc386 +endif +else FPC=ppc386 endif endif +endif override FPC:=$(subst $(SRCEXEEXT),,$(FPC)) override FPC:=$(subst \,/,$(FPC))$(SRCEXEEXT) - -# Target OS ifndef OS_TARGET OS_TARGET:=$(shell $(FPC) -iTO) endif - -# Source OS ifndef OS_SOURCE OS_SOURCE:=$(shell $(FPC) -iSO) endif - -# Target CPU ifndef CPU_TARGET CPU_TARGET:=$(shell $(FPC) -iTP) endif - -# Source CPU ifndef CPU_SOURCE CPU_SOURCE:=$(shell $(FPC) -iSP) endif - -# FPC version ifndef FPC_VERSION FPC_VERSION:=$(shell $(FPC) -iV) endif - export FPC OS_TARGET OS_SOURCE CPU_TARGET CPU_SOURCE FPC_VERSION - -##################################################################### -# Pre Settings -##################################################################### - -ifndef LCLPLATFORM -LCLPLATFORM=gtk -endif -##################################################################### -# FPCDIR Setting -##################################################################### - -# Test FPCDIR to look if the RTL dir exists ifdef FPCDIR override FPCDIR:=$(subst \,/,$(FPCDIR)) -ifeq ($(wildcard $(FPCDIR)/rtl),) -ifeq ($(wildcard $(FPCDIR)/units),) +ifeq ($(wildcard $(addprefix $(FPCDIR)/,rtl units)),) override FPCDIR=wrong endif -endif else override FPCDIR=wrong endif - -# Detect FPCDIR ifeq ($(FPCDIR),wrong) ifdef inUnix override FPCDIR=/usr/local/lib/fpc/$(FPC_VERSION) @@ -159,173 +115,129 @@ endif else override FPCDIR:=$(subst /$(FPC),,$(firstword $(strip $(wildcard $(addsuffix /$(FPC),$(SEARCHPATH)))))) override FPCDIR:=$(FPCDIR)/.. -ifeq ($(wildcard $(FPCDIR)/rtl),) -ifeq ($(wildcard $(FPCDIR)/units),) +ifeq ($(wildcard $(addprefix $(FPCDIR)/,rtl units)),) override FPCDIR:=$(FPCDIR)/.. -ifeq ($(wildcard $(FPCDIR)/rtl),) -ifeq ($(wildcard $(FPCDIR)/units),) +ifeq ($(wildcard $(addprefix $(FPCDIR)/,rtl units)),) override FPCDIR=c:/pp endif endif endif endif +UNITSDIR:=$(wildcard $(FPCDIR)/units/$(OS_TARGET)) +PACKAGESDIR:=$(wildcard $(FPCDIR) $(FPCDIR)/packages) +override PACKAGE_NAME=lazarus-examples +override PACKAGE_VERSION=0.7a +ifndef LCLPLATFORM +LCLPLATFORM=gtk endif -endif - -ifndef PACKAGESDIR -PACKAGESDIR=$(FPCDIR)/packages -endif -ifndef TOOLKITSDIR -TOOLKITSDIR= -endif -ifndef COMPONENTSDIR -COMPONENTSDIR= -endif - -# Create units dir -ifneq ($(FPCDIR),.) -UNITSDIR=$(FPCDIR)/units/$(OS_TARGET) -endif - -##################################################################### -# User Settings -##################################################################### - - -# Targets - -override EXEOBJECTS+=hello notebk comdialogs progressbar trackbar listboxtest bitbutton combobox checkbox selection scrollbar testall - -# Clean - -override EXTRACLEANUNITS+=$(notdir $(basename $(wildcard *$(PPUEXT)))) - -# Install - -override EXTRAINSTALLUNITS+=$(basename $(wildcard $(UNITTARGETDIR)/*$(PPUEXT))) -PACKAGENAME=examples -ZIPTARGET=install - -# Defaults - -override NEEDOPT=-gl - -# Directories - -override NEEDUNITDIR=. ../lcl/units ../components/units ../designer ../lcl/units/$(LCLPLATFORM) - -# Packages - -override PACKAGES+=rtl fcl gtk - -# Libraries - - -# Info - -INFOTARGET=fpc_infocfg fpc_infoobjects fpc_infoinstall - -##################################################################### -# Shell tools -##################################################################### - -# echo +override TARGET_EXAMPLES+=hello notebk comdialogs progressbar trackbar listboxtest bitbutton combobox checkbox scrollbar testall +override COMPILER_OPTIONS+=-gl +override COMPILER_UNITDIR+=. ../lcl/units ../components/units ../designer ../lcl/units/$(LCLPLATFORM) ifndef ECHO -ECHO:=$(strip $(wildcard $(addsuffix /gecho$(EXEEXT),$(SEARCHPATH)))) +ECHO:=$(strip $(wildcard $(addsuffix /gecho$(SRCEXEEXT),$(SEARCHPATH)))) ifeq ($(ECHO),) ECHO:=$(strip $(wildcard $(addsuffix /echo$(SRCEXEEXT),$(SEARCHPATH)))) ifeq ($(ECHO),) -ECHO:=echo -ECHOE:=echo +ECHO= else ECHO:=$(firstword $(ECHO)) -ECHOE=$(ECHO) -E endif else ECHO:=$(firstword $(ECHO)) -ECHOE=$(ECHO) -E endif endif - -# To copy pograms +export ECHO +ifndef DATE +DATE:=$(strip $(wildcard $(addsuffix /gdate$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(DATE),) +DATE:=$(strip $(wildcard $(addsuffix /date$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(DATE),) +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= +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= +else +CPPROG:=$(firstword $(CPPROG)) +endif +endif +export CPPROG +ifndef RMPROG +RMPROG:=$(strip $(wildcard $(addsuffix /rm$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(RMPROG),) +RMPROG= +else +RMPROG:=$(firstword $(RMPROG)) +endif +endif +export RMPROG +ifndef MVPROG +MVPROG:=$(strip $(wildcard $(addsuffix /mv$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(MVPROG),) +MVPROG= +else +MVPROG:=$(firstword $(MVPROG)) +endif +endif +export MVPROG +ifndef ECHOREDIR +ECHOREDIR:=$(subst /,$(PATHSEP),$(ECHO)) +endif ifndef COPY -COPY:=cp -fp +COPY:=$(CPPROG) -fp endif - -# Copy a whole tree ifndef COPYTREE -COPYTREE:=cp -rfp +COPYTREE:=$(CPPROG) -rfp endif - -# To move pograms ifndef MOVE -MOVE:=mv -f +MOVE:=$(MVPROG) -f endif - -# Check delete program ifndef DEL -DEL:=rm -f +DEL:=$(RMPROG) -f endif - -# Check deltree program ifndef DELTREE -DELTREE:=rm -rf +DELTREE:=$(RMPROG) -rf endif - -# To install files ifndef INSTALL ifdef inUnix -INSTALL:=install -c -m 644 +INSTALL:=$(GINSTALL) -c -m 644 else INSTALL:=$(COPY) endif endif - -# To install programs ifndef INSTALLEXE ifdef inUnix -INSTALLEXE:=install -c -m 755 +INSTALLEXE:=$(GINSTALL) -c -m 755 else INSTALLEXE:=$(COPY) endif endif - -# To make a directory. ifndef MKDIR -ifdef inUnix -MKDIR:=install -m 755 -d -else -MKDIR:=ginstall -m 755 -d +MKDIR:=$(GINSTALL) -m 755 -d endif -endif - -export ECHO ECHOE COPY COPYTREE MOVE DEL DELTREE INSTALL INSTALLEXE MKDIR - -##################################################################### -# Default Tools -##################################################################### - -# assembler, redefine it if cross compiling -ifndef AS -AS=as -endif - -# linker, but probably not used -ifndef LD -LD=ld -endif - -# ppas.bat / ppas.sh -PPAS=ppas$(BATCHEXT) - -# ldconfig to rebuild .so cache -ifdef inUnix -LDCONFIG=ldconfig -else -LDCONFIG= -endif - -# ppumove +export ECHOREDIR COPY COPYTREE MOVE DEL DELTREE INSTALL INSTALLEXE MKDIR ifndef PPUMOVE PPUMOVE:=$(strip $(wildcard $(addsuffix /ppumove$(SRCEXEEXT),$(SEARCHPATH)))) ifeq ($(PPUMOVE),) @@ -335,20 +247,53 @@ PPUMOVE:=$(firstword $(PPUMOVE)) endif endif export PPUMOVE - -# ppufiles -ifndef PPUFILES -PPUFILES:=$(strip $(wildcard $(addsuffix /ppufiles$(SRCEXEEXT),$(SEARCHPATH)))) -ifeq ($(PPUFILES),) -PPUFILES= +ifndef FPCMAKE +FPCMAKE:=$(strip $(wildcard $(addsuffix /fpcmake$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(FPCMAKE),) +FPCMAKE= else -PPUFILES:=$(firstword $(PPUFILES)) +FPCMAKE:=$(firstword $(FPCMAKE)) endif endif -export PPUFILES - -# Look if UPX is found for go32v2 and win32. We can't use $UPX becuase -# upx uses that one itself (PFV) +export FPCMAKE +ifndef ZIPPROG +ZIPPROG:=$(strip $(wildcard $(addsuffix /zip$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(ZIPPROG),) +ZIPPROG= +else +ZIPPROG:=$(firstword $(ZIPPROG)) +endif +endif +export ZIPPROG +ifndef TARPROG +TARPROG:=$(strip $(wildcard $(addsuffix /tar$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(TARPROG),) +TARPROG= +else +TARPROG:=$(firstword $(TARPROG)) +endif +endif +export TARPROG +ifndef AS +AS=as +endif +ifndef LD +LD=ld +endif +ifndef RC +RC=rc +endif +PPAS=ppas$(BATCHEXT) +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 @@ -368,32 +313,8 @@ UPXPROG= endif endif export UPXPROG - -# ZipProg, you can't use Zip as the var name (PFV) -ifndef ZIPPROG -ZIPPROG:=$(strip $(wildcard $(addsuffix /zip$(SRCEXEEXT),$(SEARCHPATH)))) -ifeq ($(ZIPPROG),) -ZIPPROG= -else -ZIPPROG:=$(firstword $(ZIPPROG)) -endif -endif -export ZIPPROG - ZIPOPT=-9 ZIPEXT=.zip - -# Tar -ifndef TARPROG -TARPROG:=$(strip $(wildcard $(addsuffix /tar$(SRCEXEEXT),$(SEARCHPATH)))) -ifeq ($(TARPROG),) -TARPROG= -else -TARPROG:=$(firstword $(TARPROG)) -endif -endif -export TARPROG - ifeq ($(USETAR),bz2) TAROPT=vI TAREXT=.tar.bz2 @@ -401,12 +322,6 @@ else TAROPT=vz TAREXT=.tar.gz endif - -##################################################################### -# Default extensions -##################################################################### - -# Default needed extensions (Go32v2,Linux) LOADEREXT=.as EXEEXT=.exe PPLEXT=.ppl @@ -416,10 +331,9 @@ ASMEXT=.s SMARTEXT=.sl STATICLIBEXT=.a SHAREDLIBEXT=.so +STATICLIBPREFIX=libp RSTEXT=.rst FPCMADE=fpcmade - -# Go32v1 ifeq ($(OS_TARGET),go32v1) PPUEXT=.pp1 OEXT=.o1 @@ -427,29 +341,27 @@ ASMEXT=.s1 SMARTEXT=.sl1 STATICLIBEXT=.a1 SHAREDLIBEXT=.so1 +STATICLIBPREFIX= FPCMADE=fpcmade.v1 +PACKAGESUFFIX=v1 endif - -# Go32v2 ifeq ($(OS_TARGET),go32v2) +STATICLIBPREFIX= FPCMADE=fpcmade.dos +ZIPSUFFIX=go32 endif - -# Linux ifeq ($(OS_TARGET),linux) EXEEXT= HASSHAREDLIB=1 FPCMADE=fpcmade.lnx +ZIPSUFFIX=linux endif - -# Linux ifeq ($(OS_TARGET),freebsd) EXEEXT= HASSHAREDLIB=1 FPCMADE=fpcmade.freebsd +ZIPSUFFIX=freebsd endif - -# Win32 ifeq ($(OS_TARGET),win32) PPUEXT=.ppw OEXT=.ow @@ -458,162 +370,45 @@ SMARTEXT=.slw STATICLIBEXT=.aw SHAREDLIBEXT=.dll FPCMADE=fpcmade.w32 +ZIPSUFFIX=w32 endif - -# OS/2 ifeq ($(OS_TARGET),os2) PPUEXT=.ppo ASMEXT=.so2 OEXT=.oo2 +AOUTEXT=.out SMARTEXT=.so STATICLIBEXT=.ao2 SHAREDLIBEXT=.dll FPCMADE=fpcmade.os2 +ZIPSUFFIX=emx endif - -# library prefix -LIBPREFIX=lib -ifeq ($(OS_TARGET),go32v2) -LIBPREFIX= +ifeq ($(OS_TARGET),amiga) +EXEEXT= +PPUEXT=.ppa +ASMEXT=.asm +OEXT=.o +SMARTEXT=.sl +STATICLIBEXT=.a +SHAREDLIBEXT=.library +FPCMADE=fpcmade.amg endif -ifeq ($(OS_TARGET),go32v1) -LIBPREFIX= +ifeq ($(OS_TARGET),atari) +PPUEXT=.ppt +ASMEXT=.s +OEXT=.o +SMARTEXT=.sl +STATICLIBEXT=.a +EXEEXT=.ttp +FPCMADE=fpcmade.ata endif - -# determine which .pas extension is used -ifndef PASEXT -ifdef EXEOBJECTS -override TESTPAS:=$(strip $(wildcard $(addsuffix .pas,$(firstword $(EXEOBJECTS))))) -else -override TESTPAS:=$(strip $(wildcard $(addsuffix .pas,$(firstword $(UNITOBJECTS))))) +ifdef REQUIRE_UNITSDIR +override UNITSDIR+=$(REQUIRE_UNITSDIR) endif -ifeq ($(TESTPAS),) -PASEXT=.pp -else -PASEXT=.pas +ifdef REQUIRE_PACKAGESDIR +override PACKAGESDIR+=$(REQUIRE_PACKAGESDIR) endif -endif - - -# Check if the dirs really exists, else turn it off -ifeq ($(wildcard $(UNITSDIR)),) -UNITSDIR= -endif -ifeq ($(wildcard $(TOOLKITSDIR)),) -TOOLKITSDIR= -endif -ifeq ($(wildcard $(PACKAGESDIR)),) -PACKAGESDIR= -endif -ifeq ($(wildcard $(COMPONENTSDIR)),) -COMPONENTSDIR= -endif - - -# PACKAGESDIR packages - -PACKAGERTL=1 -PACKAGEFCL=1 -PACKAGEGTK=1 - -ifdef PACKAGERTL -ifneq ($(wildcard $(FPCDIR)/rtl),) -ifneq ($(wildcard $(FPCDIR)/rtl/$(OS_TARGET)),) -PACKAGEDIR_RTL=$(FPCDIR)/rtl/$(OS_TARGET) -else -PACKAGEDIR_RTL=$(FPCDIR)/rtl -endif -ifeq ($(wildcard $(PACKAGEDIR_RTL)/$(FPCMADE)),) -override COMPILEPACKAGES+=package_rtl -package_rtl: - $(MAKE) -C $(PACKAGEDIR_RTL) all -endif -UNITDIR_RTL=$(PACKAGEDIR_RTL) -else -PACKAGEDIR_RTL= -ifneq ($(wildcard $(UNITSDIR)/rtl),) -ifneq ($(wildcard $(UNITSDIR)/rtl/$(OS_TARGET)),) -UNITDIR_RTL=$(UNITSDIR)/rtl/$(OS_TARGET) -else -UNITDIR_RTL=$(UNITSDIR)/rtl -endif -else -UNITDIR_RTL= -endif -endif -ifdef UNITDIR_RTL -override NEEDUNITDIR+=$(UNITDIR_RTL) -endif -endif -ifdef PACKAGEFCL -ifneq ($(wildcard $(FPCDIR)/fcl),) -ifneq ($(wildcard $(FPCDIR)/fcl/$(OS_TARGET)),) -PACKAGEDIR_FCL=$(FPCDIR)/fcl/$(OS_TARGET) -else -PACKAGEDIR_FCL=$(FPCDIR)/fcl -endif -ifeq ($(wildcard $(PACKAGEDIR_FCL)/$(FPCMADE)),) -override COMPILEPACKAGES+=package_fcl -package_fcl: - $(MAKE) -C $(PACKAGEDIR_FCL) all -endif -UNITDIR_FCL=$(PACKAGEDIR_FCL) -else -PACKAGEDIR_FCL= -ifneq ($(wildcard $(UNITSDIR)/fcl),) -ifneq ($(wildcard $(UNITSDIR)/fcl/$(OS_TARGET)),) -UNITDIR_FCL=$(UNITSDIR)/fcl/$(OS_TARGET) -else -UNITDIR_FCL=$(UNITSDIR)/fcl -endif -else -UNITDIR_FCL= -endif -endif -ifdef UNITDIR_FCL -override NEEDUNITDIR+=$(UNITDIR_FCL) -endif -endif -ifdef PACKAGEGTK -ifneq ($(wildcard $(PACKAGESDIR)/gtk),) -ifneq ($(wildcard $(PACKAGESDIR)/gtk/$(OS_TARGET)),) -PACKAGEDIR_GTK=$(PACKAGESDIR)/gtk/$(OS_TARGET) -else -PACKAGEDIR_GTK=$(PACKAGESDIR)/gtk -endif -ifeq ($(wildcard $(PACKAGEDIR_GTK)/$(FPCMADE)),) -override COMPILEPACKAGES+=package_gtk -package_gtk: - $(MAKE) -C $(PACKAGEDIR_GTK) all -endif -UNITDIR_GTK=$(PACKAGEDIR_GTK) -else -PACKAGEDIR_GTK= -ifneq ($(wildcard $(UNITSDIR)/gtk),) -ifneq ($(wildcard $(UNITSDIR)/gtk/$(OS_TARGET)),) -UNITDIR_GTK=$(UNITSDIR)/gtk/$(OS_TARGET) -else -UNITDIR_GTK=$(UNITSDIR)/gtk -endif -else -UNITDIR_GTK= -endif -endif -ifdef UNITDIR_GTK -override NEEDUNITDIR+=$(UNITDIR_GTK) -endif -endif - - -##################################################################### -# Default Directories -##################################################################### - -# Linux and freebsd use unix dirs with /usr/bin, /usr/lib -# When zipping use the target as default, when normal install then -# use the source os as default -ifdef ZIPNAME -# Zipinstall +ifdef ZIPINSTALL ifeq ($(OS_TARGET),linux) UNIXINSTALLDIR=1 endif @@ -621,7 +416,6 @@ ifeq ($(OS_TARGET),freebsd) UNIXINSTALLDIR=1 endif else -# Normal install ifeq ($(OS_SOURCE),linux) UNIXINSTALLDIR=1 endif @@ -629,132 +423,162 @@ ifeq ($(OS_SOURCE),freebsd) UNIXINSTALLDIR=1 endif endif - -# set the prefix directory where to install everything -ifndef PREFIXINSTALLDIR +ifndef INSTALL_PREFIX ifdef UNIXINSTALLDIR -PREFIXINSTALLDIR=/usr +INSTALL_PREFIX=/usr/local else -PREFIXINSTALLDIR=/pp +ifdef INSTALL_FPCPACKAGE +INSTALL_BASEDIR:=/pp +else +INSTALL_BASEDIR:=/$(PACKAGE_NAME) endif endif -export PREFIXINSTALLDIR - -# Where to place the resulting zip files -ifndef DESTZIPDIR -DESTZIPDIR:=$(BASEDIR) endif -export DESTZIPDIR - -##################################################################### -# Install Directories -##################################################################### - -# set the base directory where to install everything -ifndef BASEINSTALLDIR +export INSTALL_PREFIX +ifndef DIST_DESTDIR +DIST_DESTDIR:=$(BASEDIR) +endif +export DIST_DESTDIR +ifndef INSTALL_BASEDIR ifdef UNIXINSTALLDIR -BASEINSTALLDIR=$(PREFIXINSTALLDIR)/lib/lazarus/$(FPC_VERSION) +ifdef INSTALL_FPCPACKAGE +INSTALL_BASEDIR:=$(INSTALL_PREFIX)/lib/fpc/$(FPC_VERSION) else -BASEINSTALLDIR=$(PREFIXINSTALLDIR) +INSTALL_BASEDIR:=$(INSTALL_PREFIX)/lib/$(PACKAGE_NAME) +endif +else +INSTALL_BASEDIR:=$(INSTALL_PREFIX) endif endif - -# set the directory where to install the binaries -ifndef BININSTALLDIR +ifndef INSTALL_BINDIR ifdef UNIXINSTALLDIR -BININSTALLDIR=$(PREFIXINSTALLDIR)/bin +INSTALL_BINDIR:=$(INSTALL_PREFIX)/bin else -BININSTALLDIR=$(BASEINSTALLDIR)/bin/$(OS_TARGET) +INSTALL_BINDIR:=$(INSTALL_BASEDIR)/bin +ifdef INSTALL_FPCPACKAGE +INSTALL_BINDIR:=$(INSTALL_BINDIR)/$(OS_TARGET) endif endif - -# set the directory where to install the units. -ifndef UNITINSTALLDIR -UNITINSTALLDIR=$(BASEINSTALLDIR)/units/$(OS_TARGET) -ifdef UNITSUBDIR -UNITINSTALLDIR:=$(UNITINSTALLDIR)/$(UNITSUBDIR) +endif +ifndef INSTALL_UNITDIR +INSTALL_UNITDIR:=$(INSTALL_BASEDIR)/units/$(OS_TARGET) +ifdef INSTALL_FPCPACKAGE +ifdef PACKAGE_NAME +INSTALL_UNITDIR:=$(INSTALL_UNITDIR)/$(PACKAGE_NAME) endif endif - -# Where to install shared libraries -ifndef LIBINSTALLDIR +endif +ifndef INSTALL_LIBDIR ifdef UNIXINSTALLDIR -LIBINSTALLDIR=$(PREFIXINSTALLDIR)/lib +INSTALL_LIBDIR:=$(INSTALL_PREFIX)/lib else -LIBINSTALLDIR=$(UNITINSTALLDIR) +INSTALL_LIBDIR:=$(INSTALL_UNITDIR) endif endif - -# Where the source files will be stored -ifndef SOURCEINSTALLDIR +ifndef INSTALL_SOURCEDIR ifdef UNIXINSTALLDIR -SOURCEINSTALLDIR=$(PREFIXINSTALLDIR)/src/lazarus-$(FPC_VERSION) +ifdef INSTALL_FPCPACKAGE +INSTALL_SOURCEDIR:=$(INSTALL_PREFIX)/src/fpc-$(FPC_VERSION)/$(PACKAGE_NAME) else -SOURCEINSTALLDIR=$(BASEINSTALLDIR)/source +INSTALL_SOURCEDIR:=$(INSTALL_PREFIX)/src/$(PACKAGE_NAME)-$(PACKAGE_VERSION) endif -ifdef SOURCESUBDIR -SOURCEINSTALLDIR:=$(SOURCEINSTALLDIR)/$(SOURCESUBDIR) +else +ifdef INSTALL_FPCPACKAGE +INSTALL_SOURCEDIR:=$(INSTALL_BASEDIR)/source/$(PACKAGE_NAME) +else +INSTALL_SOURCEDIRL:=$(INSTALL_BASEDIR)/source endif endif - -# Where the doc files will be stored -ifndef DOCINSTALLDIR +endif +ifndef INSTALL_DOCDIR ifdef UNIXINSTALLDIR -DOCINSTALLDIR=$(PREFIXINSTALLDIR)/doc/lazarus-$(FPC_VERSION) +ifdef INSTALL_FPCPACKAGE +INSTALL_DOCDIR:=$(INSTALL_PREFIX)/doc/fpc-$(FPC_VERSION)/$(PACKAGE_NAME) else -DOCINSTALLDIR=$(BASEINSTALLDIR)/doc +INSTALL_DOCDIR:=$(INSTALL_PREFIX)/doc/$(PACKAGE_NAME)-$(PACKAGE_VERSION) +endif +else +ifdef INSTALL_FPCPACKAGE +INSTALL_DOCDIR:=$(INSTALL_BASEDIR)/doc/$(PACKAGE_NAME) +else +INSTALL_DOCDIR:=$(INSTALL_BASEDIR)/doc endif endif - -# Where to install the examples, under linux we use the doc dir -# because the copytree command will create a subdir itself -ifndef EXAMPLEINSTALLDIR +endif +ifndef INSTALL_EXAMPLEDIR ifdef UNIXINSTALLDIR -EXAMPLEINSTALLDIR=$(DOCINSTALLDIR)/examples +ifdef INSTALL_FPCPACKAGE +INSTALL_EXAMPLEDIR:=$(INSTALL_PREFIX)/doc/fpc-$(FPC_VERSION)/examples/$(PACKAGE_NAME) else -EXAMPLEINSTALLDIR=$(BASEINSTALLDIR)/examples +INSTALL_EXAMPLEDIR:=$(INSTALL_PREFIX)/doc/$(PACKAGE_NAME)-$(PACKAGE_VERSION) endif -ifdef EXAMPLESUBDIR -EXAMPLEINSTALLDIR:=$(EXAMPLEINSTALLDIR)/$(EXAMPLESUBDIR) +else +ifdef INSTALL_FPCPACKAGE +INSTALL_EXAMPLEDIR:=$(INSTALL_BASEDIR)/examples/$(PACKAGE_NAME) +else +INSTALL_EXAMPLEDIR:=$(INSTALL_BASEDIR)/examples endif endif - -# Where the some extra (data)files will be stored -ifndef DATAINSTALLDIR -DATAINSTALLDIR=$(BASEINSTALLDIR) endif - -##################################################################### -# Redirection -##################################################################### - -ifndef REDIRFILE -REDIRFILE=log +ifndef INSTALL_DATADIR +INSTALL_DATADIR=$(INSTALL_BASEDIR) endif - -ifdef REDIR -ifndef inUnix -override FPC=redir -eo $(FPC) +ifeq ($(OS_TARGET),linux) +REQUIRE_PACKAGES_RTL=1 endif -# set the verbosity to max -override FPCOPT+=-va -override REDIR:= >> $(REDIRFILE) +ifeq ($(OS_TARGET),go32v2) +REQUIRE_PACKAGES_RTL=1 endif - - -##################################################################### -# Compiler Command Line -##################################################################### - -# Load commandline OPTDEF and add FPC_CPU define -override FPCOPTDEF:=-d$(CPU_TARGET) - -# Load commandline OPT and add target and unit dir to be sure +ifeq ($(OS_TARGET),win32) +REQUIRE_PACKAGES_RTL=1 +endif +ifeq ($(OS_TARGET),os2) +REQUIRE_PACKAGES_RTL=1 +endif +ifeq ($(OS_TARGET),freebsd) +REQUIRE_PACKAGES_RTL=1 +endif +ifeq ($(OS_TARGET),beos) +REQUIRE_PACKAGES_RTL=1 +endif +ifeq ($(OS_TARGET),amiga) +REQUIRE_PACKAGES_RTL=1 +endif +ifeq ($(OS_TARGET),atari) +REQUIRE_PACKAGES_RTL=1 +endif +ifdef REQUIRE_PACKAGES_RTL +PACKAGEDIR_RTL:=$(subst /Makefile.fpc,,$(strip $(wildcard $(addsuffix /rtl/Makefile.fpc,$(PACKAGESDIR))))) +ifneq ($(PACKAGEDIR_RTL),) +PACKAGEDIR_RTL:=$(firstword $(PACKAGEDIR_RTL)) +ifeq ($(wildcard $(PACKAGEDIR_RTL)/$(FPCMADE)),) +override COMPILEPACKAGES+=package_rtl +package_rtl: + $(MAKE) -C $(PACKAGEDIR_RTL) all +endif +ifneq ($(wildcard $(PACKAGEDIR_RTL)/$(OS_TARGET)),) +UNITDIR_RTL=$(PACKAGEDIR_RTL)/$(OS_TARGET) +else +UNITDIR_RTL=$(PACKAGEDIR_RTL) +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 +.PHONY: package_rtl +override FPCOPTDEF=$(CPU_TARGET) ifneq ($(OS_TARGET),$(OS_SOURCE)) override FPCOPT+=-T$(OS_TARGET) endif - -# User dirs should be first, so they are looked at first ifdef UNITDIR override FPCOPT+=$(addprefix -Fu,$(UNITDIR)) endif @@ -767,114 +591,80 @@ endif ifdef INCDIR override FPCOPT+=$(addprefix -Fi,$(INCDIR)) endif - -# Smartlinking ifdef LINKSMART override FPCOPT+=-XX endif - -# Smartlinking creation ifdef CREATESMART override FPCOPT+=-CX endif - -# Debug ifdef DEBUG -override FPCOPT+=-gl -dDEBUG +override FPCOPT+=-gl +override FPCOPTDEF+=DEBUG endif - -# Release mode (strip, optimize and don't load ppc386.cfg) -# 0.99.12b has a bug in the optimizer so don't use it by default ifdef RELEASE -ifeq ($(FPC_VERSION),0.99.12) -override FPCOPT+=-Xs -OGp3 -n -else override FPCOPT+=-Xs -OG2p3 -n +override FPCOPTDEF+=RELEASE endif -endif - -# Strip ifdef STRIP override FPCOPT+=-Xs endif - -# Optimizer ifdef OPTIMIZE override FPCOPT+=-OG2p3 endif - -# Verbose settings (warning,note,info) ifdef VERBOSE override FPCOPT+=-vwni endif - -ifdef NEEDOPT -override FPCOPT+=$(NEEDOPT) +ifdef COMPILER_OPTIONS +override FPCOPT+=$(COMPILER_OPTIONS) endif - -ifdef NEEDUNITDIR -override FPCOPT+=$(addprefix -Fu,$(NEEDUNITDIR)) +ifdef COMPILER_UNITDIR +override FPCOPT+=$(addprefix -Fu,$(COMPILER_UNITDIR)) endif - -ifdef UNITSDIR -override FPCOPT+=-Fu$(UNITSDIR) +ifdef COMPILER_LIBRARYDIR +override FPCOPT+=$(addprefix -Fl,$(COMPILER_LIBRARYDIR)) endif - -# Target dirs and the prefix to use for clean/install -ifdef TARGETDIR -override FPCOPT+=-FE$(TARGETDIR) -ifeq ($(TARGETDIR),.) +ifdef COMPILER_OBJECTDIR +override FPCOPT+=$(addprefix -Fo,$(COMPILER_OBJECTDIR)) +endif +ifdef COMPILER_INCLUDEDIR +override FPCOPT+=$(addprefix -Fi,$(COMPILER_INCLUDEDIR)) +endif +ifdef COMPILER_TARGETDIR +override FPCOPT+=-FE$(COMPILER_TARGETDIR) +ifeq ($(COMPILER_TARGETDIR),.) override TARGETDIRPREFIX= else -override TARGETDIRPREFIX=$(TARGETDIR)/ +override TARGETDIRPREFIX=$(COMPILER_TARGETDIR)/ endif endif -ifdef UNITTARGETDIR -override FPCOPT+=-FU$(UNITTARGETDIR) -ifeq ($(UNITTARGETDIR),.) +ifdef COMPILER_UNITTARGETDIR +override FPCOPT+=-FU$(COMPILER_UNITTARGETDIR) +ifeq ($(COMPILER_UNITTARGETDIR),.) override UNITTARGETDIRPREFIX= else -override UNITTARGETDIRPREFIX=$(UNITTARGETDIR)/ +override UNITTARGETDIRPREFIX=$(COMPILER_UNITTARGETDIR)/ endif else -ifdef TARGETDIR -override UNITTARGETDIR=$(TARGETDIR) +ifdef COMPILER_TARGETDIR +override COMPILER_UNITTARGETDIR=$(COMPILER_TARGETDIR) override UNITTARGETDIRPREFIX=$(TARGETDIRPREFIX) endif endif - -# Add commandline options last so they can override ifdef OPT override FPCOPT+=$(OPT) endif - -# Add defines from FPCOPTDEF to FPCOPT ifdef FPCOPTDEF -override FPCOPT+=$(FPCOPTDEF) +override FPCOPT+=$(addprefix -d,$(FPCOPTDEF)) endif - -# Error file ? -ifdef ERRORFILE -override FPCOPT+=-Fr$(ERRORFILE) -endif - -# Was a config file specified ? ifdef CFGFILE override FPCOPT+=@$(CFGFILE) endif - -# For win32 the options are passed using the environment FPCEXTCMD -ifeq ($(OS_SOURCE),win32) +ifdef USEENV override FPCEXTCMD:=$(FPCOPT) override FPCOPT:=!FPCEXTCMD export FPCEXTCMD endif - -# Compiler commandline override COMPILER:=$(FPC) $(FPCOPT) - -# also call ppas if with command option -s -# but only if the OS_SOURCE and OS_TARGE are equal ifeq (,$(findstring -s ,$(COMPILER))) EXECPPAS= else @@ -882,313 +672,172 @@ ifeq ($(OS_SOURCE),$(OS_TARGET)) EXECPPAS:=@$(PPAS) endif endif - -##################################################################### -# Standard rules -##################################################################### - -debug: fpc_debug - -smart: fpc_smart - -shared: fpc_shared - -showinstall: fpc_showinstall - -install: fpc_install - -sourceinstall: fpc_sourceinstall - -exampleinstall: fpc_exampleinstall - -zipinstall: fpc_zipinstall - -zipsourceinstall: fpc_zipsourceinstall - -zipexampleinstall: fpc_zipexampleinstall - -clean: fpc_clean - -distclean: fpc_distclean - -cleanall: fpc_cleanall - -info: fpc_info - -.PHONY: debug smart shared showinstall install sourceinstall exampleinstall zipinstall zipsourceinstall zipexampleinstall clean distclean cleanall info - -##################################################################### -# Exes -##################################################################### - -.PHONY: fpc_exes - -ifdef EXEOBJECTS -override EXEFILES=$(addsuffix $(EXEEXT),$(EXEOBJECTS)) -override EXEOFILES:=$(addsuffix $(OEXT),$(EXEOBJECTS)) $(addprefix $(LIBPREFIX),$(addsuffix $(STATICLIBEXT),$(EXEOBJECTS))) - -override ALLTARGET+=fpc_exes -override INSTALLEXEFILES+=$(EXEFILES) -override CLEANEXEFILES+=$(EXEFILES) $(EXEOFILES) - +ifdef TARGET_RSTS +override RSTFILES=$(addsuffix $(RSTEXT),$(TARGET_RSTS)) +override CLEANRSTFILES+=$(RSTFILES) endif - -fpc_exes: $(EXEFILES) - -##################################################################### -# General compile rules -##################################################################### - -.PHONY: fpc_packages fpc_all fpc_debug - +.PHONY: fpc_examples +ifdef TARGET_EXAMPLES +HASEXAMPLES=1 +override EXAMPLESOURCEFILES:=$(wildcard $(addsuffix .pp,$(TARGET_EXAMPLES)) $(addsuffix .pas,$(TARGET_EXAMPLES))) +override EXAMPLEFILES:=$(addsuffix $(EXEEXT),$(TARGET_EXAMPLES)) +override EXAMPLEOFILES:=$(addsuffix $(OEXT),$(TARGET_EXAMPLES)) $(addprefix $(STATICLIBPREFIX),$(addsuffix $(STATICLIBEXT),$(TARGET_EXAMPLES))) +override CLEANEXEFILES+=$(EXAMPLEFILES) $(EXAMPLEOFILES) +ifeq ($(OS_TARGET),os2) +override CLEANEXEFILES+=$(addsuffix $(AOUTEXT),$(TARGET_EXAMPLES)) +endif +endif +ifdef TARGET_EXAMPLEDIRS +HASEXAMPLES=1 +endif +fpc_examples: all $(EXAMPLEFILES) $(addsuffix _all,$(TARGET_EXAMPLEDIRS)) +.PHONY: fpc_packages fpc_all fpc_smart fpc_debug $(FPCMADE): $(ALLTARGET) - @$(ECHO) Compiled > $(FPCMADE) - + @$(ECHOREDIR) Compiled > $(FPCMADE) fpc_packages: $(COMPILEPACKAGES) - fpc_all: fpc_packages $(FPCMADE) - -fpc_debug: - $(MAKE) all DEBUG=1 - -# Search paths for .ppu if targetdir is set -ifdef UNITTARGETDIR -vpath %$(PPUEXT) $(UNITTARGETDIR) -endif - -# General compile rules, available for both possible PASEXT - -.SUFFIXES: $(EXEEXT) $(PPUEXT) $(OEXT) .pas .pp - -%$(PPUEXT): %.pp - $(COMPILER) $< $(REDIR) - $(EXECPPAS) - -%$(PPUEXT): %.pas - $(COMPILER) $< $(REDIR) - $(EXECPPAS) - -%$(EXEEXT): %.pp - $(COMPILER) $< $(REDIR) - $(EXECPPAS) - -%$(EXEEXT): %.pas - $(COMPILER) $< $(REDIR) - $(EXECPPAS) - -##################################################################### -# Library -##################################################################### - -.PHONY: fpc_smart fpc_shared - -ifdef LIBVERSION -LIBFULLNAME=$(LIBNAME).$(LIBVERSION) -else -LIBFULLNAME=$(LIBNAME) -endif - -# Default sharedlib units are all unit objects -ifndef SHAREDLIBUNITOBJECTS -SHAREDLIBUNITOBJECTS:=$(UNITOBJECTS) -endif - fpc_smart: $(MAKE) all LINKSMART=1 CREATESMART=1 - -fpc_shared: all -ifdef HASSHAREDLIB -ifndef LIBNAME - @$(ECHO) "LIBNAME not set" -else - $(PPUMOVE) $(SHAREDLIBUNITOBJECTS) -o$(LIBFULLNAME) +fpc_debug: + $(MAKE) all DEBUG=1 +.SUFFIXES: $(EXEEXT) $(PPUEXT) $(OEXT) .pas .pp +%$(PPUEXT): %.pp + $(COMPILER) $< + $(EXECPPAS) +%$(PPUEXT): %.pas + $(COMPILER) $< + $(EXECPPAS) +%$(EXEEXT): %.pp + $(COMPILER) $< + $(EXECPPAS) +%$(EXEEXT): %.pas + $(COMPILER) $< + $(EXECPPAS) +vpath %.pp $(COMPILER_SOURCEDIR) $(COMPILER_INCLUDEDIR) +vpath %.pas $(COMPILER_SOURCEDIR) $(COMPILER_INCLUDEDIR) +vpath %$(PPUEXT) $(COMPILER_UNITTARGETDIR) +.PHONY: fpc_install fpc_sourceinstall fpc_exampleinstall +ifdef INSTALL_UNITS +override INSTALLPPUFILES+=$(addsuffix $(PPUEXT),$(INSTALL_UNITS)) endif -else - @$(ECHO) "Shared Libraries not supported" -endif - -##################################################################### -# Install rules -##################################################################### - -.PHONY: fpc_showinstall fpc_install - -ifdef EXTRAINSTALLUNITS -override INSTALLPPUFILES+=$(addsuffix $(PPUEXT),$(EXTRAINSTALLUNITS)) -endif - ifdef INSTALLPPUFILES +override INSTALLPPULINKFILES:=$(subst $(PPUEXT),$(OEXT),$(INSTALLPPUFILES)) $(addprefix $(STATICLIBPREFIX),$(subst $(PPUEXT),$(STATICLIBEXT),$(INSTALLPPUFILES))) override INSTALLPPUFILES:=$(addprefix $(UNITTARGETDIRPREFIX),$(INSTALLPPUFILES)) -ifdef PPUFILES -INSTALLPPULINKFILES:=$(addprefix $(UNITTARGETDIRPREFIX),$(shell $(PPUFILES) -S -O $(INSTALLPPUFILES))) -else -INSTALLPPULINKFILES:=$(wildcard $(subst $(PPUEXT),$(OEXT),$(INSTALLPPUFILES)) $(addprefix $(LIBPREFIX),$(subst $(PPUEXT),$(STATICLIBEXT),$(INSTALLPPUFILES)))) +override INSTALLPPULINKFILES:=$(wildcard $(addprefix $(UNITTARGETDIRPREFIX),$(INSTALLPPULINKFILES))) +override INSTALL_CREATEPACKAGEFPC=1 endif -# MWE: not here UNITTARGETDIRPREFIX is already added when no PPUFILES -# override INSTALLPPULINKFILES:=$(addprefix $(UNITTARGETDIRPREFIX),$(INSTALLPPULINKFILES)) -endif - ifdef INSTALLEXEFILES override INSTALLEXEFILES:=$(addprefix $(TARGETDIRPREFIX),$(INSTALLEXEFILES)) endif - -fpc_showinstall: $(SHOWINSTALLTARGET) -ifdef INSTALLEXEFILES - @$(ECHO) -e $(addprefix "\n"$(BININSTALLDIR)/,$(INSTALLEXEFILES)) -endif -ifdef INSTALLPPUFILES - @$(ECHO) -e $(addprefix "\n"$(UNITINSTALLDIR)/,$(INSTALLPPUFILES)) -ifneq ($(INSTALLPPULINKFILES),) - @$(ECHO) -e $(addprefix "\n"$(UNITINSTALLDIR)/,$(INSTALLPPULINKFILES)) -endif -ifneq ($(wildcard $(LIBFULLNAME)),) - @$(ECHO) $(LIBINSTALLDIR)/$(LIBFULLNAME) -ifdef HASSHAREDLIB - @$(ECHO) $(LIBINSTALLDIR)/$(LIBNAME) -endif -endif -endif -ifdef EXTRAINSTALLFILES - @$(ECHO) -e $(addprefix "\n"$(DATAINSTALLDIR)/,$(EXTRAINSTALLFILES)) -endif - fpc_install: $(INSTALLTARGET) -# Create UnitInstallFiles ifdef INSTALLEXEFILES - $(MKDIR) $(BININSTALLDIR) -# Compress the exes if upx is defined + $(MKDIR) $(INSTALL_BINDIR) ifdef UPXPROG -$(UPXPROG) $(INSTALLEXEFILES) endif - $(INSTALLEXE) $(INSTALLEXEFILES) $(BININSTALLDIR) + $(INSTALLEXE) $(INSTALLEXEFILES) $(INSTALL_BINDIR) +endif +ifdef INSTALL_CREATEPACKAGEFPC +ifdef FPCMAKE +ifdef PACKAGE_VERSION +ifneq ($(wildcard Makefile.fpc),) + $(FPCMAKE) -p Makefile.fpc + $(MKDIR) $(INSTALL_UNITDIR) + $(INSTALL) Package.fpc $(INSTALL_UNITDIR) +endif +endif +endif endif ifdef INSTALLPPUFILES - $(MKDIR) $(UNITINSTALLDIR) - $(INSTALL) $(INSTALLPPUFILES) $(UNITINSTALLDIR) + $(MKDIR) $(INSTALL_UNITDIR) + $(INSTALL) $(INSTALLPPUFILES) $(INSTALL_UNITDIR) ifneq ($(INSTALLPPULINKFILES),) - $(INSTALL) $(INSTALLPPULINKFILES) $(UNITINSTALLDIR) + $(INSTALL) $(INSTALLPPULINKFILES) $(INSTALL_UNITDIR) endif -ifneq ($(wildcard $(LIBFULLNAME)),) - $(MKDIR) $(LIBINSTALLDIR) - $(INSTALL) $(LIBFULLNAME) $(LIBINSTALLDIR) +ifneq ($(wildcard $(LIB_FULLNAME)),) + $(MKDIR) $(INSTALL_LIBDIR) + $(INSTALL) $(LIB_FULLNAME) $(INSTALL_LIBDIR) ifdef inUnix - ln -sf $(LIBFULLNAME) $(LIBINSTALLDIR)/$(LIBNAME) + ln -sf $(LIB_FULLNAME) $(INSTALL_LIBDIR)/$(LIB_NAME) endif endif endif -ifdef EXTRAINSTALLFILES - $(MKDIR) $(DATAINSTALLDIR) - $(INSTALL) $(EXTRAINSTALLFILES) $(DATAINSTALLDIR) +ifdef INSTALL_FILES + $(MKDIR) $(INSTALL_DATADIR) + $(INSTALL) $(INSTALL_FILES) $(INSTALL_DATADIR) endif - -##################################################################### -# SourceInstall rules -##################################################################### - -.PHONY: fpc_sourceinstall - -ifndef SOURCETOPDIR -SOURCETOPDIR=$(BASEDIR) +fpc_sourceinstall: distclean + $(MKDIR) $(INSTALL_SOURCEDIR) + $(COPYTREE) $(BASEDIR) $(INSTALL_SOURCEDIR) +fpc_exampleinstall: $(addsuffix _distclean,$(TARGET_EXAMPLEDIRS)) +ifdef HASEXAMPLES + $(MKDIR) $(INSTALL_EXAMPLEDIR) endif - -fpc_sourceinstall: clean - $(MKDIR) $(SOURCEINSTALLDIR) - $(COPYTREE) $(SOURCETOPDIR) $(SOURCEINSTALLDIR) - -##################################################################### -# exampleinstall rules -##################################################################### - -.PHONY: fpc_exampleinstall - -fpc_exampleinstall: $(addsuffix _clean,$(EXAMPLEDIROBJECTS)) ifdef EXAMPLESOURCEFILES - $(MKDIR) $(EXAMPLEINSTALLDIR) - $(COPY) $(EXAMPLESOURCEFILES) $(EXAMPLEINSTALLDIR) + $(COPY) $(EXAMPLESOURCEFILES) $(INSTALL_EXAMPLEDIR) endif -ifdef EXAMPLEDIROBJECTS -ifndef EXAMPLESOURCEFILES - $(MKDIR) $(EXAMPLEINSTALLDIR) +ifdef TARGET_EXAMPLEDIRS + $(COPYTREE) $(addsuffix /*,$(TARGET_EXAMPLEDIRS)) $(INSTALL_EXAMPLEDIR) endif - $(COPYTREE) $(addsuffix /*,$(EXAMPLEDIROBJECTS)) $(EXAMPLEINSTALLDIR) -endif - -##################################################################### -# Zip -##################################################################### - -.PHONY: fpc_zipinstall - -# Create suffix to add -ifndef PACKAGESUFFIX -PACKAGESUFFIX=$(OS_TARGET) -ifeq ($(OS_TARGET),go32v2) -PACKAGESUFFIX=go32 -endif -ifeq ($(OS_TARGET),win32) -PACKAGESUFFIX=w32 -endif -ifeq ($(OS_TARGET),os2) -PACKAGESUFFIX=emx -endif -endif - -# Temporary path to pack a file +.PHONY: fpc_distinstall +fpc_distinstall: install exampleinstall +.PHONY: fpc_zipinstall fpc_zipsourceinstall fpc_zipexampleinstall ifndef PACKDIR ifndef inUnix -PACKDIR=$(BASEDIR)/pack_tmp +PACKDIR=$(BASEDIR)/../fpc-pack else -PACKDIR=/tmp/lazarus-pack +PACKDIR=/tmp/fpc-pack endif endif - -# Maybe create default zipname from packagename ifndef ZIPNAME -ifdef PACKAGENAME -ZIPNAME=$(PACKAGEPREFIX)$(PACKAGENAME)$(PACKAGESUFFIX) +ifdef DIST_ZIPNAME +ZIPNAME=$(DIST_ZIPNAME) +else +ZIPNAME=$(ZIPPREFIX)$(PACKAGE_NAME)$(ZIPSUFFIX) +endif +endif +ifndef ZIPTARGET +ifdef DIST_ZIPTARGET +ZIPTARGET=DIST_ZIPTARGET +else +ZIPTARGET=install endif endif - -# Use tar by default under linux ifndef USEZIP ifdef inUnix USETAR=1 endif endif - -# Use a wrapper script by default for OS/2 -ifdef inOS2 +ifndef inUnix USEZIPWRAPPER=1 endif - -# Create commands to create the zip/tar file -ZIPWRAPPER=$(DESTZIPDIR)/fpczip$(BATCHEXT) -ZIPCMD_CDPACK:=cd $(subst /,$(PATHSEP),$(PACKDIR)) -ZIPCMD_CDBASE:=cd $(subst /,$(PATHSEP),$(BASEDIR)) +ifdef USEZIPWRAPPER +ZIPPATHSEP=$(PATHSEP) +ZIPWRAPPER=$(subst /,$(PATHSEP),$(DIST_DESTDIR)/fpczip$(BATCHEXT)) +else +ZIPPATHSEP=/ +endif +ZIPCMD_CDPACK:=cd $(subst /,$(ZIPPATHSEP),$(PACKDIR)) +ZIPCMD_CDBASE:=cd $(subst /,$(ZIPPATHSEP),$(BASEDIR)) ifdef USETAR -ZIPDESTFILE:=$(DESTZIPDIR)/$(ZIPNAME)$(TAREXT) +ZIPDESTFILE:=$(DIST_DESTDIR)/$(ZIPNAME)$(TAREXT) ZIPCMD_ZIP:=$(TARPROG) cf$(TAROPT) $(ZIPDESTFILE) * else -ZIPDESTFILE:=$(DESTZIPDIR)/$(ZIPNAME)$(ZIPEXT) -ZIPCMD_ZIP:=$(subst /,$(PATHSEP),$(ZIPPROG)) -Dr $(ZIPOPT) $(ZIPDESTFILE) * +ZIPDESTFILE:=$(DIST_DESTDIR)/$(ZIPNAME)$(ZIPEXT) +ZIPCMD_ZIP:=$(subst /,$(ZIPPATHSEP),$(ZIPPROG)) -Dr $(ZIPOPT) $(ZIPDESTFILE) * endif - fpc_zipinstall: -ifndef ZIPNAME - @$(ECHO) "Please specify ZIPNAME!" - @exit 1 -else - $(MAKE) $(ZIPTARGET) PREFIXINSTALLDIR=$(PACKDIR) + $(MAKE) $(ZIPTARGET) INSTALL_PREFIX=$(PACKDIR) ZIPINSTALL=1 $(DEL) $(ZIPDESTFILE) ifdef USEZIPWRAPPER -ifneq ($(ECHO),echo) - $(ECHO) "$(ZIPCMD_CDPACK)" > $(ZIPWRAPPER) - $(ECHO) "$(ZIPCMD_ZIP)" >> $(ZIPWRAPPER) - $(ECHO) "$(ZIPCMD_CDBASE)" >> $(ZIPWRAPPER) +ifneq ($(ECHOREDIR),echo) + $(ECHOREDIR) -e "$(subst \,\\,$(ZIPCMD_CDPACK))" > $(ZIPWRAPPER) + $(ECHOREDIR) -e "$(subst \,\\,$(ZIPCMD_ZIP))" >> $(ZIPWRAPPER) + $(ECHOREDIR) -e "$(subst \,\\,$(ZIPCMD_CDBASE))" >> $(ZIPWRAPPER) else - $(ECHO) $(ZIPCMD_CDPACK) > $(ZIPWRAPPER) - $(ECHO) $(ZIPCMD_ZIP) >> $(ZIPWRAPPER) - $(ECHO) $(ZIPCMD_CDBASE) >> $(ZIPWRAPPER) + echo $(ZIPCMD_CDPACK) > $(ZIPWRAPPER) + echo $(ZIPCMD_ZIP) >> $(ZIPWRAPPER) + echo $(ZIPCMD_CDBASE) >> $(ZIPWRAPPER) endif ifdef inUnix /bin/sh $(ZIPWRAPPER) @@ -1200,44 +849,26 @@ else $(ZIPCMD_CDPACK) ; $(ZIPCMD_ZIP) ; $(ZIPCMD_CDBASE) endif $(DELTREE) $(PACKDIR) -endif - -.PHONY: fpc_zipsourceinstall - fpc_zipsourceinstall: - $(MAKE) fpc_zipinstall ZIPTARGET=sourceinstall PACKAGESUFFIX=src - -.PHONY: fpc_zipexampleinstall - + $(MAKE) fpc_zipinstall ZIPTARGET=sourceinstall ZIPSUFFIX=src fpc_zipexampleinstall: - $(MAKE) fpc_zipinstall ZIPTARGET=exampleinstall PACKAGESUFFIX=exm - -##################################################################### -# Clean rules -##################################################################### - +ifdef HASEXAMPLES + $(MAKE) fpc_zipinstall ZIPTARGET=exampleinstall ZIPSUFFIX=exm +endif +fpc_zipdistinstall: + $(MAKE) fpc_zipinstall ZIPTARGET=distinstall .PHONY: fpc_clean fpc_cleanall fpc_distclean - ifdef EXEFILES override CLEANEXEFILES:=$(addprefix $(TARGETDIRPREFIX),$(CLEANEXEFILES)) endif - -ifdef EXTRACLEANUNITS -override CLEANPPUFILES+=$(addsuffix $(PPUEXT),$(EXTRACLEANUNITS)) +ifdef CLEAN_UNITS +override CLEANPPUFILES+=$(addsuffix $(PPUEXT),$(CLEAN_UNITS)) endif - ifdef CLEANPPUFILES +override CLEANPPULINKFILES:=$(subst $(PPUEXT),$(OEXT),$(CLEANPPUFILES)) $(addprefix $(STATICLIBPREFIX),$(subst $(PPUEXT),$(STATICLIBEXT),$(CLEANPPUFILES))) override CLEANPPUFILES:=$(addprefix $(UNITTARGETDIRPREFIX),$(CLEANPPUFILES)) -# Get the .o and .a files created for the units -ifdef PPUFILES -CLEANPPULINKFILES:=$(addprefix $(UNITTARGETDIRPREFIX),$(shell $(PPUFILES) $(CLEANPPUFILES))) -else -CLEANPPULINKFILES:=$(wildcard $(subst $(PPUEXT),$(OEXT),$(CLEANPPUFILES)) $(addprefix $(LIBPREFIX),$(subst $(PPUEXT),$(STATICLIBEXT),$(CLEANPPUFILES)))) +override CLEANPPULINKFILES:=$(wildcard $(addprefix $(UNITTARGETDIRPREFIX),$(CLEANPPULINKFILES))) endif -# MWE: not here UNITTARGETDIRPREFIX is already added when no PPUFILES -# override CLEANPPULINKFILES:=$(addprefix $(UNITTARGETDIRPREFIX),$(CLEANPPULINKFILES)) -endif - fpc_clean: $(CLEANTARGET) ifdef CLEANEXEFILES -$(DEL) $(CLEANEXEFILES) @@ -1251,22 +882,17 @@ endif ifdef CLEANRSTFILES -$(DEL) $(addprefix $(UNITTARGETDIRPREFIX),$(CLEANRSTFILES)) endif -ifdef EXTRACLEANFILES - -$(DEL) $(EXTRACLEANFILES) +ifdef CLEAN_FILES + -$(DEL) $(CLEAN_FILES) endif -ifdef LIBNAME - -$(DEL) $(LIBNAME) $(LIBFULLNAME) +ifdef LIB_NAME + -$(DEL) $(LIB_NAME) $(LIB_FULLNAME) endif - -$(DEL) $(FPCMADE) $(PPAS) link.res $(FPCEXTFILE) $(REDIRFILE) - -fpc_distclean: fpc_clean - -# Also run clean first if targetdir is set. Unittargetdir is always -# set if targetdir or unittargetdir is specified -ifdef UNITTARGETDIR + -$(DEL) $(FPCMADE) Package.fpc $(PPAS) link.res $(FPCEXTFILE) $(REDIRFILE) +fpc_distclean: clean +ifdef COMPILER_UNITTARGETDIR TARGETDIRCLEAN=fpc_clean endif - fpc_cleanall: $(CLEANTARGET) $(TARGETDIRCLEAN) ifdef CLEANEXEFILES -$(DEL) $(CLEANEXEFILES) @@ -1274,82 +900,107 @@ endif -$(DEL) *$(OEXT) *$(PPUEXT) *$(RSTEXT) *$(ASMEXT) *$(STATICLIBEXT) *$(SHAREDLIBEXT) *$(PPLEXT) -$(DELTREE) *$(SMARTEXT) -$(DEL) $(FPCMADE) $(PPAS) link.res $(FPCEXTFILE) $(REDIRFILE) - -##################################################################### -# Info rules -##################################################################### - -.PHONY: fpc_info fpc_cfginfo fpc_objectinfo fpc_toolsinfo fpc_installinfo \ - fpc_dirinfo - -fpc_info: $(INFOTARGET) - -fpc_infocfg: +ifdef AOUTEXT + -$(DEL) *$(AOUTEXT) +endif +.PHONY: fpc_info +fpc_info: + @$(ECHO) + @$(ECHO) == Package info == + @$(ECHO) Package Name..... $(PACKAGE_NAME) + @$(ECHO) Package Version.. $(PACKAGE_VERSION) @$(ECHO) @$(ECHO) == Configuration info == @$(ECHO) - @$(ECHO) FPC....... $(FPC) - @$(ECHO) Version... $(FPC_VERSION) - @$(ECHO) CPU....... $(CPU_TARGET) - @$(ECHO) Source.... $(OS_SOURCE) - @$(ECHO) Target.... $(OS_TARGET) + @$(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) - -fpc_infoobjects: + @$(ECHO) == Directory info == + @$(ECHO) + @$(ECHO) Basedir......... $(BASEDIR) + @$(ECHO) FPCDir.......... $(FPCDIR) + @$(ECHO) UnitsDir........ $(UNITSDIR) + @$(ECHO) PackagesDir..... $(PACKAGESDIR) + @$(ECHO) + @$(ECHO) GCC library..... $(GCCLIBDIR) + @$(ECHO) Other library... $(OTHERLIBDIR) + @$(ECHO) + @$(ECHO) == Tools info == + @$(ECHO) + @$(ECHO) Pwd....... $(PWD) + @$(ECHO) Mv........ $(MVPROG) + @$(ECHO) Cp........ $(CPPROG) + @$(ECHO) Rm........ $(RMPROG) + @$(ECHO) GInstall.. $(GINSTALL) + @$(ECHO) Echo...... $(ECHO) + @$(ECHO) Date...... $(DATE) + @$(ECHO) FPCMake... $(FPCMAKE) + @$(ECHO) PPUMove... $(PPUMOVE) + @$(ECHO) Upx....... $(UPXPROG) + @$(ECHO) Zip....... $(ZIPPROG) @$(ECHO) @$(ECHO) == Object info == @$(ECHO) - @$(ECHO) LoaderObjects..... $(LOADEROBJECTS) - @$(ECHO) UnitObjects....... $(UNITOBJECTS) - @$(ECHO) ExeObjects........ $(EXEOBJECTS) + @$(ECHO) Target Loaders...... $(TARGET_LOADERS) + @$(ECHO) Target Units........ $(TARGET_UNITS) + @$(ECHO) Target Programs..... $(TARGET_PROGRAMS) + @$(ECHO) Target Dirs......... $(TARGET_DIRS) + @$(ECHO) Target Examples..... $(TARGET_EXAMPLES) + @$(ECHO) Target ExampleDirs.. $(TARGET_EXAMPLEDIRS) @$(ECHO) - @$(ECHO) ExtraCleanUnits... $(EXTRACLEANUNITS) - @$(ECHO) ExtraCleanFiles... $(EXTRACLEANFILES) + @$(ECHO) Clean Units......... $(CLEAN_UNITS) + @$(ECHO) Clean Files......... $(CLEAN_FILES) @$(ECHO) - @$(ECHO) ExtraInstallUnits. $(EXTRAINSTALLUNITS) - @$(ECHO) ExtraInstallFiles. $(EXTRAINSTALLFILES) - @$(ECHO) - -fpc_infoinstall: + @$(ECHO) Install Units....... $(INSTALL_UNITS) + @$(ECHO) Install Files....... $(INSTALL_FILES) @$(ECHO) @$(ECHO) == Install info == @$(ECHO) -ifdef DATE @$(ECHO) DateStr.............. $(DATESTR) -endif -ifdef PACKAGEPREFIX - @$(ECHO) PackagePrefix........ $(PACKAGEPREFIX) -endif -ifdef PACKAGENAME - @$(ECHO) PackageName.......... $(PACKAGENAME) -endif - @$(ECHO) PackageSuffix........ $(PACKAGESUFFIX) + @$(ECHO) ZipPrefix............ $(ZIPPREFIX) + @$(ECHO) ZipSuffix............ $(ZIPSUFFIX) + @$(ECHO) Install FPC Package.. $(INSTALL_FPCPACKAGE) @$(ECHO) - @$(ECHO) BaseInstallDir....... $(BASEINSTALLDIR) - @$(ECHO) BinInstallDir........ $(BININSTALLDIR) - @$(ECHO) LibInstallDir........ $(LIBINSTALLDIR) - @$(ECHO) UnitInstallDir....... $(UNITINSTALLDIR) - @$(ECHO) SourceInstallDir..... $(SOURCEINSTALLDIR) - @$(ECHO) DocInstallDir........ $(DOCINSTALLDIR) - @$(ECHO) DataInstallDir....... $(DATAINSTALLDIR) + @$(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) DestZipDir........... $(DESTZIPDIR) - @$(ECHO) ZipName.............. $(ZIPNAME) + @$(ECHO) Dist destination dir. $(DIST_DESTDIR) + @$(ECHO) Dist zip name........ $(DIST_ZIPNAME) @$(ECHO) - -##################################################################### -# Local Makefile -##################################################################### - +debug: fpc_debug +smart: fpc_smart +examples: fpc_examples +shared: +install: fpc_install +sourceinstall: fpc_sourceinstall +exampleinstall: fpc_exampleinstall +distinstall: fpc_distinstall +zipinstall: fpc_zipinstall +zipsourceinstall: fpc_zipsourceinstall +zipexampleinstall: fpc_zipexampleinstall +zipdistinstall: fpc_zipdistinstall +clean: fpc_clean +distclean: fpc_distclean +cleanall: fpc_cleanall +info: fpc_info +.PHONY: debug smart examples shared install sourceinstall exampleinstall distinstall zipinstall zipsourceinstall zipexampleinstall zipdistinstall clean distclean cleanall info ifneq ($(wildcard fpcmake.loc),) include fpcmake.loc endif - -##################################################################### -# Users rules -##################################################################### - +.PHONY: cleartarget all makefiles makefile cleartarget: - -$(DEL) $(addsuffix $(EXEEXT), $(EXEOBJECTS)) - -all: cleartarget $(addsuffix $(EXEEXT), $(EXEOBJECTS)) + -$(DEL) $(EXAMPLEFILES) +all: cleartarget $(EXAMPLEFILES) +makefile: Makefile.fpc + -$(FPCMAKE) -w +makefiles: makefile diff --git a/examples/Makefile.fpc b/examples/Makefile.fpc index a8913e6119..85909ee476 100644 --- a/examples/Makefile.fpc +++ b/examples/Makefile.fpc @@ -2,36 +2,39 @@ # Makefile.fpc for LCL Examples for Free Pascal # -[targets] -programs=hello notebk comdialogs progressbar trackbar listboxtest \ - bitbutton combobox checkbox selection scrollbar testall +[package] +name=lazarus-examples +version=0.7a + +[target] +examples=hello notebk comdialogs progressbar trackbar listboxtest \ + bitbutton combobox checkbox scrollbar testall [clean] -units=$(notdir $(basename $(wildcard *$(PPUEXT)))) +#units=$(notdir $(basename $(wildcard *$(PPUEXT)))) -[require] -rtl=1 -options=-gl -packages=fcl gtk - -[dirs] -# not with the lazarusmake.ini -# targetdir=. +[default] + +[compiler] +options=-gl unitdir=. ../lcl/units ../components/units ../designer ../lcl/units/$(LCLPLATFORM) -[install] -units=$(basename $(wildcard $(UNITTARGETDIR)/*$(PPUEXT))) -packagename=examples -[presettings] +[prerules] ifndef LCLPLATFORM LCLPLATFORM=gtk endif -[libs] - [rules] -cleartarget: - -$(DEL) $(addsuffix $(EXEEXT), $(EXEOBJECTS)) +.PHONY: cleartarget all makefiles makefile + +cleartarget: + -$(DEL) $(EXAMPLEFILES) + +all: cleartarget $(EXAMPLEFILES) + +makefile: Makefile.fpc + -$(FPCMAKE) -w + +makefiles: makefile -all: cleartarget $(addsuffix $(EXEEXT), $(EXEOBJECTS)) diff --git a/lcl/Makefile b/lcl/Makefile index 1e76c58d79..715b00b613 100644 --- a/lcl/Makefile +++ b/lcl/Makefile @@ -1,38 +1,30 @@ # -# Makefile generated by fpcmake v1.00 [2001/01/09] +# Don't edit, this file is generated by FPCMake Version 1.1 [2001/08/08] # - -defaultrule: all - -##################################################################### -# Autodetect OS (Linux or Dos or Windows NT or OS/2) -# define inUnix when running under Unix (Linux,FreeBSD) -# define inWinNT when running under WinNT -# define inOS2 when running under OS/2 -##################################################################### - -# We need only / in the path +default: all override PATH:=$(subst \,/,$(PATH)) - -# Search for PWD and determine also if we are under linux -PWD:=$(strip $(wildcard $(addsuffix /pwd.exe,$(subst ;, ,$(PATH))))) +ifeq ($(findstring ;,$(PATH)),) +inUnix=1 +SEARCHPATH:=$(filter-out .,$(subst :, ,$(PATH))) +else +SEARCHPATH:=$(subst ;, ,$(PATH)) +endif +PWD:=$(strip $(wildcard $(addsuffix /pwd.exe,$(SEARCHPATH)))) ifeq ($(PWD),) -PWD:=$(strip $(wildcard $(addsuffix /pwd,$(subst :, ,$(PATH))))) +PWD:=$(strip $(wildcard $(addsuffix /pwd,$(SEARCHPATH)))) ifeq ($(PWD),) nopwd: @echo You need the GNU utils package to use this Makefile! @echo Get ftp://ftp.freepascal.org/pub/fpc/dist/go32v2/utilgo32.zip @exit else -inUnix=1 PWD:=$(firstword $(PWD)) +SRCEXEEXT= endif else PWD:=$(firstword $(PWD)) +SRCEXEEXT=.exe endif - -# Detect NT - NT sets OS to Windows_NT -# Detect OS/2 - OS/2 has OS2_SHELL defined ifndef inUnix ifeq ($(OS),Windows_NT) inWinNT=1 @@ -41,16 +33,11 @@ ifdef OS2_SHELL inOS2=1 endif endif -endif - -# The extension of executables -ifdef inUnix -SRCEXEEXT= else -SRCEXEEXT=.exe +ifneq ($(findstring cygwin,$(MACHTYPE)),) +inCygWin=1 +endif endif - -# The extension of batch files / scripts ifdef inUnix BATCHEXT=.sh else @@ -60,89 +47,65 @@ else BATCHEXT=.bat endif endif - -# Path Separator, the subst trick is necessary for the \ that can't exists -# at the end of a line ifdef inUnix PATHSEP=/ else -PATHSEP=$(subst /,\,/) +PATHSEP:=$(subst /,\,/) endif - -# The path which is searched separated by spaces -ifdef inUnix -SEARCHPATH=$(subst :, ,$(PATH)) -else -SEARCHPATH=$(subst ;, ,$(PATH)) -endif - -# Base dir ifdef PWD -BASEDIR:=$(shell $(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 - -##################################################################### -# FPC version/target Detection -##################################################################### - -# What compiler to use ? ifndef FPC -# Compatibility with old makefiles ifdef PP FPC=$(PP) else +ifdef inUnix +CPU_SOURCE=$(shell uname -m) +ifeq (m68k,$(CPU_SOURCE)) +FPC=ppc68k +else +FPC=ppc386 +endif +else FPC=ppc386 endif endif +endif override FPC:=$(subst $(SRCEXEEXT),,$(FPC)) override FPC:=$(subst \,/,$(FPC))$(SRCEXEEXT) - -# Target OS ifndef OS_TARGET OS_TARGET:=$(shell $(FPC) -iTO) endif - -# Source OS ifndef OS_SOURCE OS_SOURCE:=$(shell $(FPC) -iSO) endif - -# Target CPU ifndef CPU_TARGET CPU_TARGET:=$(shell $(FPC) -iTP) endif - -# Source CPU ifndef CPU_SOURCE CPU_SOURCE:=$(shell $(FPC) -iSP) endif - -# FPC version ifndef FPC_VERSION FPC_VERSION:=$(shell $(FPC) -iV) endif - export FPC OS_TARGET OS_SOURCE CPU_TARGET CPU_SOURCE FPC_VERSION - -##################################################################### -# FPCDIR Setting -##################################################################### - -# Test FPCDIR to look if the RTL dir exists ifdef FPCDIR override FPCDIR:=$(subst \,/,$(FPCDIR)) -ifeq ($(wildcard $(FPCDIR)/rtl),) -ifeq ($(wildcard $(FPCDIR)/units),) +ifeq ($(wildcard $(addprefix $(FPCDIR)/,rtl units)),) override FPCDIR=wrong endif -endif else override FPCDIR=wrong endif - -# Detect FPCDIR ifeq ($(FPCDIR),wrong) ifdef inUnix override FPCDIR=/usr/local/lib/fpc/$(FPC_VERSION) @@ -152,176 +115,131 @@ endif else override FPCDIR:=$(subst /$(FPC),,$(firstword $(strip $(wildcard $(addsuffix /$(FPC),$(SEARCHPATH)))))) override FPCDIR:=$(FPCDIR)/.. -ifeq ($(wildcard $(FPCDIR)/rtl),) -ifeq ($(wildcard $(FPCDIR)/units),) +ifeq ($(wildcard $(addprefix $(FPCDIR)/,rtl units)),) override FPCDIR:=$(FPCDIR)/.. -ifeq ($(wildcard $(FPCDIR)/rtl),) -ifeq ($(wildcard $(FPCDIR)/units),) +ifeq ($(wildcard $(addprefix $(FPCDIR)/,rtl units)),) override FPCDIR=c:/pp endif endif endif endif -endif -endif - -ifndef PACKAGESDIR -PACKAGESDIR=$(FPCDIR)/packages -endif -ifndef TOOLKITSDIR -TOOLKITSDIR= -endif -ifndef COMPONENTSDIR -COMPONENTSDIR= -endif - -# Create units dir -ifneq ($(FPCDIR),.) -UNITSDIR=$(FPCDIR)/units/$(OS_TARGET) -endif - -##################################################################### -# User Settings -##################################################################### - - -# Targets - - -# Clean - -override EXTRACLEANUNITS+=$(notdir $(basename $(wildcard $(UNITTARGETDIR)/*$(PPUEXT)))) - -# Install - -override EXTRAINSTALLUNITS+=$(notdir $(basename $(wildcard $(UNITTARGETDIR)/*$(PPUEXT)))) -PACKAGENAME=lcl -ZIPTARGET=install - -# Defaults - -override NEEDOPT=-Ca -gl - -# Directories - -override NEEDUNITDIR=$(UNITTARGETDIR) ./interfaces/abstract -override NEEDINCDIR=./include -ifndef UNITTARGETDIR -UNITTARGETDIR=./units -endif - -# Packages - -override PACKAGES+=rtl fcl gtk - -# Libraries - - -# Info - -INFOTARGET=fpc_infocfg fpc_infoobjects fpc_infoinstall - -##################################################################### -# Shell tools -##################################################################### - -# echo +UNITSDIR:=$(wildcard $(FPCDIR)/units/$(OS_TARGET)) +PACKAGESDIR:=$(wildcard $(FPCDIR) $(FPCDIR)/packages) +override PACKAGE_NAME=lazarus +override PACKAGE_VERSION=0.7a +DIST_DESTDIR=$(BASEDIR)/../dist +override TARGET_DIRS+=interfaces +override TARGET_UNITS+=buttons clipbrd clistbox comctrls controls dialogs dynhasharray extctrls filectrl forms graphics imglist interfacebase lazqueue lcllinux lmessages lresources menus messages registry spin stdctrls toolwin utrace vclglobals +override DIST_ZIPNAME=lazarus.lcl.$(ZIPSUFFIX) +override COMPILER_OPTIONS+=-gl +override COMPILER_INCLUDEDIR+=./include +override COMPILER_UNITDIR+=$(COMPILER_UNITTARGETDIR) ./interfaces/abstract +override COMPILER_UNITTARGETDIR+=./units ifndef ECHO -ECHO:=$(strip $(wildcard $(addsuffix /gecho$(EXEEXT),$(SEARCHPATH)))) +ECHO:=$(strip $(wildcard $(addsuffix /gecho$(SRCEXEEXT),$(SEARCHPATH)))) ifeq ($(ECHO),) ECHO:=$(strip $(wildcard $(addsuffix /echo$(SRCEXEEXT),$(SEARCHPATH)))) ifeq ($(ECHO),) -ECHO:=echo -ECHOE:=echo +ECHO= else ECHO:=$(firstword $(ECHO)) -ECHOE=$(ECHO) -E endif else ECHO:=$(firstword $(ECHO)) -ECHOE=$(ECHO) -E endif endif - -# To copy pograms +export ECHO +ifndef DATE +DATE:=$(strip $(wildcard $(addsuffix /gdate$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(DATE),) +DATE:=$(strip $(wildcard $(addsuffix /date$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(DATE),) +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= +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= +else +CPPROG:=$(firstword $(CPPROG)) +endif +endif +export CPPROG +ifndef RMPROG +RMPROG:=$(strip $(wildcard $(addsuffix /rm$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(RMPROG),) +RMPROG= +else +RMPROG:=$(firstword $(RMPROG)) +endif +endif +export RMPROG +ifndef MVPROG +MVPROG:=$(strip $(wildcard $(addsuffix /mv$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(MVPROG),) +MVPROG= +else +MVPROG:=$(firstword $(MVPROG)) +endif +endif +export MVPROG +ifndef ECHOREDIR +ECHOREDIR:=$(subst /,$(PATHSEP),$(ECHO)) +endif ifndef COPY -COPY:=cp -fp +COPY:=$(CPPROG) -fp endif - -# Copy a whole tree ifndef COPYTREE -COPYTREE:=cp -rfp +COPYTREE:=$(CPPROG) -rfp endif - -# To move pograms ifndef MOVE -MOVE:=mv -f +MOVE:=$(MVPROG) -f endif - -# Check delete program ifndef DEL -DEL:=rm -f +DEL:=$(RMPROG) -f endif - -# Check deltree program ifndef DELTREE -DELTREE:=rm -rf +DELTREE:=$(RMPROG) -rf endif - -# To install files ifndef INSTALL ifdef inUnix -INSTALL:=install -c -m 644 +INSTALL:=$(GINSTALL) -c -m 644 else INSTALL:=$(COPY) endif endif - -# To install programs ifndef INSTALLEXE ifdef inUnix -INSTALLEXE:=install -c -m 755 +INSTALLEXE:=$(GINSTALL) -c -m 755 else INSTALLEXE:=$(COPY) endif endif - -# To make a directory. ifndef MKDIR -ifdef inUnix -MKDIR:=install -m 755 -d -else -MKDIR:=ginstall -m 755 -d +MKDIR:=$(GINSTALL) -m 755 -d endif -endif - -export ECHO ECHOE COPY COPYTREE MOVE DEL DELTREE INSTALL INSTALLEXE MKDIR - -##################################################################### -# Default Tools -##################################################################### - -# assembler, redefine it if cross compiling -ifndef AS -AS=as -endif - -# linker, but probably not used -ifndef LD -LD=ld -endif - -# ppas.bat / ppas.sh -PPAS=ppas$(BATCHEXT) - -# ldconfig to rebuild .so cache -ifdef inUnix -LDCONFIG=ldconfig -else -LDCONFIG= -endif - -# ppumove +export ECHOREDIR COPY COPYTREE MOVE DEL DELTREE INSTALL INSTALLEXE MKDIR ifndef PPUMOVE PPUMOVE:=$(strip $(wildcard $(addsuffix /ppumove$(SRCEXEEXT),$(SEARCHPATH)))) ifeq ($(PPUMOVE),) @@ -331,20 +249,53 @@ PPUMOVE:=$(firstword $(PPUMOVE)) endif endif export PPUMOVE - -# ppufiles -ifndef PPUFILES -PPUFILES:=$(strip $(wildcard $(addsuffix /ppufiles$(SRCEXEEXT),$(SEARCHPATH)))) -ifeq ($(PPUFILES),) -PPUFILES= +ifndef FPCMAKE +FPCMAKE:=$(strip $(wildcard $(addsuffix /fpcmake$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(FPCMAKE),) +FPCMAKE= else -PPUFILES:=$(firstword $(PPUFILES)) +FPCMAKE:=$(firstword $(FPCMAKE)) endif endif -export PPUFILES - -# Look if UPX is found for go32v2 and win32. We can't use $UPX becuase -# upx uses that one itself (PFV) +export FPCMAKE +ifndef ZIPPROG +ZIPPROG:=$(strip $(wildcard $(addsuffix /zip$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(ZIPPROG),) +ZIPPROG= +else +ZIPPROG:=$(firstword $(ZIPPROG)) +endif +endif +export ZIPPROG +ifndef TARPROG +TARPROG:=$(strip $(wildcard $(addsuffix /tar$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(TARPROG),) +TARPROG= +else +TARPROG:=$(firstword $(TARPROG)) +endif +endif +export TARPROG +ifndef AS +AS=as +endif +ifndef LD +LD=ld +endif +ifndef RC +RC=rc +endif +PPAS=ppas$(BATCHEXT) +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 @@ -364,32 +315,8 @@ UPXPROG= endif endif export UPXPROG - -# ZipProg, you can't use Zip as the var name (PFV) -ifndef ZIPPROG -ZIPPROG:=$(strip $(wildcard $(addsuffix /zip$(SRCEXEEXT),$(SEARCHPATH)))) -ifeq ($(ZIPPROG),) -ZIPPROG= -else -ZIPPROG:=$(firstword $(ZIPPROG)) -endif -endif -export ZIPPROG - ZIPOPT=-9 ZIPEXT=.zip - -# Tar -ifndef TARPROG -TARPROG:=$(strip $(wildcard $(addsuffix /tar$(SRCEXEEXT),$(SEARCHPATH)))) -ifeq ($(TARPROG),) -TARPROG= -else -TARPROG:=$(firstword $(TARPROG)) -endif -endif -export TARPROG - ifeq ($(USETAR),bz2) TAROPT=vI TAREXT=.tar.bz2 @@ -397,12 +324,6 @@ else TAROPT=vz TAREXT=.tar.gz endif - -##################################################################### -# Default extensions -##################################################################### - -# Default needed extensions (Go32v2,Linux) LOADEREXT=.as EXEEXT=.exe PPLEXT=.ppl @@ -412,10 +333,9 @@ ASMEXT=.s SMARTEXT=.sl STATICLIBEXT=.a SHAREDLIBEXT=.so +STATICLIBPREFIX=libp RSTEXT=.rst FPCMADE=fpcmade - -# Go32v1 ifeq ($(OS_TARGET),go32v1) PPUEXT=.pp1 OEXT=.o1 @@ -423,29 +343,27 @@ ASMEXT=.s1 SMARTEXT=.sl1 STATICLIBEXT=.a1 SHAREDLIBEXT=.so1 +STATICLIBPREFIX= FPCMADE=fpcmade.v1 +PACKAGESUFFIX=v1 endif - -# Go32v2 ifeq ($(OS_TARGET),go32v2) +STATICLIBPREFIX= FPCMADE=fpcmade.dos +ZIPSUFFIX=go32 endif - -# Linux ifeq ($(OS_TARGET),linux) EXEEXT= HASSHAREDLIB=1 FPCMADE=fpcmade.lnx +ZIPSUFFIX=linux endif - -# Linux ifeq ($(OS_TARGET),freebsd) EXEEXT= HASSHAREDLIB=1 FPCMADE=fpcmade.freebsd +ZIPSUFFIX=freebsd endif - -# Win32 ifeq ($(OS_TARGET),win32) PPUEXT=.ppw OEXT=.ow @@ -454,162 +372,45 @@ SMARTEXT=.slw STATICLIBEXT=.aw SHAREDLIBEXT=.dll FPCMADE=fpcmade.w32 +ZIPSUFFIX=w32 endif - -# OS/2 ifeq ($(OS_TARGET),os2) PPUEXT=.ppo ASMEXT=.so2 OEXT=.oo2 +AOUTEXT=.out SMARTEXT=.so STATICLIBEXT=.ao2 SHAREDLIBEXT=.dll FPCMADE=fpcmade.os2 +ZIPSUFFIX=emx endif - -# library prefix -LIBPREFIX=lib -ifeq ($(OS_TARGET),go32v2) -LIBPREFIX= +ifeq ($(OS_TARGET),amiga) +EXEEXT= +PPUEXT=.ppa +ASMEXT=.asm +OEXT=.o +SMARTEXT=.sl +STATICLIBEXT=.a +SHAREDLIBEXT=.library +FPCMADE=fpcmade.amg endif -ifeq ($(OS_TARGET),go32v1) -LIBPREFIX= +ifeq ($(OS_TARGET),atari) +PPUEXT=.ppt +ASMEXT=.s +OEXT=.o +SMARTEXT=.sl +STATICLIBEXT=.a +EXEEXT=.ttp +FPCMADE=fpcmade.ata endif - -# determine which .pas extension is used -ifndef PASEXT -ifdef EXEOBJECTS -override TESTPAS:=$(strip $(wildcard $(addsuffix .pas,$(firstword $(EXEOBJECTS))))) -else -override TESTPAS:=$(strip $(wildcard $(addsuffix .pas,$(firstword $(UNITOBJECTS))))) +ifdef REQUIRE_UNITSDIR +override UNITSDIR+=$(REQUIRE_UNITSDIR) endif -ifeq ($(TESTPAS),) -PASEXT=.pp -else -PASEXT=.pas +ifdef REQUIRE_PACKAGESDIR +override PACKAGESDIR+=$(REQUIRE_PACKAGESDIR) endif -endif - - -# Check if the dirs really exists, else turn it off -ifeq ($(wildcard $(UNITSDIR)),) -UNITSDIR= -endif -ifeq ($(wildcard $(TOOLKITSDIR)),) -TOOLKITSDIR= -endif -ifeq ($(wildcard $(PACKAGESDIR)),) -PACKAGESDIR= -endif -ifeq ($(wildcard $(COMPONENTSDIR)),) -COMPONENTSDIR= -endif - - -# PACKAGESDIR packages - -PACKAGERTL=1 -PACKAGEFCL=1 -PACKAGEGTK=1 - -ifdef PACKAGERTL -ifneq ($(wildcard $(FPCDIR)/rtl),) -ifneq ($(wildcard $(FPCDIR)/rtl/$(OS_TARGET)),) -PACKAGEDIR_RTL=$(FPCDIR)/rtl/$(OS_TARGET) -else -PACKAGEDIR_RTL=$(FPCDIR)/rtl -endif -ifeq ($(wildcard $(PACKAGEDIR_RTL)/$(FPCMADE)),) -override COMPILEPACKAGES+=package_rtl -package_rtl: - $(MAKE) -C $(PACKAGEDIR_RTL) all -endif -UNITDIR_RTL=$(PACKAGEDIR_RTL) -else -PACKAGEDIR_RTL= -ifneq ($(wildcard $(UNITSDIR)/rtl),) -ifneq ($(wildcard $(UNITSDIR)/rtl/$(OS_TARGET)),) -UNITDIR_RTL=$(UNITSDIR)/rtl/$(OS_TARGET) -else -UNITDIR_RTL=$(UNITSDIR)/rtl -endif -else -UNITDIR_RTL= -endif -endif -ifdef UNITDIR_RTL -override NEEDUNITDIR+=$(UNITDIR_RTL) -endif -endif -ifdef PACKAGEFCL -ifneq ($(wildcard $(FPCDIR)/fcl),) -ifneq ($(wildcard $(FPCDIR)/fcl/$(OS_TARGET)),) -PACKAGEDIR_FCL=$(FPCDIR)/fcl/$(OS_TARGET) -else -PACKAGEDIR_FCL=$(FPCDIR)/fcl -endif -ifeq ($(wildcard $(PACKAGEDIR_FCL)/$(FPCMADE)),) -override COMPILEPACKAGES+=package_fcl -package_fcl: - $(MAKE) -C $(PACKAGEDIR_FCL) all -endif -UNITDIR_FCL=$(PACKAGEDIR_FCL) -else -PACKAGEDIR_FCL= -ifneq ($(wildcard $(UNITSDIR)/fcl),) -ifneq ($(wildcard $(UNITSDIR)/fcl/$(OS_TARGET)),) -UNITDIR_FCL=$(UNITSDIR)/fcl/$(OS_TARGET) -else -UNITDIR_FCL=$(UNITSDIR)/fcl -endif -else -UNITDIR_FCL= -endif -endif -ifdef UNITDIR_FCL -override NEEDUNITDIR+=$(UNITDIR_FCL) -endif -endif -ifdef PACKAGEGTK -ifneq ($(wildcard $(PACKAGESDIR)/gtk),) -ifneq ($(wildcard $(PACKAGESDIR)/gtk/$(OS_TARGET)),) -PACKAGEDIR_GTK=$(PACKAGESDIR)/gtk/$(OS_TARGET) -else -PACKAGEDIR_GTK=$(PACKAGESDIR)/gtk -endif -ifeq ($(wildcard $(PACKAGEDIR_GTK)/$(FPCMADE)),) -override COMPILEPACKAGES+=package_gtk -package_gtk: - $(MAKE) -C $(PACKAGEDIR_GTK) all -endif -UNITDIR_GTK=$(PACKAGEDIR_GTK) -else -PACKAGEDIR_GTK= -ifneq ($(wildcard $(UNITSDIR)/gtk),) -ifneq ($(wildcard $(UNITSDIR)/gtk/$(OS_TARGET)),) -UNITDIR_GTK=$(UNITSDIR)/gtk/$(OS_TARGET) -else -UNITDIR_GTK=$(UNITSDIR)/gtk -endif -else -UNITDIR_GTK= -endif -endif -ifdef UNITDIR_GTK -override NEEDUNITDIR+=$(UNITDIR_GTK) -endif -endif - - -##################################################################### -# Default Directories -##################################################################### - -# Linux and freebsd use unix dirs with /usr/bin, /usr/lib -# When zipping use the target as default, when normal install then -# use the source os as default -ifdef ZIPNAME -# Zipinstall +ifdef ZIPINSTALL ifeq ($(OS_TARGET),linux) UNIXINSTALLDIR=1 endif @@ -617,7 +418,6 @@ ifeq ($(OS_TARGET),freebsd) UNIXINSTALLDIR=1 endif else -# Normal install ifeq ($(OS_SOURCE),linux) UNIXINSTALLDIR=1 endif @@ -625,132 +425,162 @@ ifeq ($(OS_SOURCE),freebsd) UNIXINSTALLDIR=1 endif endif - -# set the prefix directory where to install everything -ifndef PREFIXINSTALLDIR +ifndef INSTALL_PREFIX ifdef UNIXINSTALLDIR -PREFIXINSTALLDIR=/usr +INSTALL_PREFIX=/usr/local else -PREFIXINSTALLDIR=/pp +ifdef INSTALL_FPCPACKAGE +INSTALL_BASEDIR:=/pp +else +INSTALL_BASEDIR:=/$(PACKAGE_NAME) endif endif -export PREFIXINSTALLDIR - -# Where to place the resulting zip files -ifndef DESTZIPDIR -DESTZIPDIR:=$(BASEDIR) endif -export DESTZIPDIR - -##################################################################### -# Install Directories -##################################################################### - -# set the base directory where to install everything -ifndef BASEINSTALLDIR +export INSTALL_PREFIX +ifndef DIST_DESTDIR +DIST_DESTDIR:=$(BASEDIR) +endif +export DIST_DESTDIR +ifndef INSTALL_BASEDIR ifdef UNIXINSTALLDIR -BASEINSTALLDIR=$(PREFIXINSTALLDIR)/lib/lazarus/$(FPC_VERSION) +ifdef INSTALL_FPCPACKAGE +INSTALL_BASEDIR:=$(INSTALL_PREFIX)/lib/fpc/$(FPC_VERSION) else -BASEINSTALLDIR=$(PREFIXINSTALLDIR) +INSTALL_BASEDIR:=$(INSTALL_PREFIX)/lib/$(PACKAGE_NAME) +endif +else +INSTALL_BASEDIR:=$(INSTALL_PREFIX) endif endif - -# set the directory where to install the binaries -ifndef BININSTALLDIR +ifndef INSTALL_BINDIR ifdef UNIXINSTALLDIR -BININSTALLDIR=$(PREFIXINSTALLDIR)/bin +INSTALL_BINDIR:=$(INSTALL_PREFIX)/bin else -BININSTALLDIR=$(BASEINSTALLDIR)/bin/$(OS_TARGET) +INSTALL_BINDIR:=$(INSTALL_BASEDIR)/bin +ifdef INSTALL_FPCPACKAGE +INSTALL_BINDIR:=$(INSTALL_BINDIR)/$(OS_TARGET) endif endif - -# set the directory where to install the units. -ifndef UNITINSTALLDIR -UNITINSTALLDIR=$(BASEINSTALLDIR)/units/$(OS_TARGET) -ifdef UNITSUBDIR -UNITINSTALLDIR:=$(UNITINSTALLDIR)/$(UNITSUBDIR) +endif +ifndef INSTALL_UNITDIR +INSTALL_UNITDIR:=$(INSTALL_BASEDIR)/units/$(OS_TARGET) +ifdef INSTALL_FPCPACKAGE +ifdef PACKAGE_NAME +INSTALL_UNITDIR:=$(INSTALL_UNITDIR)/$(PACKAGE_NAME) endif endif - -# Where to install shared libraries -ifndef LIBINSTALLDIR +endif +ifndef INSTALL_LIBDIR ifdef UNIXINSTALLDIR -LIBINSTALLDIR=$(PREFIXINSTALLDIR)/lib +INSTALL_LIBDIR:=$(INSTALL_PREFIX)/lib else -LIBINSTALLDIR=$(UNITINSTALLDIR) +INSTALL_LIBDIR:=$(INSTALL_UNITDIR) endif endif - -# Where the source files will be stored -ifndef SOURCEINSTALLDIR +ifndef INSTALL_SOURCEDIR ifdef UNIXINSTALLDIR -SOURCEINSTALLDIR=$(PREFIXINSTALLDIR)/src/lazarus-$(FPC_VERSION) +ifdef INSTALL_FPCPACKAGE +INSTALL_SOURCEDIR:=$(INSTALL_PREFIX)/src/fpc-$(FPC_VERSION)/$(PACKAGE_NAME) else -SOURCEINSTALLDIR=$(BASEINSTALLDIR)/source +INSTALL_SOURCEDIR:=$(INSTALL_PREFIX)/src/$(PACKAGE_NAME)-$(PACKAGE_VERSION) endif -ifdef SOURCESUBDIR -SOURCEINSTALLDIR:=$(SOURCEINSTALLDIR)/$(SOURCESUBDIR) +else +ifdef INSTALL_FPCPACKAGE +INSTALL_SOURCEDIR:=$(INSTALL_BASEDIR)/source/$(PACKAGE_NAME) +else +INSTALL_SOURCEDIRL:=$(INSTALL_BASEDIR)/source endif endif - -# Where the doc files will be stored -ifndef DOCINSTALLDIR +endif +ifndef INSTALL_DOCDIR ifdef UNIXINSTALLDIR -DOCINSTALLDIR=$(PREFIXINSTALLDIR)/doc/lazarus-$(FPC_VERSION) +ifdef INSTALL_FPCPACKAGE +INSTALL_DOCDIR:=$(INSTALL_PREFIX)/doc/fpc-$(FPC_VERSION)/$(PACKAGE_NAME) else -DOCINSTALLDIR=$(BASEINSTALLDIR)/doc +INSTALL_DOCDIR:=$(INSTALL_PREFIX)/doc/$(PACKAGE_NAME)-$(PACKAGE_VERSION) +endif +else +ifdef INSTALL_FPCPACKAGE +INSTALL_DOCDIR:=$(INSTALL_BASEDIR)/doc/$(PACKAGE_NAME) +else +INSTALL_DOCDIR:=$(INSTALL_BASEDIR)/doc endif endif - -# Where to install the examples, under linux we use the doc dir -# because the copytree command will create a subdir itself -ifndef EXAMPLEINSTALLDIR +endif +ifndef INSTALL_EXAMPLEDIR ifdef UNIXINSTALLDIR -EXAMPLEINSTALLDIR=$(DOCINSTALLDIR)/examples +ifdef INSTALL_FPCPACKAGE +INSTALL_EXAMPLEDIR:=$(INSTALL_PREFIX)/doc/fpc-$(FPC_VERSION)/examples/$(PACKAGE_NAME) else -EXAMPLEINSTALLDIR=$(BASEINSTALLDIR)/examples +INSTALL_EXAMPLEDIR:=$(INSTALL_PREFIX)/doc/$(PACKAGE_NAME)-$(PACKAGE_VERSION) endif -ifdef EXAMPLESUBDIR -EXAMPLEINSTALLDIR:=$(EXAMPLEINSTALLDIR)/$(EXAMPLESUBDIR) +else +ifdef INSTALL_FPCPACKAGE +INSTALL_EXAMPLEDIR:=$(INSTALL_BASEDIR)/examples/$(PACKAGE_NAME) +else +INSTALL_EXAMPLEDIR:=$(INSTALL_BASEDIR)/examples endif endif - -# Where the some extra (data)files will be stored -ifndef DATAINSTALLDIR -DATAINSTALLDIR=$(BASEINSTALLDIR) endif - -##################################################################### -# Redirection -##################################################################### - -ifndef REDIRFILE -REDIRFILE=log +ifndef INSTALL_DATADIR +INSTALL_DATADIR=$(INSTALL_BASEDIR) endif - -ifdef REDIR -ifndef inUnix -override FPC=redir -eo $(FPC) +ifeq ($(OS_TARGET),linux) +REQUIRE_PACKAGES_RTL=1 endif -# set the verbosity to max -override FPCOPT+=-va -override REDIR:= >> $(REDIRFILE) +ifeq ($(OS_TARGET),go32v2) +REQUIRE_PACKAGES_RTL=1 endif - - -##################################################################### -# Compiler Command Line -##################################################################### - -# Load commandline OPTDEF and add FPC_CPU define -override FPCOPTDEF:=-d$(CPU_TARGET) - -# Load commandline OPT and add target and unit dir to be sure +ifeq ($(OS_TARGET),win32) +REQUIRE_PACKAGES_RTL=1 +endif +ifeq ($(OS_TARGET),os2) +REQUIRE_PACKAGES_RTL=1 +endif +ifeq ($(OS_TARGET),freebsd) +REQUIRE_PACKAGES_RTL=1 +endif +ifeq ($(OS_TARGET),beos) +REQUIRE_PACKAGES_RTL=1 +endif +ifeq ($(OS_TARGET),amiga) +REQUIRE_PACKAGES_RTL=1 +endif +ifeq ($(OS_TARGET),atari) +REQUIRE_PACKAGES_RTL=1 +endif +ifdef REQUIRE_PACKAGES_RTL +PACKAGEDIR_RTL:=$(subst /Makefile.fpc,,$(strip $(wildcard $(addsuffix /rtl/Makefile.fpc,$(PACKAGESDIR))))) +ifneq ($(PACKAGEDIR_RTL),) +PACKAGEDIR_RTL:=$(firstword $(PACKAGEDIR_RTL)) +ifeq ($(wildcard $(PACKAGEDIR_RTL)/$(FPCMADE)),) +override COMPILEPACKAGES+=package_rtl +package_rtl: + $(MAKE) -C $(PACKAGEDIR_RTL) all +endif +ifneq ($(wildcard $(PACKAGEDIR_RTL)/$(OS_TARGET)),) +UNITDIR_RTL=$(PACKAGEDIR_RTL)/$(OS_TARGET) +else +UNITDIR_RTL=$(PACKAGEDIR_RTL) +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 +.PHONY: package_rtl +override FPCOPTDEF=$(CPU_TARGET) ifneq ($(OS_TARGET),$(OS_SOURCE)) override FPCOPT+=-T$(OS_TARGET) endif - -# User dirs should be first, so they are looked at first ifdef UNITDIR override FPCOPT+=$(addprefix -Fu,$(UNITDIR)) endif @@ -763,119 +593,80 @@ endif ifdef INCDIR override FPCOPT+=$(addprefix -Fi,$(INCDIR)) endif - -# Smartlinking ifdef LINKSMART override FPCOPT+=-XX endif - -# Smartlinking creation ifdef CREATESMART override FPCOPT+=-CX endif - -# Debug ifdef DEBUG -override FPCOPT+=-gl -dDEBUG +override FPCOPT+=-gl +override FPCOPTDEF+=DEBUG endif - -# Release mode (strip, optimize and don't load ppc386.cfg) -# 0.99.12b has a bug in the optimizer so don't use it by default ifdef RELEASE -ifeq ($(FPC_VERSION),0.99.12) -override FPCOPT+=-Xs -OGp3 -n -else override FPCOPT+=-Xs -OG2p3 -n +override FPCOPTDEF+=RELEASE endif -endif - -# Strip ifdef STRIP override FPCOPT+=-Xs endif - -# Optimizer ifdef OPTIMIZE override FPCOPT+=-OG2p3 endif - -# Verbose settings (warning,note,info) ifdef VERBOSE override FPCOPT+=-vwni endif - -ifdef NEEDOPT -override FPCOPT+=$(NEEDOPT) +ifdef COMPILER_OPTIONS +override FPCOPT+=$(COMPILER_OPTIONS) endif - -ifdef NEEDUNITDIR -override FPCOPT+=$(addprefix -Fu,$(NEEDUNITDIR)) +ifdef COMPILER_UNITDIR +override FPCOPT+=$(addprefix -Fu,$(COMPILER_UNITDIR)) endif - -ifdef UNITSDIR -override FPCOPT+=-Fu$(UNITSDIR) +ifdef COMPILER_LIBRARYDIR +override FPCOPT+=$(addprefix -Fl,$(COMPILER_LIBRARYDIR)) endif - -ifdef NEEDINCDIR -override FPCOPT+=$(addprefix -Fi,$(NEEDINCDIR)) +ifdef COMPILER_OBJECTDIR +override FPCOPT+=$(addprefix -Fo,$(COMPILER_OBJECTDIR)) endif - - -# Target dirs and the prefix to use for clean/install -ifdef TARGETDIR -override FPCOPT+=-FE$(TARGETDIR) -ifeq ($(TARGETDIR),.) +ifdef COMPILER_INCLUDEDIR +override FPCOPT+=$(addprefix -Fi,$(COMPILER_INCLUDEDIR)) +endif +ifdef COMPILER_TARGETDIR +override FPCOPT+=-FE$(COMPILER_TARGETDIR) +ifeq ($(COMPILER_TARGETDIR),.) override TARGETDIRPREFIX= else -override TARGETDIRPREFIX=$(TARGETDIR)/ +override TARGETDIRPREFIX=$(COMPILER_TARGETDIR)/ endif endif -ifdef UNITTARGETDIR -override FPCOPT+=-FU$(UNITTARGETDIR) -ifeq ($(UNITTARGETDIR),.) +ifdef COMPILER_UNITTARGETDIR +override FPCOPT+=-FU$(COMPILER_UNITTARGETDIR) +ifeq ($(COMPILER_UNITTARGETDIR),.) override UNITTARGETDIRPREFIX= else -override UNITTARGETDIRPREFIX=$(UNITTARGETDIR)/ +override UNITTARGETDIRPREFIX=$(COMPILER_UNITTARGETDIR)/ endif else -ifdef TARGETDIR -override UNITTARGETDIR=$(TARGETDIR) +ifdef COMPILER_TARGETDIR +override COMPILER_UNITTARGETDIR=$(COMPILER_TARGETDIR) override UNITTARGETDIRPREFIX=$(TARGETDIRPREFIX) endif endif - -# Add commandline options last so they can override ifdef OPT override FPCOPT+=$(OPT) endif - -# Add defines from FPCOPTDEF to FPCOPT ifdef FPCOPTDEF -override FPCOPT+=$(FPCOPTDEF) +override FPCOPT+=$(addprefix -d,$(FPCOPTDEF)) endif - -# Error file ? -ifdef ERRORFILE -override FPCOPT+=-Fr$(ERRORFILE) -endif - -# Was a config file specified ? ifdef CFGFILE override FPCOPT+=@$(CFGFILE) endif - -# For win32 the options are passed using the environment FPCEXTCMD -ifeq ($(OS_SOURCE),win32) +ifdef USEENV override FPCEXTCMD:=$(FPCOPT) override FPCOPT:=!FPCEXTCMD export FPCEXTCMD endif - -# Compiler commandline override COMPILER:=$(FPC) $(FPCOPT) - -# also call ppas if with command option -s -# but only if the OS_SOURCE and OS_TARGE are equal ifeq (,$(findstring -s ,$(COMPILER))) EXECPPAS= else @@ -883,295 +674,165 @@ ifeq ($(OS_SOURCE),$(OS_TARGET)) EXECPPAS:=@$(PPAS) endif endif - -##################################################################### -# Standard rules -##################################################################### - -debug: fpc_debug - -smart: fpc_smart - -shared: fpc_shared - -showinstall: fpc_showinstall - -install: fpc_install - -sourceinstall: fpc_sourceinstall - -exampleinstall: fpc_exampleinstall - -zipinstall: fpc_zipinstall - -zipsourceinstall: fpc_zipsourceinstall - -zipexampleinstall: fpc_zipexampleinstall - -clean: fpc_clean - -distclean: fpc_distclean - -cleanall: fpc_cleanall - -info: fpc_info - -.PHONY: debug smart shared showinstall install sourceinstall exampleinstall zipinstall zipsourceinstall zipexampleinstall clean distclean cleanall info - -##################################################################### -# General compile rules -##################################################################### - -.PHONY: fpc_packages fpc_all fpc_debug - +.PHONY: fpc_units +ifdef TARGET_UNITS +override ALLTARGET+=fpc_units +override UNITPPUFILES=$(addsuffix $(PPUEXT),$(TARGET_UNITS)) +override INSTALLPPUFILES+=$(UNITPPUFILES) +override CLEANPPUFILES+=$(UNITPPUFILES) +endif +fpc_units: $(UNITPPUFILES) +ifdef TARGET_RSTS +override RSTFILES=$(addsuffix $(RSTEXT),$(TARGET_RSTS)) +override CLEANRSTFILES+=$(RSTFILES) +endif +.PHONY: fpc_packages fpc_all fpc_smart fpc_debug $(FPCMADE): $(ALLTARGET) - @$(ECHO) Compiled > $(FPCMADE) - + @$(ECHOREDIR) Compiled > $(FPCMADE) fpc_packages: $(COMPILEPACKAGES) - fpc_all: fpc_packages $(FPCMADE) - -fpc_debug: - $(MAKE) all DEBUG=1 - -# Search paths for .ppu if targetdir is set -ifdef UNITTARGETDIR -vpath %$(PPUEXT) $(UNITTARGETDIR) -endif - -# General compile rules, available for both possible PASEXT - -.SUFFIXES: $(EXEEXT) $(PPUEXT) $(OEXT) .pas .pp - -%$(PPUEXT): %.pp - $(COMPILER) $< $(REDIR) - $(EXECPPAS) - -%$(PPUEXT): %.pas - $(COMPILER) $< $(REDIR) - $(EXECPPAS) - -%$(EXEEXT): %.pp - $(COMPILER) $< $(REDIR) - $(EXECPPAS) - -%$(EXEEXT): %.pas - $(COMPILER) $< $(REDIR) - $(EXECPPAS) - -##################################################################### -# Library -##################################################################### - -.PHONY: fpc_smart fpc_shared - -ifdef LIBVERSION -LIBFULLNAME=$(LIBNAME).$(LIBVERSION) -else -LIBFULLNAME=$(LIBNAME) -endif - -# Default sharedlib units are all unit objects -ifndef SHAREDLIBUNITOBJECTS -SHAREDLIBUNITOBJECTS:=$(UNITOBJECTS) -endif - fpc_smart: $(MAKE) all LINKSMART=1 CREATESMART=1 - -fpc_shared: all -ifdef HASSHAREDLIB -ifndef LIBNAME - @$(ECHO) "LIBNAME not set" -else - $(PPUMOVE) $(SHAREDLIBUNITOBJECTS) -o$(LIBFULLNAME) +fpc_debug: + $(MAKE) all DEBUG=1 +.SUFFIXES: $(EXEEXT) $(PPUEXT) $(OEXT) .pas .pp +%$(PPUEXT): %.pp + $(COMPILER) $< + $(EXECPPAS) +%$(PPUEXT): %.pas + $(COMPILER) $< + $(EXECPPAS) +%$(EXEEXT): %.pp + $(COMPILER) $< + $(EXECPPAS) +%$(EXEEXT): %.pas + $(COMPILER) $< + $(EXECPPAS) +vpath %.pp $(COMPILER_SOURCEDIR) $(COMPILER_INCLUDEDIR) +vpath %.pas $(COMPILER_SOURCEDIR) $(COMPILER_INCLUDEDIR) +vpath %$(PPUEXT) $(COMPILER_UNITTARGETDIR) +.PHONY: fpc_install fpc_sourceinstall fpc_exampleinstall +ifdef INSTALL_UNITS +override INSTALLPPUFILES+=$(addsuffix $(PPUEXT),$(INSTALL_UNITS)) endif -else - @$(ECHO) "Shared Libraries not supported" -endif - -##################################################################### -# Install rules -##################################################################### - -.PHONY: fpc_showinstall fpc_install - -ifdef EXTRAINSTALLUNITS -override INSTALLPPUFILES+=$(addsuffix $(PPUEXT),$(EXTRAINSTALLUNITS)) -endif - ifdef INSTALLPPUFILES +override INSTALLPPULINKFILES:=$(subst $(PPUEXT),$(OEXT),$(INSTALLPPUFILES)) $(addprefix $(STATICLIBPREFIX),$(subst $(PPUEXT),$(STATICLIBEXT),$(INSTALLPPUFILES))) override INSTALLPPUFILES:=$(addprefix $(UNITTARGETDIRPREFIX),$(INSTALLPPUFILES)) -ifdef PPUFILES -INSTALLPPULINKFILES:=$(addprefix $(UNITTARGETDIRPREFIX),$(shell $(PPUFILES) -S -O $(INSTALLPPUFILES))) -else -INSTALLPPULINKFILES:=$(wildcard $(subst $(PPUEXT),$(OEXT),$(INSTALLPPUFILES)) $(addprefix $(LIBPREFIX),$(subst $(PPUEXT),$(STATICLIBEXT),$(INSTALLPPUFILES)))) +override INSTALLPPULINKFILES:=$(wildcard $(addprefix $(UNITTARGETDIRPREFIX),$(INSTALLPPULINKFILES))) +override INSTALL_CREATEPACKAGEFPC=1 endif -# MWE: not here UNITTARGETDIRPREFIX is already added when no PPUFILES -# override INSTALLPPULINKFILES:=$(addprefix $(UNITTARGETDIRPREFIX),$(INSTALLPPULINKFILES)) -endif - ifdef INSTALLEXEFILES override INSTALLEXEFILES:=$(addprefix $(TARGETDIRPREFIX),$(INSTALLEXEFILES)) endif - -fpc_showinstall: $(SHOWINSTALLTARGET) -ifdef INSTALLEXEFILES - @$(ECHO) -e $(addprefix "\n"$(BININSTALLDIR)/,$(INSTALLEXEFILES)) -endif -ifdef INSTALLPPUFILES - @$(ECHO) -e $(addprefix "\n"$(UNITINSTALLDIR)/,$(INSTALLPPUFILES)) -ifneq ($(INSTALLPPULINKFILES),) - @$(ECHO) -e $(addprefix "\n"$(UNITINSTALLDIR)/,$(INSTALLPPULINKFILES)) -endif -ifneq ($(wildcard $(LIBFULLNAME)),) - @$(ECHO) $(LIBINSTALLDIR)/$(LIBFULLNAME) -ifdef HASSHAREDLIB - @$(ECHO) $(LIBINSTALLDIR)/$(LIBNAME) -endif -endif -endif -ifdef EXTRAINSTALLFILES - @$(ECHO) -e $(addprefix "\n"$(DATAINSTALLDIR)/,$(EXTRAINSTALLFILES)) -endif - fpc_install: $(INSTALLTARGET) -# Create UnitInstallFiles ifdef INSTALLEXEFILES - $(MKDIR) $(BININSTALLDIR) -# Compress the exes if upx is defined + $(MKDIR) $(INSTALL_BINDIR) ifdef UPXPROG -$(UPXPROG) $(INSTALLEXEFILES) endif - $(INSTALLEXE) $(INSTALLEXEFILES) $(BININSTALLDIR) + $(INSTALLEXE) $(INSTALLEXEFILES) $(INSTALL_BINDIR) +endif +ifdef INSTALL_CREATEPACKAGEFPC +ifdef FPCMAKE +ifdef PACKAGE_VERSION +ifneq ($(wildcard Makefile.fpc),) + $(FPCMAKE) -p Makefile.fpc + $(MKDIR) $(INSTALL_UNITDIR) + $(INSTALL) Package.fpc $(INSTALL_UNITDIR) +endif +endif +endif endif ifdef INSTALLPPUFILES - $(MKDIR) $(UNITINSTALLDIR) - $(INSTALL) $(INSTALLPPUFILES) $(UNITINSTALLDIR) + $(MKDIR) $(INSTALL_UNITDIR) + $(INSTALL) $(INSTALLPPUFILES) $(INSTALL_UNITDIR) ifneq ($(INSTALLPPULINKFILES),) - $(INSTALL) $(INSTALLPPULINKFILES) $(UNITINSTALLDIR) + $(INSTALL) $(INSTALLPPULINKFILES) $(INSTALL_UNITDIR) endif -ifneq ($(wildcard $(LIBFULLNAME)),) - $(MKDIR) $(LIBINSTALLDIR) - $(INSTALL) $(LIBFULLNAME) $(LIBINSTALLDIR) +ifneq ($(wildcard $(LIB_FULLNAME)),) + $(MKDIR) $(INSTALL_LIBDIR) + $(INSTALL) $(LIB_FULLNAME) $(INSTALL_LIBDIR) ifdef inUnix - ln -sf $(LIBFULLNAME) $(LIBINSTALLDIR)/$(LIBNAME) + ln -sf $(LIB_FULLNAME) $(INSTALL_LIBDIR)/$(LIB_NAME) endif endif endif -ifdef EXTRAINSTALLFILES - $(MKDIR) $(DATAINSTALLDIR) - $(INSTALL) $(EXTRAINSTALLFILES) $(DATAINSTALLDIR) +ifdef INSTALL_FILES + $(MKDIR) $(INSTALL_DATADIR) + $(INSTALL) $(INSTALL_FILES) $(INSTALL_DATADIR) endif - -##################################################################### -# SourceInstall rules -##################################################################### - -.PHONY: fpc_sourceinstall - -ifndef SOURCETOPDIR -SOURCETOPDIR=$(BASEDIR) +fpc_sourceinstall: distclean + $(MKDIR) $(INSTALL_SOURCEDIR) + $(COPYTREE) $(BASEDIR) $(INSTALL_SOURCEDIR) +fpc_exampleinstall: $(addsuffix _distclean,$(TARGET_EXAMPLEDIRS)) +ifdef HASEXAMPLES + $(MKDIR) $(INSTALL_EXAMPLEDIR) endif - -fpc_sourceinstall: clean - $(MKDIR) $(SOURCEINSTALLDIR) - $(COPYTREE) $(SOURCETOPDIR) $(SOURCEINSTALLDIR) - -##################################################################### -# exampleinstall rules -##################################################################### - -.PHONY: fpc_exampleinstall - -fpc_exampleinstall: $(addsuffix _clean,$(EXAMPLEDIROBJECTS)) ifdef EXAMPLESOURCEFILES - $(MKDIR) $(EXAMPLEINSTALLDIR) - $(COPY) $(EXAMPLESOURCEFILES) $(EXAMPLEINSTALLDIR) + $(COPY) $(EXAMPLESOURCEFILES) $(INSTALL_EXAMPLEDIR) endif -ifdef EXAMPLEDIROBJECTS -ifndef EXAMPLESOURCEFILES - $(MKDIR) $(EXAMPLEINSTALLDIR) +ifdef TARGET_EXAMPLEDIRS + $(COPYTREE) $(addsuffix /*,$(TARGET_EXAMPLEDIRS)) $(INSTALL_EXAMPLEDIR) endif - $(COPYTREE) $(addsuffix /*,$(EXAMPLEDIROBJECTS)) $(EXAMPLEINSTALLDIR) -endif - -##################################################################### -# Zip -##################################################################### - -.PHONY: fpc_zipinstall - -# Create suffix to add -ifndef PACKAGESUFFIX -PACKAGESUFFIX=$(OS_TARGET) -ifeq ($(OS_TARGET),go32v2) -PACKAGESUFFIX=go32 -endif -ifeq ($(OS_TARGET),win32) -PACKAGESUFFIX=w32 -endif -ifeq ($(OS_TARGET),os2) -PACKAGESUFFIX=emx -endif -endif - -# Temporary path to pack a file +.PHONY: fpc_distinstall +fpc_distinstall: install exampleinstall +.PHONY: fpc_zipinstall fpc_zipsourceinstall fpc_zipexampleinstall ifndef PACKDIR ifndef inUnix -PACKDIR=$(BASEDIR)/pack_tmp +PACKDIR=$(BASEDIR)/../fpc-pack else -PACKDIR=/tmp/lazarus-pack +PACKDIR=/tmp/fpc-pack endif endif - -# Maybe create default zipname from packagename ifndef ZIPNAME -ifdef PACKAGENAME -ZIPNAME=$(PACKAGEPREFIX)$(PACKAGENAME)$(PACKAGESUFFIX) +ifdef DIST_ZIPNAME +ZIPNAME=$(DIST_ZIPNAME) +else +ZIPNAME=$(ZIPPREFIX)$(PACKAGE_NAME)$(ZIPSUFFIX) +endif +endif +ifndef ZIPTARGET +ifdef DIST_ZIPTARGET +ZIPTARGET=DIST_ZIPTARGET +else +ZIPTARGET=install endif endif - -# Use tar by default under linux ifndef USEZIP ifdef inUnix USETAR=1 endif endif - -# Use a wrapper script by default for OS/2 -ifdef inOS2 +ifndef inUnix USEZIPWRAPPER=1 endif - -# Create commands to create the zip/tar file -ZIPWRAPPER=$(DESTZIPDIR)/fpczip$(BATCHEXT) -ZIPCMD_CDPACK:=cd $(subst /,$(PATHSEP),$(PACKDIR)) -ZIPCMD_CDBASE:=cd $(subst /,$(PATHSEP),$(BASEDIR)) +ifdef USEZIPWRAPPER +ZIPPATHSEP=$(PATHSEP) +ZIPWRAPPER=$(subst /,$(PATHSEP),$(DIST_DESTDIR)/fpczip$(BATCHEXT)) +else +ZIPPATHSEP=/ +endif +ZIPCMD_CDPACK:=cd $(subst /,$(ZIPPATHSEP),$(PACKDIR)) +ZIPCMD_CDBASE:=cd $(subst /,$(ZIPPATHSEP),$(BASEDIR)) ifdef USETAR -ZIPDESTFILE:=$(DESTZIPDIR)/$(ZIPNAME)$(TAREXT) +ZIPDESTFILE:=$(DIST_DESTDIR)/$(ZIPNAME)$(TAREXT) ZIPCMD_ZIP:=$(TARPROG) cf$(TAROPT) $(ZIPDESTFILE) * else -ZIPDESTFILE:=$(DESTZIPDIR)/$(ZIPNAME)$(ZIPEXT) -ZIPCMD_ZIP:=$(subst /,$(PATHSEP),$(ZIPPROG)) -Dr $(ZIPOPT) $(ZIPDESTFILE) * +ZIPDESTFILE:=$(DIST_DESTDIR)/$(ZIPNAME)$(ZIPEXT) +ZIPCMD_ZIP:=$(subst /,$(ZIPPATHSEP),$(ZIPPROG)) -Dr $(ZIPOPT) $(ZIPDESTFILE) * endif - fpc_zipinstall: -ifndef ZIPNAME - @$(ECHO) "Please specify ZIPNAME!" - @exit 1 -else - $(MAKE) $(ZIPTARGET) PREFIXINSTALLDIR=$(PACKDIR) + $(MAKE) $(ZIPTARGET) INSTALL_PREFIX=$(PACKDIR) ZIPINSTALL=1 $(DEL) $(ZIPDESTFILE) ifdef USEZIPWRAPPER -ifneq ($(ECHO),echo) - $(ECHO) "$(ZIPCMD_CDPACK)" > $(ZIPWRAPPER) - $(ECHO) "$(ZIPCMD_ZIP)" >> $(ZIPWRAPPER) - $(ECHO) "$(ZIPCMD_CDBASE)" >> $(ZIPWRAPPER) +ifneq ($(ECHOREDIR),echo) + $(ECHOREDIR) -e "$(subst \,\\,$(ZIPCMD_CDPACK))" > $(ZIPWRAPPER) + $(ECHOREDIR) -e "$(subst \,\\,$(ZIPCMD_ZIP))" >> $(ZIPWRAPPER) + $(ECHOREDIR) -e "$(subst \,\\,$(ZIPCMD_CDBASE))" >> $(ZIPWRAPPER) else - $(ECHO) $(ZIPCMD_CDPACK) > $(ZIPWRAPPER) - $(ECHO) $(ZIPCMD_ZIP) >> $(ZIPWRAPPER) - $(ECHO) $(ZIPCMD_CDBASE) >> $(ZIPWRAPPER) + echo $(ZIPCMD_CDPACK) > $(ZIPWRAPPER) + echo $(ZIPCMD_ZIP) >> $(ZIPWRAPPER) + echo $(ZIPCMD_CDBASE) >> $(ZIPWRAPPER) endif ifdef inUnix /bin/sh $(ZIPWRAPPER) @@ -1183,44 +844,26 @@ else $(ZIPCMD_CDPACK) ; $(ZIPCMD_ZIP) ; $(ZIPCMD_CDBASE) endif $(DELTREE) $(PACKDIR) -endif - -.PHONY: fpc_zipsourceinstall - fpc_zipsourceinstall: - $(MAKE) fpc_zipinstall ZIPTARGET=sourceinstall PACKAGESUFFIX=src - -.PHONY: fpc_zipexampleinstall - + $(MAKE) fpc_zipinstall ZIPTARGET=sourceinstall ZIPSUFFIX=src fpc_zipexampleinstall: - $(MAKE) fpc_zipinstall ZIPTARGET=exampleinstall PACKAGESUFFIX=exm - -##################################################################### -# Clean rules -##################################################################### - +ifdef HASEXAMPLES + $(MAKE) fpc_zipinstall ZIPTARGET=exampleinstall ZIPSUFFIX=exm +endif +fpc_zipdistinstall: + $(MAKE) fpc_zipinstall ZIPTARGET=distinstall .PHONY: fpc_clean fpc_cleanall fpc_distclean - ifdef EXEFILES override CLEANEXEFILES:=$(addprefix $(TARGETDIRPREFIX),$(CLEANEXEFILES)) endif - -ifdef EXTRACLEANUNITS -override CLEANPPUFILES+=$(addsuffix $(PPUEXT),$(EXTRACLEANUNITS)) +ifdef CLEAN_UNITS +override CLEANPPUFILES+=$(addsuffix $(PPUEXT),$(CLEAN_UNITS)) endif - ifdef CLEANPPUFILES +override CLEANPPULINKFILES:=$(subst $(PPUEXT),$(OEXT),$(CLEANPPUFILES)) $(addprefix $(STATICLIBPREFIX),$(subst $(PPUEXT),$(STATICLIBEXT),$(CLEANPPUFILES))) override CLEANPPUFILES:=$(addprefix $(UNITTARGETDIRPREFIX),$(CLEANPPUFILES)) -# Get the .o and .a files created for the units -ifdef PPUFILES -CLEANPPULINKFILES:=$(addprefix $(UNITTARGETDIRPREFIX),$(shell $(PPUFILES) $(CLEANPPUFILES))) -else -CLEANPPULINKFILES:=$(wildcard $(subst $(PPUEXT),$(OEXT),$(CLEANPPUFILES)) $(addprefix $(LIBPREFIX),$(subst $(PPUEXT),$(STATICLIBEXT),$(CLEANPPUFILES)))) +override CLEANPPULINKFILES:=$(wildcard $(addprefix $(UNITTARGETDIRPREFIX),$(CLEANPPULINKFILES))) endif -# MWE: not here UNITTARGETDIRPREFIX is already added when no PPUFILES -# override CLEANPPULINKFILES:=$(addprefix $(UNITTARGETDIRPREFIX),$(CLEANPPULINKFILES)) -endif - fpc_clean: $(CLEANTARGET) ifdef CLEANEXEFILES -$(DEL) $(CLEANEXEFILES) @@ -1234,22 +877,17 @@ endif ifdef CLEANRSTFILES -$(DEL) $(addprefix $(UNITTARGETDIRPREFIX),$(CLEANRSTFILES)) endif -ifdef EXTRACLEANFILES - -$(DEL) $(EXTRACLEANFILES) +ifdef CLEAN_FILES + -$(DEL) $(CLEAN_FILES) endif -ifdef LIBNAME - -$(DEL) $(LIBNAME) $(LIBFULLNAME) +ifdef LIB_NAME + -$(DEL) $(LIB_NAME) $(LIB_FULLNAME) endif - -$(DEL) $(FPCMADE) $(PPAS) link.res $(FPCEXTFILE) $(REDIRFILE) - -fpc_distclean: fpc_clean - -# Also run clean first if targetdir is set. Unittargetdir is always -# set if targetdir or unittargetdir is specified -ifdef UNITTARGETDIR + -$(DEL) $(FPCMADE) Package.fpc $(PPAS) link.res $(FPCEXTFILE) $(REDIRFILE) +fpc_distclean: clean +ifdef COMPILER_UNITTARGETDIR TARGETDIRCLEAN=fpc_clean endif - fpc_cleanall: $(CLEANTARGET) $(TARGETDIRCLEAN) ifdef CLEANEXEFILES -$(DEL) $(CLEANEXEFILES) @@ -1257,86 +895,152 @@ endif -$(DEL) *$(OEXT) *$(PPUEXT) *$(RSTEXT) *$(ASMEXT) *$(STATICLIBEXT) *$(SHAREDLIBEXT) *$(PPLEXT) -$(DELTREE) *$(SMARTEXT) -$(DEL) $(FPCMADE) $(PPAS) link.res $(FPCEXTFILE) $(REDIRFILE) - -##################################################################### -# Info rules -##################################################################### - -.PHONY: fpc_info fpc_cfginfo fpc_objectinfo fpc_toolsinfo fpc_installinfo \ - fpc_dirinfo - -fpc_info: $(INFOTARGET) - -fpc_infocfg: +ifdef AOUTEXT + -$(DEL) *$(AOUTEXT) +endif +.PHONY: fpc_info +fpc_info: + @$(ECHO) + @$(ECHO) == Package info == + @$(ECHO) Package Name..... $(PACKAGE_NAME) + @$(ECHO) Package Version.. $(PACKAGE_VERSION) @$(ECHO) @$(ECHO) == Configuration info == @$(ECHO) - @$(ECHO) FPC....... $(FPC) - @$(ECHO) Version... $(FPC_VERSION) - @$(ECHO) CPU....... $(CPU_TARGET) - @$(ECHO) Source.... $(OS_SOURCE) - @$(ECHO) Target.... $(OS_TARGET) + @$(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) - -fpc_infoobjects: + @$(ECHO) == Directory info == + @$(ECHO) + @$(ECHO) Basedir......... $(BASEDIR) + @$(ECHO) FPCDir.......... $(FPCDIR) + @$(ECHO) UnitsDir........ $(UNITSDIR) + @$(ECHO) PackagesDir..... $(PACKAGESDIR) + @$(ECHO) + @$(ECHO) GCC library..... $(GCCLIBDIR) + @$(ECHO) Other library... $(OTHERLIBDIR) + @$(ECHO) + @$(ECHO) == Tools info == + @$(ECHO) + @$(ECHO) Pwd....... $(PWD) + @$(ECHO) Mv........ $(MVPROG) + @$(ECHO) Cp........ $(CPPROG) + @$(ECHO) Rm........ $(RMPROG) + @$(ECHO) GInstall.. $(GINSTALL) + @$(ECHO) Echo...... $(ECHO) + @$(ECHO) Date...... $(DATE) + @$(ECHO) FPCMake... $(FPCMAKE) + @$(ECHO) PPUMove... $(PPUMOVE) + @$(ECHO) Upx....... $(UPXPROG) + @$(ECHO) Zip....... $(ZIPPROG) @$(ECHO) @$(ECHO) == Object info == @$(ECHO) - @$(ECHO) LoaderObjects..... $(LOADEROBJECTS) - @$(ECHO) UnitObjects....... $(UNITOBJECTS) - @$(ECHO) ExeObjects........ $(EXEOBJECTS) + @$(ECHO) Target Loaders...... $(TARGET_LOADERS) + @$(ECHO) Target Units........ $(TARGET_UNITS) + @$(ECHO) Target Programs..... $(TARGET_PROGRAMS) + @$(ECHO) Target Dirs......... $(TARGET_DIRS) + @$(ECHO) Target Examples..... $(TARGET_EXAMPLES) + @$(ECHO) Target ExampleDirs.. $(TARGET_EXAMPLEDIRS) @$(ECHO) - @$(ECHO) ExtraCleanUnits... $(EXTRACLEANUNITS) - @$(ECHO) ExtraCleanFiles... $(EXTRACLEANFILES) + @$(ECHO) Clean Units......... $(CLEAN_UNITS) + @$(ECHO) Clean Files......... $(CLEAN_FILES) @$(ECHO) - @$(ECHO) ExtraInstallUnits. $(EXTRAINSTALLUNITS) - @$(ECHO) ExtraInstallFiles. $(EXTRAINSTALLFILES) - @$(ECHO) - -fpc_infoinstall: + @$(ECHO) Install Units....... $(INSTALL_UNITS) + @$(ECHO) Install Files....... $(INSTALL_FILES) @$(ECHO) @$(ECHO) == Install info == @$(ECHO) -ifdef DATE @$(ECHO) DateStr.............. $(DATESTR) -endif -ifdef PACKAGEPREFIX - @$(ECHO) PackagePrefix........ $(PACKAGEPREFIX) -endif -ifdef PACKAGENAME - @$(ECHO) PackageName.......... $(PACKAGENAME) -endif - @$(ECHO) PackageSuffix........ $(PACKAGESUFFIX) + @$(ECHO) ZipPrefix............ $(ZIPPREFIX) + @$(ECHO) ZipSuffix............ $(ZIPSUFFIX) + @$(ECHO) Install FPC Package.. $(INSTALL_FPCPACKAGE) @$(ECHO) - @$(ECHO) BaseInstallDir....... $(BASEINSTALLDIR) - @$(ECHO) BinInstallDir........ $(BININSTALLDIR) - @$(ECHO) LibInstallDir........ $(LIBINSTALLDIR) - @$(ECHO) UnitInstallDir....... $(UNITINSTALLDIR) - @$(ECHO) SourceInstallDir..... $(SOURCEINSTALLDIR) - @$(ECHO) DocInstallDir........ $(DOCINSTALLDIR) - @$(ECHO) DataInstallDir....... $(DATAINSTALLDIR) + @$(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) DestZipDir........... $(DESTZIPDIR) - @$(ECHO) ZipName.............. $(ZIPNAME) + @$(ECHO) Dist destination dir. $(DIST_DESTDIR) + @$(ECHO) Dist zip name........ $(DIST_ZIPNAME) @$(ECHO) - -##################################################################### -# Local Makefile -##################################################################### - +TARGET_DIRS_INTERFACES=1 +ifdef TARGET_DIRS_INTERFACES +interfaces_all: + $(MAKE) -C interfaces all +interfaces_debug: + $(MAKE) -C interfaces debug +interfaces_smart: + $(MAKE) -C interfaces smart +interfaces_examples: + $(MAKE) -C interfaces examples +interfaces_shared: + $(MAKE) -C interfaces shared +interfaces_install: + $(MAKE) -C interfaces install +interfaces_sourceinstall: + $(MAKE) -C interfaces sourceinstall +interfaces_exampleinstall: + $(MAKE) -C interfaces exampleinstall +interfaces_distinstall: + $(MAKE) -C interfaces distinstall +interfaces_zipinstall: + $(MAKE) -C interfaces zipinstall +interfaces_zipsourceinstall: + $(MAKE) -C interfaces zipsourceinstall +interfaces_zipexampleinstall: + $(MAKE) -C interfaces zipexampleinstall +interfaces_zipdistinstall: + $(MAKE) -C interfaces zipdistinstall +interfaces_clean: + $(MAKE) -C interfaces clean +interfaces_distclean: + $(MAKE) -C interfaces distclean +interfaces_cleanall: + $(MAKE) -C interfaces cleanall +interfaces_info: + $(MAKE) -C interfaces info +interfaces: + $(MAKE) -C interfaces all +.PHONY: interfaces_all interfaces_debug interfaces_smart interfaces_examples interfaces_shared interfaces_install interfaces_sourceinstall interfaces_exampleinstall interfaces_distinstall interfaces_zipinstall interfaces_zipsourceinstall interfaces_zipexampleinstall interfaces_zipdistinstall interfaces_clean interfaces_distclean interfaces_cleanall interfaces_info interfaces +endif +debug: fpc_debug +smart: fpc_smart +examples: $(addsuffix _examples,$(TARGET_DIRS)) +shared: $(addsuffix _shared,$(TARGET_DIRS)) +install: fpc_install $(addsuffix _install,$(TARGET_DIRS)) +sourceinstall: fpc_sourceinstall +exampleinstall: fpc_exampleinstall $(addsuffix _exampleinstall,$(TARGET_DIRS)) +distinstall: fpc_distinstall +zipinstall: fpc_zipinstall +zipsourceinstall: fpc_zipsourceinstall +zipexampleinstall: fpc_zipexampleinstall $(addsuffix _zipexampleinstall,$(TARGET_DIRS)) +zipdistinstall: fpc_zipdistinstall $(addsuffix _zipdistinstall,$(TARGET_DIRS)) +clean: fpc_clean $(addsuffix _clean,$(TARGET_DIRS)) +distclean: fpc_distclean $(addsuffix _distclean,$(TARGET_DIRS)) +cleanall: fpc_cleanall $(addsuffix _cleanall,$(TARGET_DIRS)) +info: fpc_info +.PHONY: debug smart examples shared install sourceinstall exampleinstall distinstall zipinstall zipsourceinstall zipexampleinstall zipdistinstall clean distclean cleanall info ifneq ($(wildcard fpcmake.loc),) include fpcmake.loc endif - -##################################################################### -# Users rules -##################################################################### - +.PHONY: cleartarget all makefile makefiles cleartarget: - -$(DEL) $(UNITTARGETDIR)/allunits$(PPUEXT) - + -$(DEL) $(COMPILER_UNITTARGETDIR)/allunits$(PPUEXT) all: cleartarget allunits$(PPUEXT) - -$(DEL) $(UNITTARGETDIR)/allunits$(PPUEXT) - -$(DEL) $(UNITTARGETDIR)/interfaces$(PPUEXT) - -$(DEL) $(UNITTARGETDIR)/interfaces$(OEXT) + -$(DEL) $(COMPILER_UNITTARGETDIR)/allunits$(PPUEXT) + -$(DEL) $(COMPILER_UNITTARGETDIR)/interfaces$(PPUEXT) + -$(DEL) $(COMPILER_UNITTARGETDIR)/interfaces$(OEXT) $(MAKE) -C interfaces +makefile: Makefile.fpc + -$(FPCMAKE) -w +makefiles: makefile + $(MAKE) -C interfaces makefiles diff --git a/lcl/Makefile.fpc b/lcl/Makefile.fpc index 066a52fb90..ce35dc8ad9 100644 --- a/lcl/Makefile.fpc +++ b/lcl/Makefile.fpc @@ -3,46 +3,57 @@ # Makefile.fpc for Lazarus for Free Pascal # -[targets] -# units=allunits -# loaders=allunits +[package] +name=lazarus +#name=lazarus-lcl +version=0.7a + +[target] +dirs=interfaces +units=buttons clipbrd clistbox comctrls controls dialogs dynhasharray \ + extctrls filectrl forms graphics imglist interfacebase lazqueue \ + lcllinux lmessages lresources menus messages registry spin \ + stdctrls toolwin utrace vclglobals + +[default] + +[compiler] +options=-gl +unittargetdir=./units +unitdir=$(COMPILER_UNITTARGETDIR) ./interfaces/abstract +includedir=./include [require] -rtl=1 -options=-Ca -gl -packages=fcl gtk [clean] -units=$(notdir $(basename $(wildcard $(UNITTARGETDIR)/*$(PPUEXT)))) -# not with the lazarusmake.ini -# files=$(wildcard $(UNITTARGETDIR)/*$(OEXT)) - -[dirs] -# target dir needs to be . or a full path otherwise the -# unittargetdir will be corrupt -# not with the lazarusmake.ini -# targetdir=. -unittargetdir=./units -unitdir=$(UNITTARGETDIR) ./interfaces/abstract -incdir=./include [install] -units=$(notdir $(basename $(wildcard $(UNITTARGETDIR)/*$(PPUEXT)))) -packagename=lcl +#prefixdir=/usr +#basedir=$(PACKDIR)/lib/lazarus + +[dist] +zipname=lazarus.lcl.$(ZIPSUFFIX) [libs] -[presettings] +[prerules] +DIST_DESTDIR=$(BASEDIR)/../dist + +[rules] +.PHONY: cleartarget all makefile makefiles -[defaults] - -[rules] cleartarget: - -$(DEL) $(UNITTARGETDIR)/allunits$(PPUEXT) + -$(DEL) $(COMPILER_UNITTARGETDIR)/allunits$(PPUEXT) all: cleartarget allunits$(PPUEXT) - -$(DEL) $(UNITTARGETDIR)/allunits$(PPUEXT) - -$(DEL) $(UNITTARGETDIR)/interfaces$(PPUEXT) - -$(DEL) $(UNITTARGETDIR)/interfaces$(OEXT) + -$(DEL) $(COMPILER_UNITTARGETDIR)/allunits$(PPUEXT) + -$(DEL) $(COMPILER_UNITTARGETDIR)/interfaces$(PPUEXT) + -$(DEL) $(COMPILER_UNITTARGETDIR)/interfaces$(OEXT) $(MAKE) -C interfaces +makefile: Makefile.fpc + -$(FPCMAKE) -w + +makefiles: makefile + $(MAKE) -C interfaces makefiles + \ No newline at end of file diff --git a/lcl/interfaces/Makefile b/lcl/interfaces/Makefile index 4767b26a9d..86eb09ab70 100644 --- a/lcl/interfaces/Makefile +++ b/lcl/interfaces/Makefile @@ -1,38 +1,30 @@ # -# Makefile generated by fpcmake v1.00 [2001/01/09] +# Don't edit, this file is generated by FPCMake Version 1.1 [2001/08/08] # - -defaultrule: all - -##################################################################### -# Autodetect OS (Linux or Dos or Windows NT or OS/2) -# define inUnix when running under Unix (Linux,FreeBSD) -# define inWinNT when running under WinNT -# define inOS2 when running under OS/2 -##################################################################### - -# We need only / in the path +default: all override PATH:=$(subst \,/,$(PATH)) - -# Search for PWD and determine also if we are under linux -PWD:=$(strip $(wildcard $(addsuffix /pwd.exe,$(subst ;, ,$(PATH))))) +ifeq ($(findstring ;,$(PATH)),) +inUnix=1 +SEARCHPATH:=$(filter-out .,$(subst :, ,$(PATH))) +else +SEARCHPATH:=$(subst ;, ,$(PATH)) +endif +PWD:=$(strip $(wildcard $(addsuffix /pwd.exe,$(SEARCHPATH)))) ifeq ($(PWD),) -PWD:=$(strip $(wildcard $(addsuffix /pwd,$(subst :, ,$(PATH))))) +PWD:=$(strip $(wildcard $(addsuffix /pwd,$(SEARCHPATH)))) ifeq ($(PWD),) nopwd: @echo You need the GNU utils package to use this Makefile! @echo Get ftp://ftp.freepascal.org/pub/fpc/dist/go32v2/utilgo32.zip @exit else -inUnix=1 PWD:=$(firstword $(PWD)) +SRCEXEEXT= endif else PWD:=$(firstword $(PWD)) +SRCEXEEXT=.exe endif - -# Detect NT - NT sets OS to Windows_NT -# Detect OS/2 - OS/2 has OS2_SHELL defined ifndef inUnix ifeq ($(OS),Windows_NT) inWinNT=1 @@ -41,16 +33,11 @@ ifdef OS2_SHELL inOS2=1 endif endif -endif - -# The extension of executables -ifdef inUnix -SRCEXEEXT= else -SRCEXEEXT=.exe +ifneq ($(findstring cygwin,$(MACHTYPE)),) +inCygWin=1 +endif endif - -# The extension of batch files / scripts ifdef inUnix BATCHEXT=.sh else @@ -60,96 +47,65 @@ else BATCHEXT=.bat endif endif - -# Path Separator, the subst trick is necessary for the \ that can't exists -# at the end of a line ifdef inUnix PATHSEP=/ else -PATHSEP=$(subst /,\,/) +PATHSEP:=$(subst /,\,/) endif - -# The path which is searched separated by spaces -ifdef inUnix -SEARCHPATH=$(subst :, ,$(PATH)) -else -SEARCHPATH=$(subst ;, ,$(PATH)) -endif - -# Base dir ifdef PWD -BASEDIR:=$(shell $(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 - -##################################################################### -# FPC version/target Detection -##################################################################### - -# What compiler to use ? ifndef FPC -# Compatibility with old makefiles ifdef PP FPC=$(PP) else +ifdef inUnix +CPU_SOURCE=$(shell uname -m) +ifeq (m68k,$(CPU_SOURCE)) +FPC=ppc68k +else +FPC=ppc386 +endif +else FPC=ppc386 endif endif +endif override FPC:=$(subst $(SRCEXEEXT),,$(FPC)) override FPC:=$(subst \,/,$(FPC))$(SRCEXEEXT) - -# Target OS ifndef OS_TARGET OS_TARGET:=$(shell $(FPC) -iTO) endif - -# Source OS ifndef OS_SOURCE OS_SOURCE:=$(shell $(FPC) -iSO) endif - -# Target CPU ifndef CPU_TARGET CPU_TARGET:=$(shell $(FPC) -iTP) endif - -# Source CPU ifndef CPU_SOURCE CPU_SOURCE:=$(shell $(FPC) -iSP) endif - -# FPC version ifndef FPC_VERSION FPC_VERSION:=$(shell $(FPC) -iV) endif - export FPC OS_TARGET OS_SOURCE CPU_TARGET CPU_SOURCE FPC_VERSION - -##################################################################### -# Pre Settings -##################################################################### - -ifndef LCLPLATFORM -LCLPLATFORM=gtk -endif -##################################################################### -# FPCDIR Setting -##################################################################### - -# Test FPCDIR to look if the RTL dir exists ifdef FPCDIR override FPCDIR:=$(subst \,/,$(FPCDIR)) -ifeq ($(wildcard $(FPCDIR)/rtl),) -ifeq ($(wildcard $(FPCDIR)/units),) +ifeq ($(wildcard $(addprefix $(FPCDIR)/,rtl units)),) override FPCDIR=wrong endif -endif else override FPCDIR=wrong endif - -# Detect FPCDIR ifeq ($(FPCDIR),wrong) ifdef inUnix override FPCDIR=/usr/local/lib/fpc/$(FPC_VERSION) @@ -159,153 +115,129 @@ endif else override FPCDIR:=$(subst /$(FPC),,$(firstword $(strip $(wildcard $(addsuffix /$(FPC),$(SEARCHPATH)))))) override FPCDIR:=$(FPCDIR)/.. -ifeq ($(wildcard $(FPCDIR)/rtl),) -ifeq ($(wildcard $(FPCDIR)/units),) +ifeq ($(wildcard $(addprefix $(FPCDIR)/,rtl units)),) override FPCDIR:=$(FPCDIR)/.. -ifeq ($(wildcard $(FPCDIR)/rtl),) -ifeq ($(wildcard $(FPCDIR)/units),) +ifeq ($(wildcard $(addprefix $(FPCDIR)/,rtl units)),) override FPCDIR=c:/pp endif endif endif endif +UNITSDIR:=$(wildcard $(FPCDIR)/units/$(OS_TARGET)) +PACKAGESDIR:=$(wildcard $(FPCDIR) $(FPCDIR)/packages) +override PACKAGE_NAME=lazarus-interface +override PACKAGE_VERSION=0.7a +DIST_DESTDIR=$(BASEDIR)/../../dist +ifndef LCLPLATFORM +LCLPLATFORM=gtk endif -endif - -##################################################################### -# User Settings -##################################################################### - - -# Targets - -override DIROBJECTS+=$(wildcard gtk qt win32) - -# Clean - - -# Install - -PACKAGENAME=interfaces -ZIPTARGET=install - -# Defaults - - -# Directories - - -# Packages - - -# Libraries - - -# Info - -INFOTARGET=fpc_infocfg fpc_infoobjects fpc_infoinstall - -##################################################################### -# Shell tools -##################################################################### - -# echo +override DEFAULT_DIR=$(LCLPLATFORM) +override TARGET_DIRS+=gtk qt win32 ifndef ECHO -ECHO:=$(strip $(wildcard $(addsuffix /gecho$(EXEEXT),$(SEARCHPATH)))) +ECHO:=$(strip $(wildcard $(addsuffix /gecho$(SRCEXEEXT),$(SEARCHPATH)))) ifeq ($(ECHO),) ECHO:=$(strip $(wildcard $(addsuffix /echo$(SRCEXEEXT),$(SEARCHPATH)))) ifeq ($(ECHO),) -ECHO:=echo -ECHOE:=echo +ECHO= else ECHO:=$(firstword $(ECHO)) -ECHOE=$(ECHO) -E endif else ECHO:=$(firstword $(ECHO)) -ECHOE=$(ECHO) -E endif endif - -# To copy pograms +export ECHO +ifndef DATE +DATE:=$(strip $(wildcard $(addsuffix /gdate$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(DATE),) +DATE:=$(strip $(wildcard $(addsuffix /date$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(DATE),) +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= +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= +else +CPPROG:=$(firstword $(CPPROG)) +endif +endif +export CPPROG +ifndef RMPROG +RMPROG:=$(strip $(wildcard $(addsuffix /rm$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(RMPROG),) +RMPROG= +else +RMPROG:=$(firstword $(RMPROG)) +endif +endif +export RMPROG +ifndef MVPROG +MVPROG:=$(strip $(wildcard $(addsuffix /mv$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(MVPROG),) +MVPROG= +else +MVPROG:=$(firstword $(MVPROG)) +endif +endif +export MVPROG +ifndef ECHOREDIR +ECHOREDIR:=$(subst /,$(PATHSEP),$(ECHO)) +endif ifndef COPY -COPY:=cp -fp +COPY:=$(CPPROG) -fp endif - -# Copy a whole tree ifndef COPYTREE -COPYTREE:=cp -rfp +COPYTREE:=$(CPPROG) -rfp endif - -# To move pograms ifndef MOVE -MOVE:=mv -f +MOVE:=$(MVPROG) -f endif - -# Check delete program ifndef DEL -DEL:=rm -f +DEL:=$(RMPROG) -f endif - -# Check deltree program ifndef DELTREE -DELTREE:=rm -rf +DELTREE:=$(RMPROG) -rf endif - -# To install files ifndef INSTALL ifdef inUnix -INSTALL:=install -c -m 644 +INSTALL:=$(GINSTALL) -c -m 644 else INSTALL:=$(COPY) endif endif - -# To install programs ifndef INSTALLEXE ifdef inUnix -INSTALLEXE:=install -c -m 755 +INSTALLEXE:=$(GINSTALL) -c -m 755 else INSTALLEXE:=$(COPY) endif endif - -# To make a directory. ifndef MKDIR -ifdef inUnix -MKDIR:=install -m 755 -d -else -MKDIR:=ginstall -m 755 -d +MKDIR:=$(GINSTALL) -m 755 -d endif -endif - -export ECHO ECHOE COPY COPYTREE MOVE DEL DELTREE INSTALL INSTALLEXE MKDIR - -##################################################################### -# Default Tools -##################################################################### - -# assembler, redefine it if cross compiling -ifndef AS -AS=as -endif - -# linker, but probably not used -ifndef LD -LD=ld -endif - -# ppas.bat / ppas.sh -PPAS=ppas$(BATCHEXT) - -# ldconfig to rebuild .so cache -ifdef inUnix -LDCONFIG=ldconfig -else -LDCONFIG= -endif - -# ppumove +export ECHOREDIR COPY COPYTREE MOVE DEL DELTREE INSTALL INSTALLEXE MKDIR ifndef PPUMOVE PPUMOVE:=$(strip $(wildcard $(addsuffix /ppumove$(SRCEXEEXT),$(SEARCHPATH)))) ifeq ($(PPUMOVE),) @@ -315,20 +247,53 @@ PPUMOVE:=$(firstword $(PPUMOVE)) endif endif export PPUMOVE - -# ppufiles -ifndef PPUFILES -PPUFILES:=$(strip $(wildcard $(addsuffix /ppufiles$(SRCEXEEXT),$(SEARCHPATH)))) -ifeq ($(PPUFILES),) -PPUFILES= +ifndef FPCMAKE +FPCMAKE:=$(strip $(wildcard $(addsuffix /fpcmake$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(FPCMAKE),) +FPCMAKE= else -PPUFILES:=$(firstword $(PPUFILES)) +FPCMAKE:=$(firstword $(FPCMAKE)) endif endif -export PPUFILES - -# Look if UPX is found for go32v2 and win32. We can't use $UPX becuase -# upx uses that one itself (PFV) +export FPCMAKE +ifndef ZIPPROG +ZIPPROG:=$(strip $(wildcard $(addsuffix /zip$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(ZIPPROG),) +ZIPPROG= +else +ZIPPROG:=$(firstword $(ZIPPROG)) +endif +endif +export ZIPPROG +ifndef TARPROG +TARPROG:=$(strip $(wildcard $(addsuffix /tar$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(TARPROG),) +TARPROG= +else +TARPROG:=$(firstword $(TARPROG)) +endif +endif +export TARPROG +ifndef AS +AS=as +endif +ifndef LD +LD=ld +endif +ifndef RC +RC=rc +endif +PPAS=ppas$(BATCHEXT) +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 @@ -348,32 +313,8 @@ UPXPROG= endif endif export UPXPROG - -# ZipProg, you can't use Zip as the var name (PFV) -ifndef ZIPPROG -ZIPPROG:=$(strip $(wildcard $(addsuffix /zip$(SRCEXEEXT),$(SEARCHPATH)))) -ifeq ($(ZIPPROG),) -ZIPPROG= -else -ZIPPROG:=$(firstword $(ZIPPROG)) -endif -endif -export ZIPPROG - ZIPOPT=-9 ZIPEXT=.zip - -# Tar -ifndef TARPROG -TARPROG:=$(strip $(wildcard $(addsuffix /tar$(SRCEXEEXT),$(SEARCHPATH)))) -ifeq ($(TARPROG),) -TARPROG= -else -TARPROG:=$(firstword $(TARPROG)) -endif -endif -export TARPROG - ifeq ($(USETAR),bz2) TAROPT=vI TAREXT=.tar.bz2 @@ -381,12 +322,6 @@ else TAROPT=vz TAREXT=.tar.gz endif - -##################################################################### -# Default extensions -##################################################################### - -# Default needed extensions (Go32v2,Linux) LOADEREXT=.as EXEEXT=.exe PPLEXT=.ppl @@ -396,10 +331,9 @@ ASMEXT=.s SMARTEXT=.sl STATICLIBEXT=.a SHAREDLIBEXT=.so +STATICLIBPREFIX=libp RSTEXT=.rst FPCMADE=fpcmade - -# Go32v1 ifeq ($(OS_TARGET),go32v1) PPUEXT=.pp1 OEXT=.o1 @@ -407,29 +341,27 @@ ASMEXT=.s1 SMARTEXT=.sl1 STATICLIBEXT=.a1 SHAREDLIBEXT=.so1 +STATICLIBPREFIX= FPCMADE=fpcmade.v1 +PACKAGESUFFIX=v1 endif - -# Go32v2 ifeq ($(OS_TARGET),go32v2) +STATICLIBPREFIX= FPCMADE=fpcmade.dos +ZIPSUFFIX=go32 endif - -# Linux ifeq ($(OS_TARGET),linux) EXEEXT= HASSHAREDLIB=1 FPCMADE=fpcmade.lnx +ZIPSUFFIX=linux endif - -# Linux ifeq ($(OS_TARGET),freebsd) EXEEXT= HASSHAREDLIB=1 FPCMADE=fpcmade.freebsd +ZIPSUFFIX=freebsd endif - -# Win32 ifeq ($(OS_TARGET),win32) PPUEXT=.ppw OEXT=.ow @@ -438,53 +370,45 @@ SMARTEXT=.slw STATICLIBEXT=.aw SHAREDLIBEXT=.dll FPCMADE=fpcmade.w32 +ZIPSUFFIX=w32 endif - -# OS/2 ifeq ($(OS_TARGET),os2) PPUEXT=.ppo ASMEXT=.so2 OEXT=.oo2 +AOUTEXT=.out SMARTEXT=.so STATICLIBEXT=.ao2 SHAREDLIBEXT=.dll FPCMADE=fpcmade.os2 +ZIPSUFFIX=emx endif - -# library prefix -LIBPREFIX=lib -ifeq ($(OS_TARGET),go32v2) -LIBPREFIX= +ifeq ($(OS_TARGET),amiga) +EXEEXT= +PPUEXT=.ppa +ASMEXT=.asm +OEXT=.o +SMARTEXT=.sl +STATICLIBEXT=.a +SHAREDLIBEXT=.library +FPCMADE=fpcmade.amg endif -ifeq ($(OS_TARGET),go32v1) -LIBPREFIX= +ifeq ($(OS_TARGET),atari) +PPUEXT=.ppt +ASMEXT=.s +OEXT=.o +SMARTEXT=.sl +STATICLIBEXT=.a +EXEEXT=.ttp +FPCMADE=fpcmade.ata endif - -# determine which .pas extension is used -ifndef PASEXT -ifdef EXEOBJECTS -override TESTPAS:=$(strip $(wildcard $(addsuffix .pas,$(firstword $(EXEOBJECTS))))) -else -override TESTPAS:=$(strip $(wildcard $(addsuffix .pas,$(firstword $(UNITOBJECTS))))) +ifdef REQUIRE_UNITSDIR +override UNITSDIR+=$(REQUIRE_UNITSDIR) endif -ifeq ($(TESTPAS),) -PASEXT=.pp -else -PASEXT=.pas +ifdef REQUIRE_PACKAGESDIR +override PACKAGESDIR+=$(REQUIRE_PACKAGESDIR) endif -endif - - - -##################################################################### -# Default Directories -##################################################################### - -# Linux and freebsd use unix dirs with /usr/bin, /usr/lib -# When zipping use the target as default, when normal install then -# use the source os as default -ifdef ZIPNAME -# Zipinstall +ifdef ZIPINSTALL ifeq ($(OS_TARGET),linux) UNIXINSTALLDIR=1 endif @@ -492,7 +416,6 @@ ifeq ($(OS_TARGET),freebsd) UNIXINSTALLDIR=1 endif else -# Normal install ifeq ($(OS_SOURCE),linux) UNIXINSTALLDIR=1 endif @@ -500,132 +423,110 @@ ifeq ($(OS_SOURCE),freebsd) UNIXINSTALLDIR=1 endif endif - -# set the prefix directory where to install everything -ifndef PREFIXINSTALLDIR +ifndef INSTALL_PREFIX ifdef UNIXINSTALLDIR -PREFIXINSTALLDIR=/usr +INSTALL_PREFIX=/usr/local else -PREFIXINSTALLDIR=/pp +ifdef INSTALL_FPCPACKAGE +INSTALL_BASEDIR:=/pp +else +INSTALL_BASEDIR:=/$(PACKAGE_NAME) endif endif -export PREFIXINSTALLDIR - -# Where to place the resulting zip files -ifndef DESTZIPDIR -DESTZIPDIR:=$(BASEDIR) endif -export DESTZIPDIR - -##################################################################### -# Install Directories -##################################################################### - -# set the base directory where to install everything -ifndef BASEINSTALLDIR +export INSTALL_PREFIX +ifndef DIST_DESTDIR +DIST_DESTDIR:=$(BASEDIR) +endif +export DIST_DESTDIR +ifndef INSTALL_BASEDIR ifdef UNIXINSTALLDIR -BASEINSTALLDIR=$(PREFIXINSTALLDIR)/lib/lazarus/$(FPC_VERSION) +ifdef INSTALL_FPCPACKAGE +INSTALL_BASEDIR:=$(INSTALL_PREFIX)/lib/fpc/$(FPC_VERSION) else -BASEINSTALLDIR=$(PREFIXINSTALLDIR) +INSTALL_BASEDIR:=$(INSTALL_PREFIX)/lib/$(PACKAGE_NAME) +endif +else +INSTALL_BASEDIR:=$(INSTALL_PREFIX) endif endif - -# set the directory where to install the binaries -ifndef BININSTALLDIR +ifndef INSTALL_BINDIR ifdef UNIXINSTALLDIR -BININSTALLDIR=$(PREFIXINSTALLDIR)/bin +INSTALL_BINDIR:=$(INSTALL_PREFIX)/bin else -BININSTALLDIR=$(BASEINSTALLDIR)/bin/$(OS_TARGET) +INSTALL_BINDIR:=$(INSTALL_BASEDIR)/bin +ifdef INSTALL_FPCPACKAGE +INSTALL_BINDIR:=$(INSTALL_BINDIR)/$(OS_TARGET) endif endif - -# set the directory where to install the units. -ifndef UNITINSTALLDIR -UNITINSTALLDIR=$(BASEINSTALLDIR)/units/$(OS_TARGET) -ifdef UNITSUBDIR -UNITINSTALLDIR:=$(UNITINSTALLDIR)/$(UNITSUBDIR) +endif +ifndef INSTALL_UNITDIR +INSTALL_UNITDIR:=$(INSTALL_BASEDIR)/units/$(OS_TARGET) +ifdef INSTALL_FPCPACKAGE +ifdef PACKAGE_NAME +INSTALL_UNITDIR:=$(INSTALL_UNITDIR)/$(PACKAGE_NAME) endif endif - -# Where to install shared libraries -ifndef LIBINSTALLDIR +endif +ifndef INSTALL_LIBDIR ifdef UNIXINSTALLDIR -LIBINSTALLDIR=$(PREFIXINSTALLDIR)/lib +INSTALL_LIBDIR:=$(INSTALL_PREFIX)/lib else -LIBINSTALLDIR=$(UNITINSTALLDIR) +INSTALL_LIBDIR:=$(INSTALL_UNITDIR) endif endif - -# Where the source files will be stored -ifndef SOURCEINSTALLDIR +ifndef INSTALL_SOURCEDIR ifdef UNIXINSTALLDIR -SOURCEINSTALLDIR=$(PREFIXINSTALLDIR)/src/lazarus-$(FPC_VERSION) +ifdef INSTALL_FPCPACKAGE +INSTALL_SOURCEDIR:=$(INSTALL_PREFIX)/src/fpc-$(FPC_VERSION)/$(PACKAGE_NAME) else -SOURCEINSTALLDIR=$(BASEINSTALLDIR)/source +INSTALL_SOURCEDIR:=$(INSTALL_PREFIX)/src/$(PACKAGE_NAME)-$(PACKAGE_VERSION) endif -ifdef SOURCESUBDIR -SOURCEINSTALLDIR:=$(SOURCEINSTALLDIR)/$(SOURCESUBDIR) +else +ifdef INSTALL_FPCPACKAGE +INSTALL_SOURCEDIR:=$(INSTALL_BASEDIR)/source/$(PACKAGE_NAME) +else +INSTALL_SOURCEDIRL:=$(INSTALL_BASEDIR)/source endif endif - -# Where the doc files will be stored -ifndef DOCINSTALLDIR +endif +ifndef INSTALL_DOCDIR ifdef UNIXINSTALLDIR -DOCINSTALLDIR=$(PREFIXINSTALLDIR)/doc/lazarus-$(FPC_VERSION) +ifdef INSTALL_FPCPACKAGE +INSTALL_DOCDIR:=$(INSTALL_PREFIX)/doc/fpc-$(FPC_VERSION)/$(PACKAGE_NAME) else -DOCINSTALLDIR=$(BASEINSTALLDIR)/doc +INSTALL_DOCDIR:=$(INSTALL_PREFIX)/doc/$(PACKAGE_NAME)-$(PACKAGE_VERSION) +endif +else +ifdef INSTALL_FPCPACKAGE +INSTALL_DOCDIR:=$(INSTALL_BASEDIR)/doc/$(PACKAGE_NAME) +else +INSTALL_DOCDIR:=$(INSTALL_BASEDIR)/doc endif endif - -# Where to install the examples, under linux we use the doc dir -# because the copytree command will create a subdir itself -ifndef EXAMPLEINSTALLDIR +endif +ifndef INSTALL_EXAMPLEDIR ifdef UNIXINSTALLDIR -EXAMPLEINSTALLDIR=$(DOCINSTALLDIR)/examples +ifdef INSTALL_FPCPACKAGE +INSTALL_EXAMPLEDIR:=$(INSTALL_PREFIX)/doc/fpc-$(FPC_VERSION)/examples/$(PACKAGE_NAME) else -EXAMPLEINSTALLDIR=$(BASEINSTALLDIR)/examples +INSTALL_EXAMPLEDIR:=$(INSTALL_PREFIX)/doc/$(PACKAGE_NAME)-$(PACKAGE_VERSION) endif -ifdef EXAMPLESUBDIR -EXAMPLEINSTALLDIR:=$(EXAMPLEINSTALLDIR)/$(EXAMPLESUBDIR) +else +ifdef INSTALL_FPCPACKAGE +INSTALL_EXAMPLEDIR:=$(INSTALL_BASEDIR)/examples/$(PACKAGE_NAME) +else +INSTALL_EXAMPLEDIR:=$(INSTALL_BASEDIR)/examples endif endif - -# Where the some extra (data)files will be stored -ifndef DATAINSTALLDIR -DATAINSTALLDIR=$(BASEINSTALLDIR) endif - -##################################################################### -# Redirection -##################################################################### - -ifndef REDIRFILE -REDIRFILE=log +ifndef INSTALL_DATADIR +INSTALL_DATADIR=$(INSTALL_BASEDIR) endif - -ifdef REDIR -ifndef inUnix -override FPC=redir -eo $(FPC) -endif -# set the verbosity to max -override FPCOPT+=-va -override REDIR:= >> $(REDIRFILE) -endif - - -##################################################################### -# Compiler Command Line -##################################################################### - -# Load commandline OPTDEF and add FPC_CPU define -override FPCOPTDEF:=-d$(CPU_TARGET) - -# Load commandline OPT and add target and unit dir to be sure +override FPCOPTDEF=$(CPU_TARGET) ifneq ($(OS_TARGET),$(OS_SOURCE)) override FPCOPT+=-T$(OS_TARGET) endif - -# User dirs should be first, so they are looked at first ifdef UNITDIR override FPCOPT+=$(addprefix -Fu,$(UNITDIR)) endif @@ -638,106 +539,80 @@ endif ifdef INCDIR override FPCOPT+=$(addprefix -Fi,$(INCDIR)) endif - -# Smartlinking ifdef LINKSMART override FPCOPT+=-XX endif - -# Smartlinking creation ifdef CREATESMART override FPCOPT+=-CX endif - -# Debug ifdef DEBUG -override FPCOPT+=-gl -dDEBUG +override FPCOPT+=-gl +override FPCOPTDEF+=DEBUG endif - -# Release mode (strip, optimize and don't load ppc386.cfg) -# 0.99.12b has a bug in the optimizer so don't use it by default ifdef RELEASE -ifeq ($(FPC_VERSION),0.99.12) -override FPCOPT+=-Xs -OGp3 -n -else override FPCOPT+=-Xs -OG2p3 -n +override FPCOPTDEF+=RELEASE endif -endif - -# Strip ifdef STRIP override FPCOPT+=-Xs endif - -# Optimizer ifdef OPTIMIZE override FPCOPT+=-OG2p3 endif - -# Verbose settings (warning,note,info) ifdef VERBOSE override FPCOPT+=-vwni endif - -ifdef UNITSDIR -override FPCOPT+=-Fu$(UNITSDIR) +ifdef COMPILER_OPTIONS +override FPCOPT+=$(COMPILER_OPTIONS) endif - -# Target dirs and the prefix to use for clean/install -ifdef TARGETDIR -override FPCOPT+=-FE$(TARGETDIR) -ifeq ($(TARGETDIR),.) +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 COMPILER_TARGETDIR +override FPCOPT+=-FE$(COMPILER_TARGETDIR) +ifeq ($(COMPILER_TARGETDIR),.) override TARGETDIRPREFIX= else -override TARGETDIRPREFIX=$(TARGETDIR)/ +override TARGETDIRPREFIX=$(COMPILER_TARGETDIR)/ endif endif -ifdef UNITTARGETDIR -override FPCOPT+=-FU$(UNITTARGETDIR) -ifeq ($(UNITTARGETDIR),.) +ifdef COMPILER_UNITTARGETDIR +override FPCOPT+=-FU$(COMPILER_UNITTARGETDIR) +ifeq ($(COMPILER_UNITTARGETDIR),.) override UNITTARGETDIRPREFIX= else -override UNITTARGETDIRPREFIX=$(UNITTARGETDIR)/ +override UNITTARGETDIRPREFIX=$(COMPILER_UNITTARGETDIR)/ endif else -ifdef TARGETDIR -override UNITTARGETDIR=$(TARGETDIR) +ifdef COMPILER_TARGETDIR +override COMPILER_UNITTARGETDIR=$(COMPILER_TARGETDIR) override UNITTARGETDIRPREFIX=$(TARGETDIRPREFIX) endif endif - -# Add commandline options last so they can override ifdef OPT override FPCOPT+=$(OPT) endif - -# Add defines from FPCOPTDEF to FPCOPT ifdef FPCOPTDEF -override FPCOPT+=$(FPCOPTDEF) +override FPCOPT+=$(addprefix -d,$(FPCOPTDEF)) endif - -# Error file ? -ifdef ERRORFILE -override FPCOPT+=-Fr$(ERRORFILE) -endif - -# Was a config file specified ? ifdef CFGFILE override FPCOPT+=@$(CFGFILE) endif - -# For win32 the options are passed using the environment FPCEXTCMD -ifeq ($(OS_SOURCE),win32) +ifdef USEENV override FPCEXTCMD:=$(FPCOPT) override FPCOPT:=!FPCEXTCMD export FPCEXTCMD endif - -# Compiler commandline override COMPILER:=$(FPC) $(FPCOPT) - -# also call ppas if with command option -s -# but only if the OS_SOURCE and OS_TARGE are equal ifeq (,$(findstring -s ,$(COMPILER))) EXECPPAS= else @@ -745,299 +620,69 @@ ifeq ($(OS_SOURCE),$(OS_TARGET)) EXECPPAS:=@$(PPAS) endif endif - -##################################################################### -# Standard rules -##################################################################### - -all: fpc_all $(addsuffix _all,$(LCLPLATFORM)) - -debug: fpc_debug $(addsuffix _debug,$(LCLPLATFORM)) - -smart: fpc_smart $(addsuffix _smart,$(LCLPLATFORM)) - -shared: fpc_shared $(addsuffix _shared,$(LCLPLATFORM)) - -showinstall: fpc_showinstall $(addsuffix _showinstall,$(LCLPLATFORM)) - -install: fpc_install $(addsuffix _install,$(LCLPLATFORM)) - -sourceinstall: fpc_sourceinstall - -exampleinstall: fpc_exampleinstall - -zipinstall: fpc_zipinstall - -zipsourceinstall: fpc_zipsourceinstall - -zipexampleinstall: fpc_zipexampleinstall - -clean: fpc_clean $(addsuffix _clean,$(LCLPLATFORM)) - -distclean: fpc_distclean $(addsuffix _distclean,$(LCLPLATFORM)) - -cleanall: fpc_cleanall $(addsuffix _cleanall,$(LCLPLATFORM)) - -require: $(addsuffix _require,$(LCLPLATFORM)) - -info: fpc_info - -.PHONY: all debug smart shared showinstall install sourceinstall exampleinstall zipinstall zipsourceinstall zipexampleinstall clean distclean cleanall require info - -##################################################################### -# General compile rules -##################################################################### - -.PHONY: fpc_packages fpc_all fpc_debug - -$(FPCMADE): $(ALLTARGET) - @$(ECHO) Compiled > $(FPCMADE) - -fpc_packages: $(COMPILEPACKAGES) - -fpc_all: fpc_packages $(FPCMADE) - -fpc_debug: - $(MAKE) all DEBUG=1 - -# Search paths for .ppu if targetdir is set -ifdef UNITTARGETDIR -vpath %$(PPUEXT) $(UNITTARGETDIR) +ifdef TARGET_RSTS +override RSTFILES=$(addsuffix $(RSTEXT),$(TARGET_RSTS)) +override CLEANRSTFILES+=$(RSTFILES) endif - -# General compile rules, available for both possible PASEXT - -.SUFFIXES: $(EXEEXT) $(PPUEXT) $(OEXT) .pas .pp - -%$(PPUEXT): %.pp - $(COMPILER) $< $(REDIR) - $(EXECPPAS) - -%$(PPUEXT): %.pas - $(COMPILER) $< $(REDIR) - $(EXECPPAS) - -%$(EXEEXT): %.pp - $(COMPILER) $< $(REDIR) - $(EXECPPAS) - -%$(EXEEXT): %.pas - $(COMPILER) $< $(REDIR) - $(EXECPPAS) - -##################################################################### -# Library -##################################################################### - -.PHONY: fpc_smart fpc_shared - -ifdef LIBVERSION -LIBFULLNAME=$(LIBNAME).$(LIBVERSION) -else -LIBFULLNAME=$(LIBNAME) -endif - -# Default sharedlib units are all unit objects -ifndef SHAREDLIBUNITOBJECTS -SHAREDLIBUNITOBJECTS:=$(UNITOBJECTS) -endif - -fpc_smart: - $(MAKE) all LINKSMART=1 CREATESMART=1 - -fpc_shared: all -ifdef HASSHAREDLIB -ifndef LIBNAME - @$(ECHO) "LIBNAME not set" -else - $(PPUMOVE) $(SHAREDLIBUNITOBJECTS) -o$(LIBFULLNAME) -endif -else - @$(ECHO) "Shared Libraries not supported" -endif - -##################################################################### -# Install rules -##################################################################### - -.PHONY: fpc_showinstall fpc_install - -ifdef EXTRAINSTALLUNITS -override INSTALLPPUFILES+=$(addsuffix $(PPUEXT),$(EXTRAINSTALLUNITS)) -endif - -ifdef INSTALLPPUFILES -override INSTALLPPUFILES:=$(addprefix $(UNITTARGETDIRPREFIX),$(INSTALLPPUFILES)) -ifdef PPUFILES -INSTALLPPULINKFILES:=$(addprefix $(UNITTARGETDIRPREFIX),$(shell $(PPUFILES) -S -O $(INSTALLPPUFILES))) -else -INSTALLPPULINKFILES:=$(wildcard $(subst $(PPUEXT),$(OEXT),$(INSTALLPPUFILES)) $(addprefix $(LIBPREFIX),$(subst $(PPUEXT),$(STATICLIBEXT),$(INSTALLPPUFILES)))) -endif -# MWE: not here UNITTARGETDIRPREFIX is already added when no PPUFILES -# override INSTALLPPULINKFILES:=$(addprefix $(UNITTARGETDIRPREFIX),$(INSTALLPPULINKFILES)) -endif - -ifdef INSTALLEXEFILES -override INSTALLEXEFILES:=$(addprefix $(TARGETDIRPREFIX),$(INSTALLEXEFILES)) -endif - -fpc_showinstall: $(SHOWINSTALLTARGET) -ifdef INSTALLEXEFILES - @$(ECHO) -e $(addprefix "\n"$(BININSTALLDIR)/,$(INSTALLEXEFILES)) -endif -ifdef INSTALLPPUFILES - @$(ECHO) -e $(addprefix "\n"$(UNITINSTALLDIR)/,$(INSTALLPPUFILES)) -ifneq ($(INSTALLPPULINKFILES),) - @$(ECHO) -e $(addprefix "\n"$(UNITINSTALLDIR)/,$(INSTALLPPULINKFILES)) -endif -ifneq ($(wildcard $(LIBFULLNAME)),) - @$(ECHO) $(LIBINSTALLDIR)/$(LIBFULLNAME) -ifdef HASSHAREDLIB - @$(ECHO) $(LIBINSTALLDIR)/$(LIBNAME) -endif -endif -endif -ifdef EXTRAINSTALLFILES - @$(ECHO) -e $(addprefix "\n"$(DATAINSTALLDIR)/,$(EXTRAINSTALLFILES)) -endif - -fpc_install: $(INSTALLTARGET) -# Create UnitInstallFiles -ifdef INSTALLEXEFILES - $(MKDIR) $(BININSTALLDIR) -# Compress the exes if upx is defined -ifdef UPXPROG - -$(UPXPROG) $(INSTALLEXEFILES) -endif - $(INSTALLEXE) $(INSTALLEXEFILES) $(BININSTALLDIR) -endif -ifdef INSTALLPPUFILES - $(MKDIR) $(UNITINSTALLDIR) - $(INSTALL) $(INSTALLPPUFILES) $(UNITINSTALLDIR) -ifneq ($(INSTALLPPULINKFILES),) - $(INSTALL) $(INSTALLPPULINKFILES) $(UNITINSTALLDIR) -endif -ifneq ($(wildcard $(LIBFULLNAME)),) - $(MKDIR) $(LIBINSTALLDIR) - $(INSTALL) $(LIBFULLNAME) $(LIBINSTALLDIR) -ifdef inUnix - ln -sf $(LIBFULLNAME) $(LIBINSTALLDIR)/$(LIBNAME) -endif -endif -endif -ifdef EXTRAINSTALLFILES - $(MKDIR) $(DATAINSTALLDIR) - $(INSTALL) $(EXTRAINSTALLFILES) $(DATAINSTALLDIR) -endif - -##################################################################### -# SourceInstall rules -##################################################################### - -.PHONY: fpc_sourceinstall - -ifndef SOURCETOPDIR -SOURCETOPDIR=$(BASEDIR) -endif - -fpc_sourceinstall: clean - $(MKDIR) $(SOURCEINSTALLDIR) - $(COPYTREE) $(SOURCETOPDIR) $(SOURCEINSTALLDIR) - -##################################################################### -# exampleinstall rules -##################################################################### - -.PHONY: fpc_exampleinstall - -fpc_exampleinstall: $(addsuffix _clean,$(EXAMPLEDIROBJECTS)) -ifdef EXAMPLESOURCEFILES - $(MKDIR) $(EXAMPLEINSTALLDIR) - $(COPY) $(EXAMPLESOURCEFILES) $(EXAMPLEINSTALLDIR) -endif -ifdef EXAMPLEDIROBJECTS -ifndef EXAMPLESOURCEFILES - $(MKDIR) $(EXAMPLEINSTALLDIR) -endif - $(COPYTREE) $(addsuffix /*,$(EXAMPLEDIROBJECTS)) $(EXAMPLEINSTALLDIR) -endif - -##################################################################### -# Zip -##################################################################### - -.PHONY: fpc_zipinstall - -# Create suffix to add -ifndef PACKAGESUFFIX -PACKAGESUFFIX=$(OS_TARGET) -ifeq ($(OS_TARGET),go32v2) -PACKAGESUFFIX=go32 -endif -ifeq ($(OS_TARGET),win32) -PACKAGESUFFIX=w32 -endif -ifeq ($(OS_TARGET),os2) -PACKAGESUFFIX=emx -endif -endif - -# Temporary path to pack a file +.PHONY: fpc_distinstall +fpc_distinstall: install exampleinstall +.PHONY: fpc_zipinstall fpc_zipsourceinstall fpc_zipexampleinstall ifndef PACKDIR ifndef inUnix -PACKDIR=$(BASEDIR)/pack_tmp +PACKDIR=$(BASEDIR)/../fpc-pack else -PACKDIR=/tmp/lazarus-pack +PACKDIR=/tmp/fpc-pack endif endif - -# Maybe create default zipname from packagename ifndef ZIPNAME -ifdef PACKAGENAME -ZIPNAME=$(PACKAGEPREFIX)$(PACKAGENAME)$(PACKAGESUFFIX) +ifdef DIST_ZIPNAME +ZIPNAME=$(DIST_ZIPNAME) +else +ZIPNAME=$(ZIPPREFIX)$(PACKAGE_NAME)$(ZIPSUFFIX) +endif +endif +ifndef ZIPTARGET +ifdef DIST_ZIPTARGET +ZIPTARGET=DIST_ZIPTARGET +else +ZIPTARGET=install endif endif - -# Use tar by default under linux ifndef USEZIP ifdef inUnix USETAR=1 endif endif - -# Use a wrapper script by default for OS/2 -ifdef inOS2 +ifndef inUnix USEZIPWRAPPER=1 endif - -# Create commands to create the zip/tar file -ZIPWRAPPER=$(DESTZIPDIR)/fpczip$(BATCHEXT) -ZIPCMD_CDPACK:=cd $(subst /,$(PATHSEP),$(PACKDIR)) -ZIPCMD_CDBASE:=cd $(subst /,$(PATHSEP),$(BASEDIR)) +ifdef USEZIPWRAPPER +ZIPPATHSEP=$(PATHSEP) +ZIPWRAPPER=$(subst /,$(PATHSEP),$(DIST_DESTDIR)/fpczip$(BATCHEXT)) +else +ZIPPATHSEP=/ +endif +ZIPCMD_CDPACK:=cd $(subst /,$(ZIPPATHSEP),$(PACKDIR)) +ZIPCMD_CDBASE:=cd $(subst /,$(ZIPPATHSEP),$(BASEDIR)) ifdef USETAR -ZIPDESTFILE:=$(DESTZIPDIR)/$(ZIPNAME)$(TAREXT) +ZIPDESTFILE:=$(DIST_DESTDIR)/$(ZIPNAME)$(TAREXT) ZIPCMD_ZIP:=$(TARPROG) cf$(TAROPT) $(ZIPDESTFILE) * else -ZIPDESTFILE:=$(DESTZIPDIR)/$(ZIPNAME)$(ZIPEXT) -ZIPCMD_ZIP:=$(subst /,$(PATHSEP),$(ZIPPROG)) -Dr $(ZIPOPT) $(ZIPDESTFILE) * +ZIPDESTFILE:=$(DIST_DESTDIR)/$(ZIPNAME)$(ZIPEXT) +ZIPCMD_ZIP:=$(subst /,$(ZIPPATHSEP),$(ZIPPROG)) -Dr $(ZIPOPT) $(ZIPDESTFILE) * endif - fpc_zipinstall: -ifndef ZIPNAME - @$(ECHO) "Please specify ZIPNAME!" - @exit 1 -else - $(MAKE) $(ZIPTARGET) PREFIXINSTALLDIR=$(PACKDIR) + $(MAKE) $(ZIPTARGET) INSTALL_PREFIX=$(PACKDIR) ZIPINSTALL=1 $(DEL) $(ZIPDESTFILE) ifdef USEZIPWRAPPER -ifneq ($(ECHO),echo) - $(ECHO) "$(ZIPCMD_CDPACK)" > $(ZIPWRAPPER) - $(ECHO) "$(ZIPCMD_ZIP)" >> $(ZIPWRAPPER) - $(ECHO) "$(ZIPCMD_CDBASE)" >> $(ZIPWRAPPER) +ifneq ($(ECHOREDIR),echo) + $(ECHOREDIR) -e "$(subst \,\\,$(ZIPCMD_CDPACK))" > $(ZIPWRAPPER) + $(ECHOREDIR) -e "$(subst \,\\,$(ZIPCMD_ZIP))" >> $(ZIPWRAPPER) + $(ECHOREDIR) -e "$(subst \,\\,$(ZIPCMD_CDBASE))" >> $(ZIPWRAPPER) else - $(ECHO) $(ZIPCMD_CDPACK) > $(ZIPWRAPPER) - $(ECHO) $(ZIPCMD_ZIP) >> $(ZIPWRAPPER) - $(ECHO) $(ZIPCMD_CDBASE) >> $(ZIPWRAPPER) + echo $(ZIPCMD_CDPACK) > $(ZIPWRAPPER) + echo $(ZIPCMD_ZIP) >> $(ZIPWRAPPER) + echo $(ZIPCMD_CDBASE) >> $(ZIPWRAPPER) endif ifdef inUnix /bin/sh $(ZIPWRAPPER) @@ -1049,44 +694,26 @@ else $(ZIPCMD_CDPACK) ; $(ZIPCMD_ZIP) ; $(ZIPCMD_CDBASE) endif $(DELTREE) $(PACKDIR) -endif - -.PHONY: fpc_zipsourceinstall - fpc_zipsourceinstall: - $(MAKE) fpc_zipinstall ZIPTARGET=sourceinstall PACKAGESUFFIX=src - -.PHONY: fpc_zipexampleinstall - + $(MAKE) fpc_zipinstall ZIPTARGET=sourceinstall ZIPSUFFIX=src fpc_zipexampleinstall: - $(MAKE) fpc_zipinstall ZIPTARGET=exampleinstall PACKAGESUFFIX=exm - -##################################################################### -# Clean rules -##################################################################### - +ifdef HASEXAMPLES + $(MAKE) fpc_zipinstall ZIPTARGET=exampleinstall ZIPSUFFIX=exm +endif +fpc_zipdistinstall: + $(MAKE) fpc_zipinstall ZIPTARGET=distinstall .PHONY: fpc_clean fpc_cleanall fpc_distclean - ifdef EXEFILES override CLEANEXEFILES:=$(addprefix $(TARGETDIRPREFIX),$(CLEANEXEFILES)) endif - -ifdef EXTRACLEANUNITS -override CLEANPPUFILES+=$(addsuffix $(PPUEXT),$(EXTRACLEANUNITS)) +ifdef CLEAN_UNITS +override CLEANPPUFILES+=$(addsuffix $(PPUEXT),$(CLEAN_UNITS)) endif - ifdef CLEANPPUFILES +override CLEANPPULINKFILES:=$(subst $(PPUEXT),$(OEXT),$(CLEANPPUFILES)) $(addprefix $(STATICLIBPREFIX),$(subst $(PPUEXT),$(STATICLIBEXT),$(CLEANPPUFILES))) override CLEANPPUFILES:=$(addprefix $(UNITTARGETDIRPREFIX),$(CLEANPPUFILES)) -# Get the .o and .a files created for the units -ifdef PPUFILES -CLEANPPULINKFILES:=$(addprefix $(UNITTARGETDIRPREFIX),$(shell $(PPUFILES) $(CLEANPPUFILES))) -else -CLEANPPULINKFILES:=$(wildcard $(subst $(PPUEXT),$(OEXT),$(CLEANPPUFILES)) $(addprefix $(LIBPREFIX),$(subst $(PPUEXT),$(STATICLIBEXT),$(CLEANPPUFILES)))) +override CLEANPPULINKFILES:=$(wildcard $(addprefix $(UNITTARGETDIRPREFIX),$(CLEANPPULINKFILES))) endif -# MWE: not here UNITTARGETDIRPREFIX is already added when no PPUFILES -# override CLEANPPULINKFILES:=$(addprefix $(UNITTARGETDIRPREFIX),$(CLEANPPULINKFILES)) -endif - fpc_clean: $(CLEANTARGET) ifdef CLEANEXEFILES -$(DEL) $(CLEANEXEFILES) @@ -1100,22 +727,17 @@ endif ifdef CLEANRSTFILES -$(DEL) $(addprefix $(UNITTARGETDIRPREFIX),$(CLEANRSTFILES)) endif -ifdef EXTRACLEANFILES - -$(DEL) $(EXTRACLEANFILES) +ifdef CLEAN_FILES + -$(DEL) $(CLEAN_FILES) endif -ifdef LIBNAME - -$(DEL) $(LIBNAME) $(LIBFULLNAME) +ifdef LIB_NAME + -$(DEL) $(LIB_NAME) $(LIB_FULLNAME) endif - -$(DEL) $(FPCMADE) $(PPAS) link.res $(FPCEXTFILE) $(REDIRFILE) - -fpc_distclean: fpc_clean - -# Also run clean first if targetdir is set. Unittargetdir is always -# set if targetdir or unittargetdir is specified -ifdef UNITTARGETDIR + -$(DEL) $(FPCMADE) Package.fpc $(PPAS) link.res $(FPCEXTFILE) $(REDIRFILE) +fpc_distclean: clean +ifdef COMPILER_UNITTARGETDIR TARGETDIRCLEAN=fpc_clean endif - fpc_cleanall: $(CLEANTARGET) $(TARGETDIRCLEAN) ifdef CLEANEXEFILES -$(DEL) $(CLEANEXEFILES) @@ -1123,262 +745,228 @@ endif -$(DEL) *$(OEXT) *$(PPUEXT) *$(RSTEXT) *$(ASMEXT) *$(STATICLIBEXT) *$(SHAREDLIBEXT) *$(PPLEXT) -$(DELTREE) *$(SMARTEXT) -$(DEL) $(FPCMADE) $(PPAS) link.res $(FPCEXTFILE) $(REDIRFILE) - -##################################################################### -# Info rules -##################################################################### - -.PHONY: fpc_info fpc_cfginfo fpc_objectinfo fpc_toolsinfo fpc_installinfo \ - fpc_dirinfo - -fpc_info: $(INFOTARGET) - -fpc_infocfg: +ifdef AOUTEXT + -$(DEL) *$(AOUTEXT) +endif +.PHONY: fpc_info +fpc_info: + @$(ECHO) + @$(ECHO) == Package info == + @$(ECHO) Package Name..... $(PACKAGE_NAME) + @$(ECHO) Package Version.. $(PACKAGE_VERSION) @$(ECHO) @$(ECHO) == Configuration info == @$(ECHO) - @$(ECHO) FPC....... $(FPC) - @$(ECHO) Version... $(FPC_VERSION) - @$(ECHO) CPU....... $(CPU_TARGET) - @$(ECHO) Source.... $(OS_SOURCE) - @$(ECHO) Target.... $(OS_TARGET) + @$(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) - -fpc_infoobjects: + @$(ECHO) == Directory info == + @$(ECHO) + @$(ECHO) Basedir......... $(BASEDIR) + @$(ECHO) FPCDir.......... $(FPCDIR) + @$(ECHO) UnitsDir........ $(UNITSDIR) + @$(ECHO) PackagesDir..... $(PACKAGESDIR) + @$(ECHO) + @$(ECHO) GCC library..... $(GCCLIBDIR) + @$(ECHO) Other library... $(OTHERLIBDIR) + @$(ECHO) + @$(ECHO) == Tools info == + @$(ECHO) + @$(ECHO) Pwd....... $(PWD) + @$(ECHO) Mv........ $(MVPROG) + @$(ECHO) Cp........ $(CPPROG) + @$(ECHO) Rm........ $(RMPROG) + @$(ECHO) GInstall.. $(GINSTALL) + @$(ECHO) Echo...... $(ECHO) + @$(ECHO) Date...... $(DATE) + @$(ECHO) FPCMake... $(FPCMAKE) + @$(ECHO) PPUMove... $(PPUMOVE) + @$(ECHO) Upx....... $(UPXPROG) + @$(ECHO) Zip....... $(ZIPPROG) @$(ECHO) @$(ECHO) == Object info == @$(ECHO) - @$(ECHO) LoaderObjects..... $(LOADEROBJECTS) - @$(ECHO) UnitObjects....... $(UNITOBJECTS) - @$(ECHO) ExeObjects........ $(EXEOBJECTS) + @$(ECHO) Target Loaders...... $(TARGET_LOADERS) + @$(ECHO) Target Units........ $(TARGET_UNITS) + @$(ECHO) Target Programs..... $(TARGET_PROGRAMS) + @$(ECHO) Target Dirs......... $(TARGET_DIRS) + @$(ECHO) Target Examples..... $(TARGET_EXAMPLES) + @$(ECHO) Target ExampleDirs.. $(TARGET_EXAMPLEDIRS) @$(ECHO) - @$(ECHO) ExtraCleanUnits... $(EXTRACLEANUNITS) - @$(ECHO) ExtraCleanFiles... $(EXTRACLEANFILES) + @$(ECHO) Clean Units......... $(CLEAN_UNITS) + @$(ECHO) Clean Files......... $(CLEAN_FILES) @$(ECHO) - @$(ECHO) ExtraInstallUnits. $(EXTRAINSTALLUNITS) - @$(ECHO) ExtraInstallFiles. $(EXTRAINSTALLFILES) - @$(ECHO) - -fpc_infoinstall: + @$(ECHO) Install Units....... $(INSTALL_UNITS) + @$(ECHO) Install Files....... $(INSTALL_FILES) @$(ECHO) @$(ECHO) == Install info == @$(ECHO) -ifdef DATE @$(ECHO) DateStr.............. $(DATESTR) -endif -ifdef PACKAGEPREFIX - @$(ECHO) PackagePrefix........ $(PACKAGEPREFIX) -endif -ifdef PACKAGENAME - @$(ECHO) PackageName.......... $(PACKAGENAME) -endif - @$(ECHO) PackageSuffix........ $(PACKAGESUFFIX) + @$(ECHO) ZipPrefix............ $(ZIPPREFIX) + @$(ECHO) ZipSuffix............ $(ZIPSUFFIX) + @$(ECHO) Install FPC Package.. $(INSTALL_FPCPACKAGE) @$(ECHO) - @$(ECHO) BaseInstallDir....... $(BASEINSTALLDIR) - @$(ECHO) BinInstallDir........ $(BININSTALLDIR) - @$(ECHO) LibInstallDir........ $(LIBINSTALLDIR) - @$(ECHO) UnitInstallDir....... $(UNITINSTALLDIR) - @$(ECHO) SourceInstallDir..... $(SOURCEINSTALLDIR) - @$(ECHO) DocInstallDir........ $(DOCINSTALLDIR) - @$(ECHO) DataInstallDir....... $(DATAINSTALLDIR) + @$(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) DestZipDir........... $(DESTZIPDIR) - @$(ECHO) ZipName.............. $(ZIPNAME) + @$(ECHO) Dist destination dir. $(DIST_DESTDIR) + @$(ECHO) Dist zip name........ $(DIST_ZIPNAME) @$(ECHO) - -##################################################################### -# Directories -##################################################################### - -OBJECTDIRGTK=1 -OBJECTDIRQT=1 -OBJECTDIRWIN32=1 - -# Dir gtk - -ifdef OBJECTDIRGTK -.PHONY: gtk_all gtk_debug gtk_examples gtk_test gtk_smart gtk_shared gtk_showinstall gtk_install gtk_sourceinstall gtk_exampleinstall gtk_zipinstall gtk_zipsourceinstall gtk_zipexampleinstall gtk_clean gtk_distclean gtk_cleanall gtk_require gtk_info - +TARGET_DIRS_GTK=1 +TARGET_DIRS_QT=1 +TARGET_DIRS_WIN32=1 +ifdef TARGET_DIRS_GTK gtk_all: $(MAKE) -C gtk all - gtk_debug: $(MAKE) -C gtk debug - -gtk_examples: - $(MAKE) -C gtk examples - -gtk_test: - $(MAKE) -C gtk test - gtk_smart: $(MAKE) -C gtk smart - +gtk_examples: + $(MAKE) -C gtk examples gtk_shared: $(MAKE) -C gtk shared - -gtk_showinstall: - $(MAKE) -C gtk showinstall - gtk_install: $(MAKE) -C gtk install - gtk_sourceinstall: $(MAKE) -C gtk sourceinstall - gtk_exampleinstall: $(MAKE) -C gtk exampleinstall - +gtk_distinstall: + $(MAKE) -C gtk distinstall gtk_zipinstall: $(MAKE) -C gtk zipinstall - gtk_zipsourceinstall: $(MAKE) -C gtk zipsourceinstall - gtk_zipexampleinstall: $(MAKE) -C gtk zipexampleinstall - +gtk_zipdistinstall: + $(MAKE) -C gtk zipdistinstall gtk_clean: $(MAKE) -C gtk clean - gtk_distclean: $(MAKE) -C gtk distclean - gtk_cleanall: $(MAKE) -C gtk cleanall - -gtk_require: - $(MAKE) -C gtk require - gtk_info: $(MAKE) -C gtk info +gtk: + $(MAKE) -C gtk all +.PHONY: gtk_all gtk_debug gtk_smart gtk_examples gtk_shared gtk_install gtk_sourceinstall gtk_exampleinstall gtk_distinstall gtk_zipinstall gtk_zipsourceinstall gtk_zipexampleinstall gtk_zipdistinstall gtk_clean gtk_distclean gtk_cleanall gtk_info gtk endif - -# Dir qt - -ifdef OBJECTDIRQT -.PHONY: qt_all qt_debug qt_examples qt_test qt_smart qt_shared qt_showinstall qt_install qt_sourceinstall qt_exampleinstall qt_zipinstall qt_zipsourceinstall qt_zipexampleinstall qt_clean qt_distclean qt_cleanall qt_require qt_info - +ifdef TARGET_DIRS_QT qt_all: $(MAKE) -C qt all - qt_debug: $(MAKE) -C qt debug - -qt_examples: - $(MAKE) -C qt examples - -qt_test: - $(MAKE) -C qt test - qt_smart: $(MAKE) -C qt smart - +qt_examples: + $(MAKE) -C qt examples qt_shared: $(MAKE) -C qt shared - -qt_showinstall: - $(MAKE) -C qt showinstall - qt_install: $(MAKE) -C qt install - qt_sourceinstall: $(MAKE) -C qt sourceinstall - qt_exampleinstall: $(MAKE) -C qt exampleinstall - +qt_distinstall: + $(MAKE) -C qt distinstall qt_zipinstall: $(MAKE) -C qt zipinstall - qt_zipsourceinstall: $(MAKE) -C qt zipsourceinstall - qt_zipexampleinstall: $(MAKE) -C qt zipexampleinstall - +qt_zipdistinstall: + $(MAKE) -C qt zipdistinstall qt_clean: $(MAKE) -C qt clean - qt_distclean: $(MAKE) -C qt distclean - qt_cleanall: $(MAKE) -C qt cleanall - -qt_require: - $(MAKE) -C qt require - qt_info: $(MAKE) -C qt info +qt: + $(MAKE) -C qt all +.PHONY: qt_all qt_debug qt_smart qt_examples qt_shared qt_install qt_sourceinstall qt_exampleinstall qt_distinstall qt_zipinstall qt_zipsourceinstall qt_zipexampleinstall qt_zipdistinstall qt_clean qt_distclean qt_cleanall qt_info qt endif - -# Dir win32 - -ifdef OBJECTDIRWIN32 -.PHONY: win32_all win32_debug win32_examples win32_test win32_smart win32_shared win32_showinstall win32_install win32_sourceinstall win32_exampleinstall win32_zipinstall win32_zipsourceinstall win32_zipexampleinstall win32_clean win32_distclean win32_cleanall win32_require win32_info - +ifdef TARGET_DIRS_WIN32 win32_all: $(MAKE) -C win32 all - win32_debug: $(MAKE) -C win32 debug - -win32_examples: - $(MAKE) -C win32 examples - -win32_test: - $(MAKE) -C win32 test - win32_smart: $(MAKE) -C win32 smart - +win32_examples: + $(MAKE) -C win32 examples win32_shared: $(MAKE) -C win32 shared - -win32_showinstall: - $(MAKE) -C win32 showinstall - win32_install: $(MAKE) -C win32 install - win32_sourceinstall: $(MAKE) -C win32 sourceinstall - win32_exampleinstall: $(MAKE) -C win32 exampleinstall - +win32_distinstall: + $(MAKE) -C win32 distinstall win32_zipinstall: $(MAKE) -C win32 zipinstall - win32_zipsourceinstall: $(MAKE) -C win32 zipsourceinstall - win32_zipexampleinstall: $(MAKE) -C win32 zipexampleinstall - +win32_zipdistinstall: + $(MAKE) -C win32 zipdistinstall win32_clean: $(MAKE) -C win32 clean - win32_distclean: $(MAKE) -C win32 distclean - win32_cleanall: $(MAKE) -C win32 cleanall - -win32_require: - $(MAKE) -C win32 require - win32_info: $(MAKE) -C win32 info +win32: + $(MAKE) -C win32 all +.PHONY: win32_all win32_debug win32_smart win32_examples win32_shared win32_install win32_sourceinstall win32_exampleinstall win32_distinstall win32_zipinstall win32_zipsourceinstall win32_zipexampleinstall win32_zipdistinstall win32_clean win32_distclean win32_cleanall win32_info win32 endif - -##################################################################### -# Local Makefile -##################################################################### - +all: $(addsuffix _all,$(DEFAULT_DIR)) +debug: $(addsuffix _debug,$(DEFAULT_DIR)) +smart: $(addsuffix _smart,$(DEFAULT_DIR)) +examples: $(addsuffix _examples,$(DEFAULT_DIR)) +shared: $(addsuffix _shared,$(DEFAULT_DIR)) +install: $(addsuffix _install,$(DEFAULT_DIR)) +sourceinstall: $(addsuffix _sourceinstall,$(DEFAULT_DIR)) +exampleinstall: $(addsuffix _exampleinstall,$(DEFAULT_DIR)) +distinstall: fpc_distinstall +zipinstall: fpc_zipinstall $(addsuffix _zipinstall,$(DEFAULT_DIR)) +zipsourceinstall: fpc_zipsourceinstall $(addsuffix _zipsourceinstall,$(DEFAULT_DIR)) +zipexampleinstall: fpc_zipexampleinstall $(addsuffix _zipexampleinstall,$(DEFAULT_DIR)) +zipdistinstall: fpc_zipdistinstall $(addsuffix _zipdistinstall,$(DEFAULT_DIR)) +clean: $(addsuffix _clean,$(DEFAULT_DIR)) +distclean: $(addsuffix _distclean,$(DEFAULT_DIR)) +cleanall: $(addsuffix _cleanall,$(DEFAULT_DIR)) +info: fpc_info +.PHONY: all debug smart examples shared install sourceinstall exampleinstall distinstall zipinstall zipsourceinstall zipexampleinstall zipdistinstall clean distclean cleanall info ifneq ($(wildcard fpcmake.loc),) include fpcmake.loc endif - +.PHONY: makefile makefiles +makefile: Makefile.fpc + -$(FPCMAKE) -w +makefiles: makefile + $(MAKE) -C gtk makefiles + $(MAKE) -C qt makefiles + $(MAKE) -C win32 makefiles diff --git a/lcl/interfaces/Makefile.fpc b/lcl/interfaces/Makefile.fpc index 7b6a49ebca..8a7bd665c8 100644 --- a/lcl/interfaces/Makefile.fpc +++ b/lcl/interfaces/Makefile.fpc @@ -3,26 +3,31 @@ # Makefile.fpc for Lazarus for Free Pascal # -[targets] +[package] +name=lazarus-interface +version=0.7a + +[target] dirs=gtk qt win32 -[dirs] -# target dir needs to be . or a full path otherwise the -# unittargetdir will be corrupt -# not with the lazarusmake.ini -# targetdir=. +[default] +dir=$(LCLPLATFORM) -[defaults] -defaultdir=$(LCLPLATFORM) +[prerules] +DIST_DESTDIR=$(BASEDIR)/../../dist -[install] -packagename=interfaces - -[presettings] +[prerules] ifndef LCLPLATFORM LCLPLATFORM=gtk endif -[postsettings] - [rules] +.PHONY: makefile makefiles + +makefile: Makefile.fpc + -$(FPCMAKE) -w + +makefiles: makefile + $(MAKE) -C gtk makefiles + $(MAKE) -C qt makefiles + $(MAKE) -C win32 makefiles diff --git a/lcl/interfaces/gtk/Makefile b/lcl/interfaces/gtk/Makefile index 64da259038..57ceed94ed 100644 --- a/lcl/interfaces/gtk/Makefile +++ b/lcl/interfaces/gtk/Makefile @@ -1,38 +1,30 @@ # -# Makefile generated by fpcmake v1.00 [2001/01/09] +# Don't edit, this file is generated by FPCMake Version 1.1 [2001/08/08] # - -defaultrule: all - -##################################################################### -# Autodetect OS (Linux or Dos or Windows NT or OS/2) -# define inUnix when running under Unix (Linux,FreeBSD) -# define inWinNT when running under WinNT -# define inOS2 when running under OS/2 -##################################################################### - -# We need only / in the path +default: all override PATH:=$(subst \,/,$(PATH)) - -# Search for PWD and determine also if we are under linux -PWD:=$(strip $(wildcard $(addsuffix /pwd.exe,$(subst ;, ,$(PATH))))) +ifeq ($(findstring ;,$(PATH)),) +inUnix=1 +SEARCHPATH:=$(filter-out .,$(subst :, ,$(PATH))) +else +SEARCHPATH:=$(subst ;, ,$(PATH)) +endif +PWD:=$(strip $(wildcard $(addsuffix /pwd.exe,$(SEARCHPATH)))) ifeq ($(PWD),) -PWD:=$(strip $(wildcard $(addsuffix /pwd,$(subst :, ,$(PATH))))) +PWD:=$(strip $(wildcard $(addsuffix /pwd,$(SEARCHPATH)))) ifeq ($(PWD),) nopwd: @echo You need the GNU utils package to use this Makefile! @echo Get ftp://ftp.freepascal.org/pub/fpc/dist/go32v2/utilgo32.zip @exit else -inUnix=1 PWD:=$(firstword $(PWD)) +SRCEXEEXT= endif else PWD:=$(firstword $(PWD)) +SRCEXEEXT=.exe endif - -# Detect NT - NT sets OS to Windows_NT -# Detect OS/2 - OS/2 has OS2_SHELL defined ifndef inUnix ifeq ($(OS),Windows_NT) inWinNT=1 @@ -41,16 +33,11 @@ ifdef OS2_SHELL inOS2=1 endif endif -endif - -# The extension of executables -ifdef inUnix -SRCEXEEXT= else -SRCEXEEXT=.exe +ifneq ($(findstring cygwin,$(MACHTYPE)),) +inCygWin=1 +endif endif - -# The extension of batch files / scripts ifdef inUnix BATCHEXT=.sh else @@ -60,89 +47,65 @@ else BATCHEXT=.bat endif endif - -# Path Separator, the subst trick is necessary for the \ that can't exists -# at the end of a line ifdef inUnix PATHSEP=/ else -PATHSEP=$(subst /,\,/) +PATHSEP:=$(subst /,\,/) endif - -# The path which is searched separated by spaces -ifdef inUnix -SEARCHPATH=$(subst :, ,$(PATH)) -else -SEARCHPATH=$(subst ;, ,$(PATH)) -endif - -# Base dir ifdef PWD -BASEDIR:=$(shell $(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 - -##################################################################### -# FPC version/target Detection -##################################################################### - -# What compiler to use ? ifndef FPC -# Compatibility with old makefiles ifdef PP FPC=$(PP) else +ifdef inUnix +CPU_SOURCE=$(shell uname -m) +ifeq (m68k,$(CPU_SOURCE)) +FPC=ppc68k +else +FPC=ppc386 +endif +else FPC=ppc386 endif endif +endif override FPC:=$(subst $(SRCEXEEXT),,$(FPC)) override FPC:=$(subst \,/,$(FPC))$(SRCEXEEXT) - -# Target OS ifndef OS_TARGET OS_TARGET:=$(shell $(FPC) -iTO) endif - -# Source OS ifndef OS_SOURCE OS_SOURCE:=$(shell $(FPC) -iSO) endif - -# Target CPU ifndef CPU_TARGET CPU_TARGET:=$(shell $(FPC) -iTP) endif - -# Source CPU ifndef CPU_SOURCE CPU_SOURCE:=$(shell $(FPC) -iSP) endif - -# FPC version ifndef FPC_VERSION FPC_VERSION:=$(shell $(FPC) -iV) endif - export FPC OS_TARGET OS_SOURCE CPU_TARGET CPU_SOURCE FPC_VERSION - -##################################################################### -# FPCDIR Setting -##################################################################### - -# Test FPCDIR to look if the RTL dir exists ifdef FPCDIR override FPCDIR:=$(subst \,/,$(FPCDIR)) -ifeq ($(wildcard $(FPCDIR)/rtl),) -ifeq ($(wildcard $(FPCDIR)/units),) +ifeq ($(wildcard $(addprefix $(FPCDIR)/,rtl units)),) override FPCDIR=wrong endif -endif else override FPCDIR=wrong endif - -# Detect FPCDIR ifeq ($(FPCDIR),wrong) ifdef inUnix override FPCDIR=/usr/local/lib/fpc/$(FPC_VERSION) @@ -152,177 +115,129 @@ endif else override FPCDIR:=$(subst /$(FPC),,$(firstword $(strip $(wildcard $(addsuffix /$(FPC),$(SEARCHPATH)))))) override FPCDIR:=$(FPCDIR)/.. -ifeq ($(wildcard $(FPCDIR)/rtl),) -ifeq ($(wildcard $(FPCDIR)/units),) +ifeq ($(wildcard $(addprefix $(FPCDIR)/,rtl units)),) override FPCDIR:=$(FPCDIR)/.. -ifeq ($(wildcard $(FPCDIR)/rtl),) -ifeq ($(wildcard $(FPCDIR)/units),) +ifeq ($(wildcard $(addprefix $(FPCDIR)/,rtl units)),) override FPCDIR=c:/pp endif endif endif endif -endif -endif - -ifndef PACKAGESDIR -PACKAGESDIR=$(FPCDIR)/packages -endif -ifndef TOOLKITSDIR -TOOLKITSDIR= -endif -ifndef COMPONENTSDIR -COMPONENTSDIR= -endif - -# Create units dir -ifneq ($(FPCDIR),.) -UNITSDIR=$(FPCDIR)/units/$(OS_TARGET) -endif - -##################################################################### -# User Settings -##################################################################### - - -# Targets - -override UNITOBJECTS+=interfaces - -# Clean - -override EXTRACLEANUNITS+=$(notdir $(basename $(wildcard $(UNITTARGETDIR)/*$(PPUEXT)))) - -# Install - -override EXTRAINSTALLUNITS+=$(notdir $(basename $(wildcard $(UNITTARGETDIR)/*$(PPUEXT)))) -PACKAGENAME=gtkinterface -ZIPTARGET=install - -# Defaults - -override NEEDOPT=-Ca -gl - -# Directories - -override NEEDUNITDIR=$(UNITTARGETDIR) ../../units -override NEEDINCDIR=. -ifndef UNITTARGETDIR -UNITTARGETDIR=../../units/gtk -endif - -# Packages - -override PACKAGES+=rtl fcl gtk - -# Libraries - - -# Info - -INFOTARGET=fpc_infocfg fpc_infoobjects fpc_infoinstall - -##################################################################### -# Shell tools -##################################################################### - -# echo +UNITSDIR:=$(wildcard $(FPCDIR)/units/$(OS_TARGET)) +PACKAGESDIR:=$(wildcard $(FPCDIR) $(FPCDIR)/packages) +override PACKAGE_NAME=lazarus +override PACKAGE_VERSION=0.7a +DIST_DESTDIR=$(BASEDIR)/../../../dist +override TARGET_UNITS+=interfaces +override COMPILER_OPTIONS+=-gl +override COMPILER_INCLUDEDIR+=. +override COMPILER_UNITDIR+=$(COMPILER_UNITTARGETDIR) ../../units +override COMPILER_UNITTARGETDIR+=../../units/gtk ifndef ECHO -ECHO:=$(strip $(wildcard $(addsuffix /gecho$(EXEEXT),$(SEARCHPATH)))) +ECHO:=$(strip $(wildcard $(addsuffix /gecho$(SRCEXEEXT),$(SEARCHPATH)))) ifeq ($(ECHO),) ECHO:=$(strip $(wildcard $(addsuffix /echo$(SRCEXEEXT),$(SEARCHPATH)))) ifeq ($(ECHO),) -ECHO:=echo -ECHOE:=echo +ECHO= else ECHO:=$(firstword $(ECHO)) -ECHOE=$(ECHO) -E endif else ECHO:=$(firstword $(ECHO)) -ECHOE=$(ECHO) -E endif endif - -# To copy pograms +export ECHO +ifndef DATE +DATE:=$(strip $(wildcard $(addsuffix /gdate$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(DATE),) +DATE:=$(strip $(wildcard $(addsuffix /date$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(DATE),) +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= +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= +else +CPPROG:=$(firstword $(CPPROG)) +endif +endif +export CPPROG +ifndef RMPROG +RMPROG:=$(strip $(wildcard $(addsuffix /rm$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(RMPROG),) +RMPROG= +else +RMPROG:=$(firstword $(RMPROG)) +endif +endif +export RMPROG +ifndef MVPROG +MVPROG:=$(strip $(wildcard $(addsuffix /mv$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(MVPROG),) +MVPROG= +else +MVPROG:=$(firstword $(MVPROG)) +endif +endif +export MVPROG +ifndef ECHOREDIR +ECHOREDIR:=$(subst /,$(PATHSEP),$(ECHO)) +endif ifndef COPY -COPY:=cp -fp +COPY:=$(CPPROG) -fp endif - -# Copy a whole tree ifndef COPYTREE -COPYTREE:=cp -rfp +COPYTREE:=$(CPPROG) -rfp endif - -# To move pograms ifndef MOVE -MOVE:=mv -f +MOVE:=$(MVPROG) -f endif - -# Check delete program ifndef DEL -DEL:=rm -f +DEL:=$(RMPROG) -f endif - -# Check deltree program ifndef DELTREE -DELTREE:=rm -rf +DELTREE:=$(RMPROG) -rf endif - -# To install files ifndef INSTALL ifdef inUnix -INSTALL:=install -c -m 644 +INSTALL:=$(GINSTALL) -c -m 644 else INSTALL:=$(COPY) endif endif - -# To install programs ifndef INSTALLEXE ifdef inUnix -INSTALLEXE:=install -c -m 755 +INSTALLEXE:=$(GINSTALL) -c -m 755 else INSTALLEXE:=$(COPY) endif endif - -# To make a directory. ifndef MKDIR -ifdef inUnix -MKDIR:=install -m 755 -d -else -MKDIR:=ginstall -m 755 -d +MKDIR:=$(GINSTALL) -m 755 -d endif -endif - -export ECHO ECHOE COPY COPYTREE MOVE DEL DELTREE INSTALL INSTALLEXE MKDIR - -##################################################################### -# Default Tools -##################################################################### - -# assembler, redefine it if cross compiling -ifndef AS -AS=as -endif - -# linker, but probably not used -ifndef LD -LD=ld -endif - -# ppas.bat / ppas.sh -PPAS=ppas$(BATCHEXT) - -# ldconfig to rebuild .so cache -ifdef inUnix -LDCONFIG=ldconfig -else -LDCONFIG= -endif - -# ppumove +export ECHOREDIR COPY COPYTREE MOVE DEL DELTREE INSTALL INSTALLEXE MKDIR ifndef PPUMOVE PPUMOVE:=$(strip $(wildcard $(addsuffix /ppumove$(SRCEXEEXT),$(SEARCHPATH)))) ifeq ($(PPUMOVE),) @@ -332,20 +247,53 @@ PPUMOVE:=$(firstword $(PPUMOVE)) endif endif export PPUMOVE - -# ppufiles -ifndef PPUFILES -PPUFILES:=$(strip $(wildcard $(addsuffix /ppufiles$(SRCEXEEXT),$(SEARCHPATH)))) -ifeq ($(PPUFILES),) -PPUFILES= +ifndef FPCMAKE +FPCMAKE:=$(strip $(wildcard $(addsuffix /fpcmake$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(FPCMAKE),) +FPCMAKE= else -PPUFILES:=$(firstword $(PPUFILES)) +FPCMAKE:=$(firstword $(FPCMAKE)) endif endif -export PPUFILES - -# Look if UPX is found for go32v2 and win32. We can't use $UPX becuase -# upx uses that one itself (PFV) +export FPCMAKE +ifndef ZIPPROG +ZIPPROG:=$(strip $(wildcard $(addsuffix /zip$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(ZIPPROG),) +ZIPPROG= +else +ZIPPROG:=$(firstword $(ZIPPROG)) +endif +endif +export ZIPPROG +ifndef TARPROG +TARPROG:=$(strip $(wildcard $(addsuffix /tar$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(TARPROG),) +TARPROG= +else +TARPROG:=$(firstword $(TARPROG)) +endif +endif +export TARPROG +ifndef AS +AS=as +endif +ifndef LD +LD=ld +endif +ifndef RC +RC=rc +endif +PPAS=ppas$(BATCHEXT) +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 @@ -365,32 +313,8 @@ UPXPROG= endif endif export UPXPROG - -# ZipProg, you can't use Zip as the var name (PFV) -ifndef ZIPPROG -ZIPPROG:=$(strip $(wildcard $(addsuffix /zip$(SRCEXEEXT),$(SEARCHPATH)))) -ifeq ($(ZIPPROG),) -ZIPPROG= -else -ZIPPROG:=$(firstword $(ZIPPROG)) -endif -endif -export ZIPPROG - ZIPOPT=-9 ZIPEXT=.zip - -# Tar -ifndef TARPROG -TARPROG:=$(strip $(wildcard $(addsuffix /tar$(SRCEXEEXT),$(SEARCHPATH)))) -ifeq ($(TARPROG),) -TARPROG= -else -TARPROG:=$(firstword $(TARPROG)) -endif -endif -export TARPROG - ifeq ($(USETAR),bz2) TAROPT=vI TAREXT=.tar.bz2 @@ -398,12 +322,6 @@ else TAROPT=vz TAREXT=.tar.gz endif - -##################################################################### -# Default extensions -##################################################################### - -# Default needed extensions (Go32v2,Linux) LOADEREXT=.as EXEEXT=.exe PPLEXT=.ppl @@ -413,10 +331,9 @@ ASMEXT=.s SMARTEXT=.sl STATICLIBEXT=.a SHAREDLIBEXT=.so +STATICLIBPREFIX=libp RSTEXT=.rst FPCMADE=fpcmade - -# Go32v1 ifeq ($(OS_TARGET),go32v1) PPUEXT=.pp1 OEXT=.o1 @@ -424,29 +341,27 @@ ASMEXT=.s1 SMARTEXT=.sl1 STATICLIBEXT=.a1 SHAREDLIBEXT=.so1 +STATICLIBPREFIX= FPCMADE=fpcmade.v1 +PACKAGESUFFIX=v1 endif - -# Go32v2 ifeq ($(OS_TARGET),go32v2) +STATICLIBPREFIX= FPCMADE=fpcmade.dos +ZIPSUFFIX=go32 endif - -# Linux ifeq ($(OS_TARGET),linux) EXEEXT= HASSHAREDLIB=1 FPCMADE=fpcmade.lnx +ZIPSUFFIX=linux endif - -# Linux ifeq ($(OS_TARGET),freebsd) EXEEXT= HASSHAREDLIB=1 FPCMADE=fpcmade.freebsd +ZIPSUFFIX=freebsd endif - -# Win32 ifeq ($(OS_TARGET),win32) PPUEXT=.ppw OEXT=.ow @@ -455,162 +370,45 @@ SMARTEXT=.slw STATICLIBEXT=.aw SHAREDLIBEXT=.dll FPCMADE=fpcmade.w32 +ZIPSUFFIX=w32 endif - -# OS/2 ifeq ($(OS_TARGET),os2) PPUEXT=.ppo ASMEXT=.so2 OEXT=.oo2 +AOUTEXT=.out SMARTEXT=.so STATICLIBEXT=.ao2 SHAREDLIBEXT=.dll FPCMADE=fpcmade.os2 +ZIPSUFFIX=emx endif - -# library prefix -LIBPREFIX=lib -ifeq ($(OS_TARGET),go32v2) -LIBPREFIX= +ifeq ($(OS_TARGET),amiga) +EXEEXT= +PPUEXT=.ppa +ASMEXT=.asm +OEXT=.o +SMARTEXT=.sl +STATICLIBEXT=.a +SHAREDLIBEXT=.library +FPCMADE=fpcmade.amg endif -ifeq ($(OS_TARGET),go32v1) -LIBPREFIX= +ifeq ($(OS_TARGET),atari) +PPUEXT=.ppt +ASMEXT=.s +OEXT=.o +SMARTEXT=.sl +STATICLIBEXT=.a +EXEEXT=.ttp +FPCMADE=fpcmade.ata endif - -# determine which .pas extension is used -ifndef PASEXT -ifdef EXEOBJECTS -override TESTPAS:=$(strip $(wildcard $(addsuffix .pas,$(firstword $(EXEOBJECTS))))) -else -override TESTPAS:=$(strip $(wildcard $(addsuffix .pas,$(firstword $(UNITOBJECTS))))) +ifdef REQUIRE_UNITSDIR +override UNITSDIR+=$(REQUIRE_UNITSDIR) endif -ifeq ($(TESTPAS),) -PASEXT=.pp -else -PASEXT=.pas +ifdef REQUIRE_PACKAGESDIR +override PACKAGESDIR+=$(REQUIRE_PACKAGESDIR) endif -endif - - -# Check if the dirs really exists, else turn it off -ifeq ($(wildcard $(UNITSDIR)),) -UNITSDIR= -endif -ifeq ($(wildcard $(TOOLKITSDIR)),) -TOOLKITSDIR= -endif -ifeq ($(wildcard $(PACKAGESDIR)),) -PACKAGESDIR= -endif -ifeq ($(wildcard $(COMPONENTSDIR)),) -COMPONENTSDIR= -endif - - -# PACKAGESDIR packages - -PACKAGERTL=1 -PACKAGEFCL=1 -PACKAGEGTK=1 - -ifdef PACKAGERTL -ifneq ($(wildcard $(FPCDIR)/rtl),) -ifneq ($(wildcard $(FPCDIR)/rtl/$(OS_TARGET)),) -PACKAGEDIR_RTL=$(FPCDIR)/rtl/$(OS_TARGET) -else -PACKAGEDIR_RTL=$(FPCDIR)/rtl -endif -ifeq ($(wildcard $(PACKAGEDIR_RTL)/$(FPCMADE)),) -override COMPILEPACKAGES+=package_rtl -package_rtl: - $(MAKE) -C $(PACKAGEDIR_RTL) all -endif -UNITDIR_RTL=$(PACKAGEDIR_RTL) -else -PACKAGEDIR_RTL= -ifneq ($(wildcard $(UNITSDIR)/rtl),) -ifneq ($(wildcard $(UNITSDIR)/rtl/$(OS_TARGET)),) -UNITDIR_RTL=$(UNITSDIR)/rtl/$(OS_TARGET) -else -UNITDIR_RTL=$(UNITSDIR)/rtl -endif -else -UNITDIR_RTL= -endif -endif -ifdef UNITDIR_RTL -override NEEDUNITDIR+=$(UNITDIR_RTL) -endif -endif -ifdef PACKAGEFCL -ifneq ($(wildcard $(FPCDIR)/fcl),) -ifneq ($(wildcard $(FPCDIR)/fcl/$(OS_TARGET)),) -PACKAGEDIR_FCL=$(FPCDIR)/fcl/$(OS_TARGET) -else -PACKAGEDIR_FCL=$(FPCDIR)/fcl -endif -ifeq ($(wildcard $(PACKAGEDIR_FCL)/$(FPCMADE)),) -override COMPILEPACKAGES+=package_fcl -package_fcl: - $(MAKE) -C $(PACKAGEDIR_FCL) all -endif -UNITDIR_FCL=$(PACKAGEDIR_FCL) -else -PACKAGEDIR_FCL= -ifneq ($(wildcard $(UNITSDIR)/fcl),) -ifneq ($(wildcard $(UNITSDIR)/fcl/$(OS_TARGET)),) -UNITDIR_FCL=$(UNITSDIR)/fcl/$(OS_TARGET) -else -UNITDIR_FCL=$(UNITSDIR)/fcl -endif -else -UNITDIR_FCL= -endif -endif -ifdef UNITDIR_FCL -override NEEDUNITDIR+=$(UNITDIR_FCL) -endif -endif -ifdef PACKAGEGTK -ifneq ($(wildcard $(PACKAGESDIR)/gtk),) -ifneq ($(wildcard $(PACKAGESDIR)/gtk/$(OS_TARGET)),) -PACKAGEDIR_GTK=$(PACKAGESDIR)/gtk/$(OS_TARGET) -else -PACKAGEDIR_GTK=$(PACKAGESDIR)/gtk -endif -ifeq ($(wildcard $(PACKAGEDIR_GTK)/$(FPCMADE)),) -override COMPILEPACKAGES+=package_gtk -package_gtk: - $(MAKE) -C $(PACKAGEDIR_GTK) all -endif -UNITDIR_GTK=$(PACKAGEDIR_GTK) -else -PACKAGEDIR_GTK= -ifneq ($(wildcard $(UNITSDIR)/gtk),) -ifneq ($(wildcard $(UNITSDIR)/gtk/$(OS_TARGET)),) -UNITDIR_GTK=$(UNITSDIR)/gtk/$(OS_TARGET) -else -UNITDIR_GTK=$(UNITSDIR)/gtk -endif -else -UNITDIR_GTK= -endif -endif -ifdef UNITDIR_GTK -override NEEDUNITDIR+=$(UNITDIR_GTK) -endif -endif - - -##################################################################### -# Default Directories -##################################################################### - -# Linux and freebsd use unix dirs with /usr/bin, /usr/lib -# When zipping use the target as default, when normal install then -# use the source os as default -ifdef ZIPNAME -# Zipinstall +ifdef ZIPINSTALL ifeq ($(OS_TARGET),linux) UNIXINSTALLDIR=1 endif @@ -618,7 +416,6 @@ ifeq ($(OS_TARGET),freebsd) UNIXINSTALLDIR=1 endif else -# Normal install ifeq ($(OS_SOURCE),linux) UNIXINSTALLDIR=1 endif @@ -626,132 +423,429 @@ ifeq ($(OS_SOURCE),freebsd) UNIXINSTALLDIR=1 endif endif - -# set the prefix directory where to install everything -ifndef PREFIXINSTALLDIR +ifndef INSTALL_PREFIX ifdef UNIXINSTALLDIR -PREFIXINSTALLDIR=/usr +INSTALL_PREFIX=/usr/local else -PREFIXINSTALLDIR=/pp +ifdef INSTALL_FPCPACKAGE +INSTALL_BASEDIR:=/pp +else +INSTALL_BASEDIR:=/$(PACKAGE_NAME) endif endif -export PREFIXINSTALLDIR - -# Where to place the resulting zip files -ifndef DESTZIPDIR -DESTZIPDIR:=$(BASEDIR) endif -export DESTZIPDIR - -##################################################################### -# Install Directories -##################################################################### - -# set the base directory where to install everything -ifndef BASEINSTALLDIR +export INSTALL_PREFIX +ifndef DIST_DESTDIR +DIST_DESTDIR:=$(BASEDIR) +endif +export DIST_DESTDIR +ifndef INSTALL_BASEDIR ifdef UNIXINSTALLDIR -BASEINSTALLDIR=$(PREFIXINSTALLDIR)/lib/lazarus/$(FPC_VERSION) +ifdef INSTALL_FPCPACKAGE +INSTALL_BASEDIR:=$(INSTALL_PREFIX)/lib/fpc/$(FPC_VERSION) else -BASEINSTALLDIR=$(PREFIXINSTALLDIR) +INSTALL_BASEDIR:=$(INSTALL_PREFIX)/lib/$(PACKAGE_NAME) +endif +else +INSTALL_BASEDIR:=$(INSTALL_PREFIX) endif endif - -# set the directory where to install the binaries -ifndef BININSTALLDIR +ifndef INSTALL_BINDIR ifdef UNIXINSTALLDIR -BININSTALLDIR=$(PREFIXINSTALLDIR)/bin +INSTALL_BINDIR:=$(INSTALL_PREFIX)/bin else -BININSTALLDIR=$(BASEINSTALLDIR)/bin/$(OS_TARGET) +INSTALL_BINDIR:=$(INSTALL_BASEDIR)/bin +ifdef INSTALL_FPCPACKAGE +INSTALL_BINDIR:=$(INSTALL_BINDIR)/$(OS_TARGET) endif endif - -# set the directory where to install the units. -ifndef UNITINSTALLDIR -UNITINSTALLDIR=$(BASEINSTALLDIR)/units/$(OS_TARGET) -ifdef UNITSUBDIR -UNITINSTALLDIR:=$(UNITINSTALLDIR)/$(UNITSUBDIR) +endif +ifndef INSTALL_UNITDIR +INSTALL_UNITDIR:=$(INSTALL_BASEDIR)/units/$(OS_TARGET) +ifdef INSTALL_FPCPACKAGE +ifdef PACKAGE_NAME +INSTALL_UNITDIR:=$(INSTALL_UNITDIR)/$(PACKAGE_NAME) endif endif - -# Where to install shared libraries -ifndef LIBINSTALLDIR +endif +ifndef INSTALL_LIBDIR ifdef UNIXINSTALLDIR -LIBINSTALLDIR=$(PREFIXINSTALLDIR)/lib +INSTALL_LIBDIR:=$(INSTALL_PREFIX)/lib else -LIBINSTALLDIR=$(UNITINSTALLDIR) +INSTALL_LIBDIR:=$(INSTALL_UNITDIR) endif endif - -# Where the source files will be stored -ifndef SOURCEINSTALLDIR +ifndef INSTALL_SOURCEDIR ifdef UNIXINSTALLDIR -SOURCEINSTALLDIR=$(PREFIXINSTALLDIR)/src/lazarus-$(FPC_VERSION) +ifdef INSTALL_FPCPACKAGE +INSTALL_SOURCEDIR:=$(INSTALL_PREFIX)/src/fpc-$(FPC_VERSION)/$(PACKAGE_NAME) else -SOURCEINSTALLDIR=$(BASEINSTALLDIR)/source +INSTALL_SOURCEDIR:=$(INSTALL_PREFIX)/src/$(PACKAGE_NAME)-$(PACKAGE_VERSION) endif -ifdef SOURCESUBDIR -SOURCEINSTALLDIR:=$(SOURCEINSTALLDIR)/$(SOURCESUBDIR) +else +ifdef INSTALL_FPCPACKAGE +INSTALL_SOURCEDIR:=$(INSTALL_BASEDIR)/source/$(PACKAGE_NAME) +else +INSTALL_SOURCEDIRL:=$(INSTALL_BASEDIR)/source endif endif - -# Where the doc files will be stored -ifndef DOCINSTALLDIR +endif +ifndef INSTALL_DOCDIR ifdef UNIXINSTALLDIR -DOCINSTALLDIR=$(PREFIXINSTALLDIR)/doc/lazarus-$(FPC_VERSION) +ifdef INSTALL_FPCPACKAGE +INSTALL_DOCDIR:=$(INSTALL_PREFIX)/doc/fpc-$(FPC_VERSION)/$(PACKAGE_NAME) else -DOCINSTALLDIR=$(BASEINSTALLDIR)/doc +INSTALL_DOCDIR:=$(INSTALL_PREFIX)/doc/$(PACKAGE_NAME)-$(PACKAGE_VERSION) +endif +else +ifdef INSTALL_FPCPACKAGE +INSTALL_DOCDIR:=$(INSTALL_BASEDIR)/doc/$(PACKAGE_NAME) +else +INSTALL_DOCDIR:=$(INSTALL_BASEDIR)/doc endif endif - -# Where to install the examples, under linux we use the doc dir -# because the copytree command will create a subdir itself -ifndef EXAMPLEINSTALLDIR +endif +ifndef INSTALL_EXAMPLEDIR ifdef UNIXINSTALLDIR -EXAMPLEINSTALLDIR=$(DOCINSTALLDIR)/examples +ifdef INSTALL_FPCPACKAGE +INSTALL_EXAMPLEDIR:=$(INSTALL_PREFIX)/doc/fpc-$(FPC_VERSION)/examples/$(PACKAGE_NAME) else -EXAMPLEINSTALLDIR=$(BASEINSTALLDIR)/examples +INSTALL_EXAMPLEDIR:=$(INSTALL_PREFIX)/doc/$(PACKAGE_NAME)-$(PACKAGE_VERSION) endif -ifdef EXAMPLESUBDIR -EXAMPLEINSTALLDIR:=$(EXAMPLEINSTALLDIR)/$(EXAMPLESUBDIR) +else +ifdef INSTALL_FPCPACKAGE +INSTALL_EXAMPLEDIR:=$(INSTALL_BASEDIR)/examples/$(PACKAGE_NAME) +else +INSTALL_EXAMPLEDIR:=$(INSTALL_BASEDIR)/examples endif endif - -# Where the some extra (data)files will be stored -ifndef DATAINSTALLDIR -DATAINSTALLDIR=$(BASEINSTALLDIR) endif - -##################################################################### -# Redirection -##################################################################### - -ifndef REDIRFILE -REDIRFILE=log +ifndef INSTALL_DATADIR +INSTALL_DATADIR=$(INSTALL_BASEDIR) endif - -ifdef REDIR -ifndef inUnix -override FPC=redir -eo $(FPC) +ifdef inUnix +ifndef GCCLIBDIR +GCCLIBDIR:=$(shell dirname `(gcc -v 2>&1)| head -n 1| awk '{ print $$4 } '`) endif -# set the verbosity to max -override FPCOPT+=-va -override REDIR:= >> $(REDIRFILE) +ifndef OTHERLIBDIR +OTHERLIBDIR:=$(shell grep -v "^\#" /etc/ld.so.conf | awk '{ ORS=" "; print $1 }') endif - - -##################################################################### -# Compiler Command Line -##################################################################### - -# Load commandline OPTDEF and add FPC_CPU define -override FPCOPTDEF:=-d$(CPU_TARGET) - -# Load commandline OPT and add target and unit dir to be sure +export GCCLIBDIR OTHERLIB +endif +ifeq ($(OS_TARGET),linux) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_PASZLIB=1 +REQUIRE_PACKAGES_INET=1 +REQUIRE_PACKAGES_FCL=1 +REQUIRE_PACKAGES_GTK=1 +REQUIRE_PACKAGES_MYSQL=1 +REQUIRE_PACKAGES_IBASE=1 +REQUIRE_PACKAGES_X11=1 +REQUIRE_PACKAGES_OPENGL=1 +endif +ifeq ($(OS_TARGET),go32v2) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_PASZLIB=1 +REQUIRE_PACKAGES_FCL=1 +REQUIRE_PACKAGES_GTK=1 +REQUIRE_PACKAGES_OPENGL=1 +endif +ifeq ($(OS_TARGET),win32) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_PASZLIB=1 +REQUIRE_PACKAGES_FCL=1 +REQUIRE_PACKAGES_GTK=1 +REQUIRE_PACKAGES_MYSQL=1 +REQUIRE_PACKAGES_IBASE=1 +REQUIRE_PACKAGES_OPENGL=1 +endif +ifeq ($(OS_TARGET),os2) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_PASZLIB=1 +REQUIRE_PACKAGES_FCL=1 +REQUIRE_PACKAGES_GTK=1 +REQUIRE_PACKAGES_OPENGL=1 +endif +ifeq ($(OS_TARGET),freebsd) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_PASZLIB=1 +REQUIRE_PACKAGES_INET=1 +REQUIRE_PACKAGES_FCL=1 +REQUIRE_PACKAGES_GTK=1 +REQUIRE_PACKAGES_MYSQL=1 +REQUIRE_PACKAGES_IBASE=1 +REQUIRE_PACKAGES_X11=1 +REQUIRE_PACKAGES_OPENGL=1 +endif +ifeq ($(OS_TARGET),beos) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_PASZLIB=1 +REQUIRE_PACKAGES_FCL=1 +REQUIRE_PACKAGES_GTK=1 +REQUIRE_PACKAGES_OPENGL=1 +endif +ifeq ($(OS_TARGET),amiga) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_PASZLIB=1 +REQUIRE_PACKAGES_FCL=1 +REQUIRE_PACKAGES_GTK=1 +REQUIRE_PACKAGES_OPENGL=1 +endif +ifeq ($(OS_TARGET),atari) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_PASZLIB=1 +REQUIRE_PACKAGES_FCL=1 +REQUIRE_PACKAGES_GTK=1 +REQUIRE_PACKAGES_OPENGL=1 +endif +ifdef REQUIRE_PACKAGES_RTL +PACKAGEDIR_RTL:=$(subst /Makefile.fpc,,$(strip $(wildcard $(addsuffix /rtl/Makefile.fpc,$(PACKAGESDIR))))) +ifneq ($(PACKAGEDIR_RTL),) +PACKAGEDIR_RTL:=$(firstword $(PACKAGEDIR_RTL)) +ifeq ($(wildcard $(PACKAGEDIR_RTL)/$(FPCMADE)),) +override COMPILEPACKAGES+=package_rtl +package_rtl: + $(MAKE) -C $(PACKAGEDIR_RTL) all +endif +ifneq ($(wildcard $(PACKAGEDIR_RTL)/$(OS_TARGET)),) +UNITDIR_RTL=$(PACKAGEDIR_RTL)/$(OS_TARGET) +else +UNITDIR_RTL=$(PACKAGEDIR_RTL) +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_PASZLIB +PACKAGEDIR_PASZLIB:=$(subst /Makefile.fpc,,$(strip $(wildcard $(addsuffix /paszlib/Makefile.fpc,$(PACKAGESDIR))))) +ifneq ($(PACKAGEDIR_PASZLIB),) +PACKAGEDIR_PASZLIB:=$(firstword $(PACKAGEDIR_PASZLIB)) +ifeq ($(wildcard $(PACKAGEDIR_PASZLIB)/$(FPCMADE)),) +override COMPILEPACKAGES+=package_paszlib +package_paszlib: + $(MAKE) -C $(PACKAGEDIR_PASZLIB) all +endif +ifneq ($(wildcard $(PACKAGEDIR_PASZLIB)/$(OS_TARGET)),) +UNITDIR_PASZLIB=$(PACKAGEDIR_PASZLIB)/$(OS_TARGET) +else +UNITDIR_PASZLIB=$(PACKAGEDIR_PASZLIB) +endif +else +PACKAGEDIR_PASZLIB= +UNITDIR_PASZLIB:=$(subst /Package.fpc,,$(strip $(wildcard $(addsuffix /paszlib/Package.fpc,$(UNITSDIR))))) +ifneq ($(UNITDIR_PASZLIB),) +UNITDIR_PASZLIB:=$(firstword $(UNITDIR_PASZLIB)) +else +UNITDIR_PASZLIB= +endif +endif +ifdef UNITDIR_PASZLIB +override COMPILER_UNITDIR+=$(UNITDIR_PASZLIB) +endif +endif +ifdef REQUIRE_PACKAGES_INET +PACKAGEDIR_INET:=$(subst /Makefile.fpc,,$(strip $(wildcard $(addsuffix /inet/Makefile.fpc,$(PACKAGESDIR))))) +ifneq ($(PACKAGEDIR_INET),) +PACKAGEDIR_INET:=$(firstword $(PACKAGEDIR_INET)) +ifeq ($(wildcard $(PACKAGEDIR_INET)/$(FPCMADE)),) +override COMPILEPACKAGES+=package_inet +package_inet: + $(MAKE) -C $(PACKAGEDIR_INET) all +endif +ifneq ($(wildcard $(PACKAGEDIR_INET)/$(OS_TARGET)),) +UNITDIR_INET=$(PACKAGEDIR_INET)/$(OS_TARGET) +else +UNITDIR_INET=$(PACKAGEDIR_INET) +endif +else +PACKAGEDIR_INET= +UNITDIR_INET:=$(subst /Package.fpc,,$(strip $(wildcard $(addsuffix /inet/Package.fpc,$(UNITSDIR))))) +ifneq ($(UNITDIR_INET),) +UNITDIR_INET:=$(firstword $(UNITDIR_INET)) +else +UNITDIR_INET= +endif +endif +ifdef UNITDIR_INET +override COMPILER_UNITDIR+=$(UNITDIR_INET) +endif +endif +ifdef REQUIRE_PACKAGES_FCL +PACKAGEDIR_FCL:=$(subst /Makefile.fpc,,$(strip $(wildcard $(addsuffix /fcl/Makefile.fpc,$(PACKAGESDIR))))) +ifneq ($(PACKAGEDIR_FCL),) +PACKAGEDIR_FCL:=$(firstword $(PACKAGEDIR_FCL)) +ifeq ($(wildcard $(PACKAGEDIR_FCL)/$(FPCMADE)),) +override COMPILEPACKAGES+=package_fcl +package_fcl: + $(MAKE) -C $(PACKAGEDIR_FCL) all +endif +ifneq ($(wildcard $(PACKAGEDIR_FCL)/$(OS_TARGET)),) +UNITDIR_FCL=$(PACKAGEDIR_FCL)/$(OS_TARGET) +else +UNITDIR_FCL=$(PACKAGEDIR_FCL) +endif +else +PACKAGEDIR_FCL= +UNITDIR_FCL:=$(subst /Package.fpc,,$(strip $(wildcard $(addsuffix /fcl/Package.fpc,$(UNITSDIR))))) +ifneq ($(UNITDIR_FCL),) +UNITDIR_FCL:=$(firstword $(UNITDIR_FCL)) +else +UNITDIR_FCL= +endif +endif +ifdef UNITDIR_FCL +override COMPILER_UNITDIR+=$(UNITDIR_FCL) +endif +endif +ifdef REQUIRE_PACKAGES_GTK +PACKAGEDIR_GTK:=$(subst /Makefile.fpc,,$(strip $(wildcard $(addsuffix /gtk/Makefile.fpc,$(PACKAGESDIR))))) +ifneq ($(PACKAGEDIR_GTK),) +PACKAGEDIR_GTK:=$(firstword $(PACKAGEDIR_GTK)) +ifeq ($(wildcard $(PACKAGEDIR_GTK)/$(FPCMADE)),) +override COMPILEPACKAGES+=package_gtk +package_gtk: + $(MAKE) -C $(PACKAGEDIR_GTK) all +endif +ifneq ($(wildcard $(PACKAGEDIR_GTK)/$(OS_TARGET)),) +UNITDIR_GTK=$(PACKAGEDIR_GTK)/$(OS_TARGET) +else +UNITDIR_GTK=$(PACKAGEDIR_GTK) +endif +else +PACKAGEDIR_GTK= +UNITDIR_GTK:=$(subst /Package.fpc,,$(strip $(wildcard $(addsuffix /gtk/Package.fpc,$(UNITSDIR))))) +ifneq ($(UNITDIR_GTK),) +UNITDIR_GTK:=$(firstword $(UNITDIR_GTK)) +else +UNITDIR_GTK= +endif +endif +ifdef UNITDIR_GTK +override COMPILER_UNITDIR+=$(UNITDIR_GTK) +endif +endif +ifdef REQUIRE_PACKAGES_MYSQL +PACKAGEDIR_MYSQL:=$(subst /Makefile.fpc,,$(strip $(wildcard $(addsuffix /mysql/Makefile.fpc,$(PACKAGESDIR))))) +ifneq ($(PACKAGEDIR_MYSQL),) +PACKAGEDIR_MYSQL:=$(firstword $(PACKAGEDIR_MYSQL)) +ifeq ($(wildcard $(PACKAGEDIR_MYSQL)/$(FPCMADE)),) +override COMPILEPACKAGES+=package_mysql +package_mysql: + $(MAKE) -C $(PACKAGEDIR_MYSQL) all +endif +ifneq ($(wildcard $(PACKAGEDIR_MYSQL)/$(OS_TARGET)),) +UNITDIR_MYSQL=$(PACKAGEDIR_MYSQL)/$(OS_TARGET) +else +UNITDIR_MYSQL=$(PACKAGEDIR_MYSQL) +endif +else +PACKAGEDIR_MYSQL= +UNITDIR_MYSQL:=$(subst /Package.fpc,,$(strip $(wildcard $(addsuffix /mysql/Package.fpc,$(UNITSDIR))))) +ifneq ($(UNITDIR_MYSQL),) +UNITDIR_MYSQL:=$(firstword $(UNITDIR_MYSQL)) +else +UNITDIR_MYSQL= +endif +endif +ifdef UNITDIR_MYSQL +override COMPILER_UNITDIR+=$(UNITDIR_MYSQL) +endif +endif +ifdef REQUIRE_PACKAGES_IBASE +PACKAGEDIR_IBASE:=$(subst /Makefile.fpc,,$(strip $(wildcard $(addsuffix /ibase/Makefile.fpc,$(PACKAGESDIR))))) +ifneq ($(PACKAGEDIR_IBASE),) +PACKAGEDIR_IBASE:=$(firstword $(PACKAGEDIR_IBASE)) +ifeq ($(wildcard $(PACKAGEDIR_IBASE)/$(FPCMADE)),) +override COMPILEPACKAGES+=package_ibase +package_ibase: + $(MAKE) -C $(PACKAGEDIR_IBASE) all +endif +ifneq ($(wildcard $(PACKAGEDIR_IBASE)/$(OS_TARGET)),) +UNITDIR_IBASE=$(PACKAGEDIR_IBASE)/$(OS_TARGET) +else +UNITDIR_IBASE=$(PACKAGEDIR_IBASE) +endif +else +PACKAGEDIR_IBASE= +UNITDIR_IBASE:=$(subst /Package.fpc,,$(strip $(wildcard $(addsuffix /ibase/Package.fpc,$(UNITSDIR))))) +ifneq ($(UNITDIR_IBASE),) +UNITDIR_IBASE:=$(firstword $(UNITDIR_IBASE)) +else +UNITDIR_IBASE= +endif +endif +ifdef UNITDIR_IBASE +override COMPILER_UNITDIR+=$(UNITDIR_IBASE) +endif +endif +ifdef REQUIRE_PACKAGES_X11 +PACKAGEDIR_X11:=$(subst /Makefile.fpc,,$(strip $(wildcard $(addsuffix /x11/Makefile.fpc,$(PACKAGESDIR))))) +ifneq ($(PACKAGEDIR_X11),) +PACKAGEDIR_X11:=$(firstword $(PACKAGEDIR_X11)) +ifeq ($(wildcard $(PACKAGEDIR_X11)/$(FPCMADE)),) +override COMPILEPACKAGES+=package_x11 +package_x11: + $(MAKE) -C $(PACKAGEDIR_X11) all +endif +ifneq ($(wildcard $(PACKAGEDIR_X11)/$(OS_TARGET)),) +UNITDIR_X11=$(PACKAGEDIR_X11)/$(OS_TARGET) +else +UNITDIR_X11=$(PACKAGEDIR_X11) +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_OPENGL +PACKAGEDIR_OPENGL:=$(subst /Makefile.fpc,,$(strip $(wildcard $(addsuffix /opengl/Makefile.fpc,$(PACKAGESDIR))))) +ifneq ($(PACKAGEDIR_OPENGL),) +PACKAGEDIR_OPENGL:=$(firstword $(PACKAGEDIR_OPENGL)) +ifeq ($(wildcard $(PACKAGEDIR_OPENGL)/$(FPCMADE)),) +override COMPILEPACKAGES+=package_opengl +package_opengl: + $(MAKE) -C $(PACKAGEDIR_OPENGL) all +endif +ifneq ($(wildcard $(PACKAGEDIR_OPENGL)/$(OS_TARGET)),) +UNITDIR_OPENGL=$(PACKAGEDIR_OPENGL)/$(OS_TARGET) +else +UNITDIR_OPENGL=$(PACKAGEDIR_OPENGL) +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 +.PHONY: package_rtl package_paszlib package_inet package_fcl package_gtk package_mysql package_ibase package_x11 package_opengl +override FPCOPTDEF=$(CPU_TARGET) ifneq ($(OS_TARGET),$(OS_SOURCE)) override FPCOPT+=-T$(OS_TARGET) endif - -# User dirs should be first, so they are looked at first ifdef UNITDIR override FPCOPT+=$(addprefix -Fu,$(UNITDIR)) endif @@ -764,119 +858,86 @@ endif ifdef INCDIR override FPCOPT+=$(addprefix -Fi,$(INCDIR)) endif - -# Smartlinking ifdef LINKSMART override FPCOPT+=-XX endif - -# Smartlinking creation ifdef CREATESMART override FPCOPT+=-CX endif - -# Debug ifdef DEBUG -override FPCOPT+=-gl -dDEBUG +override FPCOPT+=-gl +override FPCOPTDEF+=DEBUG endif - -# Release mode (strip, optimize and don't load ppc386.cfg) -# 0.99.12b has a bug in the optimizer so don't use it by default ifdef RELEASE -ifeq ($(FPC_VERSION),0.99.12) -override FPCOPT+=-Xs -OGp3 -n -else override FPCOPT+=-Xs -OG2p3 -n +override FPCOPTDEF+=RELEASE endif -endif - -# Strip ifdef STRIP override FPCOPT+=-Xs endif - -# Optimizer ifdef OPTIMIZE override FPCOPT+=-OG2p3 endif - -# Verbose settings (warning,note,info) ifdef VERBOSE override FPCOPT+=-vwni endif - -ifdef NEEDOPT -override FPCOPT+=$(NEEDOPT) +ifdef COMPILER_OPTIONS +override FPCOPT+=$(COMPILER_OPTIONS) endif - -ifdef NEEDUNITDIR -override FPCOPT+=$(addprefix -Fu,$(NEEDUNITDIR)) +ifdef COMPILER_UNITDIR +override FPCOPT+=$(addprefix -Fu,$(COMPILER_UNITDIR)) endif - -ifdef UNITSDIR -override FPCOPT+=-Fu$(UNITSDIR) +ifdef COMPILER_LIBRARYDIR +override FPCOPT+=$(addprefix -Fl,$(COMPILER_LIBRARYDIR)) endif - -ifdef NEEDINCDIR -override FPCOPT+=$(addprefix -Fi,$(NEEDINCDIR)) +ifdef COMPILER_OBJECTDIR +override FPCOPT+=$(addprefix -Fo,$(COMPILER_OBJECTDIR)) endif - - -# Target dirs and the prefix to use for clean/install -ifdef TARGETDIR -override FPCOPT+=-FE$(TARGETDIR) -ifeq ($(TARGETDIR),.) +ifdef COMPILER_INCLUDEDIR +override FPCOPT+=$(addprefix -Fi,$(COMPILER_INCLUDEDIR)) +endif +ifdef COMPILER_TARGETDIR +override FPCOPT+=-FE$(COMPILER_TARGETDIR) +ifeq ($(COMPILER_TARGETDIR),.) override TARGETDIRPREFIX= else -override TARGETDIRPREFIX=$(TARGETDIR)/ +override TARGETDIRPREFIX=$(COMPILER_TARGETDIR)/ endif endif -ifdef UNITTARGETDIR -override FPCOPT+=-FU$(UNITTARGETDIR) -ifeq ($(UNITTARGETDIR),.) +ifdef COMPILER_UNITTARGETDIR +override FPCOPT+=-FU$(COMPILER_UNITTARGETDIR) +ifeq ($(COMPILER_UNITTARGETDIR),.) override UNITTARGETDIRPREFIX= else -override UNITTARGETDIRPREFIX=$(UNITTARGETDIR)/ +override UNITTARGETDIRPREFIX=$(COMPILER_UNITTARGETDIR)/ endif else -ifdef TARGETDIR -override UNITTARGETDIR=$(TARGETDIR) +ifdef COMPILER_TARGETDIR +override COMPILER_UNITTARGETDIR=$(COMPILER_TARGETDIR) override UNITTARGETDIRPREFIX=$(TARGETDIRPREFIX) endif endif - -# Add commandline options last so they can override +ifdef GCCLIBDIR +override FPCOPT+=-Fl$(GCCLIBDIR) +endif +ifdef OTHERLIBDIR +override FPCOPT+=$(addprefix -Fl,$(OTHERLIBDIR)) +endif ifdef OPT override FPCOPT+=$(OPT) endif - -# Add defines from FPCOPTDEF to FPCOPT ifdef FPCOPTDEF -override FPCOPT+=$(FPCOPTDEF) +override FPCOPT+=$(addprefix -d,$(FPCOPTDEF)) endif - -# Error file ? -ifdef ERRORFILE -override FPCOPT+=-Fr$(ERRORFILE) -endif - -# Was a config file specified ? ifdef CFGFILE override FPCOPT+=@$(CFGFILE) endif - -# For win32 the options are passed using the environment FPCEXTCMD -ifeq ($(OS_SOURCE),win32) +ifdef USEENV override FPCEXTCMD:=$(FPCOPT) override FPCOPT:=!FPCEXTCMD export FPCEXTCMD endif - -# Compiler commandline override COMPILER:=$(FPC) $(FPCOPT) - -# also call ppas if with command option -s -# but only if the OS_SOURCE and OS_TARGE are equal ifeq (,$(findstring -s ,$(COMPILER))) EXECPPAS= else @@ -884,309 +945,165 @@ ifeq ($(OS_SOURCE),$(OS_TARGET)) EXECPPAS:=@$(PPAS) endif endif - -##################################################################### -# Standard rules -##################################################################### - -debug: fpc_debug - -smart: fpc_smart - -shared: fpc_shared - -showinstall: fpc_showinstall - -install: fpc_install - -sourceinstall: fpc_sourceinstall - -exampleinstall: fpc_exampleinstall - -zipinstall: fpc_zipinstall - -zipsourceinstall: fpc_zipsourceinstall - -zipexampleinstall: fpc_zipexampleinstall - -clean: fpc_clean - -distclean: fpc_distclean - -cleanall: fpc_cleanall - -info: fpc_info - -.PHONY: debug smart shared showinstall install sourceinstall exampleinstall zipinstall zipsourceinstall zipexampleinstall clean distclean cleanall info - -##################################################################### -# Units -##################################################################### - .PHONY: fpc_units - +ifdef TARGET_UNITS override ALLTARGET+=fpc_units - -override UNITPPUFILES=$(addsuffix $(PPUEXT),$(UNITOBJECTS)) +override UNITPPUFILES=$(addsuffix $(PPUEXT),$(TARGET_UNITS)) override INSTALLPPUFILES+=$(UNITPPUFILES) override CLEANPPUFILES+=$(UNITPPUFILES) - +endif fpc_units: $(UNITPPUFILES) - -##################################################################### -# General compile rules -##################################################################### - -.PHONY: fpc_packages fpc_all fpc_debug - +ifdef TARGET_RSTS +override RSTFILES=$(addsuffix $(RSTEXT),$(TARGET_RSTS)) +override CLEANRSTFILES+=$(RSTFILES) +endif +.PHONY: fpc_packages fpc_all fpc_smart fpc_debug $(FPCMADE): $(ALLTARGET) - @$(ECHO) Compiled > $(FPCMADE) - + @$(ECHOREDIR) Compiled > $(FPCMADE) fpc_packages: $(COMPILEPACKAGES) - fpc_all: fpc_packages $(FPCMADE) - -fpc_debug: - $(MAKE) all DEBUG=1 - -# Search paths for .ppu if targetdir is set -ifdef UNITTARGETDIR -vpath %$(PPUEXT) $(UNITTARGETDIR) -endif - -# General compile rules, available for both possible PASEXT - -.SUFFIXES: $(EXEEXT) $(PPUEXT) $(OEXT) .pas .pp - -%$(PPUEXT): %.pp - $(COMPILER) $< $(REDIR) - $(EXECPPAS) - -%$(PPUEXT): %.pas - $(COMPILER) $< $(REDIR) - $(EXECPPAS) - -%$(EXEEXT): %.pp - $(COMPILER) $< $(REDIR) - $(EXECPPAS) - -%$(EXEEXT): %.pas - $(COMPILER) $< $(REDIR) - $(EXECPPAS) - -##################################################################### -# Library -##################################################################### - -.PHONY: fpc_smart fpc_shared - -ifdef LIBVERSION -LIBFULLNAME=$(LIBNAME).$(LIBVERSION) -else -LIBFULLNAME=$(LIBNAME) -endif - -# Default sharedlib units are all unit objects -ifndef SHAREDLIBUNITOBJECTS -SHAREDLIBUNITOBJECTS:=$(UNITOBJECTS) -endif - fpc_smart: $(MAKE) all LINKSMART=1 CREATESMART=1 - -fpc_shared: all -ifdef HASSHAREDLIB -ifndef LIBNAME - @$(ECHO) "LIBNAME not set" -else - $(PPUMOVE) $(SHAREDLIBUNITOBJECTS) -o$(LIBFULLNAME) +fpc_debug: + $(MAKE) all DEBUG=1 +.SUFFIXES: $(EXEEXT) $(PPUEXT) $(OEXT) .pas .pp +%$(PPUEXT): %.pp + $(COMPILER) $< + $(EXECPPAS) +%$(PPUEXT): %.pas + $(COMPILER) $< + $(EXECPPAS) +%$(EXEEXT): %.pp + $(COMPILER) $< + $(EXECPPAS) +%$(EXEEXT): %.pas + $(COMPILER) $< + $(EXECPPAS) +vpath %.pp $(COMPILER_SOURCEDIR) $(COMPILER_INCLUDEDIR) +vpath %.pas $(COMPILER_SOURCEDIR) $(COMPILER_INCLUDEDIR) +vpath %$(PPUEXT) $(COMPILER_UNITTARGETDIR) +.PHONY: fpc_install fpc_sourceinstall fpc_exampleinstall +ifdef INSTALL_UNITS +override INSTALLPPUFILES+=$(addsuffix $(PPUEXT),$(INSTALL_UNITS)) endif -else - @$(ECHO) "Shared Libraries not supported" -endif - -##################################################################### -# Install rules -##################################################################### - -.PHONY: fpc_showinstall fpc_install - -ifdef EXTRAINSTALLUNITS -override INSTALLPPUFILES+=$(addsuffix $(PPUEXT),$(EXTRAINSTALLUNITS)) -endif - ifdef INSTALLPPUFILES +override INSTALLPPULINKFILES:=$(subst $(PPUEXT),$(OEXT),$(INSTALLPPUFILES)) $(addprefix $(STATICLIBPREFIX),$(subst $(PPUEXT),$(STATICLIBEXT),$(INSTALLPPUFILES))) override INSTALLPPUFILES:=$(addprefix $(UNITTARGETDIRPREFIX),$(INSTALLPPUFILES)) -ifdef PPUFILES -INSTALLPPULINKFILES:=$(addprefix $(UNITTARGETDIRPREFIX),$(shell $(PPUFILES) -S -O $(INSTALLPPUFILES))) -else -INSTALLPPULINKFILES:=$(wildcard $(subst $(PPUEXT),$(OEXT),$(INSTALLPPUFILES)) $(addprefix $(LIBPREFIX),$(subst $(PPUEXT),$(STATICLIBEXT),$(INSTALLPPUFILES)))) +override INSTALLPPULINKFILES:=$(wildcard $(addprefix $(UNITTARGETDIRPREFIX),$(INSTALLPPULINKFILES))) +override INSTALL_CREATEPACKAGEFPC=1 endif -# MWE: not here UNITTARGETDIRPREFIX is already added when no PPUFILES -# override INSTALLPPULINKFILES:=$(addprefix $(UNITTARGETDIRPREFIX),$(INSTALLPPULINKFILES)) -endif - ifdef INSTALLEXEFILES override INSTALLEXEFILES:=$(addprefix $(TARGETDIRPREFIX),$(INSTALLEXEFILES)) endif - -fpc_showinstall: $(SHOWINSTALLTARGET) -ifdef INSTALLEXEFILES - @$(ECHO) -e $(addprefix "\n"$(BININSTALLDIR)/,$(INSTALLEXEFILES)) -endif -ifdef INSTALLPPUFILES - @$(ECHO) -e $(addprefix "\n"$(UNITINSTALLDIR)/,$(INSTALLPPUFILES)) -ifneq ($(INSTALLPPULINKFILES),) - @$(ECHO) -e $(addprefix "\n"$(UNITINSTALLDIR)/,$(INSTALLPPULINKFILES)) -endif -ifneq ($(wildcard $(LIBFULLNAME)),) - @$(ECHO) $(LIBINSTALLDIR)/$(LIBFULLNAME) -ifdef HASSHAREDLIB - @$(ECHO) $(LIBINSTALLDIR)/$(LIBNAME) -endif -endif -endif -ifdef EXTRAINSTALLFILES - @$(ECHO) -e $(addprefix "\n"$(DATAINSTALLDIR)/,$(EXTRAINSTALLFILES)) -endif - fpc_install: $(INSTALLTARGET) -# Create UnitInstallFiles ifdef INSTALLEXEFILES - $(MKDIR) $(BININSTALLDIR) -# Compress the exes if upx is defined + $(MKDIR) $(INSTALL_BINDIR) ifdef UPXPROG -$(UPXPROG) $(INSTALLEXEFILES) endif - $(INSTALLEXE) $(INSTALLEXEFILES) $(BININSTALLDIR) + $(INSTALLEXE) $(INSTALLEXEFILES) $(INSTALL_BINDIR) +endif +ifdef INSTALL_CREATEPACKAGEFPC +ifdef FPCMAKE +ifdef PACKAGE_VERSION +ifneq ($(wildcard Makefile.fpc),) + $(FPCMAKE) -p Makefile.fpc + $(MKDIR) $(INSTALL_UNITDIR) + $(INSTALL) Package.fpc $(INSTALL_UNITDIR) +endif +endif +endif endif ifdef INSTALLPPUFILES - $(MKDIR) $(UNITINSTALLDIR) - $(INSTALL) $(INSTALLPPUFILES) $(UNITINSTALLDIR) + $(MKDIR) $(INSTALL_UNITDIR) + $(INSTALL) $(INSTALLPPUFILES) $(INSTALL_UNITDIR) ifneq ($(INSTALLPPULINKFILES),) - $(INSTALL) $(INSTALLPPULINKFILES) $(UNITINSTALLDIR) + $(INSTALL) $(INSTALLPPULINKFILES) $(INSTALL_UNITDIR) endif -ifneq ($(wildcard $(LIBFULLNAME)),) - $(MKDIR) $(LIBINSTALLDIR) - $(INSTALL) $(LIBFULLNAME) $(LIBINSTALLDIR) +ifneq ($(wildcard $(LIB_FULLNAME)),) + $(MKDIR) $(INSTALL_LIBDIR) + $(INSTALL) $(LIB_FULLNAME) $(INSTALL_LIBDIR) ifdef inUnix - ln -sf $(LIBFULLNAME) $(LIBINSTALLDIR)/$(LIBNAME) + ln -sf $(LIB_FULLNAME) $(INSTALL_LIBDIR)/$(LIB_NAME) endif endif endif -ifdef EXTRAINSTALLFILES - $(MKDIR) $(DATAINSTALLDIR) - $(INSTALL) $(EXTRAINSTALLFILES) $(DATAINSTALLDIR) +ifdef INSTALL_FILES + $(MKDIR) $(INSTALL_DATADIR) + $(INSTALL) $(INSTALL_FILES) $(INSTALL_DATADIR) endif - -##################################################################### -# SourceInstall rules -##################################################################### - -.PHONY: fpc_sourceinstall - -ifndef SOURCETOPDIR -SOURCETOPDIR=$(BASEDIR) +fpc_sourceinstall: distclean + $(MKDIR) $(INSTALL_SOURCEDIR) + $(COPYTREE) $(BASEDIR) $(INSTALL_SOURCEDIR) +fpc_exampleinstall: $(addsuffix _distclean,$(TARGET_EXAMPLEDIRS)) +ifdef HASEXAMPLES + $(MKDIR) $(INSTALL_EXAMPLEDIR) endif - -fpc_sourceinstall: clean - $(MKDIR) $(SOURCEINSTALLDIR) - $(COPYTREE) $(SOURCETOPDIR) $(SOURCEINSTALLDIR) - -##################################################################### -# exampleinstall rules -##################################################################### - -.PHONY: fpc_exampleinstall - -fpc_exampleinstall: $(addsuffix _clean,$(EXAMPLEDIROBJECTS)) ifdef EXAMPLESOURCEFILES - $(MKDIR) $(EXAMPLEINSTALLDIR) - $(COPY) $(EXAMPLESOURCEFILES) $(EXAMPLEINSTALLDIR) + $(COPY) $(EXAMPLESOURCEFILES) $(INSTALL_EXAMPLEDIR) endif -ifdef EXAMPLEDIROBJECTS -ifndef EXAMPLESOURCEFILES - $(MKDIR) $(EXAMPLEINSTALLDIR) +ifdef TARGET_EXAMPLEDIRS + $(COPYTREE) $(addsuffix /*,$(TARGET_EXAMPLEDIRS)) $(INSTALL_EXAMPLEDIR) endif - $(COPYTREE) $(addsuffix /*,$(EXAMPLEDIROBJECTS)) $(EXAMPLEINSTALLDIR) -endif - -##################################################################### -# Zip -##################################################################### - -.PHONY: fpc_zipinstall - -# Create suffix to add -ifndef PACKAGESUFFIX -PACKAGESUFFIX=$(OS_TARGET) -ifeq ($(OS_TARGET),go32v2) -PACKAGESUFFIX=go32 -endif -ifeq ($(OS_TARGET),win32) -PACKAGESUFFIX=w32 -endif -ifeq ($(OS_TARGET),os2) -PACKAGESUFFIX=emx -endif -endif - -# Temporary path to pack a file +.PHONY: fpc_distinstall +fpc_distinstall: install exampleinstall +.PHONY: fpc_zipinstall fpc_zipsourceinstall fpc_zipexampleinstall ifndef PACKDIR ifndef inUnix -PACKDIR=$(BASEDIR)/pack_tmp +PACKDIR=$(BASEDIR)/../fpc-pack else -PACKDIR=/tmp/lazarus-pack +PACKDIR=/tmp/fpc-pack endif endif - -# Maybe create default zipname from packagename ifndef ZIPNAME -ifdef PACKAGENAME -ZIPNAME=$(PACKAGEPREFIX)$(PACKAGENAME)$(PACKAGESUFFIX) +ifdef DIST_ZIPNAME +ZIPNAME=$(DIST_ZIPNAME) +else +ZIPNAME=$(ZIPPREFIX)$(PACKAGE_NAME)$(ZIPSUFFIX) +endif +endif +ifndef ZIPTARGET +ifdef DIST_ZIPTARGET +ZIPTARGET=DIST_ZIPTARGET +else +ZIPTARGET=install endif endif - -# Use tar by default under linux ifndef USEZIP ifdef inUnix USETAR=1 endif endif - -# Use a wrapper script by default for OS/2 -ifdef inOS2 +ifndef inUnix USEZIPWRAPPER=1 endif - -# Create commands to create the zip/tar file -ZIPWRAPPER=$(DESTZIPDIR)/fpczip$(BATCHEXT) -ZIPCMD_CDPACK:=cd $(subst /,$(PATHSEP),$(PACKDIR)) -ZIPCMD_CDBASE:=cd $(subst /,$(PATHSEP),$(BASEDIR)) +ifdef USEZIPWRAPPER +ZIPPATHSEP=$(PATHSEP) +ZIPWRAPPER=$(subst /,$(PATHSEP),$(DIST_DESTDIR)/fpczip$(BATCHEXT)) +else +ZIPPATHSEP=/ +endif +ZIPCMD_CDPACK:=cd $(subst /,$(ZIPPATHSEP),$(PACKDIR)) +ZIPCMD_CDBASE:=cd $(subst /,$(ZIPPATHSEP),$(BASEDIR)) ifdef USETAR -ZIPDESTFILE:=$(DESTZIPDIR)/$(ZIPNAME)$(TAREXT) +ZIPDESTFILE:=$(DIST_DESTDIR)/$(ZIPNAME)$(TAREXT) ZIPCMD_ZIP:=$(TARPROG) cf$(TAROPT) $(ZIPDESTFILE) * else -ZIPDESTFILE:=$(DESTZIPDIR)/$(ZIPNAME)$(ZIPEXT) -ZIPCMD_ZIP:=$(subst /,$(PATHSEP),$(ZIPPROG)) -Dr $(ZIPOPT) $(ZIPDESTFILE) * +ZIPDESTFILE:=$(DIST_DESTDIR)/$(ZIPNAME)$(ZIPEXT) +ZIPCMD_ZIP:=$(subst /,$(ZIPPATHSEP),$(ZIPPROG)) -Dr $(ZIPOPT) $(ZIPDESTFILE) * endif - fpc_zipinstall: -ifndef ZIPNAME - @$(ECHO) "Please specify ZIPNAME!" - @exit 1 -else - $(MAKE) $(ZIPTARGET) PREFIXINSTALLDIR=$(PACKDIR) + $(MAKE) $(ZIPTARGET) INSTALL_PREFIX=$(PACKDIR) ZIPINSTALL=1 $(DEL) $(ZIPDESTFILE) ifdef USEZIPWRAPPER -ifneq ($(ECHO),echo) - $(ECHO) "$(ZIPCMD_CDPACK)" > $(ZIPWRAPPER) - $(ECHO) "$(ZIPCMD_ZIP)" >> $(ZIPWRAPPER) - $(ECHO) "$(ZIPCMD_CDBASE)" >> $(ZIPWRAPPER) +ifneq ($(ECHOREDIR),echo) + $(ECHOREDIR) -e "$(subst \,\\,$(ZIPCMD_CDPACK))" > $(ZIPWRAPPER) + $(ECHOREDIR) -e "$(subst \,\\,$(ZIPCMD_ZIP))" >> $(ZIPWRAPPER) + $(ECHOREDIR) -e "$(subst \,\\,$(ZIPCMD_CDBASE))" >> $(ZIPWRAPPER) else - $(ECHO) $(ZIPCMD_CDPACK) > $(ZIPWRAPPER) - $(ECHO) $(ZIPCMD_ZIP) >> $(ZIPWRAPPER) - $(ECHO) $(ZIPCMD_CDBASE) >> $(ZIPWRAPPER) + echo $(ZIPCMD_CDPACK) > $(ZIPWRAPPER) + echo $(ZIPCMD_ZIP) >> $(ZIPWRAPPER) + echo $(ZIPCMD_CDBASE) >> $(ZIPWRAPPER) endif ifdef inUnix /bin/sh $(ZIPWRAPPER) @@ -1198,44 +1115,26 @@ else $(ZIPCMD_CDPACK) ; $(ZIPCMD_ZIP) ; $(ZIPCMD_CDBASE) endif $(DELTREE) $(PACKDIR) -endif - -.PHONY: fpc_zipsourceinstall - fpc_zipsourceinstall: - $(MAKE) fpc_zipinstall ZIPTARGET=sourceinstall PACKAGESUFFIX=src - -.PHONY: fpc_zipexampleinstall - + $(MAKE) fpc_zipinstall ZIPTARGET=sourceinstall ZIPSUFFIX=src fpc_zipexampleinstall: - $(MAKE) fpc_zipinstall ZIPTARGET=exampleinstall PACKAGESUFFIX=exm - -##################################################################### -# Clean rules -##################################################################### - +ifdef HASEXAMPLES + $(MAKE) fpc_zipinstall ZIPTARGET=exampleinstall ZIPSUFFIX=exm +endif +fpc_zipdistinstall: + $(MAKE) fpc_zipinstall ZIPTARGET=distinstall .PHONY: fpc_clean fpc_cleanall fpc_distclean - ifdef EXEFILES override CLEANEXEFILES:=$(addprefix $(TARGETDIRPREFIX),$(CLEANEXEFILES)) endif - -ifdef EXTRACLEANUNITS -override CLEANPPUFILES+=$(addsuffix $(PPUEXT),$(EXTRACLEANUNITS)) +ifdef CLEAN_UNITS +override CLEANPPUFILES+=$(addsuffix $(PPUEXT),$(CLEAN_UNITS)) endif - ifdef CLEANPPUFILES +override CLEANPPULINKFILES:=$(subst $(PPUEXT),$(OEXT),$(CLEANPPUFILES)) $(addprefix $(STATICLIBPREFIX),$(subst $(PPUEXT),$(STATICLIBEXT),$(CLEANPPUFILES))) override CLEANPPUFILES:=$(addprefix $(UNITTARGETDIRPREFIX),$(CLEANPPUFILES)) -# Get the .o and .a files created for the units -ifdef PPUFILES -CLEANPPULINKFILES:=$(addprefix $(UNITTARGETDIRPREFIX),$(shell $(PPUFILES) $(CLEANPPUFILES))) -else -CLEANPPULINKFILES:=$(wildcard $(subst $(PPUEXT),$(OEXT),$(CLEANPPUFILES)) $(addprefix $(LIBPREFIX),$(subst $(PPUEXT),$(STATICLIBEXT),$(CLEANPPUFILES)))) +override CLEANPPULINKFILES:=$(wildcard $(addprefix $(UNITTARGETDIRPREFIX),$(CLEANPPULINKFILES))) endif -# MWE: not here UNITTARGETDIRPREFIX is already added when no PPUFILES -# override CLEANPPULINKFILES:=$(addprefix $(UNITTARGETDIRPREFIX),$(CLEANPPULINKFILES)) -endif - fpc_clean: $(CLEANTARGET) ifdef CLEANEXEFILES -$(DEL) $(CLEANEXEFILES) @@ -1249,22 +1148,17 @@ endif ifdef CLEANRSTFILES -$(DEL) $(addprefix $(UNITTARGETDIRPREFIX),$(CLEANRSTFILES)) endif -ifdef EXTRACLEANFILES - -$(DEL) $(EXTRACLEANFILES) +ifdef CLEAN_FILES + -$(DEL) $(CLEAN_FILES) endif -ifdef LIBNAME - -$(DEL) $(LIBNAME) $(LIBFULLNAME) +ifdef LIB_NAME + -$(DEL) $(LIB_NAME) $(LIB_FULLNAME) endif - -$(DEL) $(FPCMADE) $(PPAS) link.res $(FPCEXTFILE) $(REDIRFILE) - -fpc_distclean: fpc_clean - -# Also run clean first if targetdir is set. Unittargetdir is always -# set if targetdir or unittargetdir is specified -ifdef UNITTARGETDIR + -$(DEL) $(FPCMADE) Package.fpc $(PPAS) link.res $(FPCEXTFILE) $(REDIRFILE) +fpc_distclean: clean +ifdef COMPILER_UNITTARGETDIR TARGETDIRCLEAN=fpc_clean endif - fpc_cleanall: $(CLEANTARGET) $(TARGETDIRCLEAN) ifdef CLEANEXEFILES -$(DEL) $(CLEANEXEFILES) @@ -1272,82 +1166,106 @@ endif -$(DEL) *$(OEXT) *$(PPUEXT) *$(RSTEXT) *$(ASMEXT) *$(STATICLIBEXT) *$(SHAREDLIBEXT) *$(PPLEXT) -$(DELTREE) *$(SMARTEXT) -$(DEL) $(FPCMADE) $(PPAS) link.res $(FPCEXTFILE) $(REDIRFILE) - -##################################################################### -# Info rules -##################################################################### - -.PHONY: fpc_info fpc_cfginfo fpc_objectinfo fpc_toolsinfo fpc_installinfo \ - fpc_dirinfo - -fpc_info: $(INFOTARGET) - -fpc_infocfg: +ifdef AOUTEXT + -$(DEL) *$(AOUTEXT) +endif +.PHONY: fpc_info +fpc_info: + @$(ECHO) + @$(ECHO) == Package info == + @$(ECHO) Package Name..... $(PACKAGE_NAME) + @$(ECHO) Package Version.. $(PACKAGE_VERSION) @$(ECHO) @$(ECHO) == Configuration info == @$(ECHO) - @$(ECHO) FPC....... $(FPC) - @$(ECHO) Version... $(FPC_VERSION) - @$(ECHO) CPU....... $(CPU_TARGET) - @$(ECHO) Source.... $(OS_SOURCE) - @$(ECHO) Target.... $(OS_TARGET) + @$(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) - -fpc_infoobjects: + @$(ECHO) == Directory info == + @$(ECHO) + @$(ECHO) Basedir......... $(BASEDIR) + @$(ECHO) FPCDir.......... $(FPCDIR) + @$(ECHO) UnitsDir........ $(UNITSDIR) + @$(ECHO) PackagesDir..... $(PACKAGESDIR) + @$(ECHO) + @$(ECHO) GCC library..... $(GCCLIBDIR) + @$(ECHO) Other library... $(OTHERLIBDIR) + @$(ECHO) + @$(ECHO) == Tools info == + @$(ECHO) + @$(ECHO) Pwd....... $(PWD) + @$(ECHO) Mv........ $(MVPROG) + @$(ECHO) Cp........ $(CPPROG) + @$(ECHO) Rm........ $(RMPROG) + @$(ECHO) GInstall.. $(GINSTALL) + @$(ECHO) Echo...... $(ECHO) + @$(ECHO) Date...... $(DATE) + @$(ECHO) FPCMake... $(FPCMAKE) + @$(ECHO) PPUMove... $(PPUMOVE) + @$(ECHO) Upx....... $(UPXPROG) + @$(ECHO) Zip....... $(ZIPPROG) @$(ECHO) @$(ECHO) == Object info == @$(ECHO) - @$(ECHO) LoaderObjects..... $(LOADEROBJECTS) - @$(ECHO) UnitObjects....... $(UNITOBJECTS) - @$(ECHO) ExeObjects........ $(EXEOBJECTS) + @$(ECHO) Target Loaders...... $(TARGET_LOADERS) + @$(ECHO) Target Units........ $(TARGET_UNITS) + @$(ECHO) Target Programs..... $(TARGET_PROGRAMS) + @$(ECHO) Target Dirs......... $(TARGET_DIRS) + @$(ECHO) Target Examples..... $(TARGET_EXAMPLES) + @$(ECHO) Target ExampleDirs.. $(TARGET_EXAMPLEDIRS) @$(ECHO) - @$(ECHO) ExtraCleanUnits... $(EXTRACLEANUNITS) - @$(ECHO) ExtraCleanFiles... $(EXTRACLEANFILES) + @$(ECHO) Clean Units......... $(CLEAN_UNITS) + @$(ECHO) Clean Files......... $(CLEAN_FILES) @$(ECHO) - @$(ECHO) ExtraInstallUnits. $(EXTRAINSTALLUNITS) - @$(ECHO) ExtraInstallFiles. $(EXTRAINSTALLFILES) - @$(ECHO) - -fpc_infoinstall: + @$(ECHO) Install Units....... $(INSTALL_UNITS) + @$(ECHO) Install Files....... $(INSTALL_FILES) @$(ECHO) @$(ECHO) == Install info == @$(ECHO) -ifdef DATE @$(ECHO) DateStr.............. $(DATESTR) -endif -ifdef PACKAGEPREFIX - @$(ECHO) PackagePrefix........ $(PACKAGEPREFIX) -endif -ifdef PACKAGENAME - @$(ECHO) PackageName.......... $(PACKAGENAME) -endif - @$(ECHO) PackageSuffix........ $(PACKAGESUFFIX) + @$(ECHO) ZipPrefix............ $(ZIPPREFIX) + @$(ECHO) ZipSuffix............ $(ZIPSUFFIX) + @$(ECHO) Install FPC Package.. $(INSTALL_FPCPACKAGE) @$(ECHO) - @$(ECHO) BaseInstallDir....... $(BASEINSTALLDIR) - @$(ECHO) BinInstallDir........ $(BININSTALLDIR) - @$(ECHO) LibInstallDir........ $(LIBINSTALLDIR) - @$(ECHO) UnitInstallDir....... $(UNITINSTALLDIR) - @$(ECHO) SourceInstallDir..... $(SOURCEINSTALLDIR) - @$(ECHO) DocInstallDir........ $(DOCINSTALLDIR) - @$(ECHO) DataInstallDir....... $(DATAINSTALLDIR) + @$(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) DestZipDir........... $(DESTZIPDIR) - @$(ECHO) ZipName.............. $(ZIPNAME) + @$(ECHO) Dist destination dir. $(DIST_DESTDIR) + @$(ECHO) Dist zip name........ $(DIST_ZIPNAME) @$(ECHO) - -##################################################################### -# Local Makefile -##################################################################### - +debug: fpc_debug +smart: fpc_smart +examples: +shared: +install: fpc_install +sourceinstall: fpc_sourceinstall +exampleinstall: fpc_exampleinstall +distinstall: fpc_distinstall +zipinstall: fpc_zipinstall +zipsourceinstall: fpc_zipsourceinstall +zipexampleinstall: fpc_zipexampleinstall +zipdistinstall: fpc_zipdistinstall +clean: fpc_clean +distclean: fpc_distclean +cleanall: fpc_cleanall +info: fpc_info +.PHONY: debug smart examples shared install sourceinstall exampleinstall distinstall zipinstall zipsourceinstall zipexampleinstall zipdistinstall clean distclean cleanall info ifneq ($(wildcard fpcmake.loc),) include fpcmake.loc endif - -##################################################################### -# Users rules -##################################################################### - - - +.PHONY: all makefile makefiles all: - $(MAKE) --assume-new=interfaces$(PASEXT) interfaces$(PPUEXT) + $(MAKE) --assume-new=interfaces.pp interfaces$(PPUEXT) +makefile: Makefile.fpc + -$(FPCMAKE) -w +makefiles: makefile diff --git a/lcl/interfaces/gtk/Makefile.fpc b/lcl/interfaces/gtk/Makefile.fpc index 6e3d54d51a..d318fa8bc5 100644 --- a/lcl/interfaces/gtk/Makefile.fpc +++ b/lcl/interfaces/gtk/Makefile.fpc @@ -2,41 +2,34 @@ # # Makefile.fpc for Lazarus for Free Pascal # - -[targets] -units=interfaces + +[package] +name=lazarus +#name=lazarus-gtk +version=0.7a [require] -rtl=1 -options=-Ca -gl -packages=fcl gtk +packages=rtl fcl gtk -[clean] -units=$(notdir $(basename $(wildcard $(UNITTARGETDIR)/*$(PPUEXT)))) -# not with the lazarusmake.ini -# files=$(wildcard $(UNITTARGETDIR)/*$(OEXT)) +[target] +units=interfaces -[dirs] -# target dir needs to be . or a full path otherwise the -# unittargetdir will be corrupt -# not with the lazarusmake.ini -# targetdir=. +[compiler] +options=-gl unittargetdir=../../units/gtk -unitdir=$(UNITTARGETDIR) ../../units -incdir=. - -[install] -units=$(notdir $(basename $(wildcard $(UNITTARGETDIR)/*$(PPUEXT)))) -packagename=gtkinterface - -[libs] - -[presettings] - -[defaults] - +unitdir=$(COMPILER_UNITTARGETDIR) ../../units +includedir=. + +[prerules] +DIST_DESTDIR=$(BASEDIR)/../../../dist + [rules] - +.PHONY: all makefile makefiles all: - $(MAKE) --assume-new=interfaces$(PASEXT) interfaces$(PPUEXT) + $(MAKE) --assume-new=interfaces.pp interfaces$(PPUEXT) + +makefile: Makefile.fpc + -$(FPCMAKE) -w + +makefiles: makefile diff --git a/lcl/interfaces/win32/Makefile b/lcl/interfaces/win32/Makefile index c068cc8650..be0616a0d9 100644 --- a/lcl/interfaces/win32/Makefile +++ b/lcl/interfaces/win32/Makefile @@ -1,5 +1,5 @@ # -# Don't edit, this file is generated by FPCMake Version 1.1 [2001/08/07] +# Don't edit, this file is generated by FPCMake Version 1.1 [2001/08/08] # default: all override PATH:=$(subst \,/,$(PATH)) @@ -106,7 +106,6 @@ endif else override FPCDIR=wrong endif - ifeq ($(FPCDIR),wrong) ifdef inUnix override FPCDIR=/usr/local/lib/fpc/$(FPC_VERSION) @@ -126,13 +125,14 @@ endif endif UNITSDIR:=$(wildcard $(FPCDIR)/units/$(OS_TARGET)) PACKAGESDIR:=$(wildcard $(FPCDIR) $(FPCDIR)/packages) -override PACKAGE_NAME=win32interface -override PACKAGE_VERSION=0.7 -override FPCOPT+=-gl -Or -S2h +override PACKAGE_NAME=lazarus-win32 +override PACKAGE_VERSION=0.7a +DIST_DESTDIR=$(BASEDIR)/../../../dist override TARGET_UNITS+=interfaces -override INSTALL_FPCPACKAGE=n -override COMPILER_UNITDIR+=$(TARGETDIR) ../../units -override COMPILER_TARGETDIR+=../../units/win32 +override COMPILER_OPTIONS+=-gl -Or -S2h +override COMPILER_INCLUDEDIR+=. +override COMPILER_UNITDIR+=$(COMPILER_UNITTARGETDIR) ../../units +override COMPILER_UNITTARGETDIR+=../../units/win32 ifndef ECHO ECHO:=$(strip $(wildcard $(addsuffix /gecho$(SRCEXEEXT),$(SEARCHPATH)))) ifeq ($(ECHO),) @@ -523,29 +523,62 @@ endif ifndef INSTALL_DATADIR INSTALL_DATADIR=$(INSTALL_BASEDIR) endif +ifdef inUnix +ifndef GCCLIBDIR +GCCLIBDIR:=$(shell dirname `(gcc -v 2>&1)| head -n 1| awk '{ print $$4 } '`) +endif +ifndef OTHERLIBDIR +OTHERLIBDIR:=$(shell grep -v "^\#" /etc/ld.so.conf | awk '{ ORS=" "; print $1 }') +endif +export GCCLIBDIR OTHERLIB +endif ifeq ($(OS_TARGET),linux) REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_PASZLIB=1 +REQUIRE_PACKAGES_INET=1 +REQUIRE_PACKAGES_FCL=1 +REQUIRE_PACKAGES_MYSQL=1 +REQUIRE_PACKAGES_IBASE=1 endif ifeq ($(OS_TARGET),go32v2) REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_PASZLIB=1 +REQUIRE_PACKAGES_FCL=1 endif ifeq ($(OS_TARGET),win32) REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_PASZLIB=1 +REQUIRE_PACKAGES_FCL=1 +REQUIRE_PACKAGES_MYSQL=1 +REQUIRE_PACKAGES_IBASE=1 endif ifeq ($(OS_TARGET),os2) REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_PASZLIB=1 +REQUIRE_PACKAGES_FCL=1 endif ifeq ($(OS_TARGET),freebsd) REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_PASZLIB=1 +REQUIRE_PACKAGES_INET=1 +REQUIRE_PACKAGES_FCL=1 +REQUIRE_PACKAGES_MYSQL=1 +REQUIRE_PACKAGES_IBASE=1 endif ifeq ($(OS_TARGET),beos) REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_PASZLIB=1 +REQUIRE_PACKAGES_FCL=1 endif ifeq ($(OS_TARGET),amiga) REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_PASZLIB=1 +REQUIRE_PACKAGES_FCL=1 endif ifeq ($(OS_TARGET),atari) REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_PASZLIB=1 +REQUIRE_PACKAGES_FCL=1 endif ifdef REQUIRE_PACKAGES_RTL PACKAGEDIR_RTL:=$(subst /Makefile.fpc,,$(strip $(wildcard $(addsuffix /rtl/Makefile.fpc,$(PACKAGESDIR))))) @@ -574,7 +607,142 @@ ifdef UNITDIR_RTL override COMPILER_UNITDIR+=$(UNITDIR_RTL) endif endif -.PHONY: package_rtl +ifdef REQUIRE_PACKAGES_PASZLIB +PACKAGEDIR_PASZLIB:=$(subst /Makefile.fpc,,$(strip $(wildcard $(addsuffix /paszlib/Makefile.fpc,$(PACKAGESDIR))))) +ifneq ($(PACKAGEDIR_PASZLIB),) +PACKAGEDIR_PASZLIB:=$(firstword $(PACKAGEDIR_PASZLIB)) +ifeq ($(wildcard $(PACKAGEDIR_PASZLIB)/$(FPCMADE)),) +override COMPILEPACKAGES+=package_paszlib +package_paszlib: + $(MAKE) -C $(PACKAGEDIR_PASZLIB) all +endif +ifneq ($(wildcard $(PACKAGEDIR_PASZLIB)/$(OS_TARGET)),) +UNITDIR_PASZLIB=$(PACKAGEDIR_PASZLIB)/$(OS_TARGET) +else +UNITDIR_PASZLIB=$(PACKAGEDIR_PASZLIB) +endif +else +PACKAGEDIR_PASZLIB= +UNITDIR_PASZLIB:=$(subst /Package.fpc,,$(strip $(wildcard $(addsuffix /paszlib/Package.fpc,$(UNITSDIR))))) +ifneq ($(UNITDIR_PASZLIB),) +UNITDIR_PASZLIB:=$(firstword $(UNITDIR_PASZLIB)) +else +UNITDIR_PASZLIB= +endif +endif +ifdef UNITDIR_PASZLIB +override COMPILER_UNITDIR+=$(UNITDIR_PASZLIB) +endif +endif +ifdef REQUIRE_PACKAGES_INET +PACKAGEDIR_INET:=$(subst /Makefile.fpc,,$(strip $(wildcard $(addsuffix /inet/Makefile.fpc,$(PACKAGESDIR))))) +ifneq ($(PACKAGEDIR_INET),) +PACKAGEDIR_INET:=$(firstword $(PACKAGEDIR_INET)) +ifeq ($(wildcard $(PACKAGEDIR_INET)/$(FPCMADE)),) +override COMPILEPACKAGES+=package_inet +package_inet: + $(MAKE) -C $(PACKAGEDIR_INET) all +endif +ifneq ($(wildcard $(PACKAGEDIR_INET)/$(OS_TARGET)),) +UNITDIR_INET=$(PACKAGEDIR_INET)/$(OS_TARGET) +else +UNITDIR_INET=$(PACKAGEDIR_INET) +endif +else +PACKAGEDIR_INET= +UNITDIR_INET:=$(subst /Package.fpc,,$(strip $(wildcard $(addsuffix /inet/Package.fpc,$(UNITSDIR))))) +ifneq ($(UNITDIR_INET),) +UNITDIR_INET:=$(firstword $(UNITDIR_INET)) +else +UNITDIR_INET= +endif +endif +ifdef UNITDIR_INET +override COMPILER_UNITDIR+=$(UNITDIR_INET) +endif +endif +ifdef REQUIRE_PACKAGES_FCL +PACKAGEDIR_FCL:=$(subst /Makefile.fpc,,$(strip $(wildcard $(addsuffix /fcl/Makefile.fpc,$(PACKAGESDIR))))) +ifneq ($(PACKAGEDIR_FCL),) +PACKAGEDIR_FCL:=$(firstword $(PACKAGEDIR_FCL)) +ifeq ($(wildcard $(PACKAGEDIR_FCL)/$(FPCMADE)),) +override COMPILEPACKAGES+=package_fcl +package_fcl: + $(MAKE) -C $(PACKAGEDIR_FCL) all +endif +ifneq ($(wildcard $(PACKAGEDIR_FCL)/$(OS_TARGET)),) +UNITDIR_FCL=$(PACKAGEDIR_FCL)/$(OS_TARGET) +else +UNITDIR_FCL=$(PACKAGEDIR_FCL) +endif +else +PACKAGEDIR_FCL= +UNITDIR_FCL:=$(subst /Package.fpc,,$(strip $(wildcard $(addsuffix /fcl/Package.fpc,$(UNITSDIR))))) +ifneq ($(UNITDIR_FCL),) +UNITDIR_FCL:=$(firstword $(UNITDIR_FCL)) +else +UNITDIR_FCL= +endif +endif +ifdef UNITDIR_FCL +override COMPILER_UNITDIR+=$(UNITDIR_FCL) +endif +endif +ifdef REQUIRE_PACKAGES_MYSQL +PACKAGEDIR_MYSQL:=$(subst /Makefile.fpc,,$(strip $(wildcard $(addsuffix /mysql/Makefile.fpc,$(PACKAGESDIR))))) +ifneq ($(PACKAGEDIR_MYSQL),) +PACKAGEDIR_MYSQL:=$(firstword $(PACKAGEDIR_MYSQL)) +ifeq ($(wildcard $(PACKAGEDIR_MYSQL)/$(FPCMADE)),) +override COMPILEPACKAGES+=package_mysql +package_mysql: + $(MAKE) -C $(PACKAGEDIR_MYSQL) all +endif +ifneq ($(wildcard $(PACKAGEDIR_MYSQL)/$(OS_TARGET)),) +UNITDIR_MYSQL=$(PACKAGEDIR_MYSQL)/$(OS_TARGET) +else +UNITDIR_MYSQL=$(PACKAGEDIR_MYSQL) +endif +else +PACKAGEDIR_MYSQL= +UNITDIR_MYSQL:=$(subst /Package.fpc,,$(strip $(wildcard $(addsuffix /mysql/Package.fpc,$(UNITSDIR))))) +ifneq ($(UNITDIR_MYSQL),) +UNITDIR_MYSQL:=$(firstword $(UNITDIR_MYSQL)) +else +UNITDIR_MYSQL= +endif +endif +ifdef UNITDIR_MYSQL +override COMPILER_UNITDIR+=$(UNITDIR_MYSQL) +endif +endif +ifdef REQUIRE_PACKAGES_IBASE +PACKAGEDIR_IBASE:=$(subst /Makefile.fpc,,$(strip $(wildcard $(addsuffix /ibase/Makefile.fpc,$(PACKAGESDIR))))) +ifneq ($(PACKAGEDIR_IBASE),) +PACKAGEDIR_IBASE:=$(firstword $(PACKAGEDIR_IBASE)) +ifeq ($(wildcard $(PACKAGEDIR_IBASE)/$(FPCMADE)),) +override COMPILEPACKAGES+=package_ibase +package_ibase: + $(MAKE) -C $(PACKAGEDIR_IBASE) all +endif +ifneq ($(wildcard $(PACKAGEDIR_IBASE)/$(OS_TARGET)),) +UNITDIR_IBASE=$(PACKAGEDIR_IBASE)/$(OS_TARGET) +else +UNITDIR_IBASE=$(PACKAGEDIR_IBASE) +endif +else +PACKAGEDIR_IBASE= +UNITDIR_IBASE:=$(subst /Package.fpc,,$(strip $(wildcard $(addsuffix /ibase/Package.fpc,$(UNITSDIR))))) +ifneq ($(UNITDIR_IBASE),) +UNITDIR_IBASE:=$(firstword $(UNITDIR_IBASE)) +else +UNITDIR_IBASE= +endif +endif +ifdef UNITDIR_IBASE +override COMPILER_UNITDIR+=$(UNITDIR_IBASE) +endif +endif +.PHONY: package_rtl package_paszlib package_inet package_fcl package_mysql package_ibase override FPCOPTDEF=$(CPU_TARGET) ifneq ($(OS_TARGET),$(OS_SOURCE)) override FPCOPT+=-T$(OS_TARGET) @@ -642,7 +810,7 @@ override FPCOPT+=-FU$(COMPILER_UNITTARGETDIR) ifeq ($(COMPILER_UNITTARGETDIR),.) override UNITTARGETDIRPREFIX= else -override UNITTARGETDIRPREFIX=$(COMPILER_TARGETDIR)/ +override UNITTARGETDIRPREFIX=$(COMPILER_UNITTARGETDIR)/ endif else ifdef COMPILER_TARGETDIR @@ -650,6 +818,12 @@ override COMPILER_UNITTARGETDIR=$(COMPILER_TARGETDIR) override UNITTARGETDIRPREFIX=$(TARGETDIRPREFIX) endif endif +ifdef GCCLIBDIR +override FPCOPT+=-Fl$(GCCLIBDIR) +endif +ifdef OTHERLIBDIR +override FPCOPT+=$(addprefix -Fl,$(OTHERLIBDIR)) +endif ifdef OPT override FPCOPT+=$(OPT) endif @@ -734,7 +908,7 @@ ifdef INSTALL_CREATEPACKAGEFPC ifdef FPCMAKE ifdef PACKAGE_VERSION ifneq ($(wildcard Makefile.fpc),) - $(FPCMAKE) -p -T$(OS_TARGET) Makefile.fpc + $(FPCMAKE) -p Makefile.fpc $(MKDIR) $(INSTALL_UNITDIR) $(INSTALL) Package.fpc $(INSTALL_UNITDIR) endif @@ -990,5 +1164,9 @@ info: fpc_info ifneq ($(wildcard fpcmake.loc),) include fpcmake.loc endif -all: - $(MAKE) --assume-new=interfaces$(PASEXT) interfaces$(PPUEXT) +.PHONY: all makefile makefiles +all: + $(MAKE) --assume-new=interfaces.pp interfaces$(PPUEXT) +makefile: Makefile.fpc + -$(FPCMAKE) -w +makefiles: makefile diff --git a/lcl/interfaces/win32/Makefile.fpc b/lcl/interfaces/win32/Makefile.fpc index 7d9d238df9..1a7a521f55 100644 --- a/lcl/interfaces/win32/Makefile.fpc +++ b/lcl/interfaces/win32/Makefile.fpc @@ -4,26 +4,31 @@ # [package] -name=win32interface -version=0.7 +name=lazarus-win32 +version=0.7a + +[require] +packages=rtl fcl [target] units=interfaces -incdir=. [compiler] -targetdir=../../units/win32 -unitdir=$(TARGETDIR) ../../units - -[install] -fpcpackage=n - -[default] -fpcdir=C:\FreePascal\cvs\fpc +options=-gl -Or -S2h +unittargetdir=../../units/win32 +unitdir=$(COMPILER_UNITTARGETDIR) ../../units +includedir=. [prerules] -override FPCOPT+=-gl -Or -S2h +DIST_DESTDIR=$(BASEDIR)/../../../dist [rules] -all: - $(MAKE) --assume-new=interfaces$(PASEXT) interfaces$(PPUEXT) +.PHONY: all makefile makefiles + +all: + $(MAKE) --assume-new=interfaces.pp interfaces$(PPUEXT) + +makefile: Makefile.fpc + -$(FPCMAKE) -w + +makefiles: makefile diff --git a/tools/Makefile b/tools/Makefile index a1671fb70e..44b7474b48 100644 --- a/tools/Makefile +++ b/tools/Makefile @@ -1,38 +1,30 @@ # -# Makefile generated by fpcmake v1.00 [2001/01/09] +# Don't edit, this file is generated by FPCMake Version 1.1 [2001/08/08] # - -defaultrule: all - -##################################################################### -# Autodetect OS (Linux or Dos or Windows NT or OS/2) -# define inUnix when running under Unix (Linux,FreeBSD) -# define inWinNT when running under WinNT -# define inOS2 when running under OS/2 -##################################################################### - -# We need only / in the path +default: all override PATH:=$(subst \,/,$(PATH)) - -# Search for PWD and determine also if we are under linux -PWD:=$(strip $(wildcard $(addsuffix /pwd.exe,$(subst ;, ,$(PATH))))) +ifeq ($(findstring ;,$(PATH)),) +inUnix=1 +SEARCHPATH:=$(filter-out .,$(subst :, ,$(PATH))) +else +SEARCHPATH:=$(subst ;, ,$(PATH)) +endif +PWD:=$(strip $(wildcard $(addsuffix /pwd.exe,$(SEARCHPATH)))) ifeq ($(PWD),) -PWD:=$(strip $(wildcard $(addsuffix /pwd,$(subst :, ,$(PATH))))) +PWD:=$(strip $(wildcard $(addsuffix /pwd,$(SEARCHPATH)))) ifeq ($(PWD),) nopwd: @echo You need the GNU utils package to use this Makefile! @echo Get ftp://ftp.freepascal.org/pub/fpc/dist/go32v2/utilgo32.zip @exit else -inUnix=1 PWD:=$(firstword $(PWD)) +SRCEXEEXT= endif else PWD:=$(firstword $(PWD)) +SRCEXEEXT=.exe endif - -# Detect NT - NT sets OS to Windows_NT -# Detect OS/2 - OS/2 has OS2_SHELL defined ifndef inUnix ifeq ($(OS),Windows_NT) inWinNT=1 @@ -41,16 +33,11 @@ ifdef OS2_SHELL inOS2=1 endif endif -endif - -# The extension of executables -ifdef inUnix -SRCEXEEXT= else -SRCEXEEXT=.exe +ifneq ($(findstring cygwin,$(MACHTYPE)),) +inCygWin=1 +endif endif - -# The extension of batch files / scripts ifdef inUnix BATCHEXT=.sh else @@ -60,97 +47,65 @@ else BATCHEXT=.bat endif endif - -# Path Separator, the subst trick is necessary for the \ that can't exists -# at the end of a line ifdef inUnix PATHSEP=/ else -PATHSEP=$(subst /,\,/) +PATHSEP:=$(subst /,\,/) endif - -# The path which is searched separated by spaces -ifdef inUnix -SEARCHPATH=$(subst :, ,$(PATH)) -else -SEARCHPATH=$(subst ;, ,$(PATH)) -endif - -# Base dir ifdef PWD -BASEDIR:=$(shell $(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 - -##################################################################### -# FPC version/target Detection -##################################################################### - -# What compiler to use ? ifndef FPC -# Compatibility with old makefiles ifdef PP FPC=$(PP) else +ifdef inUnix +CPU_SOURCE=$(shell uname -m) +ifeq (m68k,$(CPU_SOURCE)) +FPC=ppc68k +else +FPC=ppc386 +endif +else FPC=ppc386 endif endif +endif override FPC:=$(subst $(SRCEXEEXT),,$(FPC)) override FPC:=$(subst \,/,$(FPC))$(SRCEXEEXT) - -# Target OS ifndef OS_TARGET OS_TARGET:=$(shell $(FPC) -iTO) endif - -# Source OS ifndef OS_SOURCE OS_SOURCE:=$(shell $(FPC) -iSO) endif - -# Target CPU ifndef CPU_TARGET CPU_TARGET:=$(shell $(FPC) -iTP) endif - -# Source CPU ifndef CPU_SOURCE CPU_SOURCE:=$(shell $(FPC) -iSP) endif - -# FPC version ifndef FPC_VERSION FPC_VERSION:=$(shell $(FPC) -iV) endif - export FPC OS_TARGET OS_SOURCE CPU_TARGET CPU_SOURCE FPC_VERSION - -##################################################################### -# Pre Settings -##################################################################### - -ifndef LCLPLATFORM -LCLPLATFORM=gtk -export LCLPLATFORM -endif -##################################################################### -# FPCDIR Setting -##################################################################### - -# Test FPCDIR to look if the RTL dir exists ifdef FPCDIR override FPCDIR:=$(subst \,/,$(FPCDIR)) -ifeq ($(wildcard $(FPCDIR)/rtl),) -ifeq ($(wildcard $(FPCDIR)/units),) +ifeq ($(wildcard $(addprefix $(FPCDIR)/,rtl units)),) override FPCDIR=wrong endif -endif else override FPCDIR=wrong endif - -# Detect FPCDIR ifeq ($(FPCDIR),wrong) ifdef inUnix override FPCDIR=/usr/local/lib/fpc/$(FPC_VERSION) @@ -160,153 +115,124 @@ endif else override FPCDIR:=$(subst /$(FPC),,$(firstword $(strip $(wildcard $(addsuffix /$(FPC),$(SEARCHPATH)))))) override FPCDIR:=$(FPCDIR)/.. -ifeq ($(wildcard $(FPCDIR)/rtl),) -ifeq ($(wildcard $(FPCDIR)/units),) +ifeq ($(wildcard $(addprefix $(FPCDIR)/,rtl units)),) override FPCDIR:=$(FPCDIR)/.. -ifeq ($(wildcard $(FPCDIR)/rtl),) -ifeq ($(wildcard $(FPCDIR)/units),) +ifeq ($(wildcard $(addprefix $(FPCDIR)/,rtl units)),) override FPCDIR=c:/pp endif endif endif endif -endif -endif - -##################################################################### -# User Settings -##################################################################### - - -# Targets - -override DIROBJECTS+=$(wildcard apiwizz) - -# Clean - - -# Install - -PACKAGENAME=tools -ZIPTARGET=install - -# Defaults - - -# Directories - - -# Packages - - -# Libraries - - -# Info - -INFOTARGET=fpc_infocfg fpc_infoobjects fpc_infoinstall - -##################################################################### -# Shell tools -##################################################################### - -# echo +UNITSDIR:=$(wildcard $(FPCDIR)/units/$(OS_TARGET)) +PACKAGESDIR:=$(wildcard $(FPCDIR) $(FPCDIR)/packages) +override PACKAGE_NAME=lazarus-tools +override PACKAGE_VERSION=0.7a +override TARGET_DIRS+=apiwizz ifndef ECHO -ECHO:=$(strip $(wildcard $(addsuffix /gecho$(EXEEXT),$(SEARCHPATH)))) +ECHO:=$(strip $(wildcard $(addsuffix /gecho$(SRCEXEEXT),$(SEARCHPATH)))) ifeq ($(ECHO),) ECHO:=$(strip $(wildcard $(addsuffix /echo$(SRCEXEEXT),$(SEARCHPATH)))) ifeq ($(ECHO),) -ECHO:=echo -ECHOE:=echo +ECHO= else ECHO:=$(firstword $(ECHO)) -ECHOE=$(ECHO) -E endif else ECHO:=$(firstword $(ECHO)) -ECHOE=$(ECHO) -E endif endif - -# To copy pograms +export ECHO +ifndef DATE +DATE:=$(strip $(wildcard $(addsuffix /gdate$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(DATE),) +DATE:=$(strip $(wildcard $(addsuffix /date$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(DATE),) +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= +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= +else +CPPROG:=$(firstword $(CPPROG)) +endif +endif +export CPPROG +ifndef RMPROG +RMPROG:=$(strip $(wildcard $(addsuffix /rm$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(RMPROG),) +RMPROG= +else +RMPROG:=$(firstword $(RMPROG)) +endif +endif +export RMPROG +ifndef MVPROG +MVPROG:=$(strip $(wildcard $(addsuffix /mv$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(MVPROG),) +MVPROG= +else +MVPROG:=$(firstword $(MVPROG)) +endif +endif +export MVPROG +ifndef ECHOREDIR +ECHOREDIR:=$(subst /,$(PATHSEP),$(ECHO)) +endif ifndef COPY -COPY:=cp -fp +COPY:=$(CPPROG) -fp endif - -# Copy a whole tree ifndef COPYTREE -COPYTREE:=cp -rfp +COPYTREE:=$(CPPROG) -rfp endif - -# To move pograms ifndef MOVE -MOVE:=mv -f +MOVE:=$(MVPROG) -f endif - -# Check delete program ifndef DEL -DEL:=rm -f +DEL:=$(RMPROG) -f endif - -# Check deltree program ifndef DELTREE -DELTREE:=rm -rf +DELTREE:=$(RMPROG) -rf endif - -# To install files ifndef INSTALL ifdef inUnix -INSTALL:=install -c -m 644 +INSTALL:=$(GINSTALL) -c -m 644 else INSTALL:=$(COPY) endif endif - -# To install programs ifndef INSTALLEXE ifdef inUnix -INSTALLEXE:=install -c -m 755 +INSTALLEXE:=$(GINSTALL) -c -m 755 else INSTALLEXE:=$(COPY) endif endif - -# To make a directory. ifndef MKDIR -ifdef inUnix -MKDIR:=install -m 755 -d -else -MKDIR:=ginstall -m 755 -d +MKDIR:=$(GINSTALL) -m 755 -d endif -endif - -export ECHO ECHOE COPY COPYTREE MOVE DEL DELTREE INSTALL INSTALLEXE MKDIR - -##################################################################### -# Default Tools -##################################################################### - -# assembler, redefine it if cross compiling -ifndef AS -AS=as -endif - -# linker, but probably not used -ifndef LD -LD=ld -endif - -# ppas.bat / ppas.sh -PPAS=ppas$(BATCHEXT) - -# ldconfig to rebuild .so cache -ifdef inUnix -LDCONFIG=ldconfig -else -LDCONFIG= -endif - -# ppumove +export ECHOREDIR COPY COPYTREE MOVE DEL DELTREE INSTALL INSTALLEXE MKDIR ifndef PPUMOVE PPUMOVE:=$(strip $(wildcard $(addsuffix /ppumove$(SRCEXEEXT),$(SEARCHPATH)))) ifeq ($(PPUMOVE),) @@ -316,20 +242,53 @@ PPUMOVE:=$(firstword $(PPUMOVE)) endif endif export PPUMOVE - -# ppufiles -ifndef PPUFILES -PPUFILES:=$(strip $(wildcard $(addsuffix /ppufiles$(SRCEXEEXT),$(SEARCHPATH)))) -ifeq ($(PPUFILES),) -PPUFILES= +ifndef FPCMAKE +FPCMAKE:=$(strip $(wildcard $(addsuffix /fpcmake$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(FPCMAKE),) +FPCMAKE= else -PPUFILES:=$(firstword $(PPUFILES)) +FPCMAKE:=$(firstword $(FPCMAKE)) endif endif -export PPUFILES - -# Look if UPX is found for go32v2 and win32. We can't use $UPX becuase -# upx uses that one itself (PFV) +export FPCMAKE +ifndef ZIPPROG +ZIPPROG:=$(strip $(wildcard $(addsuffix /zip$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(ZIPPROG),) +ZIPPROG= +else +ZIPPROG:=$(firstword $(ZIPPROG)) +endif +endif +export ZIPPROG +ifndef TARPROG +TARPROG:=$(strip $(wildcard $(addsuffix /tar$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(TARPROG),) +TARPROG= +else +TARPROG:=$(firstword $(TARPROG)) +endif +endif +export TARPROG +ifndef AS +AS=as +endif +ifndef LD +LD=ld +endif +ifndef RC +RC=rc +endif +PPAS=ppas$(BATCHEXT) +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 @@ -349,32 +308,8 @@ UPXPROG= endif endif export UPXPROG - -# ZipProg, you can't use Zip as the var name (PFV) -ifndef ZIPPROG -ZIPPROG:=$(strip $(wildcard $(addsuffix /zip$(SRCEXEEXT),$(SEARCHPATH)))) -ifeq ($(ZIPPROG),) -ZIPPROG= -else -ZIPPROG:=$(firstword $(ZIPPROG)) -endif -endif -export ZIPPROG - ZIPOPT=-9 ZIPEXT=.zip - -# Tar -ifndef TARPROG -TARPROG:=$(strip $(wildcard $(addsuffix /tar$(SRCEXEEXT),$(SEARCHPATH)))) -ifeq ($(TARPROG),) -TARPROG= -else -TARPROG:=$(firstword $(TARPROG)) -endif -endif -export TARPROG - ifeq ($(USETAR),bz2) TAROPT=vI TAREXT=.tar.bz2 @@ -382,12 +317,6 @@ else TAROPT=vz TAREXT=.tar.gz endif - -##################################################################### -# Default extensions -##################################################################### - -# Default needed extensions (Go32v2,Linux) LOADEREXT=.as EXEEXT=.exe PPLEXT=.ppl @@ -397,10 +326,9 @@ ASMEXT=.s SMARTEXT=.sl STATICLIBEXT=.a SHAREDLIBEXT=.so +STATICLIBPREFIX=libp RSTEXT=.rst FPCMADE=fpcmade - -# Go32v1 ifeq ($(OS_TARGET),go32v1) PPUEXT=.pp1 OEXT=.o1 @@ -408,29 +336,27 @@ ASMEXT=.s1 SMARTEXT=.sl1 STATICLIBEXT=.a1 SHAREDLIBEXT=.so1 +STATICLIBPREFIX= FPCMADE=fpcmade.v1 +PACKAGESUFFIX=v1 endif - -# Go32v2 ifeq ($(OS_TARGET),go32v2) +STATICLIBPREFIX= FPCMADE=fpcmade.dos +ZIPSUFFIX=go32 endif - -# Linux ifeq ($(OS_TARGET),linux) EXEEXT= HASSHAREDLIB=1 FPCMADE=fpcmade.lnx +ZIPSUFFIX=linux endif - -# Linux ifeq ($(OS_TARGET),freebsd) EXEEXT= HASSHAREDLIB=1 FPCMADE=fpcmade.freebsd +ZIPSUFFIX=freebsd endif - -# Win32 ifeq ($(OS_TARGET),win32) PPUEXT=.ppw OEXT=.ow @@ -439,53 +365,45 @@ SMARTEXT=.slw STATICLIBEXT=.aw SHAREDLIBEXT=.dll FPCMADE=fpcmade.w32 +ZIPSUFFIX=w32 endif - -# OS/2 ifeq ($(OS_TARGET),os2) PPUEXT=.ppo ASMEXT=.so2 OEXT=.oo2 +AOUTEXT=.out SMARTEXT=.so STATICLIBEXT=.ao2 SHAREDLIBEXT=.dll FPCMADE=fpcmade.os2 +ZIPSUFFIX=emx endif - -# library prefix -LIBPREFIX=lib -ifeq ($(OS_TARGET),go32v2) -LIBPREFIX= +ifeq ($(OS_TARGET),amiga) +EXEEXT= +PPUEXT=.ppa +ASMEXT=.asm +OEXT=.o +SMARTEXT=.sl +STATICLIBEXT=.a +SHAREDLIBEXT=.library +FPCMADE=fpcmade.amg endif -ifeq ($(OS_TARGET),go32v1) -LIBPREFIX= +ifeq ($(OS_TARGET),atari) +PPUEXT=.ppt +ASMEXT=.s +OEXT=.o +SMARTEXT=.sl +STATICLIBEXT=.a +EXEEXT=.ttp +FPCMADE=fpcmade.ata endif - -# determine which .pas extension is used -ifndef PASEXT -ifdef EXEOBJECTS -override TESTPAS:=$(strip $(wildcard $(addsuffix .pas,$(firstword $(EXEOBJECTS))))) -else -override TESTPAS:=$(strip $(wildcard $(addsuffix .pas,$(firstword $(UNITOBJECTS))))) +ifdef REQUIRE_UNITSDIR +override UNITSDIR+=$(REQUIRE_UNITSDIR) endif -ifeq ($(TESTPAS),) -PASEXT=.pp -else -PASEXT=.pas +ifdef REQUIRE_PACKAGESDIR +override PACKAGESDIR+=$(REQUIRE_PACKAGESDIR) endif -endif - - - -##################################################################### -# Default Directories -##################################################################### - -# Linux and freebsd use unix dirs with /usr/bin, /usr/lib -# When zipping use the target as default, when normal install then -# use the source os as default -ifdef ZIPNAME -# Zipinstall +ifdef ZIPINSTALL ifeq ($(OS_TARGET),linux) UNIXINSTALLDIR=1 endif @@ -493,7 +411,6 @@ ifeq ($(OS_TARGET),freebsd) UNIXINSTALLDIR=1 endif else -# Normal install ifeq ($(OS_SOURCE),linux) UNIXINSTALLDIR=1 endif @@ -501,132 +418,110 @@ ifeq ($(OS_SOURCE),freebsd) UNIXINSTALLDIR=1 endif endif - -# set the prefix directory where to install everything -ifndef PREFIXINSTALLDIR +ifndef INSTALL_PREFIX ifdef UNIXINSTALLDIR -PREFIXINSTALLDIR=/usr +INSTALL_PREFIX=/usr/local else -PREFIXINSTALLDIR=/pp +ifdef INSTALL_FPCPACKAGE +INSTALL_BASEDIR:=/pp +else +INSTALL_BASEDIR:=/$(PACKAGE_NAME) endif endif -export PREFIXINSTALLDIR - -# Where to place the resulting zip files -ifndef DESTZIPDIR -DESTZIPDIR:=$(BASEDIR) endif -export DESTZIPDIR - -##################################################################### -# Install Directories -##################################################################### - -# set the base directory where to install everything -ifndef BASEINSTALLDIR +export INSTALL_PREFIX +ifndef DIST_DESTDIR +DIST_DESTDIR:=$(BASEDIR) +endif +export DIST_DESTDIR +ifndef INSTALL_BASEDIR ifdef UNIXINSTALLDIR -BASEINSTALLDIR=$(PREFIXINSTALLDIR)/lib/lazarus/$(FPC_VERSION) +ifdef INSTALL_FPCPACKAGE +INSTALL_BASEDIR:=$(INSTALL_PREFIX)/lib/fpc/$(FPC_VERSION) else -BASEINSTALLDIR=$(PREFIXINSTALLDIR) +INSTALL_BASEDIR:=$(INSTALL_PREFIX)/lib/$(PACKAGE_NAME) +endif +else +INSTALL_BASEDIR:=$(INSTALL_PREFIX) endif endif - -# set the directory where to install the binaries -ifndef BININSTALLDIR +ifndef INSTALL_BINDIR ifdef UNIXINSTALLDIR -BININSTALLDIR=$(PREFIXINSTALLDIR)/bin +INSTALL_BINDIR:=$(INSTALL_PREFIX)/bin else -BININSTALLDIR=$(BASEINSTALLDIR)/bin/$(OS_TARGET) +INSTALL_BINDIR:=$(INSTALL_BASEDIR)/bin +ifdef INSTALL_FPCPACKAGE +INSTALL_BINDIR:=$(INSTALL_BINDIR)/$(OS_TARGET) endif endif - -# set the directory where to install the units. -ifndef UNITINSTALLDIR -UNITINSTALLDIR=$(BASEINSTALLDIR)/units/$(OS_TARGET) -ifdef UNITSUBDIR -UNITINSTALLDIR:=$(UNITINSTALLDIR)/$(UNITSUBDIR) +endif +ifndef INSTALL_UNITDIR +INSTALL_UNITDIR:=$(INSTALL_BASEDIR)/units/$(OS_TARGET) +ifdef INSTALL_FPCPACKAGE +ifdef PACKAGE_NAME +INSTALL_UNITDIR:=$(INSTALL_UNITDIR)/$(PACKAGE_NAME) endif endif - -# Where to install shared libraries -ifndef LIBINSTALLDIR +endif +ifndef INSTALL_LIBDIR ifdef UNIXINSTALLDIR -LIBINSTALLDIR=$(PREFIXINSTALLDIR)/lib +INSTALL_LIBDIR:=$(INSTALL_PREFIX)/lib else -LIBINSTALLDIR=$(UNITINSTALLDIR) +INSTALL_LIBDIR:=$(INSTALL_UNITDIR) endif endif - -# Where the source files will be stored -ifndef SOURCEINSTALLDIR +ifndef INSTALL_SOURCEDIR ifdef UNIXINSTALLDIR -SOURCEINSTALLDIR=$(PREFIXINSTALLDIR)/src/lazarus-$(FPC_VERSION) +ifdef INSTALL_FPCPACKAGE +INSTALL_SOURCEDIR:=$(INSTALL_PREFIX)/src/fpc-$(FPC_VERSION)/$(PACKAGE_NAME) else -SOURCEINSTALLDIR=$(BASEINSTALLDIR)/source +INSTALL_SOURCEDIR:=$(INSTALL_PREFIX)/src/$(PACKAGE_NAME)-$(PACKAGE_VERSION) endif -ifdef SOURCESUBDIR -SOURCEINSTALLDIR:=$(SOURCEINSTALLDIR)/$(SOURCESUBDIR) +else +ifdef INSTALL_FPCPACKAGE +INSTALL_SOURCEDIR:=$(INSTALL_BASEDIR)/source/$(PACKAGE_NAME) +else +INSTALL_SOURCEDIRL:=$(INSTALL_BASEDIR)/source endif endif - -# Where the doc files will be stored -ifndef DOCINSTALLDIR +endif +ifndef INSTALL_DOCDIR ifdef UNIXINSTALLDIR -DOCINSTALLDIR=$(PREFIXINSTALLDIR)/doc/lazarus-$(FPC_VERSION) +ifdef INSTALL_FPCPACKAGE +INSTALL_DOCDIR:=$(INSTALL_PREFIX)/doc/fpc-$(FPC_VERSION)/$(PACKAGE_NAME) else -DOCINSTALLDIR=$(BASEINSTALLDIR)/doc +INSTALL_DOCDIR:=$(INSTALL_PREFIX)/doc/$(PACKAGE_NAME)-$(PACKAGE_VERSION) +endif +else +ifdef INSTALL_FPCPACKAGE +INSTALL_DOCDIR:=$(INSTALL_BASEDIR)/doc/$(PACKAGE_NAME) +else +INSTALL_DOCDIR:=$(INSTALL_BASEDIR)/doc endif endif - -# Where to install the examples, under linux we use the doc dir -# because the copytree command will create a subdir itself -ifndef EXAMPLEINSTALLDIR +endif +ifndef INSTALL_EXAMPLEDIR ifdef UNIXINSTALLDIR -EXAMPLEINSTALLDIR=$(DOCINSTALLDIR)/examples +ifdef INSTALL_FPCPACKAGE +INSTALL_EXAMPLEDIR:=$(INSTALL_PREFIX)/doc/fpc-$(FPC_VERSION)/examples/$(PACKAGE_NAME) else -EXAMPLEINSTALLDIR=$(BASEINSTALLDIR)/examples +INSTALL_EXAMPLEDIR:=$(INSTALL_PREFIX)/doc/$(PACKAGE_NAME)-$(PACKAGE_VERSION) endif -ifdef EXAMPLESUBDIR -EXAMPLEINSTALLDIR:=$(EXAMPLEINSTALLDIR)/$(EXAMPLESUBDIR) +else +ifdef INSTALL_FPCPACKAGE +INSTALL_EXAMPLEDIR:=$(INSTALL_BASEDIR)/examples/$(PACKAGE_NAME) +else +INSTALL_EXAMPLEDIR:=$(INSTALL_BASEDIR)/examples endif endif - -# Where the some extra (data)files will be stored -ifndef DATAINSTALLDIR -DATAINSTALLDIR=$(BASEINSTALLDIR) endif - -##################################################################### -# Redirection -##################################################################### - -ifndef REDIRFILE -REDIRFILE=log +ifndef INSTALL_DATADIR +INSTALL_DATADIR=$(INSTALL_BASEDIR) endif - -ifdef REDIR -ifndef inUnix -override FPC=redir -eo $(FPC) -endif -# set the verbosity to max -override FPCOPT+=-va -override REDIR:= >> $(REDIRFILE) -endif - - -##################################################################### -# Compiler Command Line -##################################################################### - -# Load commandline OPTDEF and add FPC_CPU define -override FPCOPTDEF:=-d$(CPU_TARGET) - -# Load commandline OPT and add target and unit dir to be sure +override FPCOPTDEF=$(CPU_TARGET) ifneq ($(OS_TARGET),$(OS_SOURCE)) override FPCOPT+=-T$(OS_TARGET) endif - -# User dirs should be first, so they are looked at first ifdef UNITDIR override FPCOPT+=$(addprefix -Fu,$(UNITDIR)) endif @@ -639,106 +534,80 @@ endif ifdef INCDIR override FPCOPT+=$(addprefix -Fi,$(INCDIR)) endif - -# Smartlinking ifdef LINKSMART override FPCOPT+=-XX endif - -# Smartlinking creation ifdef CREATESMART override FPCOPT+=-CX endif - -# Debug ifdef DEBUG -override FPCOPT+=-gl -dDEBUG +override FPCOPT+=-gl +override FPCOPTDEF+=DEBUG endif - -# Release mode (strip, optimize and don't load ppc386.cfg) -# 0.99.12b has a bug in the optimizer so don't use it by default ifdef RELEASE -ifeq ($(FPC_VERSION),0.99.12) -override FPCOPT+=-Xs -OGp3 -n -else override FPCOPT+=-Xs -OG2p3 -n +override FPCOPTDEF+=RELEASE endif -endif - -# Strip ifdef STRIP override FPCOPT+=-Xs endif - -# Optimizer ifdef OPTIMIZE override FPCOPT+=-OG2p3 endif - -# Verbose settings (warning,note,info) ifdef VERBOSE override FPCOPT+=-vwni endif - -ifdef UNITSDIR -override FPCOPT+=-Fu$(UNITSDIR) +ifdef COMPILER_OPTIONS +override FPCOPT+=$(COMPILER_OPTIONS) endif - -# Target dirs and the prefix to use for clean/install -ifdef TARGETDIR -override FPCOPT+=-FE$(TARGETDIR) -ifeq ($(TARGETDIR),.) +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 COMPILER_TARGETDIR +override FPCOPT+=-FE$(COMPILER_TARGETDIR) +ifeq ($(COMPILER_TARGETDIR),.) override TARGETDIRPREFIX= else -override TARGETDIRPREFIX=$(TARGETDIR)/ +override TARGETDIRPREFIX=$(COMPILER_TARGETDIR)/ endif endif -ifdef UNITTARGETDIR -override FPCOPT+=-FU$(UNITTARGETDIR) -ifeq ($(UNITTARGETDIR),.) +ifdef COMPILER_UNITTARGETDIR +override FPCOPT+=-FU$(COMPILER_UNITTARGETDIR) +ifeq ($(COMPILER_UNITTARGETDIR),.) override UNITTARGETDIRPREFIX= else -override UNITTARGETDIRPREFIX=$(UNITTARGETDIR)/ +override UNITTARGETDIRPREFIX=$(COMPILER_UNITTARGETDIR)/ endif else -ifdef TARGETDIR -override UNITTARGETDIR=$(TARGETDIR) +ifdef COMPILER_TARGETDIR +override COMPILER_UNITTARGETDIR=$(COMPILER_TARGETDIR) override UNITTARGETDIRPREFIX=$(TARGETDIRPREFIX) endif endif - -# Add commandline options last so they can override ifdef OPT override FPCOPT+=$(OPT) endif - -# Add defines from FPCOPTDEF to FPCOPT ifdef FPCOPTDEF -override FPCOPT+=$(FPCOPTDEF) +override FPCOPT+=$(addprefix -d,$(FPCOPTDEF)) endif - -# Error file ? -ifdef ERRORFILE -override FPCOPT+=-Fr$(ERRORFILE) -endif - -# Was a config file specified ? ifdef CFGFILE override FPCOPT+=@$(CFGFILE) endif - -# For win32 the options are passed using the environment FPCEXTCMD -ifeq ($(OS_SOURCE),win32) +ifdef USEENV override FPCEXTCMD:=$(FPCOPT) override FPCOPT:=!FPCEXTCMD export FPCEXTCMD endif - -# Compiler commandline override COMPILER:=$(FPC) $(FPCOPT) - -# also call ppas if with command option -s -# but only if the OS_SOURCE and OS_TARGE are equal ifeq (,$(findstring -s ,$(COMPILER))) EXECPPAS= else @@ -746,299 +615,69 @@ ifeq ($(OS_SOURCE),$(OS_TARGET)) EXECPPAS:=@$(PPAS) endif endif - -##################################################################### -# Standard rules -##################################################################### - -all: fpc_all $(addsuffix _all,$(DIROBJECTS)) - -debug: fpc_debug $(addsuffix _debug,$(DIROBJECTS)) - -smart: fpc_smart $(addsuffix _smart,$(DIROBJECTS)) - -shared: fpc_shared $(addsuffix _shared,$(DIROBJECTS)) - -showinstall: fpc_showinstall $(addsuffix _showinstall,$(DIROBJECTS)) - -install: fpc_install $(addsuffix _install,$(DIROBJECTS)) - -sourceinstall: fpc_sourceinstall - -exampleinstall: fpc_exampleinstall - -zipinstall: fpc_zipinstall - -zipsourceinstall: fpc_zipsourceinstall - -zipexampleinstall: fpc_zipexampleinstall - -clean: fpc_clean $(addsuffix _clean,$(DIROBJECTS)) - -distclean: fpc_distclean $(addsuffix _distclean,$(DIROBJECTS)) - -cleanall: fpc_cleanall $(addsuffix _cleanall,$(DIROBJECTS)) - -require: $(addsuffix _require,$(DIROBJECTS)) - -info: fpc_info - -.PHONY: all debug smart shared showinstall install sourceinstall exampleinstall zipinstall zipsourceinstall zipexampleinstall clean distclean cleanall require info - -##################################################################### -# General compile rules -##################################################################### - -.PHONY: fpc_packages fpc_all fpc_debug - -$(FPCMADE): $(ALLTARGET) - @$(ECHO) Compiled > $(FPCMADE) - -fpc_packages: $(COMPILEPACKAGES) - -fpc_all: fpc_packages $(FPCMADE) - -fpc_debug: - $(MAKE) all DEBUG=1 - -# Search paths for .ppu if targetdir is set -ifdef UNITTARGETDIR -vpath %$(PPUEXT) $(UNITTARGETDIR) +ifdef TARGET_RSTS +override RSTFILES=$(addsuffix $(RSTEXT),$(TARGET_RSTS)) +override CLEANRSTFILES+=$(RSTFILES) endif - -# General compile rules, available for both possible PASEXT - -.SUFFIXES: $(EXEEXT) $(PPUEXT) $(OEXT) .pas .pp - -%$(PPUEXT): %.pp - $(COMPILER) $< $(REDIR) - $(EXECPPAS) - -%$(PPUEXT): %.pas - $(COMPILER) $< $(REDIR) - $(EXECPPAS) - -%$(EXEEXT): %.pp - $(COMPILER) $< $(REDIR) - $(EXECPPAS) - -%$(EXEEXT): %.pas - $(COMPILER) $< $(REDIR) - $(EXECPPAS) - -##################################################################### -# Library -##################################################################### - -.PHONY: fpc_smart fpc_shared - -ifdef LIBVERSION -LIBFULLNAME=$(LIBNAME).$(LIBVERSION) -else -LIBFULLNAME=$(LIBNAME) -endif - -# Default sharedlib units are all unit objects -ifndef SHAREDLIBUNITOBJECTS -SHAREDLIBUNITOBJECTS:=$(UNITOBJECTS) -endif - -fpc_smart: - $(MAKE) all LINKSMART=1 CREATESMART=1 - -fpc_shared: all -ifdef HASSHAREDLIB -ifndef LIBNAME - @$(ECHO) "LIBNAME not set" -else - $(PPUMOVE) $(SHAREDLIBUNITOBJECTS) -o$(LIBFULLNAME) -endif -else - @$(ECHO) "Shared Libraries not supported" -endif - -##################################################################### -# Install rules -##################################################################### - -.PHONY: fpc_showinstall fpc_install - -ifdef EXTRAINSTALLUNITS -override INSTALLPPUFILES+=$(addsuffix $(PPUEXT),$(EXTRAINSTALLUNITS)) -endif - -ifdef INSTALLPPUFILES -override INSTALLPPUFILES:=$(addprefix $(UNITTARGETDIRPREFIX),$(INSTALLPPUFILES)) -ifdef PPUFILES -INSTALLPPULINKFILES:=$(addprefix $(UNITTARGETDIRPREFIX),$(shell $(PPUFILES) -S -O $(INSTALLPPUFILES))) -else -INSTALLPPULINKFILES:=$(wildcard $(subst $(PPUEXT),$(OEXT),$(INSTALLPPUFILES)) $(addprefix $(LIBPREFIX),$(subst $(PPUEXT),$(STATICLIBEXT),$(INSTALLPPUFILES)))) -endif -# MWE: not here UNITTARGETDIRPREFIX is already added when no PPUFILES -# override INSTALLPPULINKFILES:=$(addprefix $(UNITTARGETDIRPREFIX),$(INSTALLPPULINKFILES)) -endif - -ifdef INSTALLEXEFILES -override INSTALLEXEFILES:=$(addprefix $(TARGETDIRPREFIX),$(INSTALLEXEFILES)) -endif - -fpc_showinstall: $(SHOWINSTALLTARGET) -ifdef INSTALLEXEFILES - @$(ECHO) -e $(addprefix "\n"$(BININSTALLDIR)/,$(INSTALLEXEFILES)) -endif -ifdef INSTALLPPUFILES - @$(ECHO) -e $(addprefix "\n"$(UNITINSTALLDIR)/,$(INSTALLPPUFILES)) -ifneq ($(INSTALLPPULINKFILES),) - @$(ECHO) -e $(addprefix "\n"$(UNITINSTALLDIR)/,$(INSTALLPPULINKFILES)) -endif -ifneq ($(wildcard $(LIBFULLNAME)),) - @$(ECHO) $(LIBINSTALLDIR)/$(LIBFULLNAME) -ifdef HASSHAREDLIB - @$(ECHO) $(LIBINSTALLDIR)/$(LIBNAME) -endif -endif -endif -ifdef EXTRAINSTALLFILES - @$(ECHO) -e $(addprefix "\n"$(DATAINSTALLDIR)/,$(EXTRAINSTALLFILES)) -endif - -fpc_install: $(INSTALLTARGET) -# Create UnitInstallFiles -ifdef INSTALLEXEFILES - $(MKDIR) $(BININSTALLDIR) -# Compress the exes if upx is defined -ifdef UPXPROG - -$(UPXPROG) $(INSTALLEXEFILES) -endif - $(INSTALLEXE) $(INSTALLEXEFILES) $(BININSTALLDIR) -endif -ifdef INSTALLPPUFILES - $(MKDIR) $(UNITINSTALLDIR) - $(INSTALL) $(INSTALLPPUFILES) $(UNITINSTALLDIR) -ifneq ($(INSTALLPPULINKFILES),) - $(INSTALL) $(INSTALLPPULINKFILES) $(UNITINSTALLDIR) -endif -ifneq ($(wildcard $(LIBFULLNAME)),) - $(MKDIR) $(LIBINSTALLDIR) - $(INSTALL) $(LIBFULLNAME) $(LIBINSTALLDIR) -ifdef inUnix - ln -sf $(LIBFULLNAME) $(LIBINSTALLDIR)/$(LIBNAME) -endif -endif -endif -ifdef EXTRAINSTALLFILES - $(MKDIR) $(DATAINSTALLDIR) - $(INSTALL) $(EXTRAINSTALLFILES) $(DATAINSTALLDIR) -endif - -##################################################################### -# SourceInstall rules -##################################################################### - -.PHONY: fpc_sourceinstall - -ifndef SOURCETOPDIR -SOURCETOPDIR=$(BASEDIR) -endif - -fpc_sourceinstall: clean - $(MKDIR) $(SOURCEINSTALLDIR) - $(COPYTREE) $(SOURCETOPDIR) $(SOURCEINSTALLDIR) - -##################################################################### -# exampleinstall rules -##################################################################### - -.PHONY: fpc_exampleinstall - -fpc_exampleinstall: $(addsuffix _clean,$(EXAMPLEDIROBJECTS)) -ifdef EXAMPLESOURCEFILES - $(MKDIR) $(EXAMPLEINSTALLDIR) - $(COPY) $(EXAMPLESOURCEFILES) $(EXAMPLEINSTALLDIR) -endif -ifdef EXAMPLEDIROBJECTS -ifndef EXAMPLESOURCEFILES - $(MKDIR) $(EXAMPLEINSTALLDIR) -endif - $(COPYTREE) $(addsuffix /*,$(EXAMPLEDIROBJECTS)) $(EXAMPLEINSTALLDIR) -endif - -##################################################################### -# Zip -##################################################################### - -.PHONY: fpc_zipinstall - -# Create suffix to add -ifndef PACKAGESUFFIX -PACKAGESUFFIX=$(OS_TARGET) -ifeq ($(OS_TARGET),go32v2) -PACKAGESUFFIX=go32 -endif -ifeq ($(OS_TARGET),win32) -PACKAGESUFFIX=w32 -endif -ifeq ($(OS_TARGET),os2) -PACKAGESUFFIX=emx -endif -endif - -# Temporary path to pack a file +.PHONY: fpc_distinstall +fpc_distinstall: install exampleinstall +.PHONY: fpc_zipinstall fpc_zipsourceinstall fpc_zipexampleinstall ifndef PACKDIR ifndef inUnix -PACKDIR=$(BASEDIR)/pack_tmp +PACKDIR=$(BASEDIR)/../fpc-pack else -PACKDIR=/tmp/lazarus-pack +PACKDIR=/tmp/fpc-pack endif endif - -# Maybe create default zipname from packagename ifndef ZIPNAME -ifdef PACKAGENAME -ZIPNAME=$(PACKAGEPREFIX)$(PACKAGENAME)$(PACKAGESUFFIX) +ifdef DIST_ZIPNAME +ZIPNAME=$(DIST_ZIPNAME) +else +ZIPNAME=$(ZIPPREFIX)$(PACKAGE_NAME)$(ZIPSUFFIX) +endif +endif +ifndef ZIPTARGET +ifdef DIST_ZIPTARGET +ZIPTARGET=DIST_ZIPTARGET +else +ZIPTARGET=install endif endif - -# Use tar by default under linux ifndef USEZIP ifdef inUnix USETAR=1 endif endif - -# Use a wrapper script by default for OS/2 -ifdef inOS2 +ifndef inUnix USEZIPWRAPPER=1 endif - -# Create commands to create the zip/tar file -ZIPWRAPPER=$(DESTZIPDIR)/fpczip$(BATCHEXT) -ZIPCMD_CDPACK:=cd $(subst /,$(PATHSEP),$(PACKDIR)) -ZIPCMD_CDBASE:=cd $(subst /,$(PATHSEP),$(BASEDIR)) +ifdef USEZIPWRAPPER +ZIPPATHSEP=$(PATHSEP) +ZIPWRAPPER=$(subst /,$(PATHSEP),$(DIST_DESTDIR)/fpczip$(BATCHEXT)) +else +ZIPPATHSEP=/ +endif +ZIPCMD_CDPACK:=cd $(subst /,$(ZIPPATHSEP),$(PACKDIR)) +ZIPCMD_CDBASE:=cd $(subst /,$(ZIPPATHSEP),$(BASEDIR)) ifdef USETAR -ZIPDESTFILE:=$(DESTZIPDIR)/$(ZIPNAME)$(TAREXT) +ZIPDESTFILE:=$(DIST_DESTDIR)/$(ZIPNAME)$(TAREXT) ZIPCMD_ZIP:=$(TARPROG) cf$(TAROPT) $(ZIPDESTFILE) * else -ZIPDESTFILE:=$(DESTZIPDIR)/$(ZIPNAME)$(ZIPEXT) -ZIPCMD_ZIP:=$(subst /,$(PATHSEP),$(ZIPPROG)) -Dr $(ZIPOPT) $(ZIPDESTFILE) * +ZIPDESTFILE:=$(DIST_DESTDIR)/$(ZIPNAME)$(ZIPEXT) +ZIPCMD_ZIP:=$(subst /,$(ZIPPATHSEP),$(ZIPPROG)) -Dr $(ZIPOPT) $(ZIPDESTFILE) * endif - fpc_zipinstall: -ifndef ZIPNAME - @$(ECHO) "Please specify ZIPNAME!" - @exit 1 -else - $(MAKE) $(ZIPTARGET) PREFIXINSTALLDIR=$(PACKDIR) + $(MAKE) $(ZIPTARGET) INSTALL_PREFIX=$(PACKDIR) ZIPINSTALL=1 $(DEL) $(ZIPDESTFILE) ifdef USEZIPWRAPPER -ifneq ($(ECHO),echo) - $(ECHO) "$(ZIPCMD_CDPACK)" > $(ZIPWRAPPER) - $(ECHO) "$(ZIPCMD_ZIP)" >> $(ZIPWRAPPER) - $(ECHO) "$(ZIPCMD_CDBASE)" >> $(ZIPWRAPPER) +ifneq ($(ECHOREDIR),echo) + $(ECHOREDIR) -e "$(subst \,\\,$(ZIPCMD_CDPACK))" > $(ZIPWRAPPER) + $(ECHOREDIR) -e "$(subst \,\\,$(ZIPCMD_ZIP))" >> $(ZIPWRAPPER) + $(ECHOREDIR) -e "$(subst \,\\,$(ZIPCMD_CDBASE))" >> $(ZIPWRAPPER) else - $(ECHO) $(ZIPCMD_CDPACK) > $(ZIPWRAPPER) - $(ECHO) $(ZIPCMD_ZIP) >> $(ZIPWRAPPER) - $(ECHO) $(ZIPCMD_CDBASE) >> $(ZIPWRAPPER) + echo $(ZIPCMD_CDPACK) > $(ZIPWRAPPER) + echo $(ZIPCMD_ZIP) >> $(ZIPWRAPPER) + echo $(ZIPCMD_CDBASE) >> $(ZIPWRAPPER) endif ifdef inUnix /bin/sh $(ZIPWRAPPER) @@ -1050,44 +689,26 @@ else $(ZIPCMD_CDPACK) ; $(ZIPCMD_ZIP) ; $(ZIPCMD_CDBASE) endif $(DELTREE) $(PACKDIR) -endif - -.PHONY: fpc_zipsourceinstall - fpc_zipsourceinstall: - $(MAKE) fpc_zipinstall ZIPTARGET=sourceinstall PACKAGESUFFIX=src - -.PHONY: fpc_zipexampleinstall - + $(MAKE) fpc_zipinstall ZIPTARGET=sourceinstall ZIPSUFFIX=src fpc_zipexampleinstall: - $(MAKE) fpc_zipinstall ZIPTARGET=exampleinstall PACKAGESUFFIX=exm - -##################################################################### -# Clean rules -##################################################################### - +ifdef HASEXAMPLES + $(MAKE) fpc_zipinstall ZIPTARGET=exampleinstall ZIPSUFFIX=exm +endif +fpc_zipdistinstall: + $(MAKE) fpc_zipinstall ZIPTARGET=distinstall .PHONY: fpc_clean fpc_cleanall fpc_distclean - ifdef EXEFILES override CLEANEXEFILES:=$(addprefix $(TARGETDIRPREFIX),$(CLEANEXEFILES)) endif - -ifdef EXTRACLEANUNITS -override CLEANPPUFILES+=$(addsuffix $(PPUEXT),$(EXTRACLEANUNITS)) +ifdef CLEAN_UNITS +override CLEANPPUFILES+=$(addsuffix $(PPUEXT),$(CLEAN_UNITS)) endif - ifdef CLEANPPUFILES +override CLEANPPULINKFILES:=$(subst $(PPUEXT),$(OEXT),$(CLEANPPUFILES)) $(addprefix $(STATICLIBPREFIX),$(subst $(PPUEXT),$(STATICLIBEXT),$(CLEANPPUFILES))) override CLEANPPUFILES:=$(addprefix $(UNITTARGETDIRPREFIX),$(CLEANPPUFILES)) -# Get the .o and .a files created for the units -ifdef PPUFILES -CLEANPPULINKFILES:=$(addprefix $(UNITTARGETDIRPREFIX),$(shell $(PPUFILES) $(CLEANPPUFILES))) -else -CLEANPPULINKFILES:=$(wildcard $(subst $(PPUEXT),$(OEXT),$(CLEANPPUFILES)) $(addprefix $(LIBPREFIX),$(subst $(PPUEXT),$(STATICLIBEXT),$(CLEANPPUFILES)))) +override CLEANPPULINKFILES:=$(wildcard $(addprefix $(UNITTARGETDIRPREFIX),$(CLEANPPULINKFILES))) endif -# MWE: not here UNITTARGETDIRPREFIX is already added when no PPUFILES -# override CLEANPPULINKFILES:=$(addprefix $(UNITTARGETDIRPREFIX),$(CLEANPPULINKFILES)) -endif - fpc_clean: $(CLEANTARGET) ifdef CLEANEXEFILES -$(DEL) $(CLEANEXEFILES) @@ -1101,22 +722,17 @@ endif ifdef CLEANRSTFILES -$(DEL) $(addprefix $(UNITTARGETDIRPREFIX),$(CLEANRSTFILES)) endif -ifdef EXTRACLEANFILES - -$(DEL) $(EXTRACLEANFILES) +ifdef CLEAN_FILES + -$(DEL) $(CLEAN_FILES) endif -ifdef LIBNAME - -$(DEL) $(LIBNAME) $(LIBFULLNAME) +ifdef LIB_NAME + -$(DEL) $(LIB_NAME) $(LIB_FULLNAME) endif - -$(DEL) $(FPCMADE) $(PPAS) link.res $(FPCEXTFILE) $(REDIRFILE) - -fpc_distclean: fpc_clean - -# Also run clean first if targetdir is set. Unittargetdir is always -# set if targetdir or unittargetdir is specified -ifdef UNITTARGETDIR + -$(DEL) $(FPCMADE) Package.fpc $(PPAS) link.res $(FPCEXTFILE) $(REDIRFILE) +fpc_distclean: clean +ifdef COMPILER_UNITTARGETDIR TARGETDIRCLEAN=fpc_clean endif - fpc_cleanall: $(CLEANTARGET) $(TARGETDIRCLEAN) ifdef CLEANEXEFILES -$(DEL) $(CLEANEXEFILES) @@ -1124,140 +740,146 @@ endif -$(DEL) *$(OEXT) *$(PPUEXT) *$(RSTEXT) *$(ASMEXT) *$(STATICLIBEXT) *$(SHAREDLIBEXT) *$(PPLEXT) -$(DELTREE) *$(SMARTEXT) -$(DEL) $(FPCMADE) $(PPAS) link.res $(FPCEXTFILE) $(REDIRFILE) - -##################################################################### -# Info rules -##################################################################### - -.PHONY: fpc_info fpc_cfginfo fpc_objectinfo fpc_toolsinfo fpc_installinfo \ - fpc_dirinfo - -fpc_info: $(INFOTARGET) - -fpc_infocfg: +ifdef AOUTEXT + -$(DEL) *$(AOUTEXT) +endif +.PHONY: fpc_info +fpc_info: + @$(ECHO) + @$(ECHO) == Package info == + @$(ECHO) Package Name..... $(PACKAGE_NAME) + @$(ECHO) Package Version.. $(PACKAGE_VERSION) @$(ECHO) @$(ECHO) == Configuration info == @$(ECHO) - @$(ECHO) FPC....... $(FPC) - @$(ECHO) Version... $(FPC_VERSION) - @$(ECHO) CPU....... $(CPU_TARGET) - @$(ECHO) Source.... $(OS_SOURCE) - @$(ECHO) Target.... $(OS_TARGET) + @$(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) - -fpc_infoobjects: + @$(ECHO) == Directory info == + @$(ECHO) + @$(ECHO) Basedir......... $(BASEDIR) + @$(ECHO) FPCDir.......... $(FPCDIR) + @$(ECHO) UnitsDir........ $(UNITSDIR) + @$(ECHO) PackagesDir..... $(PACKAGESDIR) + @$(ECHO) + @$(ECHO) GCC library..... $(GCCLIBDIR) + @$(ECHO) Other library... $(OTHERLIBDIR) + @$(ECHO) + @$(ECHO) == Tools info == + @$(ECHO) + @$(ECHO) Pwd....... $(PWD) + @$(ECHO) Mv........ $(MVPROG) + @$(ECHO) Cp........ $(CPPROG) + @$(ECHO) Rm........ $(RMPROG) + @$(ECHO) GInstall.. $(GINSTALL) + @$(ECHO) Echo...... $(ECHO) + @$(ECHO) Date...... $(DATE) + @$(ECHO) FPCMake... $(FPCMAKE) + @$(ECHO) PPUMove... $(PPUMOVE) + @$(ECHO) Upx....... $(UPXPROG) + @$(ECHO) Zip....... $(ZIPPROG) @$(ECHO) @$(ECHO) == Object info == @$(ECHO) - @$(ECHO) LoaderObjects..... $(LOADEROBJECTS) - @$(ECHO) UnitObjects....... $(UNITOBJECTS) - @$(ECHO) ExeObjects........ $(EXEOBJECTS) + @$(ECHO) Target Loaders...... $(TARGET_LOADERS) + @$(ECHO) Target Units........ $(TARGET_UNITS) + @$(ECHO) Target Programs..... $(TARGET_PROGRAMS) + @$(ECHO) Target Dirs......... $(TARGET_DIRS) + @$(ECHO) Target Examples..... $(TARGET_EXAMPLES) + @$(ECHO) Target ExampleDirs.. $(TARGET_EXAMPLEDIRS) @$(ECHO) - @$(ECHO) ExtraCleanUnits... $(EXTRACLEANUNITS) - @$(ECHO) ExtraCleanFiles... $(EXTRACLEANFILES) + @$(ECHO) Clean Units......... $(CLEAN_UNITS) + @$(ECHO) Clean Files......... $(CLEAN_FILES) @$(ECHO) - @$(ECHO) ExtraInstallUnits. $(EXTRAINSTALLUNITS) - @$(ECHO) ExtraInstallFiles. $(EXTRAINSTALLFILES) - @$(ECHO) - -fpc_infoinstall: + @$(ECHO) Install Units....... $(INSTALL_UNITS) + @$(ECHO) Install Files....... $(INSTALL_FILES) @$(ECHO) @$(ECHO) == Install info == @$(ECHO) -ifdef DATE @$(ECHO) DateStr.............. $(DATESTR) -endif -ifdef PACKAGEPREFIX - @$(ECHO) PackagePrefix........ $(PACKAGEPREFIX) -endif -ifdef PACKAGENAME - @$(ECHO) PackageName.......... $(PACKAGENAME) -endif - @$(ECHO) PackageSuffix........ $(PACKAGESUFFIX) + @$(ECHO) ZipPrefix............ $(ZIPPREFIX) + @$(ECHO) ZipSuffix............ $(ZIPSUFFIX) + @$(ECHO) Install FPC Package.. $(INSTALL_FPCPACKAGE) @$(ECHO) - @$(ECHO) BaseInstallDir....... $(BASEINSTALLDIR) - @$(ECHO) BinInstallDir........ $(BININSTALLDIR) - @$(ECHO) LibInstallDir........ $(LIBINSTALLDIR) - @$(ECHO) UnitInstallDir....... $(UNITINSTALLDIR) - @$(ECHO) SourceInstallDir..... $(SOURCEINSTALLDIR) - @$(ECHO) DocInstallDir........ $(DOCINSTALLDIR) - @$(ECHO) DataInstallDir....... $(DATAINSTALLDIR) + @$(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) DestZipDir........... $(DESTZIPDIR) - @$(ECHO) ZipName.............. $(ZIPNAME) + @$(ECHO) Dist destination dir. $(DIST_DESTDIR) + @$(ECHO) Dist zip name........ $(DIST_ZIPNAME) @$(ECHO) - -##################################################################### -# Directories -##################################################################### - -OBJECTDIRAPIWIZZ=1 - -# Dir apiwizz - -ifdef OBJECTDIRAPIWIZZ -.PHONY: apiwizz_all apiwizz_debug apiwizz_examples apiwizz_test apiwizz_smart apiwizz_shared apiwizz_showinstall apiwizz_install apiwizz_sourceinstall apiwizz_exampleinstall apiwizz_zipinstall apiwizz_zipsourceinstall apiwizz_zipexampleinstall apiwizz_clean apiwizz_distclean apiwizz_cleanall apiwizz_require apiwizz_info - +TARGET_DIRS_APIWIZZ=1 +ifdef TARGET_DIRS_APIWIZZ apiwizz_all: $(MAKE) -C apiwizz all - apiwizz_debug: $(MAKE) -C apiwizz debug - -apiwizz_examples: - $(MAKE) -C apiwizz examples - -apiwizz_test: - $(MAKE) -C apiwizz test - apiwizz_smart: $(MAKE) -C apiwizz smart - +apiwizz_examples: + $(MAKE) -C apiwizz examples apiwizz_shared: $(MAKE) -C apiwizz shared - -apiwizz_showinstall: - $(MAKE) -C apiwizz showinstall - apiwizz_install: $(MAKE) -C apiwizz install - apiwizz_sourceinstall: $(MAKE) -C apiwizz sourceinstall - apiwizz_exampleinstall: $(MAKE) -C apiwizz exampleinstall - +apiwizz_distinstall: + $(MAKE) -C apiwizz distinstall apiwizz_zipinstall: $(MAKE) -C apiwizz zipinstall - apiwizz_zipsourceinstall: $(MAKE) -C apiwizz zipsourceinstall - apiwizz_zipexampleinstall: $(MAKE) -C apiwizz zipexampleinstall - +apiwizz_zipdistinstall: + $(MAKE) -C apiwizz zipdistinstall apiwizz_clean: $(MAKE) -C apiwizz clean - apiwizz_distclean: $(MAKE) -C apiwizz distclean - apiwizz_cleanall: $(MAKE) -C apiwizz cleanall - -apiwizz_require: - $(MAKE) -C apiwizz require - apiwizz_info: $(MAKE) -C apiwizz info +apiwizz: + $(MAKE) -C apiwizz all +.PHONY: apiwizz_all apiwizz_debug apiwizz_smart apiwizz_examples apiwizz_shared apiwizz_install apiwizz_sourceinstall apiwizz_exampleinstall apiwizz_distinstall apiwizz_zipinstall apiwizz_zipsourceinstall apiwizz_zipexampleinstall apiwizz_zipdistinstall apiwizz_clean apiwizz_distclean apiwizz_cleanall apiwizz_info apiwizz endif - -##################################################################### -# Local Makefile -##################################################################### - +all: $(addsuffix _all,$(TARGET_DIRS)) +debug: $(addsuffix _debug,$(TARGET_DIRS)) +smart: $(addsuffix _smart,$(TARGET_DIRS)) +examples: $(addsuffix _examples,$(TARGET_DIRS)) +shared: $(addsuffix _shared,$(TARGET_DIRS)) +install: $(addsuffix _install,$(TARGET_DIRS)) +sourceinstall: +exampleinstall: $(addsuffix _exampleinstall,$(TARGET_DIRS)) +distinstall: fpc_distinstall +zipinstall: fpc_zipinstall +zipsourceinstall: fpc_zipsourceinstall +zipexampleinstall: fpc_zipexampleinstall $(addsuffix _zipexampleinstall,$(TARGET_DIRS)) +zipdistinstall: fpc_zipdistinstall $(addsuffix _zipdistinstall,$(TARGET_DIRS)) +clean: $(addsuffix _clean,$(TARGET_DIRS)) +distclean: $(addsuffix _distclean,$(TARGET_DIRS)) +cleanall: $(addsuffix _cleanall,$(TARGET_DIRS)) +info: fpc_info +.PHONY: all debug smart examples shared install sourceinstall exampleinstall distinstall zipinstall zipsourceinstall zipexampleinstall zipdistinstall clean distclean cleanall info ifneq ($(wildcard fpcmake.loc),) include fpcmake.loc endif - +.PHONY: makefile makefiles +makefile: Makefile.fpc + -$(FPCMAKE) -w +makefiles: makefile + $(MAKE) -C apiwizz makefiles diff --git a/tools/Makefile.fpc b/tools/Makefile.fpc index 4b7eb50810..d4e6cba6f6 100644 --- a/tools/Makefile.fpc +++ b/tools/Makefile.fpc @@ -3,25 +3,21 @@ # Makefile.fpc for Lazarus for Free Pascal # -[targets] -dirs=apiwizz +[package] +name=lazarus-tools +version=0.7a -[dirs] -# target dir needs to be . or a full path otherwise the -# unittargetdir will be corrupt -# not with the lazarusmake.ini -# targetdir=. +[target] +dirs=apiwizz [install] packagename=tools -[presettings] -ifndef LCLPLATFORM -LCLPLATFORM=gtk -export LCLPLATFORM -endif - - -[postsettings] - [rules] +.PHONY: makefile makefiles + +makefile: Makefile.fpc + -$(FPCMAKE) -w + +makefiles: makefile + $(MAKE) -C apiwizz makefiles diff --git a/tools/apiwizz/Makefile b/tools/apiwizz/Makefile index 0ac9d4385f..44093616e5 100644 --- a/tools/apiwizz/Makefile +++ b/tools/apiwizz/Makefile @@ -1,38 +1,30 @@ # -# Makefile generated by fpcmake v1.00 [2001/01/09] +# Don't edit, this file is generated by FPCMake Version 1.1 [2001/08/08] # - -defaultrule: all - -##################################################################### -# Autodetect OS (Linux or Dos or Windows NT or OS/2) -# define inUnix when running under Unix (Linux,FreeBSD) -# define inWinNT when running under WinNT -# define inOS2 when running under OS/2 -##################################################################### - -# We need only / in the path +default: all override PATH:=$(subst \,/,$(PATH)) - -# Search for PWD and determine also if we are under linux -PWD:=$(strip $(wildcard $(addsuffix /pwd.exe,$(subst ;, ,$(PATH))))) +ifeq ($(findstring ;,$(PATH)),) +inUnix=1 +SEARCHPATH:=$(filter-out .,$(subst :, ,$(PATH))) +else +SEARCHPATH:=$(subst ;, ,$(PATH)) +endif +PWD:=$(strip $(wildcard $(addsuffix /pwd.exe,$(SEARCHPATH)))) ifeq ($(PWD),) -PWD:=$(strip $(wildcard $(addsuffix /pwd,$(subst :, ,$(PATH))))) +PWD:=$(strip $(wildcard $(addsuffix /pwd,$(SEARCHPATH)))) ifeq ($(PWD),) nopwd: @echo You need the GNU utils package to use this Makefile! @echo Get ftp://ftp.freepascal.org/pub/fpc/dist/go32v2/utilgo32.zip @exit else -inUnix=1 PWD:=$(firstword $(PWD)) +SRCEXEEXT= endif else PWD:=$(firstword $(PWD)) +SRCEXEEXT=.exe endif - -# Detect NT - NT sets OS to Windows_NT -# Detect OS/2 - OS/2 has OS2_SHELL defined ifndef inUnix ifeq ($(OS),Windows_NT) inWinNT=1 @@ -41,16 +33,11 @@ ifdef OS2_SHELL inOS2=1 endif endif -endif - -# The extension of executables -ifdef inUnix -SRCEXEEXT= else -SRCEXEEXT=.exe +ifneq ($(findstring cygwin,$(MACHTYPE)),) +inCygWin=1 +endif endif - -# The extension of batch files / scripts ifdef inUnix BATCHEXT=.sh else @@ -60,94 +47,65 @@ else BATCHEXT=.bat endif endif - -# Path Separator, the subst trick is necessary for the \ that can't exists -# at the end of a line ifdef inUnix PATHSEP=/ else -PATHSEP=$(subst /,\,/) +PATHSEP:=$(subst /,\,/) endif - -# The path which is searched separated by spaces -ifdef inUnix -SEARCHPATH=$(subst :, ,$(PATH)) -else -SEARCHPATH=$(subst ;, ,$(PATH)) -endif - -# Base dir ifdef PWD -BASEDIR:=$(shell $(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 - -##################################################################### -# FPC version/target Detection -##################################################################### - -# What compiler to use ? ifndef FPC -# Compatibility with old makefiles ifdef PP FPC=$(PP) else +ifdef inUnix +CPU_SOURCE=$(shell uname -m) +ifeq (m68k,$(CPU_SOURCE)) +FPC=ppc68k +else +FPC=ppc386 +endif +else FPC=ppc386 endif endif +endif override FPC:=$(subst $(SRCEXEEXT),,$(FPC)) override FPC:=$(subst \,/,$(FPC))$(SRCEXEEXT) - -# Target OS ifndef OS_TARGET OS_TARGET:=$(shell $(FPC) -iTO) endif - -# Source OS ifndef OS_SOURCE OS_SOURCE:=$(shell $(FPC) -iSO) endif - -# Target CPU ifndef CPU_TARGET CPU_TARGET:=$(shell $(FPC) -iTP) endif - -# Source CPU ifndef CPU_SOURCE CPU_SOURCE:=$(shell $(FPC) -iSP) endif - -# FPC version ifndef FPC_VERSION FPC_VERSION:=$(shell $(FPC) -iV) endif - export FPC OS_TARGET OS_SOURCE CPU_TARGET CPU_SOURCE FPC_VERSION - -##################################################################### -# Pre Settings -##################################################################### - -LAZDIR=../.. -##################################################################### -# FPCDIR Setting -##################################################################### - -# Test FPCDIR to look if the RTL dir exists ifdef FPCDIR override FPCDIR:=$(subst \,/,$(FPCDIR)) -ifeq ($(wildcard $(FPCDIR)/rtl),) -ifeq ($(wildcard $(FPCDIR)/units),) +ifeq ($(wildcard $(addprefix $(FPCDIR)/,rtl units)),) override FPCDIR=wrong endif -endif else override FPCDIR=wrong endif - -# Detect FPCDIR ifeq ($(FPCDIR),wrong) ifdef inUnix override FPCDIR=/usr/local/lib/fpc/$(FPC_VERSION) @@ -157,173 +115,128 @@ endif else override FPCDIR:=$(subst /$(FPC),,$(firstword $(strip $(wildcard $(addsuffix /$(FPC),$(SEARCHPATH)))))) override FPCDIR:=$(FPCDIR)/.. -ifeq ($(wildcard $(FPCDIR)/rtl),) -ifeq ($(wildcard $(FPCDIR)/units),) +ifeq ($(wildcard $(addprefix $(FPCDIR)/,rtl units)),) override FPCDIR:=$(FPCDIR)/.. -ifeq ($(wildcard $(FPCDIR)/rtl),) -ifeq ($(wildcard $(FPCDIR)/units),) +ifeq ($(wildcard $(addprefix $(FPCDIR)/,rtl units)),) override FPCDIR=c:/pp endif endif endif endif -endif -endif - -ifndef PACKAGESDIR -PACKAGESDIR=$(FPCDIR)/packages -endif -ifndef TOOLKITSDIR -TOOLKITSDIR= -endif -ifndef COMPONENTSDIR -COMPONENTSDIR= -endif - -# Create units dir -ifneq ($(FPCDIR),.) -UNITSDIR=$(FPCDIR)/units/$(OS_TARGET) -endif - -##################################################################### -# User Settings -##################################################################### - - -# Targets - -override EXEOBJECTS+=apiwizz - -# Clean - -override EXTRACLEANUNITS+=apiwizard - -# Install - -ZIPTARGET=install - -# Defaults - - -# Directories - -override NEEDUNITDIR=. $(LAZDIR)/lcl/units $(LAZDIR)/components/units $(LAZDIR)/lcl/units/$(LCLPLATFORM) -ifndef TARGETDIR -TARGETDIR=. -endif - -# Packages - -override PACKAGES+=rtl fcl gtk - -# Libraries - - -# Info - -INFOTARGET=fpc_infocfg fpc_infoobjects fpc_infoinstall - -##################################################################### -# Shell tools -##################################################################### - -# echo +UNITSDIR:=$(wildcard $(FPCDIR)/units/$(OS_TARGET)) +PACKAGESDIR:=$(wildcard $(FPCDIR) $(FPCDIR)/packages) +override PACKAGE_NAME=lazarus-apiwizz +override PACKAGE_VERSION=0.7a +LAZDIR=../.. +override TARGET_PROGRAMS+=apiwizz +override COMPILER_OPTIONS+=-gl +override COMPILER_UNITDIR+=. $(LAZDIR)/lcl/units $(LAZDIR)/components/units $(LAZDIR)/lcl/units/$(LCLPLATFORM) +override COMPILER_TARGETDIR+=. ifndef ECHO -ECHO:=$(strip $(wildcard $(addsuffix /gecho$(EXEEXT),$(SEARCHPATH)))) +ECHO:=$(strip $(wildcard $(addsuffix /gecho$(SRCEXEEXT),$(SEARCHPATH)))) ifeq ($(ECHO),) ECHO:=$(strip $(wildcard $(addsuffix /echo$(SRCEXEEXT),$(SEARCHPATH)))) ifeq ($(ECHO),) -ECHO:=echo -ECHOE:=echo +ECHO= else ECHO:=$(firstword $(ECHO)) -ECHOE=$(ECHO) -E endif else ECHO:=$(firstword $(ECHO)) -ECHOE=$(ECHO) -E endif endif - -# To copy pograms +export ECHO +ifndef DATE +DATE:=$(strip $(wildcard $(addsuffix /gdate$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(DATE),) +DATE:=$(strip $(wildcard $(addsuffix /date$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(DATE),) +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= +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= +else +CPPROG:=$(firstword $(CPPROG)) +endif +endif +export CPPROG +ifndef RMPROG +RMPROG:=$(strip $(wildcard $(addsuffix /rm$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(RMPROG),) +RMPROG= +else +RMPROG:=$(firstword $(RMPROG)) +endif +endif +export RMPROG +ifndef MVPROG +MVPROG:=$(strip $(wildcard $(addsuffix /mv$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(MVPROG),) +MVPROG= +else +MVPROG:=$(firstword $(MVPROG)) +endif +endif +export MVPROG +ifndef ECHOREDIR +ECHOREDIR:=$(subst /,$(PATHSEP),$(ECHO)) +endif ifndef COPY -COPY:=cp -fp +COPY:=$(CPPROG) -fp endif - -# Copy a whole tree ifndef COPYTREE -COPYTREE:=cp -rfp +COPYTREE:=$(CPPROG) -rfp endif - -# To move pograms ifndef MOVE -MOVE:=mv -f +MOVE:=$(MVPROG) -f endif - -# Check delete program ifndef DEL -DEL:=rm -f +DEL:=$(RMPROG) -f endif - -# Check deltree program ifndef DELTREE -DELTREE:=rm -rf +DELTREE:=$(RMPROG) -rf endif - -# To install files ifndef INSTALL ifdef inUnix -INSTALL:=install -c -m 644 +INSTALL:=$(GINSTALL) -c -m 644 else INSTALL:=$(COPY) endif endif - -# To install programs ifndef INSTALLEXE ifdef inUnix -INSTALLEXE:=install -c -m 755 +INSTALLEXE:=$(GINSTALL) -c -m 755 else INSTALLEXE:=$(COPY) endif endif - -# To make a directory. ifndef MKDIR -ifdef inUnix -MKDIR:=install -m 755 -d -else -MKDIR:=ginstall -m 755 -d +MKDIR:=$(GINSTALL) -m 755 -d endif -endif - -export ECHO ECHOE COPY COPYTREE MOVE DEL DELTREE INSTALL INSTALLEXE MKDIR - -##################################################################### -# Default Tools -##################################################################### - -# assembler, redefine it if cross compiling -ifndef AS -AS=as -endif - -# linker, but probably not used -ifndef LD -LD=ld -endif - -# ppas.bat / ppas.sh -PPAS=ppas$(BATCHEXT) - -# ldconfig to rebuild .so cache -ifdef inUnix -LDCONFIG=ldconfig -else -LDCONFIG= -endif - -# ppumove +export ECHOREDIR COPY COPYTREE MOVE DEL DELTREE INSTALL INSTALLEXE MKDIR ifndef PPUMOVE PPUMOVE:=$(strip $(wildcard $(addsuffix /ppumove$(SRCEXEEXT),$(SEARCHPATH)))) ifeq ($(PPUMOVE),) @@ -333,20 +246,53 @@ PPUMOVE:=$(firstword $(PPUMOVE)) endif endif export PPUMOVE - -# ppufiles -ifndef PPUFILES -PPUFILES:=$(strip $(wildcard $(addsuffix /ppufiles$(SRCEXEEXT),$(SEARCHPATH)))) -ifeq ($(PPUFILES),) -PPUFILES= +ifndef FPCMAKE +FPCMAKE:=$(strip $(wildcard $(addsuffix /fpcmake$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(FPCMAKE),) +FPCMAKE= else -PPUFILES:=$(firstword $(PPUFILES)) +FPCMAKE:=$(firstword $(FPCMAKE)) endif endif -export PPUFILES - -# Look if UPX is found for go32v2 and win32. We can't use $UPX becuase -# upx uses that one itself (PFV) +export FPCMAKE +ifndef ZIPPROG +ZIPPROG:=$(strip $(wildcard $(addsuffix /zip$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(ZIPPROG),) +ZIPPROG= +else +ZIPPROG:=$(firstword $(ZIPPROG)) +endif +endif +export ZIPPROG +ifndef TARPROG +TARPROG:=$(strip $(wildcard $(addsuffix /tar$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(TARPROG),) +TARPROG= +else +TARPROG:=$(firstword $(TARPROG)) +endif +endif +export TARPROG +ifndef AS +AS=as +endif +ifndef LD +LD=ld +endif +ifndef RC +RC=rc +endif +PPAS=ppas$(BATCHEXT) +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 @@ -366,32 +312,8 @@ UPXPROG= endif endif export UPXPROG - -# ZipProg, you can't use Zip as the var name (PFV) -ifndef ZIPPROG -ZIPPROG:=$(strip $(wildcard $(addsuffix /zip$(SRCEXEEXT),$(SEARCHPATH)))) -ifeq ($(ZIPPROG),) -ZIPPROG= -else -ZIPPROG:=$(firstword $(ZIPPROG)) -endif -endif -export ZIPPROG - ZIPOPT=-9 ZIPEXT=.zip - -# Tar -ifndef TARPROG -TARPROG:=$(strip $(wildcard $(addsuffix /tar$(SRCEXEEXT),$(SEARCHPATH)))) -ifeq ($(TARPROG),) -TARPROG= -else -TARPROG:=$(firstword $(TARPROG)) -endif -endif -export TARPROG - ifeq ($(USETAR),bz2) TAROPT=vI TAREXT=.tar.bz2 @@ -399,12 +321,6 @@ else TAROPT=vz TAREXT=.tar.gz endif - -##################################################################### -# Default extensions -##################################################################### - -# Default needed extensions (Go32v2,Linux) LOADEREXT=.as EXEEXT=.exe PPLEXT=.ppl @@ -414,10 +330,9 @@ ASMEXT=.s SMARTEXT=.sl STATICLIBEXT=.a SHAREDLIBEXT=.so +STATICLIBPREFIX=libp RSTEXT=.rst FPCMADE=fpcmade - -# Go32v1 ifeq ($(OS_TARGET),go32v1) PPUEXT=.pp1 OEXT=.o1 @@ -425,29 +340,27 @@ ASMEXT=.s1 SMARTEXT=.sl1 STATICLIBEXT=.a1 SHAREDLIBEXT=.so1 +STATICLIBPREFIX= FPCMADE=fpcmade.v1 +PACKAGESUFFIX=v1 endif - -# Go32v2 ifeq ($(OS_TARGET),go32v2) +STATICLIBPREFIX= FPCMADE=fpcmade.dos +ZIPSUFFIX=go32 endif - -# Linux ifeq ($(OS_TARGET),linux) EXEEXT= HASSHAREDLIB=1 FPCMADE=fpcmade.lnx +ZIPSUFFIX=linux endif - -# Linux ifeq ($(OS_TARGET),freebsd) EXEEXT= HASSHAREDLIB=1 FPCMADE=fpcmade.freebsd +ZIPSUFFIX=freebsd endif - -# Win32 ifeq ($(OS_TARGET),win32) PPUEXT=.ppw OEXT=.ow @@ -456,162 +369,45 @@ SMARTEXT=.slw STATICLIBEXT=.aw SHAREDLIBEXT=.dll FPCMADE=fpcmade.w32 +ZIPSUFFIX=w32 endif - -# OS/2 ifeq ($(OS_TARGET),os2) PPUEXT=.ppo ASMEXT=.so2 OEXT=.oo2 +AOUTEXT=.out SMARTEXT=.so STATICLIBEXT=.ao2 SHAREDLIBEXT=.dll FPCMADE=fpcmade.os2 +ZIPSUFFIX=emx endif - -# library prefix -LIBPREFIX=lib -ifeq ($(OS_TARGET),go32v2) -LIBPREFIX= +ifeq ($(OS_TARGET),amiga) +EXEEXT= +PPUEXT=.ppa +ASMEXT=.asm +OEXT=.o +SMARTEXT=.sl +STATICLIBEXT=.a +SHAREDLIBEXT=.library +FPCMADE=fpcmade.amg endif -ifeq ($(OS_TARGET),go32v1) -LIBPREFIX= +ifeq ($(OS_TARGET),atari) +PPUEXT=.ppt +ASMEXT=.s +OEXT=.o +SMARTEXT=.sl +STATICLIBEXT=.a +EXEEXT=.ttp +FPCMADE=fpcmade.ata endif - -# determine which .pas extension is used -ifndef PASEXT -ifdef EXEOBJECTS -override TESTPAS:=$(strip $(wildcard $(addsuffix .pas,$(firstword $(EXEOBJECTS))))) -else -override TESTPAS:=$(strip $(wildcard $(addsuffix .pas,$(firstword $(UNITOBJECTS))))) +ifdef REQUIRE_UNITSDIR +override UNITSDIR+=$(REQUIRE_UNITSDIR) endif -ifeq ($(TESTPAS),) -PASEXT=.pp -else -PASEXT=.pas +ifdef REQUIRE_PACKAGESDIR +override PACKAGESDIR+=$(REQUIRE_PACKAGESDIR) endif -endif - - -# Check if the dirs really exists, else turn it off -ifeq ($(wildcard $(UNITSDIR)),) -UNITSDIR= -endif -ifeq ($(wildcard $(TOOLKITSDIR)),) -TOOLKITSDIR= -endif -ifeq ($(wildcard $(PACKAGESDIR)),) -PACKAGESDIR= -endif -ifeq ($(wildcard $(COMPONENTSDIR)),) -COMPONENTSDIR= -endif - - -# PACKAGESDIR packages - -PACKAGERTL=1 -PACKAGEFCL=1 -PACKAGEGTK=1 - -ifdef PACKAGERTL -ifneq ($(wildcard $(FPCDIR)/rtl),) -ifneq ($(wildcard $(FPCDIR)/rtl/$(OS_TARGET)),) -PACKAGEDIR_RTL=$(FPCDIR)/rtl/$(OS_TARGET) -else -PACKAGEDIR_RTL=$(FPCDIR)/rtl -endif -ifeq ($(wildcard $(PACKAGEDIR_RTL)/$(FPCMADE)),) -override COMPILEPACKAGES+=package_rtl -package_rtl: - $(MAKE) -C $(PACKAGEDIR_RTL) all -endif -UNITDIR_RTL=$(PACKAGEDIR_RTL) -else -PACKAGEDIR_RTL= -ifneq ($(wildcard $(UNITSDIR)/rtl),) -ifneq ($(wildcard $(UNITSDIR)/rtl/$(OS_TARGET)),) -UNITDIR_RTL=$(UNITSDIR)/rtl/$(OS_TARGET) -else -UNITDIR_RTL=$(UNITSDIR)/rtl -endif -else -UNITDIR_RTL= -endif -endif -ifdef UNITDIR_RTL -override NEEDUNITDIR+=$(UNITDIR_RTL) -endif -endif -ifdef PACKAGEFCL -ifneq ($(wildcard $(FPCDIR)/fcl),) -ifneq ($(wildcard $(FPCDIR)/fcl/$(OS_TARGET)),) -PACKAGEDIR_FCL=$(FPCDIR)/fcl/$(OS_TARGET) -else -PACKAGEDIR_FCL=$(FPCDIR)/fcl -endif -ifeq ($(wildcard $(PACKAGEDIR_FCL)/$(FPCMADE)),) -override COMPILEPACKAGES+=package_fcl -package_fcl: - $(MAKE) -C $(PACKAGEDIR_FCL) all -endif -UNITDIR_FCL=$(PACKAGEDIR_FCL) -else -PACKAGEDIR_FCL= -ifneq ($(wildcard $(UNITSDIR)/fcl),) -ifneq ($(wildcard $(UNITSDIR)/fcl/$(OS_TARGET)),) -UNITDIR_FCL=$(UNITSDIR)/fcl/$(OS_TARGET) -else -UNITDIR_FCL=$(UNITSDIR)/fcl -endif -else -UNITDIR_FCL= -endif -endif -ifdef UNITDIR_FCL -override NEEDUNITDIR+=$(UNITDIR_FCL) -endif -endif -ifdef PACKAGEGTK -ifneq ($(wildcard $(PACKAGESDIR)/gtk),) -ifneq ($(wildcard $(PACKAGESDIR)/gtk/$(OS_TARGET)),) -PACKAGEDIR_GTK=$(PACKAGESDIR)/gtk/$(OS_TARGET) -else -PACKAGEDIR_GTK=$(PACKAGESDIR)/gtk -endif -ifeq ($(wildcard $(PACKAGEDIR_GTK)/$(FPCMADE)),) -override COMPILEPACKAGES+=package_gtk -package_gtk: - $(MAKE) -C $(PACKAGEDIR_GTK) all -endif -UNITDIR_GTK=$(PACKAGEDIR_GTK) -else -PACKAGEDIR_GTK= -ifneq ($(wildcard $(UNITSDIR)/gtk),) -ifneq ($(wildcard $(UNITSDIR)/gtk/$(OS_TARGET)),) -UNITDIR_GTK=$(UNITSDIR)/gtk/$(OS_TARGET) -else -UNITDIR_GTK=$(UNITSDIR)/gtk -endif -else -UNITDIR_GTK= -endif -endif -ifdef UNITDIR_GTK -override NEEDUNITDIR+=$(UNITDIR_GTK) -endif -endif - - -##################################################################### -# Default Directories -##################################################################### - -# Linux and freebsd use unix dirs with /usr/bin, /usr/lib -# When zipping use the target as default, when normal install then -# use the source os as default -ifdef ZIPNAME -# Zipinstall +ifdef ZIPINSTALL ifeq ($(OS_TARGET),linux) UNIXINSTALLDIR=1 endif @@ -619,7 +415,6 @@ ifeq ($(OS_TARGET),freebsd) UNIXINSTALLDIR=1 endif else -# Normal install ifeq ($(OS_SOURCE),linux) UNIXINSTALLDIR=1 endif @@ -627,132 +422,330 @@ ifeq ($(OS_SOURCE),freebsd) UNIXINSTALLDIR=1 endif endif - -# set the prefix directory where to install everything -ifndef PREFIXINSTALLDIR +ifndef INSTALL_PREFIX ifdef UNIXINSTALLDIR -PREFIXINSTALLDIR=/usr +INSTALL_PREFIX=/usr/local else -PREFIXINSTALLDIR=/pp +ifdef INSTALL_FPCPACKAGE +INSTALL_BASEDIR:=/pp +else +INSTALL_BASEDIR:=/$(PACKAGE_NAME) endif endif -export PREFIXINSTALLDIR - -# Where to place the resulting zip files -ifndef DESTZIPDIR -DESTZIPDIR:=$(BASEDIR) endif -export DESTZIPDIR - -##################################################################### -# Install Directories -##################################################################### - -# set the base directory where to install everything -ifndef BASEINSTALLDIR +export INSTALL_PREFIX +ifndef DIST_DESTDIR +DIST_DESTDIR:=$(BASEDIR) +endif +export DIST_DESTDIR +ifndef INSTALL_BASEDIR ifdef UNIXINSTALLDIR -BASEINSTALLDIR=$(PREFIXINSTALLDIR)/lib/lazarus/$(FPC_VERSION) +ifdef INSTALL_FPCPACKAGE +INSTALL_BASEDIR:=$(INSTALL_PREFIX)/lib/fpc/$(FPC_VERSION) else -BASEINSTALLDIR=$(PREFIXINSTALLDIR) +INSTALL_BASEDIR:=$(INSTALL_PREFIX)/lib/$(PACKAGE_NAME) +endif +else +INSTALL_BASEDIR:=$(INSTALL_PREFIX) endif endif - -# set the directory where to install the binaries -ifndef BININSTALLDIR +ifndef INSTALL_BINDIR ifdef UNIXINSTALLDIR -BININSTALLDIR=$(PREFIXINSTALLDIR)/bin +INSTALL_BINDIR:=$(INSTALL_PREFIX)/bin else -BININSTALLDIR=$(BASEINSTALLDIR)/bin/$(OS_TARGET) +INSTALL_BINDIR:=$(INSTALL_BASEDIR)/bin +ifdef INSTALL_FPCPACKAGE +INSTALL_BINDIR:=$(INSTALL_BINDIR)/$(OS_TARGET) endif endif - -# set the directory where to install the units. -ifndef UNITINSTALLDIR -UNITINSTALLDIR=$(BASEINSTALLDIR)/units/$(OS_TARGET) -ifdef UNITSUBDIR -UNITINSTALLDIR:=$(UNITINSTALLDIR)/$(UNITSUBDIR) +endif +ifndef INSTALL_UNITDIR +INSTALL_UNITDIR:=$(INSTALL_BASEDIR)/units/$(OS_TARGET) +ifdef INSTALL_FPCPACKAGE +ifdef PACKAGE_NAME +INSTALL_UNITDIR:=$(INSTALL_UNITDIR)/$(PACKAGE_NAME) endif endif - -# Where to install shared libraries -ifndef LIBINSTALLDIR +endif +ifndef INSTALL_LIBDIR ifdef UNIXINSTALLDIR -LIBINSTALLDIR=$(PREFIXINSTALLDIR)/lib +INSTALL_LIBDIR:=$(INSTALL_PREFIX)/lib else -LIBINSTALLDIR=$(UNITINSTALLDIR) +INSTALL_LIBDIR:=$(INSTALL_UNITDIR) endif endif - -# Where the source files will be stored -ifndef SOURCEINSTALLDIR +ifndef INSTALL_SOURCEDIR ifdef UNIXINSTALLDIR -SOURCEINSTALLDIR=$(PREFIXINSTALLDIR)/src/lazarus-$(FPC_VERSION) +ifdef INSTALL_FPCPACKAGE +INSTALL_SOURCEDIR:=$(INSTALL_PREFIX)/src/fpc-$(FPC_VERSION)/$(PACKAGE_NAME) else -SOURCEINSTALLDIR=$(BASEINSTALLDIR)/source +INSTALL_SOURCEDIR:=$(INSTALL_PREFIX)/src/$(PACKAGE_NAME)-$(PACKAGE_VERSION) endif -ifdef SOURCESUBDIR -SOURCEINSTALLDIR:=$(SOURCEINSTALLDIR)/$(SOURCESUBDIR) +else +ifdef INSTALL_FPCPACKAGE +INSTALL_SOURCEDIR:=$(INSTALL_BASEDIR)/source/$(PACKAGE_NAME) +else +INSTALL_SOURCEDIRL:=$(INSTALL_BASEDIR)/source endif endif - -# Where the doc files will be stored -ifndef DOCINSTALLDIR +endif +ifndef INSTALL_DOCDIR ifdef UNIXINSTALLDIR -DOCINSTALLDIR=$(PREFIXINSTALLDIR)/doc/lazarus-$(FPC_VERSION) +ifdef INSTALL_FPCPACKAGE +INSTALL_DOCDIR:=$(INSTALL_PREFIX)/doc/fpc-$(FPC_VERSION)/$(PACKAGE_NAME) else -DOCINSTALLDIR=$(BASEINSTALLDIR)/doc +INSTALL_DOCDIR:=$(INSTALL_PREFIX)/doc/$(PACKAGE_NAME)-$(PACKAGE_VERSION) +endif +else +ifdef INSTALL_FPCPACKAGE +INSTALL_DOCDIR:=$(INSTALL_BASEDIR)/doc/$(PACKAGE_NAME) +else +INSTALL_DOCDIR:=$(INSTALL_BASEDIR)/doc endif endif - -# Where to install the examples, under linux we use the doc dir -# because the copytree command will create a subdir itself -ifndef EXAMPLEINSTALLDIR +endif +ifndef INSTALL_EXAMPLEDIR ifdef UNIXINSTALLDIR -EXAMPLEINSTALLDIR=$(DOCINSTALLDIR)/examples +ifdef INSTALL_FPCPACKAGE +INSTALL_EXAMPLEDIR:=$(INSTALL_PREFIX)/doc/fpc-$(FPC_VERSION)/examples/$(PACKAGE_NAME) else -EXAMPLEINSTALLDIR=$(BASEINSTALLDIR)/examples +INSTALL_EXAMPLEDIR:=$(INSTALL_PREFIX)/doc/$(PACKAGE_NAME)-$(PACKAGE_VERSION) endif -ifdef EXAMPLESUBDIR -EXAMPLEINSTALLDIR:=$(EXAMPLEINSTALLDIR)/$(EXAMPLESUBDIR) +else +ifdef INSTALL_FPCPACKAGE +INSTALL_EXAMPLEDIR:=$(INSTALL_BASEDIR)/examples/$(PACKAGE_NAME) +else +INSTALL_EXAMPLEDIR:=$(INSTALL_BASEDIR)/examples endif endif - -# Where the some extra (data)files will be stored -ifndef DATAINSTALLDIR -DATAINSTALLDIR=$(BASEINSTALLDIR) endif - -##################################################################### -# Redirection -##################################################################### - -ifndef REDIRFILE -REDIRFILE=log +ifndef INSTALL_DATADIR +INSTALL_DATADIR=$(INSTALL_BASEDIR) endif - -ifdef REDIR -ifndef inUnix -override FPC=redir -eo $(FPC) +ifdef inUnix +ifndef GCCLIBDIR +GCCLIBDIR:=$(shell dirname `(gcc -v 2>&1)| head -n 1| awk '{ print $$4 } '`) endif -# set the verbosity to max -override FPCOPT+=-va -override REDIR:= >> $(REDIRFILE) +ifndef OTHERLIBDIR +OTHERLIBDIR:=$(shell grep -v "^\#" /etc/ld.so.conf | awk '{ ORS=" "; print $1 }') endif - - -##################################################################### -# Compiler Command Line -##################################################################### - -# Load commandline OPTDEF and add FPC_CPU define -override FPCOPTDEF:=-d$(CPU_TARGET) - -# Load commandline OPT and add target and unit dir to be sure +export GCCLIBDIR OTHERLIB +endif +ifeq ($(OS_TARGET),linux) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_PASZLIB=1 +REQUIRE_PACKAGES_INET=1 +REQUIRE_PACKAGES_FCL=1 +REQUIRE_PACKAGES_MYSQL=1 +REQUIRE_PACKAGES_IBASE=1 +endif +ifeq ($(OS_TARGET),go32v2) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_PASZLIB=1 +REQUIRE_PACKAGES_FCL=1 +endif +ifeq ($(OS_TARGET),win32) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_PASZLIB=1 +REQUIRE_PACKAGES_FCL=1 +REQUIRE_PACKAGES_MYSQL=1 +REQUIRE_PACKAGES_IBASE=1 +endif +ifeq ($(OS_TARGET),os2) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_PASZLIB=1 +REQUIRE_PACKAGES_FCL=1 +endif +ifeq ($(OS_TARGET),freebsd) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_PASZLIB=1 +REQUIRE_PACKAGES_INET=1 +REQUIRE_PACKAGES_FCL=1 +REQUIRE_PACKAGES_MYSQL=1 +REQUIRE_PACKAGES_IBASE=1 +endif +ifeq ($(OS_TARGET),beos) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_PASZLIB=1 +REQUIRE_PACKAGES_FCL=1 +endif +ifeq ($(OS_TARGET),amiga) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_PASZLIB=1 +REQUIRE_PACKAGES_FCL=1 +endif +ifeq ($(OS_TARGET),atari) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_PASZLIB=1 +REQUIRE_PACKAGES_FCL=1 +endif +ifdef REQUIRE_PACKAGES_RTL +PACKAGEDIR_RTL:=$(subst /Makefile.fpc,,$(strip $(wildcard $(addsuffix /rtl/Makefile.fpc,$(PACKAGESDIR))))) +ifneq ($(PACKAGEDIR_RTL),) +PACKAGEDIR_RTL:=$(firstword $(PACKAGEDIR_RTL)) +ifeq ($(wildcard $(PACKAGEDIR_RTL)/$(FPCMADE)),) +override COMPILEPACKAGES+=package_rtl +package_rtl: + $(MAKE) -C $(PACKAGEDIR_RTL) all +endif +ifneq ($(wildcard $(PACKAGEDIR_RTL)/$(OS_TARGET)),) +UNITDIR_RTL=$(PACKAGEDIR_RTL)/$(OS_TARGET) +else +UNITDIR_RTL=$(PACKAGEDIR_RTL) +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_PASZLIB +PACKAGEDIR_PASZLIB:=$(subst /Makefile.fpc,,$(strip $(wildcard $(addsuffix /paszlib/Makefile.fpc,$(PACKAGESDIR))))) +ifneq ($(PACKAGEDIR_PASZLIB),) +PACKAGEDIR_PASZLIB:=$(firstword $(PACKAGEDIR_PASZLIB)) +ifeq ($(wildcard $(PACKAGEDIR_PASZLIB)/$(FPCMADE)),) +override COMPILEPACKAGES+=package_paszlib +package_paszlib: + $(MAKE) -C $(PACKAGEDIR_PASZLIB) all +endif +ifneq ($(wildcard $(PACKAGEDIR_PASZLIB)/$(OS_TARGET)),) +UNITDIR_PASZLIB=$(PACKAGEDIR_PASZLIB)/$(OS_TARGET) +else +UNITDIR_PASZLIB=$(PACKAGEDIR_PASZLIB) +endif +else +PACKAGEDIR_PASZLIB= +UNITDIR_PASZLIB:=$(subst /Package.fpc,,$(strip $(wildcard $(addsuffix /paszlib/Package.fpc,$(UNITSDIR))))) +ifneq ($(UNITDIR_PASZLIB),) +UNITDIR_PASZLIB:=$(firstword $(UNITDIR_PASZLIB)) +else +UNITDIR_PASZLIB= +endif +endif +ifdef UNITDIR_PASZLIB +override COMPILER_UNITDIR+=$(UNITDIR_PASZLIB) +endif +endif +ifdef REQUIRE_PACKAGES_INET +PACKAGEDIR_INET:=$(subst /Makefile.fpc,,$(strip $(wildcard $(addsuffix /inet/Makefile.fpc,$(PACKAGESDIR))))) +ifneq ($(PACKAGEDIR_INET),) +PACKAGEDIR_INET:=$(firstword $(PACKAGEDIR_INET)) +ifeq ($(wildcard $(PACKAGEDIR_INET)/$(FPCMADE)),) +override COMPILEPACKAGES+=package_inet +package_inet: + $(MAKE) -C $(PACKAGEDIR_INET) all +endif +ifneq ($(wildcard $(PACKAGEDIR_INET)/$(OS_TARGET)),) +UNITDIR_INET=$(PACKAGEDIR_INET)/$(OS_TARGET) +else +UNITDIR_INET=$(PACKAGEDIR_INET) +endif +else +PACKAGEDIR_INET= +UNITDIR_INET:=$(subst /Package.fpc,,$(strip $(wildcard $(addsuffix /inet/Package.fpc,$(UNITSDIR))))) +ifneq ($(UNITDIR_INET),) +UNITDIR_INET:=$(firstword $(UNITDIR_INET)) +else +UNITDIR_INET= +endif +endif +ifdef UNITDIR_INET +override COMPILER_UNITDIR+=$(UNITDIR_INET) +endif +endif +ifdef REQUIRE_PACKAGES_FCL +PACKAGEDIR_FCL:=$(subst /Makefile.fpc,,$(strip $(wildcard $(addsuffix /fcl/Makefile.fpc,$(PACKAGESDIR))))) +ifneq ($(PACKAGEDIR_FCL),) +PACKAGEDIR_FCL:=$(firstword $(PACKAGEDIR_FCL)) +ifeq ($(wildcard $(PACKAGEDIR_FCL)/$(FPCMADE)),) +override COMPILEPACKAGES+=package_fcl +package_fcl: + $(MAKE) -C $(PACKAGEDIR_FCL) all +endif +ifneq ($(wildcard $(PACKAGEDIR_FCL)/$(OS_TARGET)),) +UNITDIR_FCL=$(PACKAGEDIR_FCL)/$(OS_TARGET) +else +UNITDIR_FCL=$(PACKAGEDIR_FCL) +endif +else +PACKAGEDIR_FCL= +UNITDIR_FCL:=$(subst /Package.fpc,,$(strip $(wildcard $(addsuffix /fcl/Package.fpc,$(UNITSDIR))))) +ifneq ($(UNITDIR_FCL),) +UNITDIR_FCL:=$(firstword $(UNITDIR_FCL)) +else +UNITDIR_FCL= +endif +endif +ifdef UNITDIR_FCL +override COMPILER_UNITDIR+=$(UNITDIR_FCL) +endif +endif +ifdef REQUIRE_PACKAGES_MYSQL +PACKAGEDIR_MYSQL:=$(subst /Makefile.fpc,,$(strip $(wildcard $(addsuffix /mysql/Makefile.fpc,$(PACKAGESDIR))))) +ifneq ($(PACKAGEDIR_MYSQL),) +PACKAGEDIR_MYSQL:=$(firstword $(PACKAGEDIR_MYSQL)) +ifeq ($(wildcard $(PACKAGEDIR_MYSQL)/$(FPCMADE)),) +override COMPILEPACKAGES+=package_mysql +package_mysql: + $(MAKE) -C $(PACKAGEDIR_MYSQL) all +endif +ifneq ($(wildcard $(PACKAGEDIR_MYSQL)/$(OS_TARGET)),) +UNITDIR_MYSQL=$(PACKAGEDIR_MYSQL)/$(OS_TARGET) +else +UNITDIR_MYSQL=$(PACKAGEDIR_MYSQL) +endif +else +PACKAGEDIR_MYSQL= +UNITDIR_MYSQL:=$(subst /Package.fpc,,$(strip $(wildcard $(addsuffix /mysql/Package.fpc,$(UNITSDIR))))) +ifneq ($(UNITDIR_MYSQL),) +UNITDIR_MYSQL:=$(firstword $(UNITDIR_MYSQL)) +else +UNITDIR_MYSQL= +endif +endif +ifdef UNITDIR_MYSQL +override COMPILER_UNITDIR+=$(UNITDIR_MYSQL) +endif +endif +ifdef REQUIRE_PACKAGES_IBASE +PACKAGEDIR_IBASE:=$(subst /Makefile.fpc,,$(strip $(wildcard $(addsuffix /ibase/Makefile.fpc,$(PACKAGESDIR))))) +ifneq ($(PACKAGEDIR_IBASE),) +PACKAGEDIR_IBASE:=$(firstword $(PACKAGEDIR_IBASE)) +ifeq ($(wildcard $(PACKAGEDIR_IBASE)/$(FPCMADE)),) +override COMPILEPACKAGES+=package_ibase +package_ibase: + $(MAKE) -C $(PACKAGEDIR_IBASE) all +endif +ifneq ($(wildcard $(PACKAGEDIR_IBASE)/$(OS_TARGET)),) +UNITDIR_IBASE=$(PACKAGEDIR_IBASE)/$(OS_TARGET) +else +UNITDIR_IBASE=$(PACKAGEDIR_IBASE) +endif +else +PACKAGEDIR_IBASE= +UNITDIR_IBASE:=$(subst /Package.fpc,,$(strip $(wildcard $(addsuffix /ibase/Package.fpc,$(UNITSDIR))))) +ifneq ($(UNITDIR_IBASE),) +UNITDIR_IBASE:=$(firstword $(UNITDIR_IBASE)) +else +UNITDIR_IBASE= +endif +endif +ifdef UNITDIR_IBASE +override COMPILER_UNITDIR+=$(UNITDIR_IBASE) +endif +endif +.PHONY: package_rtl package_paszlib package_inet package_fcl package_mysql package_ibase +override FPCOPTDEF=$(CPU_TARGET) ifneq ($(OS_TARGET),$(OS_SOURCE)) override FPCOPT+=-T$(OS_TARGET) endif - -# User dirs should be first, so they are looked at first ifdef UNITDIR override FPCOPT+=$(addprefix -Fu,$(UNITDIR)) endif @@ -765,110 +758,86 @@ endif ifdef INCDIR override FPCOPT+=$(addprefix -Fi,$(INCDIR)) endif - -# Smartlinking ifdef LINKSMART override FPCOPT+=-XX endif - -# Smartlinking creation ifdef CREATESMART override FPCOPT+=-CX endif - -# Debug ifdef DEBUG -override FPCOPT+=-gl -dDEBUG +override FPCOPT+=-gl +override FPCOPTDEF+=DEBUG endif - -# Release mode (strip, optimize and don't load ppc386.cfg) -# 0.99.12b has a bug in the optimizer so don't use it by default ifdef RELEASE -ifeq ($(FPC_VERSION),0.99.12) -override FPCOPT+=-Xs -OGp3 -n -else override FPCOPT+=-Xs -OG2p3 -n +override FPCOPTDEF+=RELEASE endif -endif - -# Strip ifdef STRIP override FPCOPT+=-Xs endif - -# Optimizer ifdef OPTIMIZE override FPCOPT+=-OG2p3 endif - -# Verbose settings (warning,note,info) ifdef VERBOSE override FPCOPT+=-vwni endif - -ifdef NEEDUNITDIR -override FPCOPT+=$(addprefix -Fu,$(NEEDUNITDIR)) +ifdef COMPILER_OPTIONS +override FPCOPT+=$(COMPILER_OPTIONS) endif - -ifdef UNITSDIR -override FPCOPT+=-Fu$(UNITSDIR) +ifdef COMPILER_UNITDIR +override FPCOPT+=$(addprefix -Fu,$(COMPILER_UNITDIR)) endif - -# Target dirs and the prefix to use for clean/install -ifdef TARGETDIR -override FPCOPT+=-FE$(TARGETDIR) -ifeq ($(TARGETDIR),.) +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 COMPILER_TARGETDIR +override FPCOPT+=-FE$(COMPILER_TARGETDIR) +ifeq ($(COMPILER_TARGETDIR),.) override TARGETDIRPREFIX= else -override TARGETDIRPREFIX=$(TARGETDIR)/ +override TARGETDIRPREFIX=$(COMPILER_TARGETDIR)/ endif endif -ifdef UNITTARGETDIR -override FPCOPT+=-FU$(UNITTARGETDIR) -ifeq ($(UNITTARGETDIR),.) +ifdef COMPILER_UNITTARGETDIR +override FPCOPT+=-FU$(COMPILER_UNITTARGETDIR) +ifeq ($(COMPILER_UNITTARGETDIR),.) override UNITTARGETDIRPREFIX= else -override UNITTARGETDIRPREFIX=$(UNITTARGETDIR)/ +override UNITTARGETDIRPREFIX=$(COMPILER_UNITTARGETDIR)/ endif else -ifdef TARGETDIR -override UNITTARGETDIR=$(TARGETDIR) +ifdef COMPILER_TARGETDIR +override COMPILER_UNITTARGETDIR=$(COMPILER_TARGETDIR) override UNITTARGETDIRPREFIX=$(TARGETDIRPREFIX) endif endif - -# Add commandline options last so they can override +ifdef GCCLIBDIR +override FPCOPT+=-Fl$(GCCLIBDIR) +endif +ifdef OTHERLIBDIR +override FPCOPT+=$(addprefix -Fl,$(OTHERLIBDIR)) +endif ifdef OPT override FPCOPT+=$(OPT) endif - -# Add defines from FPCOPTDEF to FPCOPT ifdef FPCOPTDEF -override FPCOPT+=$(FPCOPTDEF) +override FPCOPT+=$(addprefix -d,$(FPCOPTDEF)) endif - -# Error file ? -ifdef ERRORFILE -override FPCOPT+=-Fr$(ERRORFILE) -endif - -# Was a config file specified ? ifdef CFGFILE override FPCOPT+=@$(CFGFILE) endif - -# For win32 the options are passed using the environment FPCEXTCMD -ifeq ($(OS_SOURCE),win32) +ifdef USEENV override FPCEXTCMD:=$(FPCOPT) override FPCOPT:=!FPCEXTCMD export FPCEXTCMD endif - -# Compiler commandline override COMPILER:=$(FPC) $(FPCOPT) - -# also call ppas if with command option -s -# but only if the OS_SOURCE and OS_TARGE are equal ifeq (,$(findstring -s ,$(COMPILER))) EXECPPAS= else @@ -876,313 +845,169 @@ ifeq ($(OS_SOURCE),$(OS_TARGET)) EXECPPAS:=@$(PPAS) endif endif - -##################################################################### -# Standard rules -##################################################################### - -debug: fpc_debug - -smart: fpc_smart - -shared: fpc_shared - -showinstall: fpc_showinstall - -install: fpc_install - -sourceinstall: fpc_sourceinstall - -exampleinstall: fpc_exampleinstall - -zipinstall: fpc_zipinstall - -zipsourceinstall: fpc_zipsourceinstall - -zipexampleinstall: fpc_zipexampleinstall - -clean: fpc_clean - -distclean: fpc_distclean - -cleanall: fpc_cleanall - -info: fpc_info - -.PHONY: debug smart shared showinstall install sourceinstall exampleinstall zipinstall zipsourceinstall zipexampleinstall clean distclean cleanall info - -##################################################################### -# Exes -##################################################################### - .PHONY: fpc_exes - -ifdef EXEOBJECTS -override EXEFILES=$(addsuffix $(EXEEXT),$(EXEOBJECTS)) -override EXEOFILES:=$(addsuffix $(OEXT),$(EXEOBJECTS)) $(addprefix $(LIBPREFIX),$(addsuffix $(STATICLIBEXT),$(EXEOBJECTS))) - +ifdef TARGET_PROGRAMS +override EXEFILES=$(addsuffix $(EXEEXT),$(TARGET_PROGRAMS)) +override EXEOFILES:=$(addsuffix $(OEXT),$(TARGET_PROGRAMS)) $(addprefix $(STATICLIBPREFIX),$(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 endif - fpc_exes: $(EXEFILES) - -##################################################################### -# General compile rules -##################################################################### - -.PHONY: fpc_packages fpc_all fpc_debug - +ifdef TARGET_RSTS +override RSTFILES=$(addsuffix $(RSTEXT),$(TARGET_RSTS)) +override CLEANRSTFILES+=$(RSTFILES) +endif +.PHONY: fpc_packages fpc_all fpc_smart fpc_debug $(FPCMADE): $(ALLTARGET) - @$(ECHO) Compiled > $(FPCMADE) - + @$(ECHOREDIR) Compiled > $(FPCMADE) fpc_packages: $(COMPILEPACKAGES) - fpc_all: fpc_packages $(FPCMADE) - -fpc_debug: - $(MAKE) all DEBUG=1 - -# Search paths for .ppu if targetdir is set -ifdef UNITTARGETDIR -vpath %$(PPUEXT) $(UNITTARGETDIR) -endif - -# General compile rules, available for both possible PASEXT - -.SUFFIXES: $(EXEEXT) $(PPUEXT) $(OEXT) .pas .pp - -%$(PPUEXT): %.pp - $(COMPILER) $< $(REDIR) - $(EXECPPAS) - -%$(PPUEXT): %.pas - $(COMPILER) $< $(REDIR) - $(EXECPPAS) - -%$(EXEEXT): %.pp - $(COMPILER) $< $(REDIR) - $(EXECPPAS) - -%$(EXEEXT): %.pas - $(COMPILER) $< $(REDIR) - $(EXECPPAS) - -##################################################################### -# Library -##################################################################### - -.PHONY: fpc_smart fpc_shared - -ifdef LIBVERSION -LIBFULLNAME=$(LIBNAME).$(LIBVERSION) -else -LIBFULLNAME=$(LIBNAME) -endif - -# Default sharedlib units are all unit objects -ifndef SHAREDLIBUNITOBJECTS -SHAREDLIBUNITOBJECTS:=$(UNITOBJECTS) -endif - fpc_smart: $(MAKE) all LINKSMART=1 CREATESMART=1 - -fpc_shared: all -ifdef HASSHAREDLIB -ifndef LIBNAME - @$(ECHO) "LIBNAME not set" -else - $(PPUMOVE) $(SHAREDLIBUNITOBJECTS) -o$(LIBFULLNAME) +fpc_debug: + $(MAKE) all DEBUG=1 +.SUFFIXES: $(EXEEXT) $(PPUEXT) $(OEXT) .pas .pp +%$(PPUEXT): %.pp + $(COMPILER) $< + $(EXECPPAS) +%$(PPUEXT): %.pas + $(COMPILER) $< + $(EXECPPAS) +%$(EXEEXT): %.pp + $(COMPILER) $< + $(EXECPPAS) +%$(EXEEXT): %.pas + $(COMPILER) $< + $(EXECPPAS) +vpath %.pp $(COMPILER_SOURCEDIR) $(COMPILER_INCLUDEDIR) +vpath %.pas $(COMPILER_SOURCEDIR) $(COMPILER_INCLUDEDIR) +vpath %$(PPUEXT) $(COMPILER_UNITTARGETDIR) +.PHONY: fpc_install fpc_sourceinstall fpc_exampleinstall +ifdef INSTALL_UNITS +override INSTALLPPUFILES+=$(addsuffix $(PPUEXT),$(INSTALL_UNITS)) endif -else - @$(ECHO) "Shared Libraries not supported" -endif - -##################################################################### -# Install rules -##################################################################### - -.PHONY: fpc_showinstall fpc_install - -ifdef EXTRAINSTALLUNITS -override INSTALLPPUFILES+=$(addsuffix $(PPUEXT),$(EXTRAINSTALLUNITS)) -endif - ifdef INSTALLPPUFILES +override INSTALLPPULINKFILES:=$(subst $(PPUEXT),$(OEXT),$(INSTALLPPUFILES)) $(addprefix $(STATICLIBPREFIX),$(subst $(PPUEXT),$(STATICLIBEXT),$(INSTALLPPUFILES))) override INSTALLPPUFILES:=$(addprefix $(UNITTARGETDIRPREFIX),$(INSTALLPPUFILES)) -ifdef PPUFILES -INSTALLPPULINKFILES:=$(addprefix $(UNITTARGETDIRPREFIX),$(shell $(PPUFILES) -S -O $(INSTALLPPUFILES))) -else -INSTALLPPULINKFILES:=$(wildcard $(subst $(PPUEXT),$(OEXT),$(INSTALLPPUFILES)) $(addprefix $(LIBPREFIX),$(subst $(PPUEXT),$(STATICLIBEXT),$(INSTALLPPUFILES)))) +override INSTALLPPULINKFILES:=$(wildcard $(addprefix $(UNITTARGETDIRPREFIX),$(INSTALLPPULINKFILES))) +override INSTALL_CREATEPACKAGEFPC=1 endif -# MWE: not here UNITTARGETDIRPREFIX is already added when no PPUFILES -# override INSTALLPPULINKFILES:=$(addprefix $(UNITTARGETDIRPREFIX),$(INSTALLPPULINKFILES)) -endif - ifdef INSTALLEXEFILES override INSTALLEXEFILES:=$(addprefix $(TARGETDIRPREFIX),$(INSTALLEXEFILES)) endif - -fpc_showinstall: $(SHOWINSTALLTARGET) -ifdef INSTALLEXEFILES - @$(ECHO) -e $(addprefix "\n"$(BININSTALLDIR)/,$(INSTALLEXEFILES)) -endif -ifdef INSTALLPPUFILES - @$(ECHO) -e $(addprefix "\n"$(UNITINSTALLDIR)/,$(INSTALLPPUFILES)) -ifneq ($(INSTALLPPULINKFILES),) - @$(ECHO) -e $(addprefix "\n"$(UNITINSTALLDIR)/,$(INSTALLPPULINKFILES)) -endif -ifneq ($(wildcard $(LIBFULLNAME)),) - @$(ECHO) $(LIBINSTALLDIR)/$(LIBFULLNAME) -ifdef HASSHAREDLIB - @$(ECHO) $(LIBINSTALLDIR)/$(LIBNAME) -endif -endif -endif -ifdef EXTRAINSTALLFILES - @$(ECHO) -e $(addprefix "\n"$(DATAINSTALLDIR)/,$(EXTRAINSTALLFILES)) -endif - fpc_install: $(INSTALLTARGET) -# Create UnitInstallFiles ifdef INSTALLEXEFILES - $(MKDIR) $(BININSTALLDIR) -# Compress the exes if upx is defined + $(MKDIR) $(INSTALL_BINDIR) ifdef UPXPROG -$(UPXPROG) $(INSTALLEXEFILES) endif - $(INSTALLEXE) $(INSTALLEXEFILES) $(BININSTALLDIR) + $(INSTALLEXE) $(INSTALLEXEFILES) $(INSTALL_BINDIR) +endif +ifdef INSTALL_CREATEPACKAGEFPC +ifdef FPCMAKE +ifdef PACKAGE_VERSION +ifneq ($(wildcard Makefile.fpc),) + $(FPCMAKE) -p Makefile.fpc + $(MKDIR) $(INSTALL_UNITDIR) + $(INSTALL) Package.fpc $(INSTALL_UNITDIR) +endif +endif +endif endif ifdef INSTALLPPUFILES - $(MKDIR) $(UNITINSTALLDIR) - $(INSTALL) $(INSTALLPPUFILES) $(UNITINSTALLDIR) + $(MKDIR) $(INSTALL_UNITDIR) + $(INSTALL) $(INSTALLPPUFILES) $(INSTALL_UNITDIR) ifneq ($(INSTALLPPULINKFILES),) - $(INSTALL) $(INSTALLPPULINKFILES) $(UNITINSTALLDIR) + $(INSTALL) $(INSTALLPPULINKFILES) $(INSTALL_UNITDIR) endif -ifneq ($(wildcard $(LIBFULLNAME)),) - $(MKDIR) $(LIBINSTALLDIR) - $(INSTALL) $(LIBFULLNAME) $(LIBINSTALLDIR) +ifneq ($(wildcard $(LIB_FULLNAME)),) + $(MKDIR) $(INSTALL_LIBDIR) + $(INSTALL) $(LIB_FULLNAME) $(INSTALL_LIBDIR) ifdef inUnix - ln -sf $(LIBFULLNAME) $(LIBINSTALLDIR)/$(LIBNAME) + ln -sf $(LIB_FULLNAME) $(INSTALL_LIBDIR)/$(LIB_NAME) endif endif endif -ifdef EXTRAINSTALLFILES - $(MKDIR) $(DATAINSTALLDIR) - $(INSTALL) $(EXTRAINSTALLFILES) $(DATAINSTALLDIR) +ifdef INSTALL_FILES + $(MKDIR) $(INSTALL_DATADIR) + $(INSTALL) $(INSTALL_FILES) $(INSTALL_DATADIR) endif - -##################################################################### -# SourceInstall rules -##################################################################### - -.PHONY: fpc_sourceinstall - -ifndef SOURCETOPDIR -SOURCETOPDIR=$(BASEDIR) +fpc_sourceinstall: distclean + $(MKDIR) $(INSTALL_SOURCEDIR) + $(COPYTREE) $(BASEDIR) $(INSTALL_SOURCEDIR) +fpc_exampleinstall: $(addsuffix _distclean,$(TARGET_EXAMPLEDIRS)) +ifdef HASEXAMPLES + $(MKDIR) $(INSTALL_EXAMPLEDIR) endif - -fpc_sourceinstall: clean - $(MKDIR) $(SOURCEINSTALLDIR) - $(COPYTREE) $(SOURCETOPDIR) $(SOURCEINSTALLDIR) - -##################################################################### -# exampleinstall rules -##################################################################### - -.PHONY: fpc_exampleinstall - -fpc_exampleinstall: $(addsuffix _clean,$(EXAMPLEDIROBJECTS)) ifdef EXAMPLESOURCEFILES - $(MKDIR) $(EXAMPLEINSTALLDIR) - $(COPY) $(EXAMPLESOURCEFILES) $(EXAMPLEINSTALLDIR) + $(COPY) $(EXAMPLESOURCEFILES) $(INSTALL_EXAMPLEDIR) endif -ifdef EXAMPLEDIROBJECTS -ifndef EXAMPLESOURCEFILES - $(MKDIR) $(EXAMPLEINSTALLDIR) +ifdef TARGET_EXAMPLEDIRS + $(COPYTREE) $(addsuffix /*,$(TARGET_EXAMPLEDIRS)) $(INSTALL_EXAMPLEDIR) endif - $(COPYTREE) $(addsuffix /*,$(EXAMPLEDIROBJECTS)) $(EXAMPLEINSTALLDIR) -endif - -##################################################################### -# Zip -##################################################################### - -.PHONY: fpc_zipinstall - -# Create suffix to add -ifndef PACKAGESUFFIX -PACKAGESUFFIX=$(OS_TARGET) -ifeq ($(OS_TARGET),go32v2) -PACKAGESUFFIX=go32 -endif -ifeq ($(OS_TARGET),win32) -PACKAGESUFFIX=w32 -endif -ifeq ($(OS_TARGET),os2) -PACKAGESUFFIX=emx -endif -endif - -# Temporary path to pack a file +.PHONY: fpc_distinstall +fpc_distinstall: install exampleinstall +.PHONY: fpc_zipinstall fpc_zipsourceinstall fpc_zipexampleinstall ifndef PACKDIR ifndef inUnix -PACKDIR=$(BASEDIR)/pack_tmp +PACKDIR=$(BASEDIR)/../fpc-pack else -PACKDIR=/tmp/lazarus-pack +PACKDIR=/tmp/fpc-pack endif endif - -# Maybe create default zipname from packagename ifndef ZIPNAME -ifdef PACKAGENAME -ZIPNAME=$(PACKAGEPREFIX)$(PACKAGENAME)$(PACKAGESUFFIX) +ifdef DIST_ZIPNAME +ZIPNAME=$(DIST_ZIPNAME) +else +ZIPNAME=$(ZIPPREFIX)$(PACKAGE_NAME)$(ZIPSUFFIX) +endif +endif +ifndef ZIPTARGET +ifdef DIST_ZIPTARGET +ZIPTARGET=DIST_ZIPTARGET +else +ZIPTARGET=install endif endif - -# Use tar by default under linux ifndef USEZIP ifdef inUnix USETAR=1 endif endif - -# Use a wrapper script by default for OS/2 -ifdef inOS2 +ifndef inUnix USEZIPWRAPPER=1 endif - -# Create commands to create the zip/tar file -ZIPWRAPPER=$(DESTZIPDIR)/fpczip$(BATCHEXT) -ZIPCMD_CDPACK:=cd $(subst /,$(PATHSEP),$(PACKDIR)) -ZIPCMD_CDBASE:=cd $(subst /,$(PATHSEP),$(BASEDIR)) +ifdef USEZIPWRAPPER +ZIPPATHSEP=$(PATHSEP) +ZIPWRAPPER=$(subst /,$(PATHSEP),$(DIST_DESTDIR)/fpczip$(BATCHEXT)) +else +ZIPPATHSEP=/ +endif +ZIPCMD_CDPACK:=cd $(subst /,$(ZIPPATHSEP),$(PACKDIR)) +ZIPCMD_CDBASE:=cd $(subst /,$(ZIPPATHSEP),$(BASEDIR)) ifdef USETAR -ZIPDESTFILE:=$(DESTZIPDIR)/$(ZIPNAME)$(TAREXT) +ZIPDESTFILE:=$(DIST_DESTDIR)/$(ZIPNAME)$(TAREXT) ZIPCMD_ZIP:=$(TARPROG) cf$(TAROPT) $(ZIPDESTFILE) * else -ZIPDESTFILE:=$(DESTZIPDIR)/$(ZIPNAME)$(ZIPEXT) -ZIPCMD_ZIP:=$(subst /,$(PATHSEP),$(ZIPPROG)) -Dr $(ZIPOPT) $(ZIPDESTFILE) * +ZIPDESTFILE:=$(DIST_DESTDIR)/$(ZIPNAME)$(ZIPEXT) +ZIPCMD_ZIP:=$(subst /,$(ZIPPATHSEP),$(ZIPPROG)) -Dr $(ZIPOPT) $(ZIPDESTFILE) * endif - fpc_zipinstall: -ifndef ZIPNAME - @$(ECHO) "Please specify ZIPNAME!" - @exit 1 -else - $(MAKE) $(ZIPTARGET) PREFIXINSTALLDIR=$(PACKDIR) + $(MAKE) $(ZIPTARGET) INSTALL_PREFIX=$(PACKDIR) ZIPINSTALL=1 $(DEL) $(ZIPDESTFILE) ifdef USEZIPWRAPPER -ifneq ($(ECHO),echo) - $(ECHO) "$(ZIPCMD_CDPACK)" > $(ZIPWRAPPER) - $(ECHO) "$(ZIPCMD_ZIP)" >> $(ZIPWRAPPER) - $(ECHO) "$(ZIPCMD_CDBASE)" >> $(ZIPWRAPPER) +ifneq ($(ECHOREDIR),echo) + $(ECHOREDIR) -e "$(subst \,\\,$(ZIPCMD_CDPACK))" > $(ZIPWRAPPER) + $(ECHOREDIR) -e "$(subst \,\\,$(ZIPCMD_ZIP))" >> $(ZIPWRAPPER) + $(ECHOREDIR) -e "$(subst \,\\,$(ZIPCMD_CDBASE))" >> $(ZIPWRAPPER) else - $(ECHO) $(ZIPCMD_CDPACK) > $(ZIPWRAPPER) - $(ECHO) $(ZIPCMD_ZIP) >> $(ZIPWRAPPER) - $(ECHO) $(ZIPCMD_CDBASE) >> $(ZIPWRAPPER) + echo $(ZIPCMD_CDPACK) > $(ZIPWRAPPER) + echo $(ZIPCMD_ZIP) >> $(ZIPWRAPPER) + echo $(ZIPCMD_CDBASE) >> $(ZIPWRAPPER) endif ifdef inUnix /bin/sh $(ZIPWRAPPER) @@ -1194,44 +1019,26 @@ else $(ZIPCMD_CDPACK) ; $(ZIPCMD_ZIP) ; $(ZIPCMD_CDBASE) endif $(DELTREE) $(PACKDIR) -endif - -.PHONY: fpc_zipsourceinstall - fpc_zipsourceinstall: - $(MAKE) fpc_zipinstall ZIPTARGET=sourceinstall PACKAGESUFFIX=src - -.PHONY: fpc_zipexampleinstall - + $(MAKE) fpc_zipinstall ZIPTARGET=sourceinstall ZIPSUFFIX=src fpc_zipexampleinstall: - $(MAKE) fpc_zipinstall ZIPTARGET=exampleinstall PACKAGESUFFIX=exm - -##################################################################### -# Clean rules -##################################################################### - +ifdef HASEXAMPLES + $(MAKE) fpc_zipinstall ZIPTARGET=exampleinstall ZIPSUFFIX=exm +endif +fpc_zipdistinstall: + $(MAKE) fpc_zipinstall ZIPTARGET=distinstall .PHONY: fpc_clean fpc_cleanall fpc_distclean - ifdef EXEFILES override CLEANEXEFILES:=$(addprefix $(TARGETDIRPREFIX),$(CLEANEXEFILES)) endif - -ifdef EXTRACLEANUNITS -override CLEANPPUFILES+=$(addsuffix $(PPUEXT),$(EXTRACLEANUNITS)) +ifdef CLEAN_UNITS +override CLEANPPUFILES+=$(addsuffix $(PPUEXT),$(CLEAN_UNITS)) endif - ifdef CLEANPPUFILES +override CLEANPPULINKFILES:=$(subst $(PPUEXT),$(OEXT),$(CLEANPPUFILES)) $(addprefix $(STATICLIBPREFIX),$(subst $(PPUEXT),$(STATICLIBEXT),$(CLEANPPUFILES))) override CLEANPPUFILES:=$(addprefix $(UNITTARGETDIRPREFIX),$(CLEANPPUFILES)) -# Get the .o and .a files created for the units -ifdef PPUFILES -CLEANPPULINKFILES:=$(addprefix $(UNITTARGETDIRPREFIX),$(shell $(PPUFILES) $(CLEANPPUFILES))) -else -CLEANPPULINKFILES:=$(wildcard $(subst $(PPUEXT),$(OEXT),$(CLEANPPUFILES)) $(addprefix $(LIBPREFIX),$(subst $(PPUEXT),$(STATICLIBEXT),$(CLEANPPUFILES)))) +override CLEANPPULINKFILES:=$(wildcard $(addprefix $(UNITTARGETDIRPREFIX),$(CLEANPPULINKFILES))) endif -# MWE: not here UNITTARGETDIRPREFIX is already added when no PPUFILES -# override CLEANPPULINKFILES:=$(addprefix $(UNITTARGETDIRPREFIX),$(CLEANPPULINKFILES)) -endif - fpc_clean: $(CLEANTARGET) ifdef CLEANEXEFILES -$(DEL) $(CLEANEXEFILES) @@ -1245,22 +1052,17 @@ endif ifdef CLEANRSTFILES -$(DEL) $(addprefix $(UNITTARGETDIRPREFIX),$(CLEANRSTFILES)) endif -ifdef EXTRACLEANFILES - -$(DEL) $(EXTRACLEANFILES) +ifdef CLEAN_FILES + -$(DEL) $(CLEAN_FILES) endif -ifdef LIBNAME - -$(DEL) $(LIBNAME) $(LIBFULLNAME) +ifdef LIB_NAME + -$(DEL) $(LIB_NAME) $(LIB_FULLNAME) endif - -$(DEL) $(FPCMADE) $(PPAS) link.res $(FPCEXTFILE) $(REDIRFILE) - -fpc_distclean: fpc_clean - -# Also run clean first if targetdir is set. Unittargetdir is always -# set if targetdir or unittargetdir is specified -ifdef UNITTARGETDIR + -$(DEL) $(FPCMADE) Package.fpc $(PPAS) link.res $(FPCEXTFILE) $(REDIRFILE) +fpc_distclean: clean +ifdef COMPILER_UNITTARGETDIR TARGETDIRCLEAN=fpc_clean endif - fpc_cleanall: $(CLEANTARGET) $(TARGETDIRCLEAN) ifdef CLEANEXEFILES -$(DEL) $(CLEANEXEFILES) @@ -1268,80 +1070,106 @@ endif -$(DEL) *$(OEXT) *$(PPUEXT) *$(RSTEXT) *$(ASMEXT) *$(STATICLIBEXT) *$(SHAREDLIBEXT) *$(PPLEXT) -$(DELTREE) *$(SMARTEXT) -$(DEL) $(FPCMADE) $(PPAS) link.res $(FPCEXTFILE) $(REDIRFILE) - -##################################################################### -# Info rules -##################################################################### - -.PHONY: fpc_info fpc_cfginfo fpc_objectinfo fpc_toolsinfo fpc_installinfo \ - fpc_dirinfo - -fpc_info: $(INFOTARGET) - -fpc_infocfg: +ifdef AOUTEXT + -$(DEL) *$(AOUTEXT) +endif +.PHONY: fpc_info +fpc_info: + @$(ECHO) + @$(ECHO) == Package info == + @$(ECHO) Package Name..... $(PACKAGE_NAME) + @$(ECHO) Package Version.. $(PACKAGE_VERSION) @$(ECHO) @$(ECHO) == Configuration info == @$(ECHO) - @$(ECHO) FPC....... $(FPC) - @$(ECHO) Version... $(FPC_VERSION) - @$(ECHO) CPU....... $(CPU_TARGET) - @$(ECHO) Source.... $(OS_SOURCE) - @$(ECHO) Target.... $(OS_TARGET) + @$(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) - -fpc_infoobjects: + @$(ECHO) == Directory info == + @$(ECHO) + @$(ECHO) Basedir......... $(BASEDIR) + @$(ECHO) FPCDir.......... $(FPCDIR) + @$(ECHO) UnitsDir........ $(UNITSDIR) + @$(ECHO) PackagesDir..... $(PACKAGESDIR) + @$(ECHO) + @$(ECHO) GCC library..... $(GCCLIBDIR) + @$(ECHO) Other library... $(OTHERLIBDIR) + @$(ECHO) + @$(ECHO) == Tools info == + @$(ECHO) + @$(ECHO) Pwd....... $(PWD) + @$(ECHO) Mv........ $(MVPROG) + @$(ECHO) Cp........ $(CPPROG) + @$(ECHO) Rm........ $(RMPROG) + @$(ECHO) GInstall.. $(GINSTALL) + @$(ECHO) Echo...... $(ECHO) + @$(ECHO) Date...... $(DATE) + @$(ECHO) FPCMake... $(FPCMAKE) + @$(ECHO) PPUMove... $(PPUMOVE) + @$(ECHO) Upx....... $(UPXPROG) + @$(ECHO) Zip....... $(ZIPPROG) @$(ECHO) @$(ECHO) == Object info == @$(ECHO) - @$(ECHO) LoaderObjects..... $(LOADEROBJECTS) - @$(ECHO) UnitObjects....... $(UNITOBJECTS) - @$(ECHO) ExeObjects........ $(EXEOBJECTS) + @$(ECHO) Target Loaders...... $(TARGET_LOADERS) + @$(ECHO) Target Units........ $(TARGET_UNITS) + @$(ECHO) Target Programs..... $(TARGET_PROGRAMS) + @$(ECHO) Target Dirs......... $(TARGET_DIRS) + @$(ECHO) Target Examples..... $(TARGET_EXAMPLES) + @$(ECHO) Target ExampleDirs.. $(TARGET_EXAMPLEDIRS) @$(ECHO) - @$(ECHO) ExtraCleanUnits... $(EXTRACLEANUNITS) - @$(ECHO) ExtraCleanFiles... $(EXTRACLEANFILES) + @$(ECHO) Clean Units......... $(CLEAN_UNITS) + @$(ECHO) Clean Files......... $(CLEAN_FILES) @$(ECHO) - @$(ECHO) ExtraInstallUnits. $(EXTRAINSTALLUNITS) - @$(ECHO) ExtraInstallFiles. $(EXTRAINSTALLFILES) - @$(ECHO) - -fpc_infoinstall: + @$(ECHO) Install Units....... $(INSTALL_UNITS) + @$(ECHO) Install Files....... $(INSTALL_FILES) @$(ECHO) @$(ECHO) == Install info == @$(ECHO) -ifdef DATE @$(ECHO) DateStr.............. $(DATESTR) -endif -ifdef PACKAGEPREFIX - @$(ECHO) PackagePrefix........ $(PACKAGEPREFIX) -endif -ifdef PACKAGENAME - @$(ECHO) PackageName.......... $(PACKAGENAME) -endif - @$(ECHO) PackageSuffix........ $(PACKAGESUFFIX) + @$(ECHO) ZipPrefix............ $(ZIPPREFIX) + @$(ECHO) ZipSuffix............ $(ZIPSUFFIX) + @$(ECHO) Install FPC Package.. $(INSTALL_FPCPACKAGE) @$(ECHO) - @$(ECHO) BaseInstallDir....... $(BASEINSTALLDIR) - @$(ECHO) BinInstallDir........ $(BININSTALLDIR) - @$(ECHO) LibInstallDir........ $(LIBINSTALLDIR) - @$(ECHO) UnitInstallDir....... $(UNITINSTALLDIR) - @$(ECHO) SourceInstallDir..... $(SOURCEINSTALLDIR) - @$(ECHO) DocInstallDir........ $(DOCINSTALLDIR) - @$(ECHO) DataInstallDir....... $(DATAINSTALLDIR) + @$(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) DestZipDir........... $(DESTZIPDIR) - @$(ECHO) ZipName.............. $(ZIPNAME) + @$(ECHO) Dist destination dir. $(DIST_DESTDIR) + @$(ECHO) Dist zip name........ $(DIST_ZIPNAME) @$(ECHO) - -##################################################################### -# Local Makefile -##################################################################### - +debug: fpc_debug +smart: fpc_smart +examples: +shared: +install: fpc_install +sourceinstall: fpc_sourceinstall +exampleinstall: fpc_exampleinstall +distinstall: fpc_distinstall +zipinstall: fpc_zipinstall +zipsourceinstall: fpc_zipsourceinstall +zipexampleinstall: fpc_zipexampleinstall +zipdistinstall: fpc_zipdistinstall +clean: fpc_clean +distclean: fpc_distclean +cleanall: fpc_cleanall +info: fpc_info +.PHONY: debug smart examples shared install sourceinstall exampleinstall distinstall zipinstall zipsourceinstall zipexampleinstall zipdistinstall clean distclean cleanall info ifneq ($(wildcard fpcmake.loc),) include fpcmake.loc endif - -##################################################################### -# Users rules -##################################################################### - +.PHONY: all makefile makefiles all: $(MAKE) --assume-new=apiwizz.pp apiwizz$(EXEEXT) +makefile: Makefile.fpc + -$(FPCMAKE) -w +makefiles: makefile diff --git a/tools/apiwizz/Makefile.fpc b/tools/apiwizz/Makefile.fpc index b4eeda39de..c66f822727 100644 --- a/tools/apiwizz/Makefile.fpc +++ b/tools/apiwizz/Makefile.fpc @@ -2,26 +2,35 @@ # Makefile.fpc for APIWizard for Free Pascal # -[targets] +[package] +name=lazarus-apiwizz +version=0.7a + +[target] programs=apiwizz -[clean] -units=apiwizard - [require] -rtl=1 -packages=fcl gtk +packages=rtl fcl -[presettings] -LAZDIR=../.. +[clean] +#units=apiwizard -[dirs] -targetdir=. +[compiler] +options=-gl unitdir=. $(LAZDIR)/lcl/units $(LAZDIR)/components/units $(LAZDIR)/lcl/units/$(LCLPLATFORM) +targetdir=. -[libs] +[prerules] +LAZDIR=../.. [rules] +.PHONY: all makefile makefiles + all: $(MAKE) --assume-new=apiwizz.pp apiwizz$(EXEEXT) + +makefile: Makefile.fpc + -$(FPCMAKE) -w + +makefiles: makefile