makefile eval 问题--共同探讨
请问一下:下面makefile中 $(1): $$($(1)_OBJS) $$($(1)_LIBS:%=-l%) 是什么意思? 尤其是 $(1)_LIBS:%=-l% 怎么理解。
##################### makefile ##########################
PROGRAMS = server client
server_OBJS = server.o server_priv.o server_access.o
server_LIBS = priv protocol
client_OBJS = client.o client_api.o client_mem.o
client_LIBS = protocol
# Everything after this is generic
.PHONY: all
all: $(PROGRAMS)
define PROGRAM_template
$(1): $$($(1)_OBJS) $$($(1)_LIBS:%=-l%)
ALL_OBJS += $$($(1)_OBJS)
endef
$(foreach prog,$(PROGRAMS),$(eval $(call PROGRAM_template,$(prog))))
$(PROGRAMS):
$(LINK.o) $^ $(LDLIBS) -o $@
clean:
rm -f $(ALL_OBJS) $(PROGRAMS)
########################### end ####################################
------解决方案--------------------
linux shell 下 -1代表以前执行的命令的参数,
比如!-1 或者 !:! !:2 等等,