#
# Makefile  -  makefile for UNDI driver binaries
#
# Copyright (C) 1998-2007 Gero Kuhlmann <gero@gkminix.han.de>
#
#  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
#  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., 675 Mass Ave, Cambridge, MA 02139, USA.
#
# $Id: Makefile,v 1.19 2007/02/01 12:09:20 gkminix Exp $
#


# Directory name of this module
MODNAME   = bootrom/netdrvr
MODDEFS   = _UNDI_
MODSUBDIR = undi


# Include makefile configuration
include ../../../../make.config
include ../../../../make.rules


# Subdirectories
SUBDIRS   = source


# Source files for the target system
DRVEXT1   = undi
DRVEXT2   = bin
DRIVERS   = $(wildcard *.$(DRVEXT1)) $(wildcard *.$(DRVEXT2))
MD5SUMS   = $(ROMDIR)/netdrvr/MD5SUMS


# Rules to generate the MD5 checksum files
.PHONY:	dist-md5

all:		dist-md5

dist-md5:	$(MD5SUMS)

$(MD5SUMS):	$(DRIVERS) | $(INSTDRV) $(MD5PROG)
		@MD5PROG="$(MD5PROGEXEC)" INSTALL="$(INSTALL)" $(INSTDRV) -u \
			-t $(MODSUBDIR) -s drivers -v \
			-n $(DESTDIR)$(ROMDIR)/netdrvr -m $(MD5SUMS) \
			$(foreach fname,$(DRIVERS),-d $(fname))



# Make files for distribution
distrib:	distrib-all dist-md5


# Installation
install:	$(DRIVERS) | $(INSTDRV) $(MD5PROG)
	$(INSTALL) -d $(DESTDIR)$(nbnetdrvdir)
	$(INSTALL) -d $(DESTDIR)$(nbnetdrvdir)/$(MODSUBDIR)
	@echo Installing network drivers
	@MD5PROG="$(MD5PROGEXEC)" INSTALL="$(INSTALL)" $(INSTDRV) \
			-t $(MODSUBDIR) -v \
			-n $(DESTDIR)$(nbnetdrvdir) -m $(nbnetdrvdir)/MD5SUMS \
			$(foreach fname,$(DRIVERS),-d $(fname))



# Clean up
clean:		clean-general clean-recursive

distclean:	clean-general distclean-recursive

realclean:	clean-general realclean-recursive

