【问题标题】:makefile filename manipulationsmakefile 文件名操作
【发布时间】:2020-01-25 08:04:18
【问题描述】:

我正在尝试从makefile 中名为~/Downloads/GGG/some_file.6.txt 的文件中提取6。我非常接近,并设法得到.6,但我似乎无法摆脱点.,只得到6。这是我的生成文件:

FILE = ~/Downloads/GGG/some_file.6.txt

another_file.txt: ${FILE}
    @echo $<
    @echo $(suffix $(basename $<))
    @cp $< $@

结果如下:

$ make
/home/oren/Downloads/GGG/some_file.6.txt
.6

我怎样才能去掉这个点?

【问题讨论】:

标签: makefile suffix basename


【解决方案1】:

你可以试试:

@echo $(patsubst .%,%,$(suffix $(basename $<)))

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-03-23
    • 1970-01-01
    • 1970-01-01
    • 2014-06-25
    • 1970-01-01
    相关资源
    最近更新 更多