Using redo with Ada

39 views
Skip to first unread message

Страхиња Радић

unread,
Jul 25, 2021, 7:19:36 AM7/25/21
to redo-list
Hi, I'm trying to use apenwarr/redo with GNAT (GCC Ada). I have the following
setup:

#default.o.do
gnatgcc -c -O2 $2.adb -gnata -o /dev/stdout

#all.do
redo-ifchange myprog

#myprog.do
FILES=main
FILES_ADB=$(echo $FILES | sed -e's/\(\<\S*\>\)/\1.adb/g')
FILES_O=$(echo $FILES | sed -e's/\(\<\S*\>\)/\1.o/g')
echo "$FILES_O" | xargs redo-ifchange
for f in "$FILES"; do
gnatbind $f
done
gnatlink $FILES_ADB -o myprog

The problem is that GNAT doesn't seem to like custom extension from $3, nor
/dev/stdout. I'm getting the following message from gnat1:

gnat1: incorrect object file extension

This happens regardless of whether I put /dev/stdout or $3 at the end of the
command in default.o.do.

Is there any way to trick GNAT into cooperating with redo?

Thanks in advance,
Strahinya Radich

signature.asc

Sergey Matveev

unread,
Jul 25, 2021, 7:31:45 AM7/25/21
to redo...@googlegroups.com
*** Страхиња Радић [2021-07-25 13:19]:
>Is there any way to trick GNAT into cooperating with redo?

Just use temporary file with required extension and rename it?

trap "rm -f $3.needed" HUP PIPE INT QUIT TERM EXIT
gnatgcc -c -O2 $2.adb -gnata -o $3.needed
mv $3.needed $3

--
Sergey Matveev (http://www.stargrave.org/)
OpenPGP: CF60 E89A 5923 1E76 E263 6422 AE1A 8109 E498 57EF

Страхиња Радић

unread,
Jul 25, 2021, 7:57:13 AM7/25/21
to redo-list
Thanks Sergey, this worked! :)

My setup is now:

#all.do
redo-ifchange myprog

#default.o.do
trap "rm -f $2.o" HUP PIPE INT QUIT TERM EXIT
gnatgcc -c -O2 $2.adb -gnata -o $2.o
mv $2.o $3

#myprog.do
FILES=main
FILES_ADB=$(echo $FILES | sed -e's/\(\<\S*\>\)/\1.adb/g')
FILES_O=$(echo $FILES | sed -e's/\(\<\S*\>\)/\1.o/g')
echo "$FILES_O" | xargs redo-ifchange
for f in "$FILES"; do
gnatbind $f
done
gnatlink $FILES -o $3

P.S.: I seem to be not receiving any mails from Google Groups, I saw your answer
from the web interface instead and replied. Thanks again!

signature.asc
Reply all
Reply to author
Forward
0 new messages