#**************************************************************************
#*                                                                        *
#*                                 OCaml                                  *
#*                                                                        *
#*                          Florian Angeletti                             *
#*                                                                        *
#*   Copyright 2018                                                       *
#*                                                                        *
#*   All rights reserved.  This file is distributed under the terms of    *
#*   the GNU Lesser General Public License version 2.1, with the          *
#*   special exception on linking described in the file LICENSE.          *
#*                                                                        *
#**************************************************************************

# Define the lists of mli file used by ocamldoc to generate the stdlib
# + otherlibs + compilerlibs documentation

-include $(SRC)/Makefile.config
-include $(SRC)/stdlib/StdlibModules
PARSING_MLIS := $(wildcard $(SRC)/parsing/*.mli)
UTILS_MLIS := $(wildcard $(SRC)/utils/*.mli)
STR_MLIS = $(addprefix $(SRC)/otherlibs/str/, str.mli)
UNIX_MLIS = $(addprefix $(SRC)/otherlibs/unix/, unix.mli unixLabels.mli)
DYNLINK_MLIS = $(addprefix $(SRC)/otherlibs/dynlink/, dynlink.mli)
THREAD_MLIS = $(addprefix $(SRC)/otherlibs/systhreads/, \
  thread.mli condition.mli mutex.mli event.mli semaphore.mli threadUnix.mli)
DRIVER_MLIS = $(SRC)/driver/pparse.mli


DOC_STDLIB_DIRS = stdlib \
	otherlibs/str \
	otherlibs/$(UNIXLIB) otherlibs/dynlink \
	otherlibs/systhreads

DOC_COMPILERLIBS_DIRS= parsing utils typing bytecomp driver file_formats lambda

DOC_ALL_DIRS = $(DOC_COMPILERLIBS) $(DOC_STDLIB_DIRS)

DOC_STDLIB_INCLUDES = $(addprefix -I $(SRC)/, $(DOC_STDLIB_DIRS))
DOC_COMPILERLIBS_INCLUDES = $(addprefix -I $(SRC)/, $(DOC_COMPILERLIBS_DIRS))

DOC_ALL_INCLUDES = $(DOC_STDLIB_INCLUDES) $(DOC_COMPILERLIBS_INCLUDES)

STDLIB_MOD_WP = $(filter-out stdlib__pervasives, $(STDLIB_MODULES))
STDLIB_MLI0 = $(STDLIB_MOD_WP:%=$(SRC)/stdlib/%.mli)
STDLIB_MLIS=\
  $(STDLIB_MLI0:$(SRC)/stdlib/stdlib__%=$(SRC)/stdlib/%) \
  $(STR_MLIS) \
  $(UNIX_MLIS) \
  $(THREAD_MLIS) \
  $(DYNLINK_MLIS)

COMPILERLIBS_MLIS=\
  $(PARSING_MLIS) \
  $(UTILS_MLIS) \
  $(DRIVER_MLIS)

DOC_STDLIB_TEXT = $(SRC)/stdlib/ocaml_operators.mld
DOC_COMPILERLIBS_TEXT =  $(SRC)/manual/manual/library/compiler_libs.mld
DOC_ALL_TEXT = $(DOC_STDLIB_TEXT) $(DOC_COMPILERLIBS_TEXT)


DOC_ALL_MLIS= $(STDLIB_MLIS) $(COMPILERLIBS_MLIS)
DOC_ALL = $(DOC_ALL_MLIS) $(DOC_ALL_TEXT)
