指定 makefile 的依赖关系
我希望这对外面的人来说是显而易见的。我正在创建一个需要一些特殊编译的 makefile。我有 cuda 文件和 c++ 文件,每个文件都需要单独编译。我希望能够指定文件,然后根据
CUDA_FILES := file1.cu file2.cu file3.cu
CPP_FILES := file4.cpp file5.cpp
# lots of options
#rules:
all: project1
project1: file1.o file2.o file3.o file4.o file5.o
$(LD) $(LDLIBS) $^ -o $@
%.o: %.cu
$(CUDA) $(CUDA_ARCH) $(CUDA_OPTIONS) $(CUDA_INCLUDES) -Xcompiler "$(COMPILER OPTIONS" $^ -o $@
project1:
行列出最终输出的依赖项,如何从文件列表中自动生成对象列表以指定为依赖?
I hope that this is obvious to someone out there. I am creating a makefile that I need some special compilation for. I have cuda files and c++ files each need to be compiled separately. I want to be able to specify the file and then list the dependencies for the final output in terms of the
CUDA_FILES := file1.cu file2.cu file3.cu
CPP_FILES := file4.cpp file5.cpp
# lots of options
#rules:
all: project1
project1: file1.o file2.o file3.o file4.o file5.o
$(LD) $(LDLIBS) $^ -o $@
%.o: %.cu
$(CUDA) $(CUDA_ARCH) $(CUDA_OPTIONS) $(CUDA_INCLUDES) -Xcompiler "$(COMPILER OPTIONS" $^ -o $@
for the line with project1:
how do I automatically generate the object list from the files lists to specify as a dependency?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
只需列出目标文件而不是源文件:
编辑:如果您不想遵循此方法,请使用字符串替换:
Just list the object files instead of the source files:
Edit: If you don't want to follow this method, use string substitution:
我建议使用更现代的字符串替换函数,例如:
I would suggest using the more modern string substitution functions, like: