Shinichiro Hamaji | 10c0106 | 2015-04-03 16:14:32 +0900 | [diff] [blame^] | 1 | # TODO(hamaji) |
| 2 | |
| 3 | test1: |
| 4 | touch server.c server_priv.c server_access.c |
| 5 | touch client.c client_api.c client_mem.c |
| 6 | |
| 7 | test2: all |
| 8 | |
| 9 | PROGRAMS = server client |
| 10 | |
| 11 | server_OBJS = server.o server_priv.o server_access.o |
| 12 | server_LIBS = priv protocol |
| 13 | |
| 14 | client_OBJS = client.o client_api.o client_mem.o |
| 15 | client_LIBS = protocol |
| 16 | |
| 17 | # Everything after this is generic |
| 18 | |
| 19 | .PHONY: all |
| 20 | all: $(PROGRAMS) |
| 21 | |
| 22 | define PROGRAM_template = |
| 23 | $(1): $$($(1)_OBJS) $$($(1)_LIBS:%=-l%) |
| 24 | ALL_OBJS += $$($(1)_OBJS) |
| 25 | endef |
| 26 | |
| 27 | $(foreach prog,$(PROGRAMS),$(eval $(call PROGRAM_template,$(prog)))) |
| 28 | |
| 29 | $(PROGRAMS): |
| 30 | $(LINK.o) $^ $(LDLIBS) -o $@ |
| 31 | |
| 32 | clean: |
| 33 | rm -f $(ALL_OBJS) $(PROGRAMS) |