[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: debugging eval,call,foreach....
From: |
Toomas Rosin |
Subject: |
Re: debugging eval,call,foreach.... |
Date: |
Mon, 21 Oct 2002 12:43:33 +0300 (EEST) |
Hello!
For example, the manual has this example:
PROGRAMS= client server
define PROGRAM_template
$(1): $$($(1)_OBJ) $$($(1)_LIBS:%=-l%)
ALL_OBJS += $$($(1)_OBJS)
endef
$(foreach prog,$(PROGRAMS),$(eval $(call PROGRAM_template,$(prog))))
it would be nice have a way to produce:
client: $(client_OBJS)
ALL_OBJS+=$(client_OBJS)
server: $(server_OBJS)
ALL_OBJS+=$(server_OBJS)
to help verify that all the quoting/escaping in PROGRAM_template and the
$( ...) stuff is right.
Use `warning'.
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)
# Add newlines to make the results stand out more clearly in output
define PROGRAM_template
$(1): $$($(1)_OBJ) $$($(1)_LIBS:%=-l%)
ALL_OBJS += $$($(1)_OBJS)
endef
# $(foreach prog,$(PROGRAMS),$(eval $(call PROGRAM_template,$(prog))))
# Replace `eval' with `warning':
$(foreach prog,$(PROGRAMS),$(warning $(call PROGRAM_template,$(prog))))
$(PROGRAMS):
@echo $(LINK.o) $^ $(LDLIBS) -o $@
Sample session:
address@hidden:~ $ make
Makefile:24:
server: $(server_OBJ) $(server_LIBS:%=-l%)
ALL_OBJS += $(server_OBJS)
Makefile:24:
client: $(client_OBJ) $(client_LIBS:%=-l%)
ALL_OBJS += $(client_OBJS)
cc -o server
cc -o client
address@hidden:~ $
Peace,
Toomas
- GNU make 3.80 is now available, psmith, 2002/10/04
- debugging eval,call,foreach...., mcmahill, 2002/10/15
- Re: debugging eval,call,foreach...., Paul D. Smith, 2002/10/15
- Re: debugging eval,call,foreach...., Russell, 2002/10/16
- Re: debugging eval,call,foreach....,
Toomas Rosin <=