Split up javascript engine makefiles

by splitting javascript engine specific makefiles and source up we
avoid having to consider old JSAPI or none code while working on
duktape.
This commit is contained in:
Vincent Sanders 2015-10-12 17:40:35 +01:00
parent 3877d4ad03
commit ce32141057
10 changed files with 134 additions and 104 deletions

View File

@ -1,103 +1,34 @@
#
# NetSurf javascript source file inclusion
#
# Included by Makefile.sources
# Included by Makefile
#
# ----------------------------------------------------------------------------
# JSAPI binding
# ----------------------------------------------------------------------------
S_JSAPI_BINDING:=
D_JSAPI_BINDING:=
JSAPI_BINDING_htmldocument := javascript/jsapi/htmldocument.bnd
JSAPI_BINDING_htmlelement := javascript/jsapi/htmlelement.bnd
JSAPI_BINDING_window := javascript/jsapi/window.bnd
JSAPI_BINDING_navigator := javascript/jsapi/navigator.bnd
JSAPI_BINDING_console := javascript/jsapi/console.bnd
JSAPI_BINDING_location := javascript/jsapi/location.bnd
JSAPI_BINDING_htmlcollection := javascript/jsapi/htmlcollection.bnd
JSAPI_BINDING_nodelist := javascript/jsapi/nodelist.bnd
JSAPI_BINDING_text := javascript/jsapi/text.bnd
JSAPI_BINDING_comment := javascript/jsapi/comment.bnd
JSAPI_BINDING_node := javascript/jsapi/node.bnd
JSAPI_BINDING_event := javascript/jsapi/event.bnd
# 1: input binding file
# 2: source output file
# 3: header output file
# 4: binding name
define convert_jsapi_binding
S_JSAPI_BINDING += $(2)
D_JSAPI_BINDING += $(patsubst %.c,%.d,$(2))
$(2): $(1) $(OBJROOT)/created
$$(VQ)echo " GENBIND: $(1)"
$(Q)nsgenbind -g -I javascript/WebIDL -d $(patsubst %.c,%.d,$(2)) -h $(3) -o $(2) $(1)
$(3): $(2)
endef
# Javascript sources
# Check if jsapi is required
ifeq ($(NETSURF_USE_JS),YES)
WANT_JS_SOURCE := YES
endif
else
ifeq ($(NETSURF_USE_MOZJS),YES)
WANT_JS_SOURCE := YES
endif
endif
S_JAVASCRIPT_BINDING:=
ifeq ($(WANT_JS_SOURCE),YES)
S_JSAPI :=
S_JAVASCRIPT += content.c jsapi.c fetcher.c $(addprefix jsapi/,$(S_JSAPI))
$(eval $(foreach V,$(filter JSAPI_BINDING_%,$(.VARIABLES)),$(call convert_jsapi_binding,$($(V)),$(OBJROOT)/$(patsubst JSAPI_BINDING_%,%,$(V)).c,$(OBJROOT)/$(patsubst JSAPI_BINDING_%,%,$(V)).h,$(patsubst JSAPI_BINDING_%,%,$(V))_jsapi)))
ifeq ($(filter $(MAKECMDGOALS),clean test coverage),)
-include $(D_JSAPI_BINDING)
endif
# JSAPI (spidemonkey)
include javascript/jsapi/Makefile
else
ifeq ($(NETSURF_USE_DUKTAPE),YES)
javascript/dukky.c: $(OBJROOT)/duktape/binding.h
BINDINGS := $(wildcard javascript/duktape/*.bnd)
$(OBJROOT)/duktape/binding.h $(OBJROOT)/duktape/Makefile: javascript/duktape/netsurf.bnd $(BINDINGS)
$(Q)mkdir -p $(OBJROOT)/duktape
$(VQ)echo " GENBIND: $<"
$(Q)nsgenbind -D -I javascript/WebIDL $< $(OBJROOT)/duktape
# create unimplemented report for doxygen
Docs/UnimplementedJavascript.txt: javascript/duktape/netsurf.bnd $(BINDINGS)
$(Q)mkdir -p $(OBJROOT)/duktape
$(VQ)echo "/** \page unimplemented Unimplemented javascript bindings" > $@
$(VQ)echo "This is a list of all the binding methods, getters and setters without an implementation in a binding." >> $@
$(VQ)echo "" >> $@
$(VQ)echo " GENBIND: $<"
$(Q)nsgenbind -Wunimplemented -I javascript/WebIDL $< $(OBJROOT)/duktape 2>&1 >/dev/null | grep "Unimplemented" | cut -d' ' -f4- | sort -k 2 | awk '{print $$0"\\n" }' >> $@
$(VQ)echo "*/" >> $@
ifeq ($(filter $(MAKECMDGOALS),clean test coverage),)
-include $(OBJROOT)/duktape/Makefile
endif
S_JSAPI_BINDING:=$(addprefix $(OBJROOT)/duktape/,$(NSGENBIND_SOURCES))
$(S_JSAPI_BINDING): $(BINDINGS)
S_JAVASCRIPT += dukky.c content.c fetcher.c duktape/duktape.c
CFLAGS += -DDUK_OPT_HAVE_CUSTOM_H
# Duktape
include javascript/duktape/Makefile
else
S_JAVASCRIPT += none.c fetcher.c
# None
include javascript/none/Makefile
endif
endif
S_JAVASCRIPT := $(addprefix javascript/,$(S_JAVASCRIPT)) $(S_JSAPI_BINDING)
# Fetcher for javascript scheme is always required
S_JAVASCRIPT += fetcher.c
S_JAVASCRIPT := $(addprefix javascript/,$(S_JAVASCRIPT)) $(S_JAVASCRIPT_BINDING)

View File

@ -0,0 +1,37 @@
#
# NetSurf javascript source file inclusion
#
# Included by javascript/Makefile
#
javascript/dukky.c: $(OBJROOT)/duktape/binding.h
BINDINGS := $(wildcard javascript/duktape/*.bnd)
$(OBJROOT)/duktape/binding.h $(OBJROOT)/duktape/Makefile: javascript/duktape/netsurf.bnd $(BINDINGS)
$(Q)mkdir -p $(OBJROOT)/duktape
$(VQ)echo " GENBIND: $<"
$(Q)nsgenbind -D -g -I javascript/WebIDL $< $(OBJROOT)/duktape
$(VQ)echo " GENBIND: completed"
# create unimplemented report for doxygen
Docs/UnimplementedJavascript.txt: javascript/duktape/netsurf.bnd $(BINDINGS)
$(Q)mkdir -p $(OBJROOT)/duktape
$(VQ)echo "/** \page unimplemented Unimplemented javascript bindings" > $@
$(VQ)echo "This is a list of all the binding methods, getters and setters without an implementation in a binding." >> $@
$(VQ)echo "" >> $@
$(VQ)echo " GENBIND: $<"
$(Q)nsgenbind -Wunimplemented -I javascript/WebIDL $< $(OBJROOT)/duktape 2>&1 >/dev/null | grep "Unimplemented" | cut -d' ' -f4- | sort -k 2 | awk '{print $$0"\\n" }' >> $@
$(VQ)echo "*/" >> $@
ifeq ($(filter $(MAKECMDGOALS),clean test coverage),)
-include $(OBJROOT)/duktape/Makefile
endif
S_JAVASCRIPT_BINDING:=$(addprefix $(OBJROOT)/duktape/,$(NSGENBIND_SOURCES))
$(S_JAVASCRIPT_BINDING): $(BINDINGS)
S_JAVASCRIPT += content.c duktape/dukky.c duktape/duktape.c
CFLAGS += -DDUK_OPT_HAVE_CUSTOM_H

View File

@ -32,7 +32,7 @@
#include "duktape/binding.h"
#include "duktape/duktape.h"
#include "duktape.h"
#include "dukky.h"
#include <dom/dom.h>

View File

@ -47,7 +47,7 @@ struct dom_html_br_element;
%};
prologue %{
#include "javascript/dukky.h"
#include "javascript/duktape/dukky.h"
%};
};

