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 14SHELL_PATH ?= $(SHELL) 15TAR ?= $(TAR) 16RM ?= rm -f 17 18subdir := $(shell pwd|sed 's,.*/,,') 19 20srcdir = @srcdir@ 21top_srcdir = @top_srcdir@ 22top_builddir = @top_builddir@ 23abs_srcdir = @abs_srcdir@ 24abs_builddir = @abs_builddir@ 25abs_top_builddir = @abs_top_builddir@ 26abs_top_srcdir = @abs_top_srcdir@ 27 28all: init.sh 29 ./bin/harness t-*.sh 30 31bin/not: $(srcdir)/not.c .bin-dir-stamp 32 $(CC) -o bin/not $< 33 34bin/harness: $(srcdir)/harness.c .bin-dir-stamp 35 $(CC) -o bin/harness $< 36 37init.sh: $(srcdir)/Makefile.in $(srcdir)/test-utils.sh .bin-dir-stamp bin/not bin/harness $(T) 38 rm -f $@-t $@ 39 echo 'top_srcdir=$(top_srcdir)' >> $@-t 40 echo 'abs_top_builddir=$(abs_top_builddir)' >> $@-t 41 echo 'abs_top_srcdir=$(abs_top_builddir)' >> $@-t 42 echo 'PATH=$(abs_top_builddir)/test/bin:$$PATH' >> $@-t 43 echo 'export LD_LIBRARY_PATH="$(abs_top_builddir)/libdm:$(abs_top_builddir)/liblvm:$(abs_top_builddir)/daemons/dmeventd"' >> $@-t 44 echo 'abs_srcdir=$(abs_srcdir)' >> $@-t 45 echo 'abs_builddir=$(abs_builddir)' >> $@-t 46 echo 'export PATH' >> $@-t 47 chmod a-w $@-t 48 mv $@-t $@ 49 -cp $(srcdir)/test-utils.sh . 50 -cp $(srcdir)/test-lib.sh . 51 -cp $(T) . 52 53# Shell quote; 54SHELL_PATH_SQ = $(subst ','\'',$(SHELL_PATH)) 55 56T = $(wildcard $(srcdir)/t-*.sh) 57 58ifeq ("@APPLIB@", "yes") 59T += lvm2app.sh 60all: api/vgtest 61api/vgtest: 62 $(MAKE) -C api vgtest 63endif 64 65Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status 66 cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ 67 68#$(T): init.sh 69# ./bin/harness $@ 70 71.bin-dir-stamp: lvm-wrapper 72 rm -rf bin 73 mkdir bin 74 for i in lvm $$(cat ../tools/.commands); do \ 75 ln -s ../lvm-wrapper bin/$$i; \ 76 done 77 ln -s "$(abs_top_builddir)/tools/dmsetup" bin/dmsetup 78 touch $@ 79 80lvm-wrapper: Makefile 81 rm -f $@-t $@ 82 echo '#!/bin/sh' > $@-t 83 echo 'cmd=$$(echo ./$$0|sed "s,.*/,,")' >> $@-t 84 echo 'test "$$cmd" = lvm &&' >> $@-t 85 echo 'exec "$(abs_top_builddir)/tools/lvm" "$$@"' >> $@-t 86 echo 'exec "$(abs_top_builddir)/tools/lvm" "$$cmd" "$$@"' >> $@-t 87 chmod a-w,a+x $@-t 88 mv $@-t $@ 89 90clean: 91 rm -rf init.sh lvm-wrapper bin .bin-dir-stamp 92 93distclean: clean 94 rm -f Makefile 95 96.PHONY: $(T) clean distclean 97.NOTPARALLEL: 98