Makefile.in revision 1.1 1 # Copyright (C) 2007 Red Hat, Inc. All rights reserved.
2 #
3 # This file is part of LVM2.
4 #
5 # This copyrighted material is made available to anyone wishing to use,
6 # modify, copy, or redistribute it subject to the terms and conditions
7 # of the GNU General Public License v.2.
8 #
9 # You should have received a copy of the GNU General Public License
10 # along with this program; if not, write to the Free Software Foundation,
11 # Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
12
13 #TEST_OPTS=--verbose --debug
14 SHELL_PATH ?= $(SHELL)
15 TAR ?= $(TAR)
16 RM ?= rm -f
17
18 subdir := $(shell pwd|sed 's,.*/,,')
19
20 srcdir = @srcdir@
21 top_srcdir = @top_srcdir@
22 top_builddir = @top_builddir@
23 abs_srcdir = @abs_srcdir@
24 abs_builddir = @abs_builddir@
25 abs_top_builddir = @abs_top_builddir@
26 abs_top_srcdir = @abs_top_srcdir@
27
28 all: init.sh
29 sh harness.sh
30
31 init.sh: Makefile.in .bin-dir-stamp
32 rm -f $@-t $@
33 echo 'top_srcdir=$(top_srcdir)' >> $@-t
34 echo 'abs_top_builddir=$(abs_top_builddir)' >> $@-t
35 echo 'abs_top_srcdir=$(abs_top_builddir)' >> $@-t
36 echo 'PATH=$(abs_top_builddir)/test/bin:$$PATH' >> $@-t
37 echo 'export LD_LIBRARY_PATH="$(abs_top_builddir)/libdm:$(abs_top_builddir)/dmeventd"' >> $@-t
38 echo 'abs_srcdir=$(abs_srcdir)' >> $@-t
39 echo 'abs_builddir=$(abs_builddir)' >> $@-t
40 echo 'export PATH' >> $@-t
41 chmod a-w $@-t
42 mv $@-t $@
43
44 # Shell quote;
45 SHELL_PATH_SQ = $(subst ','\'',$(SHELL_PATH))
46
47 T = $(wildcard t-*.sh)
48
49 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
50 cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
51
52 $(T): init.sh
53 sh harness.sh $@
54
55 .bin-dir-stamp: lvm-wrapper
56 rm -rf bin
57 mkdir bin
58 for i in lvm $$(cat $(top_srcdir)/tools/.commands); do \
59 ln -s ../lvm-wrapper bin/$$i; \
60 done
61 ln -s "$(abs_top_builddir)/tools/dmsetup" bin/dmsetup
62 touch $@
63
64 lvm-wrapper: Makefile
65 rm -f $@-t $@
66 echo '#!/bin/sh' > $@-t
67 echo 'cmd=$$(echo ./$$0|sed "s,.*/,,")' >> $@-t
68 echo 'test "$$cmd" = lvm &&' >> $@-t
69 echo 'exec "$(abs_top_builddir)/tools/lvm" "$$@"' >> $@-t
70 echo 'exec "$(abs_top_builddir)/tools/lvm" "$$cmd" "$$@"' >> $@-t
71 chmod a-w,a+x $@-t
72 mv $@-t $@
73
74 clean:
75 rm -rf init.sh lvm-wrapper bin .bin-dir-stamp
76
77 distclean: clean
78
79 .PHONY: $(T) clean distclean
80 .NOTPARALLEL:
81