# Makefile for the GNU Pascal utilities
#
# Independent of GCC/GPC's other Makefile structure (for now)
#
# Copyright (C) 2002 Free Software Foundation, Inc.
#
# Author: Frank Heckenbach <frank@pascal.gnu.de>
#
# This file is part of GNU Pascal.
#
# GNU Pascal 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.
#
# GNU Pascal 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 GNU Pascal; see the file COPYING. If not, write to the
# Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
# 02111-1307, USA.

# Variables to override
PC=gpc # In general: $(GPC_FOR_HOST)!
PFLAGS=-O2 -Wall
prefix=/usr/local
bindir=$(prefix)/bin
INSTALL_PROG=install -m 755
GCC_DIR=../..
exeext=

# Internal variables
EXE=binobj$(exeext) gpidump$(exeext)
EXE2=binobj gpidump
GENERATED_FILES=tree.inc
PC_WITH_FLAGS=$(PC) --automake --executable-file-name $(PFLAGS)

all: $(EXE)

install: $(EXE)
	$(INSTALL_PROG) $(EXE) "$(bindir)"

binobj$(exeext): binobj.pas
	$(PC_WITH_FLAGS) "$<"

gpidump$(exeext): gpidump.pas tree.inc $(GCC_DIR)/p/gpi.h
	$(PC_WITH_FLAGS) -I "$(GCC_DIR)/p" "$<"

# mk-t-inc decides when to rebuild tree.inc
tree.inc: force
	./mk-t-inc "$(GCC_DIR)" "$@"

force:

clean:
	rm -f *.o *.gpi *.gpm *.gpd $(EXE) $(EXE2) $(GENERATED_FILES)
