aboutsummaryrefslogtreecommitdiff
path: root/codegenerator.mk
diff options
context:
space:
mode:
authorCory Fields <theuni-nospam-@xbmc.org>2012-10-16 13:50:40 -0400
committerCory Fields <theuni-nospam-@xbmc.org>2012-11-08 16:35:18 -0500
commit9b0476705cdab5f295a15df08bbc36c92ee80236 (patch)
tree2838c893e0911665dee38b4cade08c3d3115618a /codegenerator.mk
parent5132cf8d6d8349c4203311aeaef39144833068ab (diff)
build: try to code-gen during bootstrap
This allows us to create a completely bootstrapped tarball that does not require java or swig as build-deps.
Diffstat (limited to 'codegenerator.mk')
-rw-r--r--codegenerator.mk60
1 files changed, 60 insertions, 0 deletions
diff --git a/codegenerator.mk b/codegenerator.mk
new file mode 100644
index 0000000000..b052960c84
--- /dev/null
+++ b/codegenerator.mk
@@ -0,0 +1,60 @@
+TOPDIR ?= .
+INTERFACES_DIR ?= xbmc/interfaces
+
+JAVA ?= $(shell which java)
+ifeq ($(JAVA),)
+JAVA = java-not-found
+endif
+
+SWIG ?= $(shell which swig)
+ifeq ($(SWIG),)
+SWIG = swig-not-found
+endif
+
+DOXYGEN ?= $(shell which doxygen)
+ifeq ($(DOXYGEN),)
+DOXYGEN = doxygen-not-found
+else
+DOXY_XML_PATH=$(GENDIR)/doxygenxml
+endif
+
+GENDIR = $(INTERFACES_DIR)/python/generated
+GROOVY_DIR = $(TOPDIR)/lib/groovy
+
+GENERATED = $(GENDIR)/AddonModuleXbmc.cpp
+GENERATED += $(GENDIR)/AddonModuleXbmcgui.cpp
+GENERATED += $(GENDIR)/AddonModuleXbmcplugin.cpp
+GENERATED += $(GENDIR)/AddonModuleXbmcaddon.cpp
+GENERATED += $(GENDIR)/AddonModuleXbmcvfs.cpp
+
+vpath %.i $(INTERFACES_DIR)/swig
+
+$(GENDIR)/%.cpp: $(GENDIR)/%.xml $(JAVA) $(SWIG) $(DOXY_XML_PATH)
+ $(JAVA) -cp "$(GROOVY_DIR)/groovy-all-1.8.4.jar:$(GROOVY_DIR)/commons-lang-2.6.jar:$(TOPDIR)/tools/codegenerator:$(INTERFACES_DIR)/python" \
+ groovy.ui.GroovyMain $(TOPDIR)/tools/codegenerator/Generator.groovy $< $(INTERFACES_DIR)/python/PythonSwig.cpp.template $@ $(DOXY_XML_PATH)
+ rm $<
+
+$(GENDIR)/%.xml: %.i $(SWIG) $(JAVA)
+ mkdir -p $(GENDIR)
+ $(SWIG) -w401 -c++ -o $@ -xml -I$(TOPDIR)/xbmc -xmllang python $<
+
+codegenerated: $(DOXYGEN) $(SWIG) $(JAVA) $(GENERATED)
+
+$(DOXY_XML_PATH): $(SWIG) $(JAVA)
+ cd $(INTERFACES_DIR)/python; ($(DOXYGEN) Doxyfile > /dev/null) 2>&1 | grep -v " warning: "
+ touch $@
+
+$(DOXYGEN):
+ @echo "Warning: No doxygen installed. The Api will not have any docstrings."
+ mkdir -p $(GENDIR)/doxygenxml
+
+$(JAVA):
+ @echo Java not found, it will be used if found after configure.
+ @echo This is not necessarily an error.
+ @false
+
+$(SWIG):
+ @echo Swig not found, it will be used if found after configure.
+ @echo This is not necessarily an error.
+ @false
+