|
@@ -1,248 +1,112 @@
|
|
|
#
|
|
|
-# $Id: Makefile.fpc,v 1.32 2005/05/05 12:59:59 peter Exp $
|
|
|
+# Makefile.fpc for running fpmake
|
|
|
#
|
|
|
-# Makefile.fpc for FP IDE
|
|
|
-#
|
|
|
-
|
|
|
-[package]
|
|
|
-name=ide
|
|
|
-version=2.7.1
|
|
|
-
|
|
|
-[target]
|
|
|
-dirs=compiler
|
|
|
-programs=fp
|
|
|
-rst=fpstrings
|
|
|
+[require]
|
|
|
+packages=rtl fpmkunit
|
|
|
|
|
|
[install]
|
|
|
-datadir=$(INSTALL_BASEDIR)/ide
|
|
|
fpcpackage=y
|
|
|
-
|
|
|
-[compiler]
|
|
|
-options=-Sg
|
|
|
-
|
|
|
-[require]
|
|
|
-packages=fv gdbint regexpr chm fcl-base fcl-xml
|
|
|
-packages_go32v2=graph
|
|
|
-libc=y
|
|
|
+fpcsubdir=ide
|
|
|
|
|
|
[default]
|
|
|
fpcdir=..
|
|
|
|
|
|
[prerules]
|
|
|
-#
|
|
|
-# Automatic detection if libgdb.a is present
|
|
|
-#
|
|
|
-
|
|
|
-# set default value for PPC_TARGET
|
|
|
-ifndef PPC_TARGET
|
|
|
-PPC_TARGET=$(CPU_TARGET)
|
|
|
-endif
|
|
|
-
|
|
|
-# do not add -d$(CPU_TARGET)
|
|
|
-override NOCPUDEF=1
|
|
|
-# Use PPC_TARGET instead
|
|
|
-override FPCOPT+= -d$(PPC_TARGET)
|
|
|
-
|
|
|
-ifndef NOGDB
|
|
|
-
|
|
|
-ifeq ($(FULL_TARGET),i386-win32)
|
|
|
-needlinkparam=1
|
|
|
-endif
|
|
|
-
|
|
|
-
|
|
|
-ifeq ($(FULL_TARGET),x86_64-win64)
|
|
|
-needlinkparam=1
|
|
|
-endif
|
|
|
-
|
|
|
-ifeq ($(OS_TARGET),freebsd)
|
|
|
-needusrlocallib=1
|
|
|
-neednostdlib=1
|
|
|
+# Translate INSTALL_UNITDIR to fpmake's --unitinstalldir parameter
|
|
|
+ifdef INSTALL_UNITDIR
|
|
|
+FPMAKE_INSTALL_OPT+=--unitinstalldir=$(INSTALL_UNITDIR)
|
|
|
endif
|
|
|
-ifeq ($(OS_TARGET),openbsd)
|
|
|
-needusrlocallib=1
|
|
|
+# Translate OS_TARGET and CPU_TARGET to fpmake's --os and --cpu parameters
|
|
|
+ifdef OS_TARGET
|
|
|
+FPC_TARGETOPT+=--os=$(OS_TARGET)
|
|
|
endif
|
|
|
-ifeq ($(OS_TARGET),netbsd)
|
|
|
-neednostdlib=1
|
|
|
-endif
|
|
|
-
|
|
|
-ifdef needlinkparam
|
|
|
-override SPECIALLINK=-Xe -k--allow-multiple-definition
|
|
|
+ifdef CPU_TARGET
|
|
|
+FPC_TARGETOPT+=--cpu=$(CPU_TARGET)
|
|
|
endif
|
|
|
+FPMAKE_BIN_CLEAN=$(wildcard .$(PATHSEP)fpmake$(SRCEXEEXT))
|
|
|
+LOCALFPMAKE=.$(PATHSEP)fpmake$(SRCEXEEXT)
|
|
|
+# do not add -d$(CPU_TARGET)
|
|
|
+override NOCPUDEF=1
|
|
|
|
|
|
-ifdef needusrlocallib
|
|
|
-override SPECIALLINK+=-Fl/usr/local/lib
|
|
|
-endif
|
|
|
-ifdef neednostdlib
|
|
|
-override SPECIALLINK+=-Xd
|
|
|
-endif
|
|
|
-# Try to find GDB library
|
|
|
-# Look for a valid GDBLIBDIR environment variable
|
|
|
-ifdef GDBLIBDIR
|
|
|
-override LIBGDBFILE:=$(firstword $(wildcard $(addsuffix /libgdb.a,$(GDBLIBDIR))))
|
|
|
+[rules]
|
|
|
+# Do not pass the Makefile's unit and binary target locations. fpmake uses it's own.
|
|
|
+override FPCOPT:=$(filter-out -FU%,$(FPCOPT))
|
|
|
+override FPCOPT:=$(filter-out -FE%,$(FPCOPT))
|
|
|
+# Compose general fpmake-parameters
|
|
|
+ifdef FPMAKEOPT
|
|
|
+FPMAKE_OPT+=$(FPMAKEOPT)
|
|
|
+endif
|
|
|
+FPMAKE_OPT+=--localunitdir=..
|
|
|
+FPMAKE_OPT+=--globalunitdir=../packages
|
|
|
+FPMAKE_OPT+=$(FPC_TARGETOPT)
|
|
|
+FPMAKE_OPT+=$(addprefix -o ,$(FPCOPT))
|
|
|
+FPMAKE_OPT+=--compiler=$(FPC)
|
|
|
+FPMAKE_OPT+=-bu
|
|
|
+ifndef BUILDFULLNATIVE
|
|
|
+FPMAKE_OPT+=-sp
|
|
|
+endif
|
|
|
+ifdef NOGDB
|
|
|
+FPMAKE_OPT+=--NoGDB=1
|
|
|
+endif
|
|
|
+ifdef PPC_TARGET
|
|
|
+FPMAKE_OPT+=--CompilerTarget=$(PPC_TARGET)
|
|
|
endif
|
|
|
+.NOTPARALLEL:
|
|
|
|
|
|
-# Use default dirs if not available
|
|
|
-ifeq ($(LIBGDBFILE),)
|
|
|
-# Default locations <target>/<cpu> (linux) or <target> (win32,go32v2) only
|
|
|
-override GDBLIBDIR=$(wildcard $(FPCDIR)/libgdb/$(OS_TARGET)/$(CPU_TARGET))
|
|
|
-ifeq ($(GDBLIBDIR),)
|
|
|
-override GDBLIBDIR=$(FPCDIR)/libgdb/$(OS_TARGET)
|
|
|
-endif
|
|
|
-# Detect if libgdb.a is available
|
|
|
-override LIBGDBFILE:=$(firstword $(wildcard $(addsuffix /libgdb.a,$(GDBLIBDIR))))
|
|
|
+fpmake: fpmake.pp
|
|
|
+ $(FPCFPMAKE) fpmake.pp $(FPMAKE_SKIP_CONFIG) $(addprefix -Fu,$(COMPILER_FPMAKE_UNITDIR)) $(FPCMAKEOPT) $(OPT)
|
|
|
+all: fpmake
|
|
|
+ $(LOCALFPMAKE) compile $(FPMAKE_OPT)
|
|
|
+smart: fpmake
|
|
|
+ $(LOCALFPMAKE) compile $(FPMAKE_OPT) -o -XX -o -CX
|
|
|
+release: fpmake
|
|
|
+ $(LOCALFPMAKE) compile $(FPMAKE_OPT) -o -dRELEASE
|
|
|
+debug: fpmake
|
|
|
+ $(LOCALFPMAKE) compile $(FPMAKE_OPT) -o -dDEBUG
|
|
|
+# If no fpmake exists and (dist)clean is called, do not try to build fpmake, it will
|
|
|
+# most often fail because the dependencies are cleared.
|
|
|
+# In case of a clean, simply do nothing
|
|
|
+ifeq ($(FPMAKE_BIN_CLEAN),)
|
|
|
+clean:
|
|
|
+else
|
|
|
+clean:
|
|
|
+ $(FPMAKE_BIN_CLEAN) clean $(FPMAKE_OPT)
|
|
|
endif
|
|
|
|
|
|
-# No custom libgdb.a found, try using system default library if available
|
|
|
-ifeq ($(LIBGDBFILE),)
|
|
|
-SYSLIBDIR=/lib /usr/lib /usr/local/lib
|
|
|
-# Detect if libgdb.a is available
|
|
|
-override LIBGDBFILE=$(firstword $(wildcard $(addsuffix /libgdb.a,$(SYSLIBDIR))))
|
|
|
-ifneq (${LIBGDBFILE},)
|
|
|
-$(warning Using system default libgdb file located in ${LIBGDBFILE})
|
|
|
-GDBLIBDIR=$(dir ${LIBGDBFILE})
|
|
|
-endif
|
|
|
-endif
|
|
|
+CLEAN_TARGET_DIRS=$(subst /Makefile.fpc, ,$(wildcard */Makefile.fpc))
|
|
|
+%_distclean:
|
|
|
+ $(MAKE) -C $* distclean
|
|
|
|
|
|
-# Disable GDB when no libgdb.a found
|
|
|
-ifeq ($(LIBGDBFILE),)
|
|
|
-GDB=
|
|
|
+# In case of a distclean, perform an 'old'-style distclean. This to avoid problems
|
|
|
+# when the package is compiled using fpcmake prior to running this clean using fpmake
|
|
|
+ifeq ($(FPMAKE_BIN_CLEAN),)
|
|
|
+distclean: fpc_cleanall $(addsuffix _distclean,$(CLEAN_TARGET_DIRS))
|
|
|
else
|
|
|
-GDB=1
|
|
|
-# Detect if gdblib.inc is available
|
|
|
-override LIBGDBINC:=$(firstword $(wildcard $(addsuffix /gdblib.inc,$(GDBLIBDIR))))
|
|
|
-ifeq ($(LIBGDBINC),)
|
|
|
-GDBLIBINCFOUND=0
|
|
|
-GDBLIBINCCOND=
|
|
|
+distclean:
|
|
|
+ifdef inUnix
|
|
|
+ { $(FPMAKE_BIN_CLEAN) distclean $(FPMAKE_OPT); if [ $$? != "0" ]; then { echo Something wrong with fpmake exectable. Remove the executable and call make recursively to recover.; $(DEL) $(FPMAKE_BIN_CLEAN); $(MAKE) fpc_cleanall; }; fi; }
|
|
|
else
|
|
|
-GDBLIBINCFOUND=1
|
|
|
-GDBLIBINCCOND=-dUSE_GDBLIBINC -I$(GDBLIBDIR)
|
|
|
+ $(FPMAKE_BIN_CLEAN) distclean $(FPMAKE_OPT)
|
|
|
endif
|
|
|
+ -$(DEL) $(LOCALFPMAKE)
|
|
|
+ -$(DEL) fpmake.o
|
|
|
+ -$(DEL) fpmake.dbg
|
|
|
endif
|
|
|
-
|
|
|
-ifdef GDB
|
|
|
-# The gdbint is already included due the gdbint package dependency
|
|
|
-override LIBDIR+=$(GDBLIBDIR)
|
|
|
-endif
|
|
|
-
|
|
|
-else
|
|
|
-
|
|
|
-# Disable
|
|
|
-GDB=
|
|
|
-
|
|
|
-endif #NOGDB
|
|
|
-
|
|
|
-
|
|
|
-[rules]
|
|
|
-.NOTPARALLEL:
|
|
|
-
|
|
|
-.PHONY: compilerunits compilerclean \
|
|
|
- nogdb gdb all \
|
|
|
- clean_compiler clean testgdb postgdbinfo
|
|
|
-
|
|
|
-clean: fpc_cleanall
|
|
|
-
|
|
|
-distclean: clean compilerclean
|
|
|
-
|
|
|
-#
|
|
|
-# GDB detection
|
|
|
-#
|
|
|
-ifndef NOGDB
|
|
|
-
|
|
|
-ifdef GDB
|
|
|
-testgdb:
|
|
|
- @$(ECHO) LibGDB found in $(LIBGDBFILE)
|
|
|
-
|
|
|
-postgdbinfo:
|
|
|
- @$(ECHO) LibGDB was found, IDE has Debugger support
|
|
|
-
|
|
|
+cleanall: distclean
|
|
|
+install: fpmake
|
|
|
+ifdef UNIXHier
|
|
|
+ $(LOCALFPMAKE) install $(FPMAKE_OPT) --prefix=$(INSTALL_PREFIX) --baseinstalldir=$(INSTALL_LIBDIR)/fpc/$(FPC_VERSION) $(FPMAKE_INSTALL_OPT)
|
|
|
else
|
|
|
-override COMPILER+=-dNODEBUG
|
|
|
-testgdb:
|
|
|
- @$(ECHO) LibGDB not found
|
|
|
- @$(ECHO) LIBGDBFILE=$(LIBGDBFILE)
|
|
|
- @$(ECHO) GDBLIBDIR=$(GDBLIBDIR)
|
|
|
- @$(ECHO) $(wildcard $(addsuffix /libgdb.a,$(GDBLIBDIR)))
|
|
|
-
|
|
|
-postgdbinfo:
|
|
|
- @$(ECHO) LibGDB was not found, IDE has no Debugger support
|
|
|
+ $(LOCALFPMAKE) install $(FPMAKE_OPT) --prefix=$(INSTALL_BASEDIR) $(FPMAKE_INSTALL_OPT)
|
|
|
endif
|
|
|
-
|
|
|
+# distinstall also installs the example-sources
|
|
|
+distinstall: fpmake
|
|
|
+ifdef UNIXHier
|
|
|
+ $(LOCALFPMAKE) install $(FPMAKE_OPT) --prefix=$(INSTALL_PREFIX) --baseinstalldir=$(INSTALL_LIBDIR)/fpc/$(FPC_VERSION) $(FPMAKE_INSTALL_OPT) -ie
|
|
|
else
|
|
|
-testgdb:
|
|
|
- @$(ECHO) Building without Debugger
|
|
|
-postgdbinfo:
|
|
|
- @$(ECHO) Debugger disabled, IDE has no Debugger support
|
|
|
-override COMPILER+=-dNODEBUG
|
|
|
-endif # NOGDB
|
|
|
-
|
|
|
-
|
|
|
-#
|
|
|
-# Compiler
|
|
|
-#
|
|
|
-
|
|
|
-compilerunits : compiler/$(FPCMADE)
|
|
|
-compiler/$(FPCMADE):
|
|
|
- $(MAKE) -C compiler all
|
|
|
-
|
|
|
-compilerclean :
|
|
|
- $(MAKE) -C compiler clean
|
|
|
-
|
|
|
-#
|
|
|
-# Build targets
|
|
|
-#
|
|
|
-# building happends in 2 steps, first the packages, compiler
|
|
|
-# dirs are build. In the second step the IDE is build. This is
|
|
|
-# required because it needs to detect which compiler version
|
|
|
-# to use.
|
|
|
-#
|
|
|
-fp$(EXEEXT): $(wildcard *.pas) $(wildcard *.inc)
|
|
|
- $(COMPILER) $(GDBLIBINCCOND) $(SPECIALLINK) fp.pas
|
|
|
-
|
|
|
-buildfp:
|
|
|
- $(MAKE) compilerunits
|
|
|
- $(MAKE) testgdb
|
|
|
- $(MAKE) fpc_all
|
|
|
- $(MAKE) postgdbinfo
|
|
|
-
|
|
|
-gdb:
|
|
|
-# $(MAKE) -C ../packages/base/gdbint
|
|
|
- $(MAKE) buildfp
|
|
|
-
|
|
|
-nogdb:
|
|
|
- $(MAKE) buildfp NOGDB=1
|
|
|
-
|
|
|
-#
|
|
|
-# Default targets
|
|
|
-#
|
|
|
-
|
|
|
-# By default we try to create the ide with full debugging support,
|
|
|
-all: gdb
|
|
|
-
|
|
|
-# This is necessary because we don't have all units separate in the
|
|
|
-# units targets
|
|
|
-clean: cleanall
|
|
|
-
|
|
|
-#
|
|
|
-# Installation
|
|
|
-#
|
|
|
-
|
|
|
-ifndef UNIXHier
|
|
|
-override INSTALL_DATADIR=$(INSTALL_BINDIR)
|
|
|
-endif
|
|
|
-
|
|
|
-install: fpc_install
|
|
|
- $(MKDIR) $(INSTALL_DATADIR)
|
|
|
- $(MKDIR) $(INSTALL_DOCDIR)
|
|
|
- $(INSTALL) fp.ans $(wildcard *.pt) $(wildcard *.tdf) $(INSTALL_DATADIR)
|
|
|
-ifeq ($(OS_TARGET),win32)
|
|
|
- $(INSTALL) fp32.ico $(INSTALL_DATADIR)
|
|
|
+ $(LOCALFPMAKE) install $(FPMAKE_OPT) --prefix=$(INSTALL_BASEDIR) $(FPMAKE_INSTALL_OPT) -ie
|
|
|
endif
|
|
|
- $(INSTALL) readme.ide $(INSTALL_DOCDIR)
|
|
|
-
|
|
|
-
|
|
|
-#
|
|
|
-# Misc
|
|
|
-#
|
|
|
-clean_compiler:
|
|
|
- $(MAKE) -C compiler clean
|
|
|
- $(MAKE) -C ../compiler ppuclean
|
|
|
+zipinstall: fpmake
|
|
|
+ $(LOCALFPMAKE) zipinstall $(FPMAKE_OPT) --zipprefix=$(DIST_DESTDIR)/$(ZIPPREFIX)
|
|
|
+zipdistinstall: fpmake
|
|
|
+ $(LOCALFPMAKE) zipinstall $(FPMAKE_OPT) --zipprefix=$(DIST_DESTDIR)/$(ZIPPREFIX) -ie
|