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: bin/not init.sh 29 sh harness.sh 30 31bin/not: .bin-dir-stamp 32 $(CC) -o bin/not not.c 33 34init.sh: Makefile.in .bin-dir-stamp 35 rm -f $@-t $@ 36 echo 'top_srcdir=$(top_srcdir)' >> $@-t 37 echo 'abs_top_builddir=$(abs_top_builddir)' >> $@-t 38 echo 'abs_top_srcdir=$(abs_top_builddir)' >> $@-t 39 echo 'PATH=$(abs_top_builddir)/test/bin:$$PATH' >> $@-t 40 echo 'export LD_LIBRARY_PATH="$(abs_top_builddir)/libdm:$(abs_top_builddir)/dmeventd"' >> $@-t 41 echo 'abs_srcdir=$(abs_srcdir)' >> $@-t 42 echo 'abs_builddir=$(abs_builddir)' >> $@-t 43 echo 'export PATH' >> $@-t 44 chmod a-w $@-t 45 mv $@-t $@ 46 47# Shell quote; 48SHELL_PATH_SQ = $(subst ','\'',$(SHELL_PATH)) 49 50T = $(wildcard t-*.sh) 51 52Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status 53 cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ 54 55$(T): bin/not init.sh 56 sh harness.sh $@ 57 58.bin-dir-stamp: lvm-wrapper 59 rm -rf bin 60 mkdir bin 61 for i in lvm $$(cat $(top_srcdir)/tools/.commands); do \ 62 ln -s ../lvm-wrapper bin/$$i; \ 63 done 64 ln -s "$(abs_top_builddir)/tools/dmsetup" bin/dmsetup 65 touch $@ 66 67lvm-wrapper: Makefile 68 rm -f $@-t $@ 69 echo '#!/bin/sh' > $@-t 70 echo 'cmd=$$(echo ./$$0|sed "s,.*/,,")' >> $@-t 71 echo 'test "$$cmd" = lvm &&' >> $@-t 72 echo 'exec "$(abs_top_builddir)/tools/lvm" "$$@"' >> $@-t 73 echo 'exec "$(abs_top_builddir)/tools/lvm" "$$cmd" "$$@"' >> $@-t 74 chmod a-w,a+x $@-t 75 mv $@-t $@ 76 77clean: 78 rm -rf init.sh lvm-wrapper bin .bin-dir-stamp 79 80distclean: clean 81 82.PHONY: $(T) clean distclean 83.NOTPARALLEL: 84