#######################################################################
#                                                                     #
#                              OCamlGen                               #
#                                                                     #
#                       OCaml module Generator                        #
#                                                                     #
#               EPI Pomdapi, INRIA Paris - Rocquencourt               #
#                                                                     #
#  Copyright 1997-2014 INRIA.                                         #
#  Institut National de Recherche en Informatique et en Automatique.  #
#  All rights reserved. This file is distributed only by permission.  #
#                                                                     #
#  Pierre Weis <Pierre.Weis@inria.fr>                                 #
#                                                                     #
#######################################################################

# $Id: Makefile_user,v 1.13 2014/01/31 09:51:51 fclement Exp $

include ./.User_preamble.pph

include $(PPH_USER_MAKEFILES_DIR)/Environment.pph
include $(PPH_INSTALLATION_MAKEFILES_DIR)/Environment.pph

PR = print
PRX = $(PR)_xml

# Fill the data to mimic installed hierarchy using links.
# Use at sign ('@') to separate components of tuples, and percent sign ('%') to
# abstract the location in paths of the version number.
# * LINK_DATA = list of data to make links. All vital elements of the current
#   software must be listed; they are presumably installed either in bin,
#   include, lib, or in share. Each link datum is of the form
#   <link_sub_dir>@<link_name>@<target_path> where
#   * <link_sub_dir> = sub-directory in which to put the link (relative to
#       PROJECT_ROOT_DIR), i.e. where effective installation of the
#       corresponding entity occurs (relative to INSTALL_ROOT_DIR),
#   * <link_name> = name of the link,
#   * <target_path> = path to the target of the link (relative to
#       PROJECT_ROOT_DIR).
#LINK_DATA = <link_sub_dir>@<link_name>@<target_path> ...
LINK_DATA = \
	bin@ocaml$(PR)c%@src/walkers/$(PR)/ocaml$(PR)c.byt \
	bin@ocaml$(PR)c%@src/walkers/$(PR)/ocaml$(PR)c.bin \
	bin@ocaml$(PRX)c%@src/walkers/$(PRX)/ocaml$(PRX)c.byt \
	bin@ocaml$(PRX)c%@src/walkers/$(PRX)/ocaml$(PRX)c.bin \
	lib/ocaml@ocamlgen%@src/lib \
	share/ocamlgen%@config@config

SUB_DIRS = config src example

include $(PPH_USER_MAKEFILES_DIR)/Rule_Target.pph
include $(PPH_INSTALLATION_MAKEFILES_DIR)/Rule_Target.pph

configure-local: configure-in-root-dir
unconfigure-local: unconfigure-in-root-dir

install-local: init-install-log install-documentation
uninstall-local: uninstall-documentation
uninstall-all-versions-local: uninstall-all-versions-documentation

install-manual-pages-if-any: install-manual-pages
uninstall-documentation: uninstall-manual-pages
uninstall-all-versions-documentation: uninstall-all-versions-manual-pages

# configure-before: configure-in-root-dir
# unconfigure-after: unconfigure-in-root-dir

# install-before: init-install-log install-documentation
# uninstall-after: uninstall-documentation
# uninstall-all-versions-after: uninstall-all-versions-documentation

# install-manual-pages-if-any: install-manual-pages
# uninstall-documentation: uninstall-manual-pages
# uninstall-all-versions-documentation: uninstall-all-versions-manual-pages

.PHONY: byt bin

byt bin:
	SUB_DIRS="\
	  libs basement lib parsing dtdwg walkers/$(PR) walkers/$(PRX)" && \
	for DIR in $$SUB_DIRS; do \
	  (\cd src/$$DIR >/dev/null && $(MAKE) $@); \
	done
