linux配置程序时,经常需要设置配置文件。程序更新时,配置文件不需要替换,只有第一次部署时才拷贝。脚本如下:file = /etc/1.confifeq ($(file), $(wildcard $(file)))@echo 1.conf existelsecp 1.conf $(etc_dir)endif
Makefile
工具
这个git仓库最初
存在
是为了将我所了解的大多数
makefile
内容保
存在
一个地方-我不想继续重建相同的内容。 同样,它是一个方便的地方,用于存储诸如编译器标志之类的东西(尤其是对于不同的平台)以及诸如AVR的刷新命令之类的东西。
cp
Makefile
<other>
填写必要的变量,例如PROJ和SRC (可能是最小值)。
然后编辑MKFILE_DIR变量以指向此git存储库,或将MKFILE_DIR导出到.bashrc 。
键入make help以获取概述。
Makefile
示例显示了许多功能。 您应该在SRC定义源
文件
,其头与HDR源
文件
名不同,等等。(例如,我在config.h有一个带有编译时配置的项目,但是没有config.c ,所以我说HDR = config.h )。
TESTS_SRC当前假
test = $(shell if [ -d $(DIR_TEST) ]; then echo "exist"; else echo "noexist"; fi)
$(info $(test))
all: $(TARGET) $(OBJD)
ifeq ("$(test)", "noexist")
$(shell mkdir $(DIR_TEST))
endif
1,ifeq
判断
时,$(test
-e filename 如果 filename
存在
,则为真
-d filename 如果 filename为目录,则为真
-f filename 如果 filename为常规
文件
,则为真
-L filename 如果 filename为符号链接,则为真
-r filename 如果 filename可读,则为真
-w filename 如果 filename可写,则为真
参数pattern是一个
文件
名格式,包含有通配符。函数wildcard的结果是一列和格式匹配且真实
存在
的
文件
的名称,
文件
名之间用一个空格隔开。
比如当前目录下有
文件
1.c,2.c,1.h,2.h 则
c_src := $(wildcard *.c)
结果为:1.c 2.c
在U-BOOT的
makefile
中:
ifeq (include/config.mk,$(wildcard incl
Makefile
中
判断
文件
是否存在
:
exist = $(shell if [ -f $(file) ]; then echo “master conf file exist”; fi;)
$(if $(exist ) , cp -f $(file) $@ , )
(null), rm
-f Test1.o Test2.o Main.o
test_me.exe, ...) failed.make (e=2): The system cannot find the file specified. mingw32-make: *** [clean] Error 2rm -f Test1.o Test2.o Main.o
test_me.exeThis m
1.$(subst FROM,TO,TEXT)<br />
函数名称:字符串替换函数—subst。<br />
函数功能:把字串“TEXT”中的“FROM”字符替换为“TO”。<br />
返回值:替换后的新字符串。<br /><br />
2.$(patsubst PATTERN,REPLACEMENT,TEXT)<br />
函数名称:模式替换函数—patsubst。<br />
函数功能:搜索“TEXT”中以空格分开的单词,将否符合模式“TAT
pciPassthru.64bitMMIOSizeGB 键值等于
你打算直通到虚拟机的PCI设备(*)的数量,将该数字乘以16,然后四舍五入到下一个2的幂。
比如:1个直通设备就是 1*16=16
然后四舍五入到下一个2的幂就是=32
Specifying the 2nd entry requires a simple calculation. Count the number of high-end PCI devices(*) you intend to pass into the VM, multiply that number by 16 and then round up to the next power of two. For example, to use passthrough with two devices, the value would be: 2 * 16 = 32, rounded up to the next power of two to yield 64. For a single device, use 32. Use this value in the 2nd entry:
最新英伟达GPU算力
Pink Wang :
Yolov4烟火检测
weixin_46041783:
最新英伟达GPU算力
weixin_43756818: