summaryrefslogtreecommitdiffstats
path: root/vpp-api/Makefile.am
diff options
context:
space:
mode:
Diffstat (limited to 'vpp-api/Makefile.am')
-rw-r--r--vpp-api/Makefile.am15
1 files changed, 15 insertions, 0 deletions
diff --git a/vpp-api/Makefile.am b/vpp-api/Makefile.am
index 1812b63765c..310bd2321eb 100644
--- a/vpp-api/Makefile.am
+++ b/vpp-api/Makefile.am
@@ -1,2 +1,17 @@
AUTOMAKE_OPTIONS = foreign
SUBDIRS = python java
+
+api_json_dir = $(abs_builddir)/vpp-api
+api_srcs:=$(shell find $(prefix)/../ -name '*.api')
+api_json:=$(patsubst %.api,$(api_json_dir)/%.api.json,$(notdir $(api_srcs)))
+
+define define_compile_rules
+$(api_json_dir)/%.api.json: $(1)%.api
+ @echo " + Generating '$$<'"
+ @mkdir -p $$(@D)
+ $(CC) $$(CPPFLAGS) -E -P -C -x c $$< | vppapigen --input - --json $$@
+endef
+
+$(foreach directory,$(dir $(api_srcs)),$(eval $(call define_compile_rules,$(directory))))
+
+BUILT_SOURCES = $(api_json)