#*********************************************************************#
#                                                                     #
#                           Htmlc                                     #
#                                                                     #
#            Pierre Weis, projet Cristal, INRIA Rocquencourt          #
#                                                                     #
# Copyright 1997-2004,                                                #
# Institut National de Recherche en Informatique et en Automatique.   #
# Distributed only by permission.                                     #
#                                                                     #
#*********************************************************************#

#(* $Id: Makefile,v 1.61 2009/09/24 06:57:04 weis Exp $ *)

MAKEFILESDIR = ./config

include $(MAKEFILESDIR)/Makefile

.PHONY: doc documentation
.PHONY: install installbyt installbin
.PHONY: install-no-documentation install-documentation installman
.PHONY: uninstall uninstallbyt uninstallbin
.PHONY: uninstall-no-documentation uninstall-documentation uninstallman

.PHONY: version tarball distribute

# Normal build targets
byt: version
	cd compiler && $(MAKE) $@

bin: version
	cd compiler && $(MAKE) $@

# To clean the whole thing.
distclean::
	$(MAKE) -f Makefile.distrib $@

# Targets for developers only.
all:: default doc

documentation:
	cd doc && $(MAKE) all

doc: documentation

install: install-no-documentation install-documentation
install-no-documentation: installbyt installbin
install-documentation: installman

installbyt:
	cd compiler && $(MAKE) installbyt
installbin:
	cd compiler && $(MAKE) installbin
installman:
	cd doc && $(MAKE) install

uninstall: uninstall-documentation uninstall-no-documentation
uninstall-documentation: uninstallman
uninstall-no-documentation: uninstallbin uninstallbyt

uninstallbyt:
	cd compiler && $(MAKE) uninstallbyt
uninstallbin:
	cd compiler && $(MAKE) uninstallbin
uninstallman:
	cd doc && $(MAKE) uninstall

clean_all: clean
	(cd doc && $(MAKE) clean) && \
	(cd doc_src && $(MAKE) clean) && \
	$(MAKE) -f Makefile.distrib clean

clean::
	cd compiler && $(MAKE) $@

depend:
	cd compiler && $(MAKE) $@

test:
	cd compiler && $(MAKE) $@

# Automatic handling of versionning
version: config/Makefile
config/Makefile: config/Makefile.in config/env
	MSG1="# Automatically generated by Htmlc." && \
	MSG2="#" && \
	MSG3="# Do not edit this file," && \
	MSG4="# but rather its source: \"Makefile.in\"." && \
	($(ECHO) "$$MSG1"; $(ECHO) "$$MSG2"; \
	 $(ECHO) "$$MSG3"; $(ECHO) "$$MSG4") | \
	$(CAT) - config/Makefile.in | \
	$(HTMLC) -f - -t config/Makefile

# For developers and maintainers only.
tarball distribute: all
	$(MAKE) -f Makefile.distrib $@
