Przeglądaj źródła

* Scripts to generate Makefiles which call fpmake

git-svn-id: trunk@24487 -
joost 12 lat temu
rodzic
commit
534e8e2a0c

+ 5 - 0
.gitattributes

@@ -14273,6 +14273,11 @@ utils/dxegen/dxegen.pp svneol=native#text/plain
 utils/dxegen/fpmake.pp svneol=native#text/plain
 utils/dxegen/fpmake.pp svneol=native#text/plain
 utils/fpcm/Makefile svneol=native#text/plain
 utils/fpcm/Makefile svneol=native#text/plain
 utils/fpcm/Makefile.fpc svneol=native#text/plain
 utils/fpcm/Makefile.fpc svneol=native#text/plain
+utils/fpcm/Makefile.fpmake.bs.template svneol=native#text/plain
+utils/fpcm/Makefile.fpmake.template svneol=native#text/plain
+utils/fpcm/convert_all_fpmake.sh svneol=native#text/plain
+utils/fpcm/convert_fpmake.sh svneol=native#text/plain
+utils/fpcm/convert_fpmake.txt svneol=native#text/plain
 utils/fpcm/fpcmake.inc svneol=native#text/plain
 utils/fpcm/fpcmake.inc svneol=native#text/plain
 utils/fpcm/fpcmake.ini svneol=native#text/plain
 utils/fpcm/fpcmake.ini svneol=native#text/plain
 utils/fpcm/fpcmake.pp svneol=native#text/plain
 utils/fpcm/fpcmake.pp svneol=native#text/plain

+ 119 - 0
utils/fpcm/Makefile.fpmake.bs.template

