[win32] integrate XBMC_PC.rc into CompileInfo.bat for automatic versioning
[vuplus_xbmc] / codegenerator.mk
1 TOPDIR ?= .
2 INTERFACES_DIR ?= xbmc/interfaces
3
4 JAVA ?= $(shell which java)
5 ifeq ($(JAVA),)
6 JAVA = java-not-found
7 endif
8
9 SWIG ?= $(shell which swig)
10 ifeq ($(SWIG),)
11 SWIG = swig-not-found
12 endif
13
14 DOXYGEN ?= $(shell which doxygen)
15 ifeq ($(DOXYGEN),)
16 DOXYGEN = doxygen-not-found
17 else
18 DOXY_XML_PATH=$(GENDIR)/doxygenxml
19 endif
20
21 GENERATED_JSON = $(INTERFACES_DIR)/json-rpc/ServiceDescription.h addons/xbmc.json/addon.xml
22 ifeq ($(wildcard $(JSON_BUILDER)),)
23   JSON_BUILDER = $(shell which JsonSchemaBuilder)
24 ifeq ($(JSON_BUILDER),)
25   JSON_BUILDER = tools/depends/native/JsonSchemaBuilder/bin/JsonSchemaBuilder
26 endif
27 endif
28
29 GENDIR = $(INTERFACES_DIR)/python/generated
30 GROOVY_DIR = $(TOPDIR)/lib/groovy
31
32 GENERATED =  $(GENDIR)/AddonModuleXbmc.cpp
33 GENERATED += $(GENDIR)/AddonModuleXbmcgui.cpp
34 GENERATED += $(GENDIR)/AddonModuleXbmcplugin.cpp
35 GENERATED += $(GENDIR)/AddonModuleXbmcaddon.cpp
36 GENERATED += $(GENDIR)/AddonModuleXbmcvfs.cpp
37
38 GENERATE_DEPS += $(TOPDIR)/xbmc/interfaces/legacy/*.h $(TOPDIR)/xbmc/interfaces/python/typemaps/*.intm $(TOPDIR)/xbmc/interfaces/python/typemaps/*.outtm
39
40 vpath %.i $(INTERFACES_DIR)/swig
41
42 $(GENDIR)/%.cpp: $(GENDIR)/%.xml $(JAVA) $(SWIG) $(DOXY_XML_PATH)
43         # Work around potential groovy bug reported at: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=733234
44         $(JAVA) -cp "$(GROOVY_DIR)/groovy-all-2.1.7.jar:$(GROOVY_DIR)/commons-lang-2.6.jar:$(TOPDIR)/tools/codegenerator:$(INTERFACES_DIR)/python" \
45           org.codehaus.groovy.tools.FileSystemCompiler -d $(TOPDIR)/tools/codegenerator $(TOPDIR)/tools/codegenerator/Helper.groovy  $(TOPDIR)/tools/codegenerator/SwigTypeParser.groovy $(INTERFACES_DIR)/python/MethodType.groovy $(INTERFACES_DIR)/python/PythonTools.groovy
46         $(JAVA) -cp "$(GROOVY_DIR)/groovy-all-2.1.7.jar:$(GROOVY_DIR)/commons-lang-2.6.jar:$(TOPDIR)/tools/codegenerator:$(INTERFACES_DIR)/python" \
47           groovy.ui.GroovyMain $(TOPDIR)/tools/codegenerator/Generator.groovy $< $(INTERFACES_DIR)/python/PythonSwig.cpp.template $@ $(DOXY_XML_PATH)
48         rm $<
49
50 $(GENDIR)/%.xml: %.i $(SWIG) $(JAVA) $(GENERATE_DEPS)
51         mkdir -p $(GENDIR)
52         $(SWIG) -w401 -c++ -o $@ -xml -I$(TOPDIR)/xbmc -xmllang python $<
53
54 codegenerated: $(DOXYGEN) $(SWIG) $(JAVA) $(GENERATED) $(GENERATED_JSON) $(GENERATED_ADDON_JSON)
55
56 $(DOXY_XML_PATH): $(SWIG) $(JAVA)
57         cd $(INTERFACES_DIR)/python; ($(DOXYGEN) Doxyfile > /dev/null) 2>&1 | grep -v " warning: "
58         touch $@
59
60 $(DOXYGEN):
61         @echo "Warning: No doxygen installed. The Api will not have any docstrings."
62         mkdir -p $(GENDIR)/doxygenxml
63
64 $(JAVA):
65         @echo Java not found, it will be used if found after configure.
66         @echo This is not necessarily an error.
67         @false
68
69 $(SWIG):
70         @echo Swig not found, it will be used if found after configure.
71         @echo This is not necessarily an error.
72         @false
73
74 $(GENERATED_JSON): $(JSON_BUILDER)
75         @echo Jsonbuilder: $(JSON_BUILDER)
76         make -C $(INTERFACES_DIR)/json-rpc $(notdir $@)
77
78 $(JSON_BUILDER):
79 ifeq ($(BOOTSTRAP_FROM_DEPENDS), yes)
80         @echo JsonSchemaBuilder not found. You didn\'t build depends. Check docs/README.\<yourplatform\>
81         @false
82 else
83 #build json builder - ".." because makefile is in the parent dir of "bin"
84         make -C $(abspath $(dir $@)..)
85 endif