#ident @(#)rules.cnf	1.8 04/01/23 
###########################################################################
# Written 1998 by J. Schilling
###########################################################################
#
# Make Rules for global dynamic configuration
#
###########################################################################
# 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, or (at your option)
# 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; see the file COPYING.  If not, write to the Free Software
# Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
###########################################################################

config: $(OINCSDIR)/rules.cnf

$(OINCSDIR)/Inull:
	$(MKDIR) -p $(OINCSDIR)
	@echo > $@

$(OINCSDIR):
	$(MKDIR) -p $@

#
# Hack until the <mach>-<os>-*cc.rul files are updated
#
_HCCCOM=	$(OARCH:%-gcc=gcc)
HCCCOM=		$(_HCCCOM:%-cc=cc)

_CCCOM=		$(_UNIQ)$(CCCOM)
__CCCOM=	$(_CCCOM:$(_UNIQ)=$(HCCCOM))
XCCCOM=		$(__CCCOM:$(_UNIQ)%=%)

#CONFFLAGS +=	-cc=$(XCCCOM)

$(OINCSDIR)/rules.cnf $(OINCSDIR)/xconfig.h: $(OINCSDIR)/Inull \
						$(SRCROOT)/conf/configure \
						$(SRCROOT)/conf/rules.cnf.in \
						$(SRCROOT)/conf/xconfig.h.in
	$(RUL_CONF)

###########################################################################
RUL_CONF=	@echo "	==> CONFIGURING RULES \"$@\""; $(RM_F) $@; \
		cd $(OINCSDIR); \
		CONFIG_NOFAIL=TRUE CC="$(XCCCOM)" CFLAGS="$(CFLAGS)" sh ../../conf/configure $(CONFFLAGS)
###########################################################################
include $(OINCSDIR)/Inull
include $(OINCSDIR)/rules.cnf
###########################################################################
include	$(SRCROOT)/$(RULESDIR)/$(LOCAL_CNF)
