Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
给定以下 GNU Makefile 代码。
ENDING = '\.cpp' OBJ = $(SOURCES:$(ENDING)=.o) # (does not work)
然而,这并没有取代任何东西,
OBJ = $(SOURCES:.cpp=.o)
确实(对于 cpp 文件)。有没有办法告诉 patsubst特定的结局?或者至少要替换所有类型的结尾,如下所示?
OBJ = $(SOURCES:.*=.o) # (does not work)
这有效:
ENDING = .cpp OBJ = $(SOURCES:$(ENDING)=.o)
这将取代所有结局:
OBJ = $(addsuffix .o,$(basename $(SOURCES)))