#
# Makefile  -  makefile for mknbi program for Linux
#
# Copyright (C) 1995-2003 Gero Kuhlmann   <gero@gkminix.han.de>
# Copyright (C) 1996,1997 Gero Kuhlmann   <gero@gkminix.han.de>
#		 and Markus Gutschke <gutschk@math.uni-muenster.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.2 2003/03/30 10:02:37 gkminix Exp $
#


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


# MANEXT is the manual section number
MANEXT = 8


# Source and object files for the host system
SRCS      = mknbi.c first_c.c firstd_c.c
OBJS      = $(SRCS:.c=.o)
TARGET    = mknbi-linux


# Rules to make the target
all:		$(TARGET)

$(TARGET):	mknbi

mknbi:		$(OBJS) $(LIBNBA)
		$(CC) -o mknbi $(LDFLAGS) $(OBJS) $(LIBS)


# Generate C source file from boot image loader binary source
first_c.c:	stamp-first-$(GNU16BIT)

first/first.b86:
		@echo making first.b86 in first
		@(cd first && $(MAKE) first-$(GNU16BIT)) || exit 1

stamp-first-gnu:	first/first.b86 $(MAKEC)
		$(MAKEC) first <first/first.b86 >first_c.c
		@touch stamp-first-gnu

stamp-first-nognu:
		@touch first_c.c
		@touch stamp-first-nognu


firstd_c.c:	stamp-firstd-$(GNU16BIT)

first/first-debug.b86:
		@echo making first-debug.b86 in first
		@(cd first && $(MAKE) first-debug-$(GNU16BIT)) || exit 1

stamp-firstd-gnu:	first/first-debug.b86 $(MAKEC)
		$(MAKEC) firstd <first/first-debug.b86 >firstd_c.c
		@touch stamp-firstd-gnu

stamp-firstd-nognu:
		@touch firstd_c.c
		@touch stamp-firstd-nognu


# distrib generates all files which are not removed by distclean
distrib:	stamp-first-gnu stamp-firstd-gnu

install:	all
		$(INSTALL) -d $(bindir)
		$(INSTALL) -d $(mandir)/man$(MANEXT)
		$(INSTALL) -m 511 mknbi $(bindir)/$(TARGET)
		$(INSTALL) -m 644 -o bin -g bin mknbi.man $(mandir)/man$(MANEXT)/$(TARGET).$(MANEXT)


clean:			clean-local clean-recursive

clean-local:		clean-general
			rm -f mknbi


distclean:		distclean-local distclean-recursive

distclean-local:	clean-local


realclean:		realclean-local realclean-recursive

realclean-local:	distclean-local
			rm -f first_c.c firstd_c.c




syntax highlighted by Code2HTML, v. 0.9.1