#
# Author: Heinz Mauelshagen, Germany <linux.LVM@ez-darmstadt.telekom.de>
#
# Februar 1997
#
# lvm is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
# any later version.
# 
# lvm is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
# 
# You should have received a copy of the GNU General Public License
# along with GNU CC; see the file COPYING.  If not, write to
# the Free Software Foundation, 59 Temple Place - Suite 330,
# Boston, MA 02111-1307, USA. 
#
#

SUBDIRS = .

include ../make.tmpl

lvm_dep = lvm.c lvm.h Makefile

CFLAGS += -Wall -fomit-frame-pointer -fno-strength-reduce -pipe -malign-loops=2 -malign-jumps=2 -malign-functions=2 -DMODULE -DMODVERSIONS

all_this:	lvm.o
	@echo ""
	@echo "Done kernel part"
	@echo ""

install-module:	lvm.o
	rm -f $(LVM_DEST)
	install -o root -g root -m 644 lvm.o $(LVM_DEST)
	rm -f /dev/lvm; mknod /dev/lvm c $(LVM_MAJOR) 0; chmod 640 /dev/lvm

remove-module:	lvm.o
	rm -f $(LVM_DEST) /dev/lvm

remove-ll_rw_blk:	$(LL_RW_BLK)
	@if [ ! -f $(LL_RW_BLK) ]; \
	then \
           @echo "Fatal ERROR: invalid OS version\n"; \
	fi
	@if [ -f $(LL_RW_BLK_DEST).ORG ]; \
	then \
           cp -p $(LL_RW_BLK_DEST).ORG $(LL_RW_BLK_DEST); \
	fi
	@if [ $$? -eq 0 ]; \
	then \
	   rm -f $(LL_RW_BLK_DEST).ORG; \
	fi
	@if [ -f $(KSYMS_DEST).ORG ]; \
	then \
           cp -p $(KSYMS_DEST).ORG $(KSYMS_DEST); \
	fi
	@if [ $$? -eq 0 ]; \
	then \
	   rm -f $(KSYMS_DEST).ORG; \
	fi

install-ll_rw_blk:	$(LL_RW_BLK)
	@if [ ! -f $(LL_RW_BLK) ]; \
	then \
           @echo "Fatal ERROR: invalid OS version\n"; \
	fi
	@if [ ! -f $(LL_RW_BLK_DEST).ORG ]; \
	then \
           cp -p $(LL_RW_BLK) $(LL_RW_BLK_DEST).ORG; \
	fi
	@if [ ! -f $(KSYMS_DEST).ORG ]; \
	then \
           cp -p $(KSYMS_DEST) $(KSYMS_DEST).ORG; \
	fi
	install -o root -g root -m 555 $(LL_RW_BLK) $(LL_RW_BLK_DEST)
	install -o root -g root -m 555 $(KSYMS) $(KSYMS_DEST)

install_this:	install-ll_rw_blk install-module

remove_this:	remove-ll_rw_blk remove-module

lvm.o:	$(lvm_dep)

clean_this:
	rm -f $(ALL_OBJECTS)

