diff --git a/Makefile b/Makefile index f7f3df6798..7e6f17e79e 100644 --- a/Makefile +++ b/Makefile @@ -27,6 +27,8 @@ help: $(info api-deps - generate a file to tell make what API file dependencies will be) $(info regen-apis - clear out all generated apis, and regenerate them) $(info help-api - show all api targets to build individually) + $(info clean-apis - delete all generated APIs) + $(info cargo - run cargo on all APIs, use ARGS="args ..." to specify cargo arguments) $(info license - regenerate the main license file) $(PYTHON): diff --git a/src/mako/deps.mako b/src/mako/deps.mako index 12a895d8ed..90b9841fc6 100644 --- a/src/mako/deps.mako +++ b/src/mako/deps.mako @@ -11,12 +11,15 @@ api_name = util.library_name(a.name, a.version) api_common = gen_root + '/src/cmn.rs' api_clean = api_name + '-clean' + api_cargo = api_name + '-cargo' # source, destination of individual output files sds = [(directories.mako_src + '/' + i.source + '.mako', gen_root + '/' + i.get('output_dir', '') + '/' + i.source) for i in api.templates] api_json = directories.api_base + '/' + a.name + '/' + a.version + '/' + a.name + '-api.json' api_json_inputs = api_json + " $(API_SHARED_INFO)" - api_info.append((api_name, api_clean, gen_root)) + api_info.append((api_name, api_clean, api_cargo, gen_root)) + + space_join = lambda i: ' '.join(a[i] for a in api_info) %>\ ${api_common}: $(RUST_SRC)/cmn.rs $(lastword $(MAKEFILE_LIST)) @ echo "// COPY OF '$<'" > $@ @@ -28,19 +31,24 @@ ${gen_root_stamp}: ${' '.join(i[0] for i in sds)} ${api_json_inputs} $(MAKO_LIB_ @touch $@ ${api_name}: ${gen_root_stamp} ${api_common} - + +${api_cargo}: ${api_name} + cd ${gen_root} && cargo $(ARGS) + ${api_clean}: -rm -Rf ${gen_root} % endfor -.PHONY += $(.PHONY) help-api clean-apis apis ${' '.join(a[0] for a in api_info)} ${' '.join(a[1] for a in api_info)} +.PHONY += $(.PHONY) help-api clean-apis apis ${space_join(0)} ${space_join(1)} ${space_join(2)} help-api: $(info apis - make all APIs) % for a in api_info: $(info ${a[0]} - build the ${a[0]} api) $(info ${a[1]} - clean all generated files of the ${a[0]} api) + $(info ${a[2]} - run cargo on the ${a[0]} api, using given ARGS="arg1 ...") % endfor -clean-apis: ${' '.join(a[1] for a in api_info)} -apis: ${' '.join(a[0] for a in api_info)} \ No newline at end of file +clean-apis: ${space_join(1)} +cargo: ${space_join(2)} +apis: ${space_join(0)} \ No newline at end of file