Files
tubestation/servo/components/script/makefile.cargo
Corey Farwell f2d2d439ba servo: Merge #7209 - Cleanup/refactor build scripts for DOM codegen (from frewsxcv:codegen-build-cleanup); r=metajack
Prior to this commit, the script codegen makefile relied on an
intermediary pythonpath.py file that handled python dependencies and
incorporated a couple hacks to get the codegen building working. This
commit removes that intermediary file and attempts to make the script
codegen build process cleaner.

Source-Repo: https://github.com/servo/servo
Source-Revision: 493da96cae7cc0e3b533fc1f01cc0c5e38a27e02
2015-09-01 13:53:49 -06:00

49 lines
1.7 KiB
Plaintext

# Recursive wildcard function
# http://blog.jgc.org/2011/07/gnu-make-recursive-wildcard-function.html
rwildcard=$(foreach d,$(wildcard $1*),$(call rwildcard,$d/,$2) \
$(filter $(subst *,%,$2),$d))
PYTHON = $(shell which python2.7 2>/dev/null || echo python)
BINDINGS_SRC = $(shell pwd)/dom/bindings/codegen
WEBIDLS_SRC = $(shell pwd)/dom/webidls
WEBIDLS = $(call rwildcard,$(WEBIDLS_SRC),*.webidl)
BINDINGS = $(patsubst %.webidl,%Binding.rs,$(WEBIDLS))
AUTOGEN_SRC = $(foreach var,$(BINDINGS),$(subst $(WEBIDLS_SRC),$(OUT_DIR)/Bindings,$(var)))
export PYTHONPATH := $(BINDINGS_SRC)/parser:$(BINDINGS_SRC)/ply:$(PYTHONPATH)
CACHE_DIR = $(OUT_DIR)/_cache
bindinggen_dependencies := $(addprefix $(BINDINGS_SRC)/,BindingGen.py Bindings.conf Configuration.py CodegenRust.py parser/WebIDL.py) $(OUT_DIR)/ParserResults.pkl $(OUT_DIR)/Bindings/.done
globalgen_dependencies := $(addprefix $(BINDINGS_SRC)/,GlobalGen.py Bindings.conf Configuration.py CodegenRust.py parser/WebIDL.py) $(CACHE_DIR)/.done $(OUT_DIR)/Bindings/.done
.PHONY: all
all: $(AUTOGEN_SRC)
$(OUT_DIR)/Bindings/.done:
mkdir -p $(OUT_DIR)/Bindings
touch $@
$(CACHE_DIR)/.done:
mkdir -p $(CACHE_DIR)
touch $@
$(OUT_DIR)/ParserResults.pkl: $(globalgen_dependencies) $(WEBIDLS)
$(PYTHON) \
$(BINDINGS_SRC)/GlobalGen.py \
--cachedir=$(CACHE_DIR) \
$(BINDINGS_SRC)/Bindings.conf \
$(OUT_DIR) \
. \
$(WEBIDLS)
$(AUTOGEN_SRC): $(OUT_DIR)/Bindings/%Binding.rs: $(bindinggen_dependencies) \
$(addprefix $(WEBIDLS_SRC)/,%.webidl)
$(PYTHON) \
$(BINDINGS_SRC)/BindingGen.py \
$(BINDINGS_SRC)/Bindings.conf \
$(OUT_DIR)/Bindings/$*Binding \
$(addprefix $(WEBIDLS_SRC)/,$*.webidl)
touch $@