# wrappi
-# Copyright (C) 2011 Red Hat Inc.
+# Copyright (C) 2011-2012 Red Hat Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
OCAMLCFLAGS = \
-g -warn-error CDEFLMPSUVYZX \
- -I ../generator-lib $(OCAMLPACKAGES)
+ $(OCAMLPACKAGES)
OCAMLOPTFLAGS = $(OCAMLCFLAGS)
# In alphabetical order.
SOURCES = \
+ config.ml \
+ wrappi_accumulator.mli \
+ wrappi_accumulator.ml \
wrappi_boilerplate.mli \
wrappi_boilerplate.ml \
wrappi_c_impl.mli \
wrappi_pr.mli \
wrappi_pr.ml \
wrappi_structs.mli \
- wrappi_structs.ml
+ wrappi_structs.ml \
+ wrappi_types.mli \
+ wrappi_types.ml \
+ wrappi_utils.mli \
+ wrappi_utils.ml
+# The difference between LIB_OBJECTS and OBJECTS is just that
+# functions and types in LIB_OBJECTS can be used in pa_wrap and in the
+# code generated from the API objects (../APIs/*.api). LIB_OBJECTS
+# are built into generator_lib.cma which is linked to pa_wrap, and to
+# the APIs, and into the generator.
+#
# In dependency order.
+LIB_OBJECTS = \
+ config.cmo \
+ wrappi_utils.cmo \
+ wrappi_types.cmo \
+ wrappi_accumulator.cmo
+
OBJECTS = \
wrappi_pr.cmo \
wrappi_boilerplate.cmo \
wrappi_c.cmo \
wrappi_main.cmo
-noinst_SCRIPTS = generator
+noinst_SCRIPTS = generator_lib.cma pa_wrap.cmo generator
+
+generator_lib.cma: $(LIB_OBJECTS)
+ $(OCAMLFIND) ocamlc -a $^ -o $@
-generator: $(OBJECTS) ../generator-lib/generator_lib.cma ../APIs/apis.cma
- $(OCAMLFIND) ocamlc $(OCAMLCFLAGS) -linkpkg \
- ../generator-lib/generator_lib.cma ../APIs/apis.cma \
- $(OBJECTS) \
+pa_wrap.cmo: pa_wrap.ml generator_lib.cma
+ $(OCAMLFIND) ocamlc $(OCAMLCFLAGS) \
+ -linkpkg generator_lib.cma \
+ -pp $(CAMLP4OF) \
+ -c $< -o $@
+
+generator: generator_lib.cma $(OBJECTS) ../APIs/apis.cma
+ $(OCAMLFIND) ocamlc $(OCAMLCFLAGS) \
+ -linkpkg generator_lib.cma ../APIs/apis.cma $(OBJECTS) \
-o $@
-%.cmi: %.mli ../generator-lib/generator_lib.cma
+../APIs/apis.cma: generator_lib.cma pa_wrap.cmo
+ $(MAKE) -C ../APIs apis.cma
+
+%.cmi: %.mli
$(OCAMLFIND) ocamlc $(OCAMLCFLAGS) -c $< -o $@
%.cmo: %.ml
$(OCAMLFIND) ocamlc $(OCAMLCFLAGS) -c $< -o $@
include .depend
-CLEANFILES = *.cmi *.cmo *.cmx *~ generator
+CLEANFILES = *.cmi *.cmo *.cmx *.cma *.cmxa *~ generator
SUFFIXES = .cmo .cmi .cmx .ml .mli .mll .mly