1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126
|
#
# Copyright (C) 2001-2004 Sistina Software, Inc. All rights reserved.
# Copyright (C) 2004 Red Hat, Inc. All rights reserved.
#
# This file is part of the device-mapper userspace tools.
#
# This copyrighted material is made available to anyone wishing to use,
# modify, copy, or redistribute it subject to the terms and conditions
# of the GNU General Public License v.2.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
SHELL = /bin/sh
srcdir = @srcdir@
top_srcdir = @top_srcdir@
VPATH = @srcdir@
interface = @interface@
kerneldir = @kerneldir@
kernelvsn = @kernelvsn@
tmpdir=@tmpdir@
LN_S = @LN_S@
FS=dmfs-error.c dmfs-lv.c dmfs-root.c dmfs-status.c \
dmfs-super.c dmfs-suspend.c dmfs-table.c dmfs.h
COMMON=dm-linear.c dm-stripe.c \
dm-snapshot.c kcopyd.c \
dm-table.c dm-target.c dm.c dm.h dm-snapshot.h \
dm-exception-store.c kcopyd.h \
dm-io.c dm-io.h dm-log.c dm-log.h dm-daemon.c dm-daemon.h dm-raid1.c
IOCTL=dm-ioctl.c
common_hdrs=common/device-mapper.h
ioctl_hdr=ioctl/dm-ioctl.h
KERNELTAR=/usr/src/linux-$(kernelvsn).tar
fs=$(patsubst %,fs/%,$(FS))
common=$(patsubst %,common/%,$(COMMON))
ioctl=$(patsubst %,ioctl/%,$(IOCTL))
.PHONY: install clean distclean all symlinks patches patches-clean
all: symlinks
symlinks:
for i in $(common) $(fs) $(ioctl); do \
if [ -L $(kerneldir)/drivers/md/`basename $$i` ] ; \
then $(RM) $(kerneldir)/drivers/md/`basename $$i`; \
fi; \
done
for i in $(common) $($(interface)) ; do \
$(LN_S) `pwd`/$$i $(kerneldir)/drivers/md ; \
done
for i in $(common_hdrs) $(ioctl_hdr) ; do \
if [ -L $(kerneldir)/include/linux/`basename $$i` ] ; \
then $(RM) \
$(kerneldir)/include/linux/`basename $$i`; \
fi; \
done
for i in $(common_hdrs) ; do \
$(LN_S) `pwd`/$$i $(kerneldir)/include/linux ; \
done
if [ "$(interface)" == "ioctl" ] ; then \
$(LN_S) `pwd`/$(ioctl_hdr) $(kerneldir)/include/linux ; \
fi
patches:
if [ ! -e $(KERNELTAR) ] ; then \
echo "Can't find kernel source tarball $(KERNELTAR)" ; \
exit 1; \
fi
if [ ! -e $(tmpdir) ] ; then mkdir $(tmpdir); fi
if [ ! -d $(tmpdir) ] ; then \
echo "Working directory $(tmpdir) missing" ; \
exit 1; \
fi
( \
cd $(tmpdir); \
tar xf $(KERNELTAR) ; \
cp -al linux linux-$(kernelvsn) ; \
)
for i in $(common) $($(interface)) ; do \
$(LN_S) `pwd`/$$i $(tmpdir)/linux/drivers/md ; \
done
for i in $(common_hdrs) ; do \
$(LN_S) `pwd`/$$i $(tmpdir)/linux/include/linux ; \
done
if [ "$(interface)" == "ioctl" ] ; then \
$(LN_S) `pwd`/$(ioctl_hdr) $(tmpdir)/linux/include/linux ; \
fi
for i in ../patches/common/linux-$(kernelvsn)* \
../patches/$(interface)/linux-$(kernelvsn)* ; do \
patch -d $(tmpdir)/linux -p1 -i `pwd`/$$i ; \
done
( \
cd $(tmpdir); \
diff -ruN linux-$(kernelvsn) linux ; \
exit 0; \
) > ../patches/linux-$(kernelvsn)-devmapper-$(interface).patch
$(RM) -r $(tmpdir)
patches-clean:
$(RM) -r $(tmpdir)
$(RM) ../patches/linux-$(kernelvsn)-devmapper-$(interface).patch
install:
clean:
distclean:
$(RM) Makefile
|