Browse Source

+ Moved from base to here

michael 25 years ago
parent
commit
e0f911fc0a
1 changed files with 504 additions and 0 deletions
  1. 504 0
      Makefile.fpc

+ 504 - 0
Makefile.fpc

@@ -0,0 +1,504 @@
+#
+#   Makefile.fpc for Free Pascal Source Tree
+#
+
+[targets]
+dirs=compiler rtl utils fcl api fv packages ide
+
+[defaults]
+defaultrule=help
+
+[tools]
+toolzip=1
+toolupx=1
+tooldate=1
+
+[sections]
+none=1
+dirs=1
+tools=1
+exts=1
+clean=1
+zipinstall=1
+
+
+[presettings]
+OLDFPCDIR:=$(FPCDIR)
+
+checkfpcdir:
+ifdef OLDFPCDIR
+ifneq ($(OLDFPCDIR),)
+        @echo ---------------------------------------------------------
+        @echo
+        @echo   You must unset FPCDIR to use this the packaging rules.
+        @echo
+        @echo ---------------------------------------------------------
+        @cantcontinuewithfpcdir
+endif
+endif
+
+# Check if install/ subdir is available
+ifneq ($(wildcard install),)
+CVSINSTALL=install
+else
+CVSINSTALL=.
+endif
+
+# All target
+ifdef SNAPSHOT
+ALLTARGET=all
+else
+ifndef ALLTARGET
+ifeq ($(OS_TARGET),win32)
+ALLTARGET=smart
+else
+ifeq ($(OS_TARGET),go32v2)
+ALLTARGET=smart
+else
+ALLTARGET=all
+endif
+endif
+endif
+endif
+
+# Stop with an error?
+ifdef SNAPSHOT
+NOSTOP=-
+else
+NOSTOP=
+endif
+
+# Prefix for units
+ifeq ($(OS_TARGET),linux)
+PKGPRE=units
+else
+PKGPRE=u
+endif
+
+# Test dir if none specified
+ifndef PREFIXINSTALLDIR
+ifdef inlinux
+PREFIXINSTALLDIR=/tmp/pptest
+else
+PREFIXINSTALLDIR=/pptest
+endif
+endif
+
+# Always compile for release
+override RELEASE=1
+export RELEASE
+
+# We want to have the resulting .zips in the current dir
+ifndef DESTZIPDIR
+export DESTZIPDIR:=$(BASEDIR)
+endif
+
+# Temporary path to pack a file
+BASEPACKDIR=$(BASEDIR)/basepack
+
+# Use new ppc386
+PPNEW=$(BASEDIR)/compiler/ppc386$(EXEEXT)
+
+# Don't use ppufiles for win32 becuase of commandline length problems
+ifneq ($(OS_TARGET),win32)
+PPUFILESNEW=$(BASEDIR)/utils/ppufiles$(EXEEXT)
+endif
+
+# Build/install options
+BUILDOPTS=FPC=$(PPNEW) RELEASE=1
+INSTALLOPTS=FPC=$(PPNEW) ZIPDESTDIR=$(BASEDIR)
+ifdef PPUFILESNEW
+override INSTALLOPT+=PPUFILES=$(PPUFILESNEW)
+endif
+
+# Compile also IDE (check for ide and fv dir)
+ifneq ($(wildcard ide),)
+ifneq ($(wildcard fv),)
+ifeq ($(OS_TARGET),go32v2)
+IDE=1
+endif
+ifeq ($(OS_TARGET),win32)
+IDE=1
+endif
+ifeq ($(OS_TARGET),linux)
+IDE=1
+endif
+endif
+endif
+
+[rules]
+# These values can change
+unexport FPC_VERSION OS_SOURCE
+
+#####################################################################
+# Main targets
+#####################################################################
+
+.PHONY: help checkfpcdir
+
+help:
+        @echo
+        @echo Directory targets:
+        @echo
+        @echo $(DIROBJECTS)
+        @echo
+        @echo Packing targets are:
+        @echo
+        @echo go32v2zip,win32zip,linuxzip,sourcezip
+        @echo
+        @exit
+
+
+#####################################################################
+# Dependencies
+#####################################################################
+
+#######################################
+# Compiler
+#######################################
+
+.PHONY: compiler_cycle
+
+compiler_cycle:
+        $(MAKE) -C compiler cycle
+
+
+#######################################
+# IDE
+#######################################
+
+.PHONY: ide_comp ide_full
+
+ide_comp:
+        $(MAKE) -C compiler ppuclean
+        $(MAKE) -C ide full
+
+# Look if libgdb.a is available then use fullgdb
+ifneq ($(wildcard packages/gdbint/libgdb/$(OS_TARGET)/libgdb.a),)
+ide_full:
+        $(MAKE) -C compiler ppuclean
+        $(MAKE) -C ide fullgdb
+else
+ide_full:
+        $(MAKE) -C compiler ppuclean
+        $(MAKE) -C ide full
+endif
+
+
+#######################################
+# Install targets
+#######################################
+
+demo_install:
+        $(MAKE) -C $(CVSINSTALL)/demo sourceinstall
+
+man_install:
+        $(MAKE) -C $(CVSINSTALL)/man installman
+
+doc_install:
+        $(MAKE) -C $(CVSINSTALL)/doc installdoc
+
+
+#######################################
+# Packaging targets
+#######################################
+
+idezips: ide_fullzip ide_fullgdbzip optcompinstall optcompzip
+
+ide_compzip:
+        $(MAKE) compiler_clean
+        $(MAKE) ide_clean
+        $(MAKE) ide_full
+        $(MAKE) -C ide/text zipinstall ZIPNAME=ide-comp-$(PACKAGESUFFIX)
+ide_fullgdbzip:
+        $(MAKE) ide_clean
+        $(MAKE) ide_fullgdb
+        $(MAKE) -C ide/text zipinstall ZIPNAME=ide-full-$(PACKAGESUFFIX)
+
+optcompinstall:
+        $(MAKE) compiler_cycle OPT=-dNEWOPTIMIZATIONS
+        $(MAKE) compiler_install
+        $(MAKE) rtl_install
+
+optcompzip:
+        $(MAKE) fpc_zipinstall PACKAGENAME=optcomp ZIPTARGET=optcompinstall
+
+
+##########################################################################
+# Install
+##########################################################################
+
+.PHONY: installer installersrc
+
+INSTALLERBUILDDIR=fpinst
+
+installer:
+        $(COPYTREE) $(CVSINSTALL)/fpinst $(INSTALLERBUILDDIR)
+        $(MAKE) -C $(INSTALLERBUILDDIR) all RELEASE=1
+        $(MOVE) $(INSTALLERBUILDDIR)/install.exe .
+ifdef UPXPROG
+        -$(UPXPROG) install.exe
+endif
+        $(DELTREE) $(INSTALLERBUILDDIR)
+
+installersrc:
+        $(COPYTREE) $(CVSINSTALL)/fpinst $(INSTALLERBUILDDIR)
+        $(MAKE) -C $(INSTALLERBUILDDIR) zipsourceinstall
+        $(DELTREE) $(INSTALLERBUILDDIR)
+
+
+##########################################################################
+# Packaging
+##########################################################################
+
+.PHONY: all clean distclean build install installbase zipinstall zipinstallbase zipinstallfcl \
+        zipinstallpackages
+
+export RELEASE DESTZIPDIR
+
+all: build
+
+clean: $(addsuffix _distclean,$(DIROBJECTS))
+        $(DEL) build-stamp.$(OS_TARGET)
+
+distclean: clean
+
+
+build: build-stamp.$(OS_TARGET)
+build-stamp.$(OS_TARGET):
+# create new compiler
+ifeq ($(OS_TARGET),win32)
+        -$(MAKE) compiler_cycle
+else
+        $(MAKE) compiler_cycle
+endif
+# clean
+        $(MAKE) rtl_clean
+        $(MAKE) api_clean
+        $(MAKE) fcl_clean
+        $(MAKE) packages_clean
+        $(MAKE) utils_clean
+ifdef IDE
+        $(MAKE) fv_clean
+        $(MAKE) ide_clean
+endif
+# build everything
+        $(MAKE) rtl_$(ALLTARGET) $(BUILDOPTS)
+        $(MAKE) api_$(ALLTARGET) $(BUILDOPTS)
+        $(MAKE) fcl_$(ALLTARGET) $(BUILDOPTS)
+        $(MAKE) packages_$(ALLTARGET) $(BUILDOPTS)
+        $(MAKE) utils_all $(BUILDOPTS)
+ifdef IDE
+        -$(MAKE) ide_full $(BUILDOPTS)
+endif
+        $(ECHO) Build > build-stamp.$(OS_TARGET)
+
+installbase: build-stamp.$(OS_TARGET)
+# create dirs
+        $(MKDIR) $(BASEINSTALLDIR)
+        $(MKDIR) $(DOCINSTALLDIR)
+        $(MKDIR) $(BININSTALLDIR)
+ifndef SNAPSHOT
+# readme & whatsnew and docs
+        $(COPY) $(CVSINSTALL)/doc/*.txt $(CVSINSTALL)/doc/copying* $(CVSINSTALL)/doc/faq.* $(DOCINSTALLDIR)
+# bingo32 (cwsdpmi,wmemu387.dxe)
+ifeq ($(OS_TARGET),go32v2)
+        $(COPY) $(CVSINSTALL)/bingo32/* $(BININSTALLDIR)
+endif
+# binw32 (cygwin1.dll)
+ifeq ($(OS_TARGET),win32)
+        $(COPY) $(CVSINSTALL)/binw32/* $(BININSTALLDIR)
+endif
+# manpages for linux
+ifeq ($(OS_TARGET),linux)
+        $(MAKE) -C $(CVSINSTALL)/man installman
+endif
+endif
+# install generated things
+        $(MAKE) compiler_install $(INSTALLOPTS)
+        $(MAKE) rtl_install $(INSTALLOPTS)
+
+install: build-stamp.$(OS_TARGET)
+        $(MAKE) installbase $(INSTALLOPTS)
+        $(MAKE) utils_install $(INSTALLOPTS)
+        $(MAKE) api_install $(INSTALLOPTS)
+        $(MAKE) fcl_install $(INSTALLOPTS)
+        $(MAKE) packages_install $(INSTALLOPTS)
+ifdef IDE
+        $(NOSTOP)$(MAKE) ide_install $(BUILDOPTS)
+endif
+# install examples
+ifndef SNAPSHOT
+        $(MAKE) fcl_exampleinstall $(INSTALLOPTS)
+        $(MAKE) api_exampleinstall $(INSTALLOPTS)
+        $(MAKE) packages_exampleinstall $(INSTALLOPTS)
+endif
+
+zipinstall: build-stamp.$(OS_TARGET)
+        $(MAKE) fpc_zipinstall ZIPTARGET=installbase PACKAGENAME=base $(INSTALLOPTS)
+        $(MAKE) utils_zipinstall $(INSTALLOPTS)
+        $(MAKE) api_zipinstall $(INSTALLOPTS) PACKAGEPREFIX=$(PKGPRE)
+        $(MAKE) fcl_zipinstall $(INSTALLOPTS) PACKAGEPREFIX=$(PKGPRE)
+        $(MAKE) packages_zipinstall $(INSTALLOPTS) PACKAGEPREFIX=$(PKGPRE)
+ifdef IDE
+        $(NOSTOP)$(MAKE) ide_zipinstall $(INSTALLOPTS)
+endif
+ifndef SNAPSHOT
+        $(MAKE) fcl_zipexampleinstall $(INSTALLOPTS) PACKAGEPREFIX=$(PKGPRE)
+        $(MAKE) api_zipexampleinstall $(INSTALLOPTS) PACKAGEPREFIX=$(PKGPRE)
+        $(MAKE) packages_zipexampleinstall $(INSTALLOPTS) PACKAGEPREFIX=$(PKGPRE)
+endif
+
+
+##########################################################################
+# Docs
+##########################################################################
+
+.PHONY: docspdf docs docsrcinstall docsrc
+
+docspdf:
+        $(MAKE) -C docs pdfinstall
+
+docs:
+        $(MAKE) fpc_zipinstall ZIPTARGET=docspdf ZIPNAME=docs
+
+docsrcinstall:
+        $(MAKE) -C docs clean
+        $(MKDIR) $(SOURCEINSTALLDIR)
+        $(COPYTREE) docs $(SOURCEINSTALLDIR)
+
+docsrc:
+        $(MAKE) fpc_zipinstall ZIPTARGET=docsrcinstall ZIPNAME=docsrc
+
+
+##########################################################################
+# Demos
+##########################################################################
+
+.PHONY: demozip
+
+demozip:
+        $(MAKE) -C $(CVSINSTALL)/demo zipsourceinstall ZIPNAME=demo
+
+
+##########################################################################
+# Source targets
+##########################################################################
+
+.PHONY: sourcebase sourcezip
+
+sourcebase:
+# base Makefiles needed for sources
+        $(MKDIR) $(SOURCEINSTALLDIR)
+        $(MKDIR) $(SOURCEINSTALLDIR)/rtl
+        $(MKDIR) $(SOURCEINSTALLDIR)/packages
+        $(COPY) Makefile*  $(SOURCEINSTALLDIR)
+        $(COPY) rtl/Makefile* $(SOURCEINSTALLDIR)/rtl
+        $(COPY) packages/Makefile* $(SOURCEINSTALLDIR)/packages
+
+sourcezip:
+        $(MAKE) fpc_zipinstall ZIPTARGET=sourcebase ZIPNAME=basesrc
+        $(MAKE) compiler_zipsourceinstall
+        $(MAKE) rtl_zipsourceinstall
+        $(MAKE) api_zipsourceinstall
+        $(MAKE) fcl_zipsourceinstall
+        $(MAKE) packages_zipsourceinstall
+        $(MAKE) utils_zipsourceinstall
+        $(MAKE) ide_zipsourceinstall
+#        $(MAKE) installersrc
+#        $(MAKE) docsrc
+
+
+##########################################################################
+# OS targets
+##########################################################################
+
+.PHONY: go32v2 win32 linux go32v2zip win32zip linuxzip
+
+go32v2: checkfpcdir
+        $(MAKE) install OS_TARGET=go32v2
+
+win32: checkfpcdir
+        $(MAKE) install OS_TARGET=win32
+
+linux: checkfpcdir
+        $(MAKE) install OS_TARGET=linux
+
+go32v2zip: checkfpcdir
+        $(MAKE) zipinstall OS_TARGET=go32v2
+
+win32zip: checkfpcdir
+        $(MAKE) zipinstall OS_TARGET=win32
+
+linuxzip: checkfpcdir
+        $(MAKE) zipinstall OS_TARGET=linux
+
+
+##########################################################################
+# Debian / RPM
+##########################################################################
+
+.PHONY: debcopy deb rpmcopy rpm
+
+DEBSRCDIR:=/usr/src/fpc-$(FPC_VERSION)
+debcopy: distclean
+        rm -rf $(DEBSRCDIR)
+        install -d $(DEBSRCDIR)
+        $(COPYTREE) compiler $(DEBSRCDIR)
+        $(COPYTREE) rtl $(DEBSRCDIR)
+        $(COPYTREE) fcl $(DEBSRCDIR)
+        $(COPYTREE) api $(DEBSRCDIR)
+        $(COPYTREE) packages $(DEBSRCDIR)
+        $(COPYTREE) utils $(DEBSRCDIR)
+        $(COPYTREE) logs $(DEBSRCDIR)
+        $(COPYTREE) docs $(DEBSRCDIR)
+        $(COPYTREE) base/Makefile* $(DEBSRCDIR)
+        $(COPYTREE) $(CVSINSTALL)/debian $(DEBSRCDIR)
+        $(COPYTREE) $(CVSINSTALL)/man $(DEBSRCDIR)
+        $(COPYTREE) $(CVSINSTALL)/doc $(DEBSRCDIR)
+        $(COPYTREE) $(CVSINSTALL)/demo $(DEBSRCDIR)
+        find $(DEBSRCDIR) -name 'CVS*' | xargs -n1 rm -rf
+        chmod 755 $(DEBSRCDIR)/debian/rules
+
+deb: checkfpcdir debcopy
+        cd $(DEBSRCDIR) ; debian/rules binary
+
+
+REDHATDIR=/usr/src/redhat
+RPMSOURCESDIR:=$(REDHATDIR)/SOURCES
+RPMSPECDIR:=$(REDHATDIR)/SPECS
+RPMSRCDIR:=$(RPMSOURCESDIR)/fpc
+DOCSRCDIR:=$(RPMSOURCESDIR)/fpcdoc
+rpmcopy: distclean
+        install -d $(REDHATDIR)
+        install -d $(RPMSPECDIR)
+        install -d $(RPMSOURCESDIR)
+# fpc.rpm
+        rm -rf $(RPMSRCDIR)
+        cp $(CVSINSTALL)/fpc-$(FPC_VERSION).spec $(RPMSPECDIR)
+        install -d $(RPMSRCDIR)
+        $(COPYTREE) compiler $(RPMSRCDIR)
+        $(COPYTREE) rtl $(RPMSRCDIR)
+        $(COPYTREE) fcl $(RPMSRCDIR)
+        $(COPYTREE) api $(RPMSRCDIR)
+        $(COPYTREE) packages $(RPMSRCDIR)
+        $(COPYTREE) utils $(RPMSRCDIR)
+        $(COPYTREE) logs $(RPMSRCDIR)
+        $(COPYTREE) base/Makefile* $(RPMSRCDIR)
+        $(COPYTREE) $(CVSINSTALL)/man $(RPMSRCDIR)
+        $(COPYTREE) $(CVSINSTALL)/doc $(RPMSRCDIR)
+        $(COPYTREE) $(CVSINSTALL)/demo $(RPMSRCDIR)
+        find $(RPMSRCDIR) -name 'CVS*' | xargs -n1 rm -rf
+        cd $(RPMSRCDIR) ; tar cvz * > $(RPMSOURCESDIR)/fpc-$(FPC_VERSION)-src.tar.gz
+# fpc-docs.rpm
+        rm -rf $(DOCSRCDIR)
+        cp $(CVSINSTALL)/fpc-docs-$(FPC_VERSION).spec $(RPMSPECDIR)
+        install -d $(DOCSRCDIR)
+        $(COPYTREE) docs $(DOCSRCDIR)
+        find $(DOCSRCDIR) -name 'CVS*' | xargs -n1 rm -rf
+        cd $(DOCSRCDIR) ; tar cvz * > $(RPMSOURCESDIR)/fpc-docs-$(FPC_VERSION)-src.tar.gz
+
+rpm: checkfpcdir rpmcopy
+        cd $(RPMSPECDIR) ; rpm -ba fpc-$(FPC_VERSION).spec
+        cd $(RPMSPECDIR) ; rpm -ba fpc-docs-$(FPC_VERSION).spec
+