1f36411005c05a92651e6098973e09584e0d2172
[multipath-tools/.git] / tests / Makefile
1 include ../Makefile.inc
2
3 CFLAGS += $(BIN_CFLAGS) -I$(multipathdir) -I$(mpathcmddir)
4 LIBDEPS += -L$(multipathdir) -lmultipath -lcmocka
5
6 TESTS := uevent parser util dmevents
7
8 .SILENT: $(TESTS:%=%.o)
9 .PRECIOUS: $(TESTS:%=%-test)
10
11 all:    $(TESTS:%=%.out)
12
13 dmevents-test: dmevents.o ../multipathd/dmevents.c globals.c $(multipathdir)/libmultipath.so
14         @$(CC) -o $@ $< $(LDFLAGS) $(LIBDEPS) -lpthread -ldevmapper -lurcu -Wl,--wrap=open -Wl,--wrap=close -Wl,--wrap=dm_is_mpath -Wl,--wrap=dm_geteventnr -Wl,--wrap=ioctl -Wl,--wrap=libmp_dm_task_create -Wl,--wrap=dm_task_no_open_count -Wl,--wrap=dm_task_run -Wl,--wrap=dm_task_get_names -Wl,--wrap=dm_task_destroy -Wl,--wrap=poll -Wl,--wrap=remove_map_by_alias -Wl,--wrap=update_multipath
15
16 %-test: %.o globals.c $(multipathdir)/libmultipath.so
17         @$(CC) -o $@ $< $(LDFLAGS) $(LIBDEPS)
18
19 %.out:  %-test
20         @echo == running $< ==
21         @LD_LIBRARY_PATH=$(multipathdir):$(mpathcmddir) ./$< >$@
22
23 clean: dep_clean
24         rm -f $(TESTS:%=%-test) $(TESTS:%=%.out) $(TESTS:%=%.o)
25
26 OBJS = $(TESTS:%=%.o)
27 .SECONDARY: $(OBJS)
28
29 include $(wildcard $(OBJS:.o=.d))
30
31 dep_clean:
32         $(RM) $(OBJS:.o=.d)