linux – Makefile命令替换问题
发布时间:2020-11-18 04:25:07 所属栏目:Linux 来源:互联网
导读:给定不同的配置文件时, rebar不会自动重建文件.所以,我试图在Makefile级别上执行此操作: REBAR=./rebarREBAR_DEBUG=$(REBAR) -C rebar.debug.configREBAR_COMPILE=$(REBAR) get-deps compileLAST_CONFIG:=$(cat config.tmp)PLT=dialyzer/sqlite3.
|
给定不同的配置文件时,rebar不会自动重建文件.所以,我试图在Makefile级别上执行此操作: REBAR=./rebar
REBAR_DEBUG=$(REBAR) -C rebar.debug.config
REBAR_COMPILE=$(REBAR) get-deps compile
LAST_CONFIG:=$(cat config.tmp)
PLT=dialyzer/sqlite3.plt
all: config_normal compile
compile:
$(REBAR_COMPILE)
test:
$(REBAR_COMPILE) eunit
clean:
-rm -rf deps ebin priv doc/* .eunit c_src/*.o
docs:
$(REBAR_COMPILE) doc
static: config_debug
$(REBAR_DEBUG) get-deps compile
ifeq ($(wildcard $(PLT)),)
dialyzer --build_plt --apps kernel stdlib erts --output_plt $(PLT)
else
dialyzer --plt $(PLT) -r ebin
endif
cross_compile: config_cross
$(REBAR_COMPILE) -C rebar.cross_compile.config
valgrind: clean
$(REBAR_DEBUG) get-deps compile
valgrind --tool=memcheck --leak-check=yes --num-callers=20 ./test.sh
ifeq ($(LAST_CONFIG),normal)
config_normal:
echo "$(LAST_CONFIG) == normal"
else
config_normal: clean
echo "$(LAST_CONFIG) != normal"
rm -f config.tmp
echo "normal" > config.tmp
endif
ifeq ($(LAST_CONFIG),debug)
config_debug: ;
else
config_debug: clean
rm -f config.tmp
echo "debug" > config.tmp
endif
ifeq ($(LAST_CONFIG),cross)
config_cross: ;
else
config_cross: clean
rm -f config.tmp
echo "cross" > config.tmp
endif
.PHONY: all compile test clean docs static valgrind config_normal config_debug config_cross
意图很明显:当我使用需要某个配置文件的目标时,检查上次是否使用了相同的文件;运行干净并记录我们现在使用的配置. 但它不起作用,文件不断重新编译: aromanov@alexey-desktop:~/workspace/gmcontroller/lib/sqlite3$make rm -rf deps ebin priv doc/* .eunit c_src/*.o echo " != normal" != normal rm -f config.tmp echo "normal" > config.tmp ./rebar get-deps compile ==> sqlite3 (get-deps) ==> sqlite3 (compile) Compiled src/sqlite3_lib.erl Compiled src/sqlite3.erl Compiling c_src/sqlite3_drv.c 尽管config.tmp包含“normal”: aromanov@alexey-desktop:~/workspace/gmcontroller/lib/sqlite3$LAST_CONFIG=$(cat config.tmp); echo $LAST_CONFIG normal 我错过了什么? 解决方法您缺少需要使用shell的部分,以便在定义变量时实际调用外部程序.
LAST_CONFIG:=$(shell cat config.tmp) (编辑:岳阳站长网) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
相关内容
- 存储 – Linux – 实际硬件RAID控制器调优(scsi和cciss)
- linux – 如何使用Expect自动化telnet会话?
- 如何在Linux上编译Intel Mac二进制文件?
- Linux系统调用,libc,VDSO和实现解析
- linux – xorg.conf,xset和xinput set之间有什么区别?
- 并发性 – 特定场景的最佳Linux内核锁定机制是什么
- linux – 防止bash脚本中的’rm -rf /’的最佳实践
- linux – 读取/ dev / block / mmcblk0和/ dev / block / m
- linux – 建议测试“pam.d / common- *”文件更改的方法
- linux – bash – 将日志文件直接输出到日志文件中(名称中包
