# * verify any regression
# * add/remove files in c_src
# OPTION
-# number is the bootstrap level (prefix) to use. It correspond to the nc
-# level. By default, the lastest generated nitc is used
+# number is the bootstrap level to use. It corresponds to the nc
+# level. By default, the lastest generated nitc is used.
# prefix
p=$1
if [ "x$p" = "x" ]; then
- p=`ls .nit_compile/nitc*.sh -t | head -1 | sed 's!\.nit_compile/nitc\.\(.*\)_build\.sh!\1!'`
+ p=`ls .nit_compile*/nitc._build.sh -t | head -1 | sed 's!\.nit_compile\(.*\)/nitc\._build\.sh!\1!'`
if [ "x$p" = "x" ]; then
echo "No generated nitc"
exit 1
fi
- echo "Lastest generated nitc uses prefix $p"
+ echo "Lastest generated nitc is bootstrap level $p"
fi
rm -r c_src 2> /dev/null
mkdir c_src
-sed -n "s|.nit_compile/\\(.*\\).${p}_sep.c.*|\\1|p" .nit_compile/nitc.${p}_build.sh | while read -r file; do
- echo "* $file"
- sed "/include/s/.${p}_/._/" ".nit_compile/$file.${p}_sep.c" > c_src/${file}._sep.c
- sed "/include/s/.${p}_/._/" ".nit_compile/$file.${p}_sep.h" > c_src/${file}._sep.h
+sed -n '/^ *.nit_compile/{s!\\$!!;p}' .nit_compile3/nitc._build.sh | while read -r file; do
+ cp $file c_src
+ [ -r ${file%.c}.h ] && cp ${file%.c}.h c_src
done
-sed "/include/s/.${p}_/._/" .nit_compile/nitc.${p}_tables.c > c_src/nitc._tables.c
-sed "s|.nit_compile|.|g;s|../bin/../|../|g;s/.${p}_/._/g;s|nitc_${p}|nitc|" .nit_compile/nitc.${p}_build.sh > c_src/nitc._build.sh
+sed -e "s|.nit_compile${p}|.|g;s|/\[a-z\]+/../|/|g;s|nitc_${p}|nitc|" -e 's/^CLIBDIR=.*/CLIBDIR="clib"/' .nit_compile${p}/nitc._build.sh > c_src/nitc._build.sh
chmod +x c_src/nitc._build.sh
-cp ../c_src/Makefile ../c_src/README c_src
+cp -r ../c_src/Makefile ../c_src/README ../clib c_src