summaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authorDaniil Baturin <daniil@baturin.org>2018-05-28 04:48:30 +0700
committerDaniil Baturin <daniil@baturin.org>2018-05-28 04:48:30 +0700
commitd8f24a21fe821e6ce927fad66fb3f54821e9906a (patch)
tree5572d6171cce291279c028cbe5c3e480b5d18c38 /Makefile
parente0d21fa6bcce2ad0ea3b09015723fd9184a0be8c (diff)
downloadlibvyosconfig-d8f24a21fe821e6ce927fad66fb3f54821e9906a.tar.gz
libvyosconfig-d8f24a21fe821e6ce927fad66fb3f54821e9906a.zip
Integrate the parser/lexer and the renderer in the build setup.
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile42
1 files changed, 29 insertions, 13 deletions
diff --git a/Makefile b/Makefile
index e196d22..4636a16 100644
--- a/Makefile
+++ b/Makefile
@@ -5,17 +5,19 @@ $(shell mkdir -p $(BUILDDIR) $(BUILDDIR)/stub $(BUILDDIR)/lib $(BUILDDIR)/stub_g
PACKAGES=vyconf,ctypes.stubs,ctypes.foreign
# The files used to build the stub generator.
-GENERATOR_FILES=$(BUILDDIR)/lib/bindings.cmx \
+GENERATOR_FILES=$(BUILDDIR)/lib/vyos1x_parser.cmx \
+ $(BUILDDIR)/lib/vyos1x_lexer.cmx \
+ $(BUILDDIR)/lib/vyos1x_renderer.cmx \
+ $(BUILDDIR)/lib/bindings.cmx \
$(BUILDDIR)/stub_generator/generate.cmx
# The files from which we'll build a shared library.
-LIBFILES=$(BUILDDIR)/lib/bindings.cmx \
- $(BUILDDIR)/generated/vyosconfig_bindings.cmx \
- $(BUILDDIR)/lib/apply_bindings.cmx \
- $(BUILDDIR)/generated/vyosconfig.o \
- $(BUILDDIR)/lib/vyos1x_parser.cmx \
- $(BUILDDIR)/lib/vyos1x_lexer.cmx \
- $(BUILDDIR)/lib/vyos1x_renderer.cmx
+LIBFILES=$(BUILDDIR)/lib/vyos1x_parser.cmx \
+ $(BUILDDIR)/lib/vyos1x_lexer.cmx \
+ $(BUILDDIR)/lib/vyos1x_renderer.cmx \
+ $(BUILDDIR)/lib/bindings.cmx \
+ $(BUILDDIR)/generated/vyosconfig_bindings.cmx \
+ $(BUILDDIR)/lib/apply_bindings.cmx
CAML_INIT=$(BUILDDIR)/stub/init.o
@@ -69,12 +71,26 @@ $(BUILDDIR)/%.cmx: %.ml
ocamlfind opt -c -o $@ -I $(BUILDDIR)/generated -I $(BUILDDIR)/lib -package $(PACKAGES) $<
$(GENERATOR): $(GENERATOR_FILES)
- ocamlfind opt -o $@ -linkpkg -package $(PACKAGES) $^
+ ocamlfind opt -o $@ -I $(BUILDDIR)/lib -linkpkg -package $(PACKAGES) $^
-$(BUILDDIR)/lib/vyos1x_parser.cmx:
- ocamllex lib/vyos1x_lexer.mll
- menhir lib/vyos1x_parser.mly
- ocamlfind opt -c -o $@ -package $(PACKAGES) lib/vyos1x_parser.ml lib/vyos1x_lexer.ml
+$(BUILDDIR)/lib/vyos1x_lexer.ml:
+ ocamllex parser/vyos1x_lexer.mll -o $(BUILDDIR)/lib/vyos1x_lexer.ml
+
+$(BUILDDIR)/lib/vyos1x_lexer.cmx: $(BUILDDIR)/lib/vyos1x_lexer.ml $(BUILDDIR)/lib/vyos1x_parser.cmi
+ ocamlfind opt -o $@ -I $(BUILDDIR)/lib -linkpkg -package $(PACKAGES) $(BUILDDIR)/lib/vyos1x_lexer.ml
+
+$(BUILDDIR)/lib/vyos1x_parser.ml:
+ menhir parser/vyos1x_parser.mly
+ mv parser/vyos1x_parser.ml $(BUILDDIR)/lib
+
+$(BUILDDIR)/lib/vyos1x_parser.mli: $(BUILDDIR)/lib/vyos1x_parser.ml
+ mv parser/vyos1x_parser.mli $(BUILDDIR)/lib
+
+$(BUILDDIR)/lib/vyos1x_parser.cmi: $(BUILDDIR)/lib/vyos1x_parser.mli
+ ocamlfind opt -o $@ -I $(BUILDDIR)/lib -package $(PACKAGES) $^
+
+$(BUILDDIR)/lib/vyos1x_parser.cmx: $(BUILDDIR)/lib/vyos1x_parser.cmi $(BUILDDIR)/lib/vyos1x_lexer.cmx
+ ocamlfind opt -c -o $@ -package $(PACKAGES) -I $(BUILDDIR)/lib $(BUILDDIR)/lib/vyos1x_parser.ml $(BUILDDIR)/lib/vyos1x_lexer.ml
clean:
rm -rf $(BUILDDIR)