I have an unusual situation: I have an assembler file, which has .c extension and I cannot change build scripts, where this file is defined as "C" type. However, I can build it with the same GCC options if I rename it into .asm or *.s.
Is there any standard method to make GCC to thi开发者_StackOverflow社区nk an input file is Assembler even if it has .c extension?
I can't change build script! I can only change the .c file. So, maybe there is a way to set command-line option '-x assembler' using preprocessor?
This sounds a bit complicated, but if you use bash or anything similar you can alias gcc to a script you'll write and in this script when it gets the file you want to change behavior use the -x assembler
parameter with gcc and act normally in otherfiles.
精彩评论