3450b14056c31afb0f08358f78ebced47c816286
[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
7
8 .SILENT: $(TESTS:%=%.o)
9 .PRECIOUS: $(TESTS:%=%-test)
10
11 %-test: %.o globals.c $(multipathdir)/libmultipath.so
12         @$(CC) -o $@ $< $(LDFLAGS) $(LIBDEPS)
13
14 %.out:  %-test
15         @echo == running $< ==
16         @LD_LIBRARY_PATH=$(multipathdir):$(mpathcmddir) ./$< >$@
17
18 all:    $(TESTS:%=%.out)
19
20 clean: dep_clean
21         rm -f $(TESTS:%=%-test) $(TESTS:%=%.out) $(TESTS:%=%.o)
22
23 OBJS = $(TESTS:%=%.o)
24 .SECONDARY: $(OBJS)
25
26 include $(wildcard $(OBJS:.o=.d))
27
28 dep_clean:
29         $(RM) $(OBJS:.o=.d)