Generate code into OUT_DIR.

This is necessary to ensure Cargo knows when to rebuild. Normally
.gitignore would be enough to exclude these from Cargo's freshness
calculation, but https://github.com/rust-lang/cargo/issues/1729 prevents
this currently. This is the new, correct way to do these thigns, just
like the style crate does.
This commit is contained in:
Jack Moffitt 2015-06-17 15:59:04 -06:00
parent e1b28d893e
commit 07d95627ca
5 changed files with 64 additions and 51 deletions

View file

@ -8,38 +8,38 @@ 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),$(BINDINGS_SRC)/Bindings,$(var)))
AUTOGEN_SRC = $(foreach var,$(BINDINGS),$(subst $(WEBIDLS_SRC),$(OUT_DIR)/Bindings,$(var)))
CACHE_DIR = $(BINDINGS_SRC)/_cache
CACHE_DIR = $(OUT_DIR)/_cache
bindinggen_dependencies := $(addprefix $(BINDINGS_SRC)/,BindingGen.py Bindings.conf Configuration.py CodegenRust.py parser/WebIDL.py ParserResults.pkl Bindings/.done)
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 $(BINDINGS_SRC)/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)
$(BINDINGS_SRC)/Bindings/.done:
mkdir -p $(BINDINGS_SRC)/Bindings
$(OUT_DIR)/Bindings/.done:
mkdir -p $(OUT_DIR)/Bindings
touch $@
$(CACHE_DIR)/.done:
mkdir -p $(CACHE_DIR)
touch $@
$(BINDINGS_SRC)/ParserResults.pkl: $(globalgen_dependencies) $(WEBIDLS)
$(OUT_DIR)/ParserResults.pkl: $(globalgen_dependencies) $(WEBIDLS)
$(PYTHON) $(BINDINGS_SRC)/pythonpath.py \
-I$(BINDINGS_SRC)/parser -I$(BINDINGS_SRC)/ply \
-D$(BINDINGS_SRC) \
-D$(OUT_DIR) \
$(BINDINGS_SRC)/GlobalGen.py $(BINDINGS_SRC)/Bindings.conf . \
--cachedir=$(CACHE_DIR) \
$(WEBIDLS)
$(AUTOGEN_SRC): $(BINDINGS_SRC)/Bindings/%Binding.rs: $(bindinggen_dependencies) \
$(addprefix $(WEBIDLS_SRC)/,%.webidl)
$(AUTOGEN_SRC): $(OUT_DIR)/Bindings/%Binding.rs: $(bindinggen_dependencies) \
$(addprefix $(WEBIDLS_SRC)/,%.webidl)
$(PYTHON) $(BINDINGS_SRC)/pythonpath.py \
-I$(BINDINGS_SRC)/parser -I$(BINDINGS_SRC)/ply \
-D$(BINDINGS_SRC) \
-D$(OUT_DIR) \
$(BINDINGS_SRC)/BindingGen.py \
$(BINDINGS_SRC)/Bindings.conf Bindings/$*Binding $(addprefix $(WEBIDLS_SRC)/,$*.webidl)
touch $@