#################################################################################
#                Cameleon                                                         #
#                                                                               #
#    Copyright (C) 2005 Institut National de Recherche en Informatique et       #
#    en Automatique. All rights reserved.                                       #
#                                                                               #
#    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.1 of the License, or     #
#    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 Lesser 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                                                            #
#                                                                               #
#    Contact: Maxence.Guesdon@inria.fr                                          #
#                                                                               #
#################################################################################

include master.Makefile

SCRIPTS=

IMAGES=images/topcameleon.xpm

# Compilation
#############

work: utils src

all: work srcdoc doc

src: dummy
	cd src && $(MAKE) all

utils: dummy
#	cd utils && $(MAKE) all

re : depend clean all

perl:
	$(ROOT)/utils/compile.sh

help:
	@echo "work:      utils src"
	@echo "all:       work srcdoc doc"
	@echo "src:       src/all"
	@echo "utils:     utils/all"
	@echo "re:        depend clean all"

# Documentation :
#################
srcdoc: dummy
	cd src && $(MAKE) doc

doc: dummy
	cd doc && $(MAKE) all

# myself

master.Makefile: master.Makefile.in config.status
	./config.status

config.status: configure master.Makefile.in \
	src/cameleon/cam_installation.ml.in \
	src/cameleon/cam_config.ml.in \
	src/report/rep_installation.ml.in \
	src/dbforge/dbf_installation.ml.in
	./config.status --recheck

configure: configure.in
	autoconf

# headers :
###########
HEADFILES= configure.in configure \
	master.Makefile.in Makefile \
	src/*/*.ml src/*/*.mli src/*/*.mll src/*/*.mly src/*/*.in \
	src/Makefile doc/Makefile utils/Makefile
headers: dummy
	echo $(HEADFILES)
	headache -h header -c .headache_config $(HEADFILES)

noheaders: dummy
	headache -r -c .headache_config $(HEADFILES)

# backup, clean and depend :
############################

distclean: clean
	cd src && $(MAKE) distclean
	$(RM) config.cache config.log config.status master.Makefile
#	cd utils && $(MAKE) distclean
#	cd doc && $(MAKE) distclean

clean:: dummy
	$(RM) *~ \#*\#
	cd src && $(MAKE) clean
#	cd utils && $(MAKE) clean
#	cd doc && $(MAKE) clean


depend: dummy
	cd src && $(MAKE) depend

dummy:

#################
# code count
#################
codecount:
	@echo `cat src/*/*.ml src/*/*.mli | wc -l` lines


#################
# installation
#################

install: dummy installimages
	cd src && $(MAKE) install
	$(MAKE) installdoc

installdoc:
	cd doc && $(MAKE) install

%.gif: %.png
	convert $< $@

%.xpm: %.png
	convert -scale 32x32 $< $@

installimages: dummy $(IMAGES)
	$(MKDIR) $(PIXMAPSDIR)
	$(CP) $(IMAGES) $(PIXMAPSDIR)

installscripts: dummy
#	$(MKDIR) $(DIR_UTILS)
#	$(CP) $(SCRIPTS) $(DIR_UTILS)

###########################
# additional dependencies
###########################

# DO NOT DELETE
