另一个Makefile问题
我有一个由少量文件组成的简单应用程序。这些文件是 apptest.c、apptest.h、apptest.S。让我有点困惑的是 apptest_AUTO.s 发挥作用。任何人都知道这样做的目的是什么? 我可以想象汇编代码的另一个副本正在制作之后 在实际用作程序集的输入之前是否由预处理器进行处理?
CC=/bin/sparc-elf-gcc
CPP=/bin/sparc-elf-cpp
CIS_ASM=bin/sparc-elf-as
all: apptest.exe
apptest.exe: apptest.o
$(CC) apptest.o -o apptest.exe
apptest.o: apptest.c apptest.h apptest.S
$(CC) $(SFLAGS) apptest.c -o apptest_AUTO.s
$(CPP) apptest.S >> apptest_AUTO.s
$(CIS_ASM) apptest_AUTO.s -o apptest.o
I have a simple application consisting of a small number of files. The files are
apptest.c, apptest.h, apptest.S. What is confusing me a bit is the part where the
apptest_AUTO.s comes into play. Anyone have an idea what is the purpose of doing that?
I could imagine that another copy of the assembler code is being made after it is
being processed by the pre-processor before it is actually used as input to the Assembly?
CC=/bin/sparc-elf-gcc
CPP=/bin/sparc-elf-cpp
CIS_ASM=bin/sparc-elf-as
all: apptest.exe
apptest.exe: apptest.o
$(CC) apptest.o -o apptest.exe
apptest.o: apptest.c apptest.h apptest.S
$(CC) $(SFLAGS) apptest.c -o apptest_AUTO.s
$(CPP) apptest.S >> apptest_AUTO.s
$(CIS_ASM) apptest_AUTO.s -o apptest.o
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
有人希望有机会在将汇编源代码编译为目标代码之前自动修改它。我以前见过它,不是针对 SPARC,而是通常针对更旧的架构(M680x0、Z8000)和更旧的 C 编译器(1980 年代,而不是 2010 年代)。
鉴于所示的顺序,它似乎不太可能做任何有用的事情。
Someone wanted the opportunity to automatically modify the assembler source before compiling it to object code. I've seen it done before, not for SPARC but typically much older architectures (M680x0, Z8000) and much older C compilers (1980s, not 2010s).
Given the sequence shown, it seems unlikely to be doing anything useful.
这是一种奇怪的做法,但它通过编译 apptest.c 将 apptest.S 的预处理版本粘贴到汇编代码输出的末尾。最终结果将是一个由 apptest.c 和 apptest.S 构建的单个目标文件。
看起来像是一种防止两个目标文件之间名称冲突的技巧。更传统的方法是这样的,
It is a odd way of doing things, but it is pasting a preprocessed version of apptest.S onto the end of the assembler code output by compiling apptest.c. The end result would be a single object file which is built from both apptest.c and apptest.S.
Looks like a hack to prevent name clash between the two object files. A more conventional approach would be something like,