OCAML_LIB_FLAGS += -cclib -lrt

# Make sure we use the right channel representation (new with OCaml 3.10!)
match $(OCAML_VERSION)
case ^3\.0.*
default
  CFLAGS += -DCHANNEL_HAS_FLAGS
  export CFLAGS

LIB_CNAMES = \
  misc ocaml_utils_stubs unix_ext_stubs \
  bigstring_stubs linux_ext_stubs ml_backtrace

LIB_MLNAMES[] =
  OUnit_utils
  backtrace
  bag
  bigbuffer
  bigstring
  binable
  binary_packing
  bool
  bucket
  caml
  common
  comparable
  container
  core_arg
  core_array
  core_char
  core_filename
  core_gc
  core_hashtbl
  core_int
  core_int32
  core_int64
  core_list
  core_mutex
  core_nativeint
  core_printf
  core_queue
  core_stack
  core_string
  core_sys
  core_unix
  crc
  dequeue
  doubly_linked
  error_check
  exn
  fast_hashtbl
  float
  floatable
  force_once
  fqueue
  hash_queue
  hash_set
  hashable
  heap
  in_channel
  int_conversions
  int_intf
  interfaces
  interned
  interval
  interval_set
  linebuf
  linux_ext
  logger
  memo
  monad
  option
  ordered_collection_common
  out_channel
  pMap
  pSet
  piecewise_linear
  pretty_printer
  quickcheck
  ref
  result
  robustly_comparable
  setable
  sexpable
  space_safe_tuple
  squeue
  std
  std_internal
  stringable
  thread_safe_queue
  time
  timer
  tuple
  unique_id
  unix_ext
  word_size
  size

OCamlMakePPDeps($(PA_SEXP_BIN), \
  bucket \
  common \
  dequeue \
  fast_hashtbl \
  float \
  input \
  interval \
  interval_set \
  core_array \
  core_char \
  core_int \
  core_int32 \
  core_int64 \
  core_list \
  core_nativeint \
  core_stack \
  core_string \
  core_unix \
  option \
  OUnit_utils \
  piecewise_linear \
  time \
  pMap \
  result \
  std_internal \
)

switch $(string $(shell uname -s))
case Darwin
  DARWIN = true
  export DARWIN
default
  LINUX = true
  export LINUX

switch $(PROCESSOR)
case x86_64
  ARCH_FLAGS = -DARCH_SIXTYFOUR
  export ARCH_FLAGS
default
  ARCH_FLAGS =
  export ARCH_FLAGS

OCamlPreprocess(cpp $(ARCH_FLAGS), std bigstring)

OCamlMakeLibPackage (core)

doc:
	ocamldoc -html -pp 'camlp4o -I ../../../lib pa_type_conv.cmo pa_sexp_conv.cmo pa_bin_prot.cmo' *.ml *.mli -d /var/www/html/docs/core

OCamlMakeProjDefaults(mycaml)

InstantiateOCamlEnv()
