I'm trying to use armclang compiler through a GNU makefile, but there is a clash between both tools when using -I option.
For armclang compiler, the -I means "Adds the specified directory to the list of places that are searched to find included files.Syntax -Idir" without a space.
For GNU makefile ‘-I dir’ has the same meaning (but with a space).
in My makefile I have the following:
$(aarch32_bootobj): %.o: %.s
@echo " [ASM ] $<"
@armclang --target=armv8a-arm-none-eabi -Icommon/shared -c $< -o $@
When Running the Makefile, I'm getting the following Warning and Error :
armclang: warning: argument unused during compilation: '-I common/shared'
aarch32/shared/bootcode.s:32:10: error: Could not find include file 'boot_defs.hs'
Where boot_defs.hs exists under common/shared
When running the same armclang command outside the makefile, it works. therefore I'm assuming that makefile has formatted the -Icommon/share option and added automatic space just after the -I.
Is there any way to run the armclang command correctly? in other worlds, is it possible to let the makefile parse the -Icommon/shared without any automatic formatting?
I have been trying a lot of tricks to workaround that without any success.
Thanks a lot In advance.
GNU make doesn't split the -Icommon/shared
option, and even if it did armclang
would be able to parse that. If you remove the @
from the armclang
call in the Makefile, you'll see exactly what make
does and that the -Icommon/shared
parameter remains intact.
Your problem is with armclang
; see this bug on the tracker. It doesn't pass -I
flags to its integrated assembler. A workaround, then, should be to pass -no-integrated-as
to armclang
:
@armclang -no-integrated-as --target=armv8a-arm-none-eabi -Icommon/shared -c $< -o $@
If that doesn't work, replace the .include
directive with #include
and either rename your asm files to .S
(upper-case S
), which indicates that they need C preprocessing, or pass armclang
the -x assembler-with-cpp
flag. The behavior of this is documented here.