# *----------------------------------------------------------------------*
# * Bounds Checking for GCC.						 *
# * Copyright (C) 1995 Richard W.M. Jones <rwmj@doc.ic.ac.uk>.		 *
# *----------------------------------------------------------------------*
# * 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	 *
# * (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; if not, write to the Free Software		 *
# * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.		 *
# *----------------------------------------------------------------------*
# * File:
# *	tools/Makefile
# * Summary:
# *	See README file.
# * Other notes:
# *	
# * Author      	Date		Notes
# * 
# *----------------------------------------------------------------------*

CC	= ../../xgcc
CFLAGS	= -Wall -O -B../../

SHELL	= /bin/sh

# You will need the `BFD' library which is commonly distributed with Gnu
# GDB, or you may have it installed already. Place the line needed to link
# it here:
BFD_LIB	= -lbfd

all:	grab-statics

distclean: clean

clean:
	rm -f find-objects string-subst grab-statics *.o *~ *.bak *.BAK core \
		statics-*.o

grab-statics: grab-statics.in string-subst find-objects
	cat grab-statics.in | \
		./string-subst @w@ 'Caution! This file is automatically generated. Edits will be lost!' | \
		./string-subst @tools_dir@ `pwd` | \
		./string-subst @output_dir@ `pwd` | \
		./string-subst @lib_dir@ `cd ../..; pwd` | \
		./string-subst @gcc@ `cd ../..; pwd`/xgcc | \
		./string-subst @gcc_flags@ "-B`cd ../..; pwd`/ -fno-builtin -g" \
			> grab-statics
	chmod 0755 grab-statics

string-subst: string-subst.o
	$(CC) $(CFLAGS) $< -o $@

find-objects: find-objects.o
	$(CC) $(CFLAGS) $< $(BFD_LIB) -o $@
