#
# Makefile  -  makefile for romcheck program
#
# Copyright (C) 2003-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.10 2007/02/01 12:09:23 gkminix Exp $
#


# Directory name of this module
MODNAME = misc/romcheck


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


# Source files for the target system
SSRCS86   = loader.S86 startup.S86 doscan.S86
CSRCS86   = main.c86 printscan.c86 printhex.c86 printinfo.c86 io.c86
MAINOBJS  = startup.o86 doscan.o86 $(CSRCS86:%.c86=%.o86)
MAINBIN   = main.bin
LOADOBJS  = loader.o86
LOADBIN   = loader.boot


# Rules to generate the target system files
all:		romcheck-$(GNU16BIT)



# Generate the final target binary
.PHONY:		romcheck-gnu romcheck-nognu

romcheck-gnu:	romcheck.bin

romcheck-nognu:

romcheck.bin:	$(LOADBIN) $(MAINBIN)
		cat $(LOADBIN) $(MAINBIN) > $@
		@chmod 644 $@


# Generate the boot sector binary
$(LOADBIN):	$(LOADOBJS)


# Generate the main program binary
$(MAINBIN):	$(MAINOBJS)


# Make all files for distribution
distrib:	romcheck.bin


# Install
install:	romcheck-$(GNU16BIT)
		$(INSTALL) -d $(DESTDIR)$(nbmiscdir)
		$(INSTALL_DATA) romcheck.bin $(DESTDIR)$(nbmiscdir)/romcheck.bin


# Clean up
clean:		clean-general
		rm -f $(LOADBIN) $(MAINBIN)

distclean:	clean

realclean:	distclean
		rm -f romcheck.bin


