Makefile文件名操作

时间:2019-09-25 07:22:16

标签: makefile suffix basename

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

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

我如何摆脱点?

1 个答案:

答案 0 :(得分:1)

您可以尝试:

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