1test1: 2 touch server.c server_priv.c server_access.c 3 touch client.c client_api.c client_mem.c 4 5test2: all 6 7PROGRAMS = server client 8 9server_OBJS = server.o server_priv.o server_access.o 10 11client_OBJS = client.o client_api.o client_mem.o 12 13# Everything after this is generic 14 15.PHONY: all 16all: $(PROGRAMS) 17 18define PROGRAM_template 19 $(1): $$($(1)_OBJS) 20 ALL_OBJS += $$($(1)_OBJS) 21endef 22 23$(foreach prog,$(PROGRAMS),$(eval $(call PROGRAM_template,$(prog)))) 24 25$(PROGRAMS): 26 echo $^ -o $@ 27 28clean: 29 rm -f $(ALL_OBJS) $(PROGRAMS) 30