# 
#   Affix - Bluetooth Protocol Stack for Linux
#   Copyright (C) 2001 Nokia Corporation
#   Original Author: Dmitry Kasatkin <dmitry.kasatkin@nokia.com>
#
#   This program 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 of the License, or (at your
#   option) any later version.
#
#   This program 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 this program; if not, write to the Free Software Foundation, Inc.,
#   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
#
#
#   $Id: Makefile,v 1.13 2003/08/13 13:06:35 jh Exp $
#
#   Makefile for installing scripts
#
#   Fixes:	Dmitry Kasatkin <dmitry.kasatkin@nokia.com>
#		
 
ifndef src
    src = .
endif

include $(src)/../config.mk

all:

clean:
	@rm -f *~


install:	nodes
	@echo "Installing scripts"
	install -m 0755 -d $(DESTDIR)/etc/affix
	
	install -m 0755 -d $(DESTDIR)/etc/pcmcia
	install -m 0644 pcmcia/*.conf $(DESTDIR)/etc/pcmcia

ifeq (, $(DESTDIR))
	@if [ -d /etc/modutils ] ; then \
		install -m 0644 ./modutils $(DESTDIR)/etc/modutils/affix; \
		update-modules; \
	fi
else
	install -m 0755 -d $(DESTDIR)/etc/modutils
	install -m 0644 ./modutils $(DESTDIR)/etc/modutils/affix
endif

uninstall:
	@CDIR=`pwd`;\
	cd $(DESTDIR)/etc/pcmcia;\
	rm -f affix.conf;\
	rm -f $(DESTDIR)/etc/modutils/affix;\
	cd $$CDIR
	
nodes:
ifdef CONFIG_DEVFS_FS
	@echo installing devfs conf file
	install -m 0755 -d $(DESTDIR)/etc/devfs/conf.d
	install -m 0644 devfs $(DESTDIR)/etc/devfs/conf.d/affix
else
	@echo Creating nodes in /dev/...
	install -m 0755 -d $(DESTDIR)/dev
	@rm -rf $(DESTDIR)/dev/bty0
	@mknod -m 0644 $(DESTDIR)/dev/bty0 c 60 0
	@rm -rf $(DESTDIR)/dev/bty1
	@mknod -m 0644 $(DESTDIR)/dev/bty1 c 60 1
	@rm -rf $(DESTDIR)/dev/bty2
	@mknod -m 0644 $(DESTDIR)/dev/bty2 c 60 2
	@rm -rf $(DESTDIR)/dev/bty3
	@mknod -m 0644 $(DESTDIR)/dev/bty3 c 60 3
	@rm -rf $(DESTDIR)/dev/bty4
	@mknod -m 0644 $(DESTDIR)/dev/bty4 c 60 4
endif

