# 
# The LOOP Project
# 
# The LOOP Team, Dresden University and Nijmegen University
# 
# Copyright (C) 2002
# 
# 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 in file COPYING in this or one of the
# parent directories for more details.
# 
# Created 23.1.02 by Hendrik
# 
# Time-stamp: <Monday 8 October 01 17:58:00 tews@ithif51>
# 
# Top level Makefile
# 
# $Id: Makefile.in,v 1.5 2003/08/21 15:15:11 tews Exp $
# 


######################################################################
#
# CONFIGURE SECTION
#
######################################################################


# Autoconf uses both prefix and exec_prefix. 
# Here both should be identified. If configuring manually 
# delete (or uncomment) prefix and configure exec_prefix.
prefix=/usr/local

# prefix for BINDIR and LIBDIR, set this to /usr/local,
# or leave it and set BINDIR and LIBDIR individually
exec_prefix=${prefix}


# Directory for executables. 
# This is where ccslc (and optionally ccslc.opt) will be installed
BINDIR=${exec_prefix}/bin

# Man page directory.
# the manpages will be installed in MANDIR/man1
MANDIR=${prefix}/man

# Emacs lisp directory
# the place where the emacs lisp code for the ccsl emacs mode goes
ELIBDIR=${prefix}/share/emacs/site-lisp

# Set the names of the ocaml compilers. Does not need a change 
# under normal circumstances. 
# Using the .opt versions saves you about just as much time as
# you need to read this.
OCAMLC_NAME=ocamlc
OCAMLOPT_NAME=ocamlopt
#OCAMLC_NAME=ocamlc.opt
#OCAMLOPT_NAME=ocamlopt.opt

######################################################################
#
# END OF CONFIGURE SECTION
#
######################################################################

# There should be no need to change anything below.

# OCAMLDIR holds the directory where the ocaml executables can be found
# In all normal circumstances these executables are found via the 
# the search path and OCAMLDIR should stay empty.
OCAMLDIR=
#
# If the executables are not in the search path, then set the variable 
# like
#OCAMLDIR=/usr/local/ocaml-2.04/bin

# The programm used for installing
INSTALL=./install-sh -c
#INSTALL=./install-sh -c

# insert -g here for compiling with debugging support
export COMPFLAGS=


# Library directory.
# not used any longer
# LIBDIR=@libdir@


#append a slash to OCAMLDIR
ifeq ($(OCAMLDIR),)
OCAMLDIR1=$(OCAMLDIR)
else
OCAMLDIR1=$(subst //,/,$(OCAMLDIR)/)
endif

# names of the ocaml binaries

export OCAMLLEX=$(OCAMLDIR1)ocamllex
export OCAMLYACC=$(OCAMLDIR1)ocamlyacc
export OCAMLCP=$(OCAMLDIR1)ocamlcp
export OCAMLDEP=$(OCAMLDIR1)ocamldep
export OCAMLMKTOP=$(OCAMLDIR1)ocamlmktop

export OCAMLC=$(OCAMLDIR1)$(OCAMLC_NAME)
export OCAMLOPT=$(OCAMLDIR1)$(OCAMLOPT_NAME)


#PVSLIBDIR=$(LIBDIR)


all: 
	$(MAKE) -C Keywords -e
	$(MAKE) -C Common -e
	$(MAKE) -C Ccsl -e ccslc

opt: 
	$(MAKE) -C Common -e native
	$(MAKE) -C Ccsl -e ccslc.opt


install:
	$(INSTALL) -d $(BINDIR)
#	$(INSTALL) -d $(PVSLIBDIR)
	$(INSTALL) -d $(MANDIR)/man1
	$(INSTALL) -d $(ELIBDIR)
	$(INSTALL) Ccsl/ccslc $(BINDIR)
	if test -f Ccsl/ccslc.opt ; then \
		$(INSTALL) Ccsl/ccslc.opt $(BINDIR) ; \
	fi
#	for f in Lib/Pvs/* ; do \
#		$(INSTALL) $$f $(PVSLIBDIR); \
#	done
	for f in Emacs/*el ; do \
		$(INSTALL) $$f $(ELIBDIR); \
	done
	$(INSTALL) Doc/ccslc.1 $(MANDIR)/man1
	$(INSTALL) Doc/ccslc.opt.1 $(MANDIR)/man1


uninstall:
	rm -f $(BINDIR)/ccslc
	rm -f $(BINDIR)/ccslc.opt
	rmdir $(BINDIR)
#	for f in Lib/Pvs/* ; do \
#		rm -f $(PVSLIBDIR)/`basename $$f`; \
#	done
	for f in Emacs/*el ; do \
		rm -f $(ELIBDIR)/`basename $ff`; \
	done
#	rmdir $(PVSLIBDIR)


depend:
	for f in Keywords Common Ccsl ; do \
		touch $$f/.depend; \
	done
	$(MAKE) -C Keywords depend
	$(MAKE) -C Ccsl depend

clean:
	$(MAKE) -C Common cleanall
	$(MAKE) -C Doc clean


.PHONY: all opt clean install uninstall depend

# How to do a release !
# 
# 1. check or increase version number
# 2. write NEWS, ChangeLog files
#    ./makeconfig
# 3. commit
# 4. cvs tag merged-to-head-28-10-02
# 5. merge
# 6. conflicts
# 7. ./makecvsconfig
# 8. commit merges
# 9. cvs tag merged-from-work-17-12-02
# 


### Local Variables: ***
### version-control: t ***
### kept-new-versions: 5 ***
### delete-old-versions: t ***
### time-stamp-line-limit: 30 ***
### End: ***