@@ -0,0 +1,119 @@
+#
+#   Makefile.fpc for running fpmake
+#
+
+[package]
+name=insert-name-here
+version=2.7.1
+
+[require]
+packages=rtl
+
+[install]
+fpcpackage=y
+
+[default]
+fpcdir=../..
+
+[prerules]
+FPMAKE_BIN_CLEAN=$(wildcard .$(PATHSEP)fpmake$(SRCEXEEXT))
+ifdef OS_TARGET
+FPC_TARGETOPT+=--os=$(OS_TARGET)
+endif
+ifdef CPU_TARGET
+FPC_TARGETOPT+=--cpu=$(CPU_TARGET)
+endif
+LOCALFPMAKE=.$(PATHSEP)fpmake$(SRCEXEEXT)
+# Adding a dependency on fpmkunit is not possbile due to an infinite loop. So
+# the fpmkunit-searchpath is added here:
+PACKAGEDIR_FPMKUNIT:=$(firstword $(subst /Makefile.fpc,,$(strip $(wildcard $(addsuffix /fpmkunit/Makefile.fpc,$(PACKAGESDIR))))))
+ifneq ($(PACKAGEDIR_FPMKUNIT),)
+ifneq ($(wildcard $(PACKAGEDIR_FPMKUNIT)/units_bs/$(SOURCESUFFIX)),)
+UNITDIR_FPMAKE_FPMKUNIT=$(PACKAGEDIR_FPMKUNIT)/units_bs/$(SOURCESUFFIX)
+else
+UNITDIR_FPMAKE_FPMKUNIT=$(PACKAGEDIR_FPMKUNIT)
+endif
+ifdef CHECKDEPEND
+$(PACKAGEDIR_FPMKUNIT)/$(FPCMADE):
+        $(MAKE) -C $(PACKAGEDIR_FPMKUNIT) $(FPCMADE)
+override ALLDEPENDENCIES+=$(PACKAGEDIR_FPMKUNIT)/$(FPCMADE)
+endif
+else
+PACKAGEDIR_FPMKUNIT=
+UNITDIR_FPMKUNIT:=$(subst /Package.fpc,,$(strip $(wildcard $(addsuffix /fpmkunit/Package.fpc,$(UNITSDIR)))))
+ifneq ($(UNITDIR_FPMKUNIT),)
+UNITDIR_FPMKUNIT:=$(firstword $(UNITDIR_FPMKUNIT))
+else
+UNITDIR_FPMKUNIT=
+endif
+endif
+ifdef UNITDIR_FPMAKE_FPMKUNIT
+override COMPILER_FPMAKE_UNITDIR+=$(UNITDIR_FPMAKE_FPMKUNIT)
+endif
+
+[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=insert-packageunits-here
+FPMAKE_OPT+=$(FPC_TARGETOPT)
+FPMAKE_OPT+=$(addprefix -o ,$(FPCOPT))
+FPMAKE_OPT+=--compiler=$(FPC)
+FPMAKE_OPT+=-bu
+.NOTPARALLEL:
+
+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
+# 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:	$(addsuffix _distclean,$(TARGET_DIRS)) fpc_cleanall
+else
+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
+        $(FPMAKE_BIN_CLEAN) distclean $(FPMAKE_OPT)
+endif
+	-$(DEL) $(LOCALFPMAKE)
+endif
+cleanall: distclean
+install:	fpmake
+ifdef UNIXHier
+	$(LOCALFPMAKE) install $(FPMAKE_OPT) --prefix=$(INSTALL_PREFIX) --baseinstalldir=$(INSTALL_LIBDIR)/fpc/$(FPC_VERSION) --unitinstalldir=$(INSTALL_UNITDIR)
+else
+	$(LOCALFPMAKE) install $(FPMAKE_OPT) --prefix=$(INSTALL_BASEDIR) --unitinstalldir=$(INSTALL_UNITDIR)
+endif
+# distinstall also installs the example-sources
+distinstall:	fpmake
+ifdef UNIXHier
+	$(LOCALFPMAKE) install $(FPMAKE_OPT) --prefix=$(INSTALL_PREFIX) --baseinstalldir=$(INSTALL_LIBDIR)/fpc/$(FPC_VERSION) --unitinstalldir=$(INSTALL_UNITDIR) -ie
+else
+	$(LOCALFPMAKE) install $(FPMAKE_OPT) --prefix=$(INSTALL_BASEDIR)  --unitinstalldir=$(INSTALL_UNITDIR) -ie
+endif
+zipinstall:	fpmake
+	$(LOCALFPMAKE) zipinstall $(FPMAKE_OPT) --zipprefix=$(DIST_DESTDIR)/$(ZIPPREFIX)
+zipdistinstall:	fpmake
+	$(LOCALFPMAKE) zipinstall $(FPMAKE_OPT) --zipprefix=$(DIST_DESTDIR)/$(ZIPPREFIX) -ie

+ 93 - 0
utils/fpcm/Makefile.fpmake.template

@@ -0,0 +1,93 @@
+#
+#   Makefile.fpc for running fpmake
+#
+
+[package]
+name=insert-name-here
+version=2.7.1
+
+[require]
+packages=rtl fpmkunit
+
+[install]
+fpcpackage=y
+
+[default]
+fpcdir=../..
+
+[prerules]
+FPMAKE_BIN_CLEAN=$(wildcard .$(PATHSEP)fpmake$(SRCEXEEXT))
+ifdef OS_TARGET
+FPC_TARGETOPT+=--os=$(OS_TARGET)
+endif
+ifdef CPU_TARGET
+FPC_TARGETOPT+=--cpu=$(CPU_TARGET)
+endif
+LOCALFPMAKE=.$(PATHSEP)fpmake$(SRCEXEEXT)
+
+[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=insert-packageunits-here
+FPMAKE_OPT+=$(FPC_TARGETOPT)
+FPMAKE_OPT+=$(addprefix -o ,$(FPCOPT))
+FPMAKE_OPT+=--compiler=$(FPC)
+FPMAKE_OPT+=-bu
+.NOTPARALLEL:
+
+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
+# 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:	$(addsuffix _distclean,$(TARGET_DIRS)) fpc_cleanall
+else
+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
+        $(FPMAKE_BIN_CLEAN) distclean $(FPMAKE_OPT)
+endif
+	-$(DEL) $(LOCALFPMAKE)
+endif
+cleanall: distclean
+install:	fpmake
+ifdef UNIXHier
+	$(LOCALFPMAKE) install $(FPMAKE_OPT) --prefix=$(INSTALL_PREFIX) --baseinstalldir=$(INSTALL_LIBDIR)/fpc/$(FPC_VERSION) --unitinstalldir=$(INSTALL_UNITDIR)
+else
+	$(LOCALFPMAKE) install $(FPMAKE_OPT) --prefix=$(INSTALL_BASEDIR) --unitinstalldir=$(INSTALL_UNITDIR)
+endif
+# distinstall also installs the example-sources
+distinstall:	fpmake
+ifdef UNIXHier
+	$(LOCALFPMAKE) install $(FPMAKE_OPT) --prefix=$(INSTALL_PREFIX) --baseinstalldir=$(INSTALL_LIBDIR)/fpc/$(FPC_VERSION) --unitinstalldir=$(INSTALL_UNITDIR) -ie
+else
+	$(LOCALFPMAKE) install $(FPMAKE_OPT) --prefix=$(INSTALL_BASEDIR)  --unitinstalldir=$(INSTALL_UNITDIR) -ie
+endif
+zipinstall:	fpmake
+	$(LOCALFPMAKE) zipinstall $(FPMAKE_OPT) --zipprefix=$(DIST_DESTDIR)/$(ZIPPREFIX)
+zipdistinstall:	fpmake
+	$(LOCALFPMAKE) zipinstall $(FPMAKE_OPT) --zipprefix=$(DIST_DESTDIR)/$(ZIPPREFIX) -ie

+ 36 - 0
utils/fpcm/convert_all_fpmake.sh

@@ -0,0 +1,36 @@
+#!/bin/bash
+PACKAGESDIR=..
+TEMPLATEDIR=./
+initial_conversion=false
+
+while getopts ":d:p:i" opt; do
+  case $opt in
+    i)
+      initial_conversion=true
+      ;;
+    d)
+      PACKAGESDIR=$OPTARG
+      ;;
+    p)
+      TEMPLATEDIR=$OPTARG/
+      ;;
+    \?)
+      echo "Invalid option: -$OPTARG"
+      exit 1
+      ;;
+    :)
+      echo "Option -$OPTARG requires an argument." 
+      exit 1
+      ;;
+  esac
+done
+
+if $initial_conversion
+then
+  FPMAKEOPT="-i -d $PACKAGESDIR"
+else
+  FPMAKEOPT="-d $PACKAGESDIR"
+fi
+
+eval $(find */Makefile.fpc -printf 'if [ %h = "paszlib" -o %h = "fcl-process" -o %h = "libtar" -o %h = "hash" ] ; then "$TEMPLATEDIR"convert_fpmake.sh -T "$TEMPLATEDIR"Makefile.fpmake.bs.template $FPMAKEOPT %h ; elif [ ! %h = "fpmkunit" ] ; then "$TEMPLATEDIR"convert_fpmake.sh -T "$TEMPLATEDIR"Makefile.fpmake.template $FPMAKEOPT %h ; fi ;' )
+

