当前位置: 技术问答>linux和unix
makefile eval 问题--共同探讨
来源: 互联网 发布时间:2016-05-13
本文导语: 请问一下:下面makefile中 $(1): $$($(1)_OBJS) $$($(1)_LIBS:%=-l%) 是什么意思? 尤其是 $(1)_LIBS:%=-l% 怎么理解。 ##################### makefile ########################## PROGRAMS = server client server_OBJS = server.o s...
请问一下:下面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 ####################################
##################### 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 等等,
比如!-1 或者 !:! !:2 等等,