#
# Makefile  -  main makefile for bootrom
#
# Copyright (C) 1996-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.
#


# Directory name of this module and special defines
MODNAME = bootrom


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


# Specify all subdirectories where we are going to make something
SUBDIRS	= loader kernel netdrvr


# Specify all targets
GNUTARGETS   = $(addsuffix -gnu,$(SUBDIRS))
NOGNUTARGETS = $(addsuffix -nognu,$(SUBDIRS))
TARGETS      = $(addsuffix -$(GNU16BIT),$(SUBDIRS));


all:		$(TARGETS)

$(GNUTARGETS):	all-recursive

$(NOGNUTARGETS):

$(SUBDIRS):
	@echo making all in $@ ; \
	 (cd $@ && $(MAKE) all) || exit 1;


# Produce all files necessary for distribution
distrib:	distrib-recursive


# Install all files in place
instbin:
	@echo Make all necessary directories
	$(INSTALL) -d $(DESTDIR)$(nbbindir)
	$(INSTALL) -d $(DESTDIR)$(nbmiscdir)
	@echo Install new binaries
	@for i in $(bindestdir)/*.bin; do			\
	  echo $(INSTALL_DATA) $$i $(DESTDIR)$(nbbindir);	\
	  $(INSTALL_DATA) $$i $(DESTDIR)$(nbbindir);		\
	done
	@for i in $(bindestdir)/*.com; do			\
	  echo $(INSTALL_DATA) $$i $(DESTDIR)$(nbmiscdir);	\
	  $(INSTALL_DATA) $$i $(DESTDIR)$(nbmiscdir);		\
	done

install:	install-recursive instbin


# Maintenance rules
clean:		clean-recursive
	rm -f .depend core


realclean: 	realclean-recursive
	rm -f $(bindestdir)/*.bin $(bindestdir)/*.com
	rm -f .depend core


distclean:	distclean-recursive
	rm -f .depend core

