#
# Author: Heinz Mauelshagen, Germany (mge@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 lvm_kernel.h Makefile $(TOP)/lvm_version.h $(TOP)/lvm_version.h.inp

CFLAGS += -DMODULE -Wall -fomit-frame-pointer -fno-strength-reduce -pipe -m486 -malign-loops=2 -malign-jumps=2 -malign-functions=2 -DCPU=586 -DDEBUG_LVM_PROC_GET_INFO

# CFLAGS += -DDEBUG_LVM_GET_INFO -DLVM_CONFIG_PROC_FS -DDEBUG -DDEBUG_MAP -DDEBUG_MAP_SIZE -DDEBUG_IOCTL -DDEBUG_READ -DLVM_TOTAL_RESET -DDEBUG_GENDISK -DDEBUG_VG_CREATE -DDEBUG_LVM_BLK_OPEN -DDEBUG_KFREE -DLVM_GET_INODE -DMODULE -DMODVERSIONS
CFLAGS += -DLVM_TOTAL_RESET -DLVM_GET_INODE -DMODULE -DMODVERSIONS -DLVM_CONFIG_PROC_FS

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)

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)

