我想libswscale.so.2
用(分别称为和的libswscale.so
变量)替换字符串。这是我在 Makefile 中尝试的:$(SLIBNAME_WITH_MAJOR)
$(SLIBNAME)
$(SUBDIR)$(SLIBNAME_WITH_MAJOR): $(OBJS) $(SUBDIR)lib$(NAME).ver
[...]
@echo SHFLAGS=$(SHFLAGS)
@echo SLIBNAME_WITH_MAJOR=$(SLIBNAME_WITH_MAJOR)
@echo SLIBNAME=$(SLIBNAME)
@echo A $(patsubst $(SLIBNAME_WITH_MAJOR),$(SLIBNAME),$(SHFLAGS))
@echo B $(SHFLAGS:$(SLIBNAME_WITH_MAJOR)=$(SLIBNAME))
@echo C $($(SHFLAGS):$(SLIBNAME_WITH_MAJOR)=$(SLIBNAME))
@echo D $(SHFLAGS:$(SLIBNAME_WITH_MAJOR)=$(SLIBNAME))
@echo E $(subst $(SLIBNAME_WITH_MAJOR),$(SLIBNAME),$(SHFLAGS))
@echo F $(subst l,L,$(SHFLAGS))
输出是
SHFLAGS=-shared -Wl,-soname,libswscale.so.2 -Wl,-Bsymbolic -Wl,--version-script,libswscale/libswscale.ver
SLIBNAME_WITH_MAJOR=libswscale.so.2
SLIBNAME=libswscale.so
A -shared -Wl,-soname,libswscale.so.2 -Wl,-Bsymbolic -Wl,--version-script,libswscale/libswscale.ver
B -shared -Wl,-soname,libswscale.so.2 -Wl,-Bsymbolic -Wl,--version-script,libswscale/libswscale.ver
C
D -shared -Wl,-soname,libswscale.so.2 -Wl,-Bsymbolic -Wl,--version-script,libswscale/libswscale.ver
E -shared -Wl,-soname,libswscale.so.2 -Wl,-Bsymbolic -Wl,--version-script,libswscale/libswscale.ver
F -shared -WL,-soname,libswscale.so.2 -WL,-BsymboLic -WL,--version-script,LibswscaLe/LibswscaLe.ver
最后一个(F)特别荒谬。这里有什么问题?是因为它$(SHFLAGS)
也是由变量组成的吗?