Source

opycaml / OMakefile

# How-to-build using OMake
#
# yes no | omake --install # to create OMakeroot for the first time

# If OMakeroot is here, include OMyMakefile
if $(file-exists OMakeroot)
   include OMyMakefile
   export

if $(defined WithOMyApt)
    RequireAptPackages(python-dev libncurses5-dev)

OCAML_WHERE = $(shell ocamlc -where)

REQUIRED_PACKS[]=camlidl

################################################################## C BUILD RULE

PY_PREFIX=/usr
PY_VERSION=2.7
CFLAGS+= -fPIC -I $(OCAML_WHERE) -I $(PY_PREFIX)/include/python$(PY_VERSION)
OCAMLFLAGS= -warn-error A-4-7-9-31 -w A

# I (jfuruse) install camlidl using findlib, but not for the others.
CAMLIDL_FINDLIB=$(OCAMLFIND_DESTDIR)/camlidl
L_CAMLIDL_FINDLIB=-L$(CAMLIDL_FINDLIB)
CCOPT_L_CAMLIDL_FINDLIB=-ccopt $(L_CAMLIDL_FINDLIB)

IDLS[] =
    auto
    base
    bytearray
    dict
    err
    high
    import
    int
    mapping
    misc
    module
    number
    object
    sequence
    string
    tuple
    type
    float

%.idl: %.idl.in idlconvert.pl
    ./idlconvert.pl $< > $@

autoclasses.idl autoclasses.h: classes.h.in classes.idl.in classes.pl type.ml
    ./classes.pl type.ml

# bash -c is required to search camlidl.
# Without bash -c, camlidl cannot be found by the shell, if it is just installed.
auto.ml auto.mli auto_stubs.c: $(addsuffix .idl, $(IDLS)) $(Installed camlidl) autoclasses.idl autoclasses.h
	bash -c "camlidl auto.idl"

autoapi.ml : auto.ml module.pl $(addsuffix .idl.in, $(IDLS))
    ./module.pl *.idl.in > $@

OCamlGeneratedFiles(autoapi.ml OOApiauto.ml)

api.auto.mli: api.cmi api.ml

OOApiauto.ml: api.auto.mli oowrap/oowrap.cmo
    camlp4o ./oowrap/oowrap.cmo api.auto.mli -printer Camlp4OCamlPrinter > $@

auto_stubs.o: auto_stubs.c auto.h api_ml.h autoclasses.h

clean:
  rm -f $(filter-proper-targets $(ls R, .))

MyOCamlPackageExtras[] = opycaml_python.o from_python_c.o
MyOCamlPackage(opycaml, utils type autoapi api OOApiauto OOApi, auto_stubs api_ml, -lpython$(PY_VERSION) -L$(PREFIX)/lib/ocaml $(L_CAMLIDL_FINDLIB) -lcamlidl)

opycaml_python.o: opycaml.cmx libopycaml.a dllopycaml.so
	$(OCamlOpt) -output-obj -o $@ opycaml.cmx -cclib -lopycaml -ccopt -L$(OCAML_WHERE) $(CCOPT_L_CAMLIDL_FINDLIB) -ccopt -Wl,-rpath,$(OCAML_WHERE) -cclib -lpython$(PY_VERSION) -cclib -lcamlidl

.DEFAULT: opycaml.cma opycaml.cmxa opycaml_python.o from_python_c.o

OCAML_LIBS += opycaml

OCamlProgram(test, test)
OCamlProgram(test_bug1, test_bug1)

.SUBDIRS: tests oowrap
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.