Missing backslash broke dependency file.
[wrappi.git] / APIs / Makefile.am
index 0edf67d..e7e9497 100644 (file)
@@ -15,7 +15,7 @@
 # along with this program; if not, write to the Free Software
 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 
-OCAMLCFLAGS = -g -warn-error CDEFLMPSUVYZX
+OCAMLCFLAGS = -g -warn-error CDEFLMPSUVYZX -I ../generator-lib
 OCAMLOPTFLAGS = $(OCAMLCFLAGS)
 
 PP = -pp '$(CAMLP4O) ../generator-macros/pa_wrap.cmo -impl'
@@ -23,13 +23,28 @@ PP = -pp '$(CAMLP4O) ../generator-macros/pa_wrap.cmo -impl'
 #API_FILES = $(wildcard *.api)
 API_FILES = mkdir.api mknod.api
 
-OBJ_FILES = $(patsubst %.api,%.cmo,$(API_FILES))
+OBJECTS = $(patsubst %.api,%.cmo,$(API_FILES))
 
-noinst_SCRIPTS = $(OBJ_FILES)
+noinst_SCRIPTS = apis.cma
 
-%.cmo: %.api
+apis.cma: $(OBJECTS) ../generator-lib/generator_lib.cma
+       $(OCAMLFIND) ocamlc -linkall -a $(OBJECTS) -o apis.cma
+
+%.cmo: %.api ../generator-lib/generator_lib.cma
        $(OCAMLFIND) ocamlc $(OCAMLOPTFLAGS) $(PP) -impl $< -c -o $@
 
-CLEANFILES = *.cmi *.cmo *.cmx *~
+CLEANFILES = *.cmi *.cmo *.cmx *.cma *.cmxa *~
+
+depend: .depend
+
+.depend: $(API_FILES)
+       rm -f $@ $@-t
+       $(OCAMLFIND) ocamldep $(PP) -impl $^ | \
+         $(SED) -e 's/ *$$//' | \
+         $(SED) -e :a -e '/ *\\$$/N; s/ *\\\n */ /; ta' | \
+         LANG=C sort > $@-t
+       mv $@-t $@
+
+include .depend
 
 SUFFIXES = .cmo .cmi .cmx .ml .mli .mll .mly .api