53
javascript/jsapi/Makefile Normal file
View File

@ -0,0 +1,53 @@
#
# NetSurf javascript source file inclusion
#
# Included by javascript/Makefile
#
# ----------------------------------------------------------------------------
# JSAPI binding
# ----------------------------------------------------------------------------
D_JSAPI_BINDING:=
JSAPI_BINDING_htmldocument := javascript/jsapi/htmldocument.bnd
JSAPI_BINDING_htmlelement := javascript/jsapi/htmlelement.bnd
JSAPI_BINDING_window := javascript/jsapi/window.bnd
JSAPI_BINDING_navigator := javascript/jsapi/navigator.bnd
JSAPI_BINDING_console := javascript/jsapi/console.bnd
JSAPI_BINDING_location := javascript/jsapi/location.bnd
JSAPI_BINDING_htmlcollection := javascript/jsapi/htmlcollection.bnd
JSAPI_BINDING_nodelist := javascript/jsapi/nodelist.bnd
JSAPI_BINDING_text := javascript/jsapi/text.bnd
JSAPI_BINDING_comment := javascript/jsapi/comment.bnd
JSAPI_BINDING_node := javascript/jsapi/node.bnd
JSAPI_BINDING_event := javascript/jsapi/event.bnd
# 1: input binding file
# 2: source output file
# 3: header output file
# 4: binding name
define convert_jsapi_binding
S_JAVASCRIPT_BINDING += $(2)
D_JSAPI_BINDING += $(patsubst %.c,%.d,$(2))
$(2): $(1) $(OBJROOT)/created
$$(VQ)echo " GENBIND: $(1)"
$(Q)nsgenbind -g -I javascript/WebIDL -d $(patsubst %.c,%.d,$(2)) -h $(3) -o $(2) $(1)
$(3): $(2)
endef
S_JSAPI :=
S_JAVASCRIPT += content.c jsapi/jsapi.c $(addprefix jsapi/,$(S_JSAPI))
$(eval $(foreach V,$(filter JSAPI_BINDING_%,$(.VARIABLES)),$(call convert_jsapi_binding,$($(V)),$(OBJROOT)/$(patsubst JSAPI_BINDING_%,%,$(V)).c,$(OBJROOT)/$(patsubst JSAPI_BINDING_%,%,$(V)).h,$(patsubst JSAPI_BINDING_%,%,$(V))_jsapi)))
ifeq ($(filter $(MAKECMDGOALS),clean test coverage),)
-include $(D_JSAPI_BINDING)
endif

9
javascript/none/Makefile Normal file
View File

@ -0,0 +1,9 @@
#
# NetSurf javascript source file inclusion
#
# Included by javascript/Makefile
#
# no javascript interpreter
S_JAVASCRIPT += none/none.c