1
votes

I am attempting to compile a .adb file with gnatmake, and the -o flag isn't producing the object file name I want:

$ gnatmake --GCC=g++ -D bin/src/ghdl_grt/ -f -u -c src/ghdl_grt/grt-vstrings_io.adb -o bin/src/ghdl_grt/grt-vstrings_io.adb.o

g++ -c -Isrc/ghdl_grt/ -I- -o /home/jon/controlix-code/bin/src/ghdl_grt/grt-vstrings_io.o src/ghdl_grt/grt-vstrings_io.adb

As you can see, it gets the path correct, but the filename should end with .adb.o and it only ends with .o. Any ideas?

2
I have no choice but to use Ada on this project, since GHDL is the only open-source VHDL compiler/simulator I can find, I need to support VHDL in the embedded system I'm putting together for this project, and I need to use GNAT since it is alto the only game in town....Jon Taylor
Why do you need ".adb.o" ?Zerte
I need the ".adb.o" thing to calculate recursive dependencies in the makefile system I'm using.Jon Taylor
UPDATE: I found out how to use "mv" to rename with wildcards from within the makefile (see stackoverflow.com/questions/39523099/…), which seems to have fixed my problem. I still think it is wierd for GNAT to have a "-o" option which (silently) changes the name of the output file while leaving the output directory unchanged(?!??). Confusing to say the least....Jon Taylor
@JonTaylor -- It is kind of weird, but then GCC is, at this point, rather crufty and has all sorts of... accumulations and idiosyncrasiesShark8

2 Answers

6
votes

For gnatmake, -o 'chooses an alternate executable name'. But even using gcc (or g++) on its own fails, at any rate on macOS, because gnat1: incorrect object file name.

I found that you can compile to assembler and then compile that. Using a local file I happened to have lying about,

$ g++ -D $PWD -c gator2.adb -S -o gator2.adb.s
$ g++ -D $PWD -c gator2.adb.s
3
votes

Well, that's a weird naming scheme, but... gnatmake only allows you to specify alternate executable names with -o:

-o name Choose an alternate executable name

You can, however, tell gnatmake to pass on options to the compiler:

-cargs opts opts are passed to the compiler

And similarly, to the binder and linker:

-bargs opts opts are passed to the binder

-largs opts opts are passed to the linker

Thus,

$ gnatmake --GCC=g++ -D bin/src/ghdl_grt/ -f -u -c src/ghdl_grt/grt-vstrings_io.adb -cargs -o bin/src/ghdl_grt/grt-vstrings_io.adb.o