理解makefile中的make命令?
我试图修改一个makefile来交叉编译二进制文件。有关命令如下:理解makefile中的make命令?,makefile,Makefile,我试图修改一个makefile来交叉编译二进制文件。有关命令如下: # GNU Make solution makefile autogenerated by Premake # Type "make help" for usage help ifndef config config=debug endif export config PROJECTS := json openjaus openjaus-core openjaus-environment openjaus-mobil
# GNU Make solution makefile autogenerated by Premake
# Type "make help" for usage help
ifndef config
config=debug
endif
export config
PROJECTS := json openjaus openjaus-core openjaus-environment openjaus-mobility openjaus-manipulator openjaus-ugv Base Managed PingTest LargeMessageTest PdDemo GposDemo GposClientDemo StillImageSensorDemo StillImageClientDemo
.PHONY: all clean help $(PROJECTS)
all: $(PROJECTS)
json:
@echo "==== Building json ($(config)) ===="
@${MAKE} --no-print-directory -C .build -f json.make
可以看出,makefile有几个目标。它们都具有与“json”目标相同的结构。所讨论的命令是
@${MAKE} --no-print-directory -C .build -f json.make
==== Building json (debug) ====
make[1]: Nothing to be done for `/home/botbear/openwrt/trunk/staging_dir/toolchain- arm_v6k_gcc-linaro_uClibc-0.9.32_eabi/bin/arm-openwrt-linux-c++'.
“${MAKE}”变量=MAKE(我已经用echo验证了这一点)
C是做什么的?
.build是做什么的?
我擅长使用-f json.make
另外,当我运行make时,json.make文件会被创建、编译并自行删除,所以我没有访问该文件的权限
修改相关命令时收到的错误是
@${MAKE} --no-print-directory -C .build -f json.make
==== Building json (debug) ====
make[1]: Nothing to be done for `/home/botbear/openwrt/trunk/staging_dir/toolchain- arm_v6k_gcc-linaro_uClibc-0.9.32_eabi/bin/arm-openwrt-linux-c++'.
修改后的命令如下所示:
@${MAKE} /home/botbear/openwrt/trunk/staging_dir/toolchain-arm_v6k_gcc-linaro_uClibc-0.9.32_eabi/bin/arm-openwrt-linux-c++ --no-print-directory -C .build -f json.make
感谢您的帮助 您可以使用
man make
了解make
的参数:
-C dir, --directory=dir
Change to directory dir before reading the makefiles or doing any-
thing else. If multiple -C options are specified, each is inter-
preted relative to the previous one: -C / -C etc is equivalent to
-C /etc. This is typically used with recursive invocations of
make.
-f file, --file=file, --makefile=FILE
Use file as a makefile.
因此-C.build
更改目录.build
我不明白你问题中关于修改命令的部分。试着找到json.make的位置。似乎是这个makefile创建并删除了您刚才提到的目录 在命令行中,似乎将目录更改为.build并执行json.make。不确定json.make如何在那里结束。是。生成创建然后删除的目录?可能重复的