# vi: set ts=8 shiftwidth=8 noexpandtab:
#
# VNPForth - Compiled native Forth for IA32 Linux systems
# Copyright (C) 2005  Simon Baldwin (simon_baldwin@yahoo.com)
#
# 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#

DIST	= vnpforth-1.4
GZIP	= /usr/bin/gzip

# Default target, build everything, and run tests and demos.
all:
	cd compiler; $(MAKE) all
	cd compiler_tests; $(MAKE) check
	cd runtime; $(MAKE) all
	cd forth_tests; $(MAKE) all check
	cd forth_demos; $(MAKE) all

# Install and uninstall.
install: all
	cd compiler; $(MAKE) install
	cd runtime; $(MAKE) install

uninstall:
	cd compiler; $(MAKE) uninstall
	cd runtime; $(MAKE) uninstall

# Cleanup.
clean:
	cd compiler; $(MAKE) clean
	cd compiler_tests; $(MAKE) clean
	cd runtime; $(MAKE) clean
	cd forth_tests; $(MAKE) clean
	cd forth_demos; $(MAKE) clean
	rm -f $(DIST).tar $(DIST).tar.gz $(DIST).tgz

clobber: clean
distclean: clean
	rm -f $(DIST).tar $(DIST).tar.gz $(DIST).tgz
maintainer-clean: distclean

# Create tgz source distribution.
dist:	distclean
	rm -f $(DIST).tar $(DIST).tar.gz $(DIST).tgz
	rm -f $(DIST); ln -s . $(DIST)
	FILES="`ls -d $(DIST)/* | grep -v '^$(DIST)/$(DIST)$$'`";	\
		tar cvf $(DIST).tar $$FILES
	rm $(DIST)
	$(GZIP) -9 $(DIST).tar
	if [ -f $(DIST).tar.gz ]; then					\
		mv $(DIST).tar.gz $(DIST).tgz;				\
	fi
