[Omake] Win32 toolchain

Dmitry Bely dmitry.bely at gmail.com
Wed Nov 29 06:25:52 PST 2006


To distinguish between MSVC and Mingw-compiled Ocaml I currently use
the following method:

########## C options/toolchain ##########

CCompilerAndOpts() =
  copts =
  tmp = $(tmpfile tmp)
  ocamlc -c -verbose _.c >& $(tmp); cd # suppress error
  awk($(tmp))
  case $'^\+ +\(.*\) +["'']?_\.c'
    copts = $1
    export
  rm $(tmp)
  return $(copts)

CToolChain(copts) =
  match $(copts)
  case $'^\([[:alnum:]]+\)'
    switch $1
    case cl
      tc = msvc
      export
    case gcc
      tc = cc
      export
    case cc
      tc = cc
      export
    default
      tc = unknown
      export
    export
  return $(tc)

DefCFlags(copts) =
  match $(copts)
  case $'^[[:alnum:]]+ +\(.*\)'
    return $(filter-out /nologo -c, $(split $1))

static. =
  DEF_CFLAGS = $(DefCFlags $(CCompilerAndOpts))
  TOOLCHAIN = $(CToolChain $(CCompilerAndOpts))
  OCAMLLIBDIR = $(shell ocamlc -where)

Not very elegant but works. Maybe to have something like this in the
distribution?

- Dmitry Bely


More information about the Omake mailing list