java - Makefile:“多个目标模式。停止。”
问题描述
当然,我又傻了。
谁能告诉我这是为什么?
$(shell compileJava.bat)
没有任何变量、特殊字符、不需要的空格、冒号等的表达式导致错误Makefile:70: *** multiple target patterns. Stop.
。
我已经在整个互联网上搜索了答案。
我正在尝试做的事情。
我正在制作一个涉及本地人的 Java 项目。我有这样的结构;
+ root (project)
-+ build
-+ natives (for the built native libraries like dlls)
-+ classes (for the built java classes)
-+ generated (gradles compileJava task automatically generates jni header files)
-+ src
-+ main
-+ java (all of the java source)
-+ resources
-+ c
-+ Makefile (will be called to compile and link the c(++) code)
-+ Makefile (the general makefile, error occurs in here at line 70)
-+ compileJava.bat (calls gradlew compileJava with a jdk argument, but since im using
windows and make doesnt support colons, like C:, i had to put it in a batch file)
并且根 Makefile 应该遵循这个过程;
[1] call "compileJava.bat" to compile the java code & gen the headers (error occurs here)
[2] call "make -C src/main/c" to run the native build makefile
[3] call "jar cf <name> <contents>" to package all java code (and the natives) into a jar
链接
我的整个根 Makefile:Pastebin
compileJava.bat
:巴斯宾
解决方案
做什么$(shell ...)
?它调用一个 shell 命令,并计算出命令的标准输出。
如果您编写这样的makefile:
$(shell true)
然后 shell 命令不打印任何内容,因此它扩展为空,然后 make 尝试不评估任何内容,但没有任何反应。
如果您编写这样的makefile:
$(shell echo hi)
然后shell命令打印“hi”,这个函数扩展为字符串“hi”,就好像你写了一个makefile:
hi
当然,这不是一个有效的生成文件。
所以这:
$(shell make -C src/...)
扩展到运行 make 的整个输出,这显然根本不是一个有效的 makefile。
您可以通过将结果放入变量中来避免这种情况:
_tmp := $(shell make -C src/...)
但是,我真的认为你需要重新考虑你的整个方法。Makefile 不是像 shell 脚本那样的过程程序。
推荐阅读
- python-3.7 - 为什么这个定义返回 False 而不是 True?
- laravel - PHP 函数 stripos() 期望参数 1 是字符串,给定对象
- java - 我怎样才能找到以下函数的时间复杂度?
- c - “分段错误(核心转储)”的原因是什么
- continuous-integration - Gitlab管道:仅在依赖项更改时如何重新缓存节点模块?
- azure - 如何使用个人 Microsoft 帐户通过 AzureAD 多租户应用程序访问 AzureRM?
- html - 如何为我的网址添加自动大写?
- ruby-on-rails - 带有多态注释的 Rails has_one
- html - 使用 XSL 遍历所有子元素(不同类型)
- php - 如何通过比较删除特定索引