+ 70 - 0
utils/fpcm/convert_fpmake.sh

@@ -0,0 +1,70 @@
+#!/bin/bash
+TEMPLATEFILE=Makefile.fpmake.template
+PACKAGESDIR=..
+initial_conversion=false
+
+while getopts ":T:d:i" opt; do
+  case $opt in
+    T)
+      TEMPLATEFILE=$OPTARG
+      ;;
+    i)
+      initial_conversion=true
+      ;;
+    d)
+      PACKAGESDIR=$OPTARG
+      ;;
+    \?)
+      echo "Invalid option: -$OPTARG"
+      exit 1
+      ;;
+    :)
+      echo "Option -$OPTARG requires an argument." 
+      exit 1
+      ;;
+  esac
+done
+
+shift $((OPTIND-1))
+
+if [ ! "$#" -eq 1 ] 
+then
+  echo "Usage: convert_fpmake.sh [-T templatename] [-d packagesdir] [packagename]"
+  exit
+fi
+if [ ! -d $1 ] 
+then
+  echo "Package $1 not found"
+  exit
+fi
+if [ ! -e $TEMPLATEFILE ] 
+then
+  echo "Package template $TEMPLATEFILE not found"
+  exit
+fi
+
+echo "Processing package $1"
+if $initial_conversion
+then
+  if [ -f $1/Makefile.fpc.fpcmake ]
+  then
+    echo "Package is al geconverteerd"
+    exit
+  fi
+
+  rm -f $1/Makefile.fpc.fpcmake
+  svn rename $1/Makefile.fpc $1/Makefile.fpc.fpcmake
+fi
+
+cp -v $TEMPLATEFILE $1/Makefile.fpc
+sed -i s/name=insert-name-here/name=$1/ $1/Makefile.fpc
+sed -i s,insert-packageunits-here,$PACKAGESDIR, $1/Makefile.fpc
+
+if $initial_conversion
+then
+  svn add Makefile.fpc
+fi
+
+cd $1
+fpcmake -TAll
+cd ..

+ 18 - 0
utils/fpcm/convert_fpmake.txt

@@ -0,0 +1,18 @@
+The convert_all_fpmake.sh script generates the Makefile.fpc's for calling
+fpmake.
+It does that for all packages in sub-directories of the current directory. The
+Makefile.fpc's are based on the Makefile.fpmake.template and the 
+Makefile.fpmake.bs.template, the latter for packages that are needed to bootstrap the fpmkunit. Note that the fpmkunint-package is skipped by this
+script, since it's Makefile.fpc is very different from the others.
+
+For generating the utils-makefiles do:
+
+cd utils
+fpcm/convert_all_fpmake.sh -d ../../packages -p fpcm
+
+
+For generating the packages-makefiles:
+
+cd packages
+../utils/fpcm/convert_all_fpmake.sh -p ../utils/fpcm
+