mirror of
https://github.com/OMGeeky/google-apis-rs.git
synced 2026-01-22 11:11:25 +01:00
That way, we read the data files only once, but produce all the outputs we need. Together with a powerful makefile, we have a multi-invocation with proper depedency tracking. Everything will be regenerated though, even though just a single input template file changed. The alternative would be to have one dependency and invocation per input dependency, but that will read the entire json each time. Let's see what's faster/more useful during development.
43 lines
993 B
Makefile
43 lines
993 B
Makefile
.PHONY: json-to-xml clean help api-deps
|
|
|
|
include Makefile.helpers
|
|
|
|
VENV := virtualenv
|
|
VENV_DIR := .pyenv
|
|
PYTHON := $(VENV_DIR)/bin/python
|
|
PIP := $(VENV_DIR)/bin/pip
|
|
MAKO_RENDER := ./etc/bin/mako-render
|
|
TPL := $(PYTHON) $(MAKO_RENDER)
|
|
|
|
API_DEPS_TPL = src/mako/deps.mako
|
|
API_DEPS = .api.deps
|
|
API_SHARED_INFO = ./etc/api/shared.yaml
|
|
API_JSON_FILES = $(shell find ./etc -type f -name '*-api.json')
|
|
|
|
help:
|
|
$(info using template engine: '$(TPL)')
|
|
$(info )
|
|
$(info Targets)
|
|
$(info help - print this help)
|
|
$(info api-deps - generate a file to tell make what API file dependencies will be)
|
|
$(info help-api - show all api targets to build individually)
|
|
|
|
$(PYTHON):
|
|
virtualenv $(VENV_DIR)
|
|
$(PIP) install mako pyyaml
|
|
|
|
$(MAKO_RENDER): $(PYTHON)
|
|
|
|
$(API_DEPS): $(API_SHARED_INFO) $(API_DEPS_TPL) $(MAKO_RENDER)
|
|
$(TPL) -io $(API_DEPS_TPL) --data-files $(API_SHARED_INFO) > $@
|
|
|
|
api-deps: $(API_DEPS)
|
|
|
|
include $(API_DEPS)
|
|
|
|
clean: clean-api
|
|
-rm -Rf $(VENV_DIR)
|
|
-rm $(API_DEPS)
|
|
|
|
|