#
# Makefile  -  makefile for miscellaneous programs and files
#
# Copyright (C) 1998-2003 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.1 2003/03/09 00:43:09 gkminix Exp $
#


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


# Names of configuration files
drivers	= netboot.drivers
db	= netboot.db
difs	= difs/*.dif


# Manual page section
MANEXT	= 5


# Specify all subdirectories where we are going to make something
SUBDIRS	= romcheck



# Generate all target files
all:		makec $(nbconfig) netboot.man $(drivers)
	@for subdir in $(SUBDIRS); do \
	  echo making $@ in $$subdir; \
	  (cd $$subdir && $(MAKE) $@) || exit 1; \
	 done


# distrib generates all files which are not removed by distclean
# We need makec for distrib targets in some other Makefiles, so build
# it here as well.
distrib:	makec distrib-recursive


makec:		makec.c
	$(CC) -o makec makec.c


$(nbconfig):	netboot.config.in
	sed "s&%PREFIX%&$(prefix)&" netboot.config.in >$(nbconfig)


netboot.man:	netboot.man.in
	sed "s&%CONFIG%&$(sysconfdir)/$(nbconfig)&;s&%LIBDIR%&$(nblibdir)&" netboot.man.in >netboot.man


$(drivers):	netboot.drivers.in
	cat netboot.drivers.in $(difs) >$(drivers)


install:	$(nbconfig) $(drivers) \
		netboot.man $(nbconfig).man $(drivers).man $(db).man \
		install-recursive
	$(INSTALL) -d $(sysconfdir)
	$(INSTALL) -d $(nblibdir)
	$(INSTALL) -d $(mandir)/man$(MANEXT)
	$(INSTALL) -m 644 -o bin -g bin $(nbconfig) $(sysconfdir)/$(nbconfig)-dist
	$(INSTALL) -m 644 -o bin -g bin $(drivers) $(nblibdir)/$(drivers)
	$(INSTALL) -m 644 -o bin -g bin netboot.man $(mandir)/man$(MANEXT)/netboot.$(MANEXT)
	$(INSTALL) -m 644 -o bin -g bin $(nbconfig).man $(mandir)/man$(MANEXT)/$(nbconfig).$(MANEXT)
	$(INSTALL) -m 644 -o bin -g bin $(drivers).man $(mandir)/man$(MANEXT)/$(drivers).$(MANEXT)
	$(INSTALL) -m 644 -o bin -g bin $(db).man $(mandir)/man$(MANEXT)/$(db).$(MANEXT)


clean:	clean-general clean-recursive
	rm -f makec $(nbconfig) netboot.man $(drivers)

realclean: 	clean-general realclean-recursive
	rm -f makec $(nbconfig) netboot.man $(drivers)

distclean:	clean-general distclean-recursive
	rm -f makec $(nbconfig) netboot.man $(drivers)




syntax highlighted by Code2HTML, v. 0.9.1