FILENAME:= mn.004.contrast-reading.html
DOT:= . DASH:= - # replace . with - RESULT= $(subst $(DOT),$(DASH),$(FILENAME)) HTML_SUFFIX:= .html RST_SUFFIX:= \%zh.rst # replace .html with %zh.rst RESULT2= $(subst $(HTML_SUFFIX),$(RST_SUFFIX),$(FILENAME)) default: @echo $(RESULT) @echo $(RESULT2)
from: https://siongui.github.io/2016/04/08/makefile-string-replace/