fpc/rtl/regenmakefiles.sh
2023-07-30 11:18:18 +02:00

63 lines
1.0 KiB
Bash
Executable File

#!/bin/bash
#
# Check directory
#
if [ -z "$1" ]; then
RTLDIR=$(pwd)
else
RTLDIR=$1
if [ ! -d $RTLDIR ]; then
echo "The directory $RTLDIR does not exist"
exit 1
fi
fi
#
# Check rtl dir ?
#
if [ ! -d $RTLDIR/ucmaps ]; then
echo "This script must be executed in the rtl directory or have an argument tto specify the RTL directory"
exit 1
fi
#
# fpcmake to use
#
if [ -e $RTLDIR/../utils/fpcm/fpcmake ]; then
FPCMAKE=$RTLDIR/../utils/fpcm/fpcmake
else
FPCMAKE=fpcmake
fi
#
# Go
#
echo "Using fpcmake: $FPCMAKE"
#
# Main
#
echo "Doing RTL toplevel dir: $RTLDIR"
pushd $RTLDIR >/dev/null 2>&1
$FPCMAKE -q -Tall
popd >/dev/null 2>&1
#
# OS-specific
#
for d in *
do
if [ -f $d/Makefile.fpc ]; then
echo "Doing directory $d"
pushd $RTLDIR/$d >/dev/null 2>&1
case $d in
darwin)
TARGETS="darwin,ios,iphonesim" ;;
*)
TARGETS=$d
esac
CMD="$FPCMAKE -T$TARGETS -q -x $RTLDIR/inc/Makefile.rtl"
# echo "Command: $CMD"
$CMD
popd >/dev/null 2>&1
fi
done
#
# That's all, folks!
#