chore(cargo): cargo calls for any API

That way, it's so much easier to parallelize doc and test generation,
just to be sure it's truly working.
This commit is contained in:
Sebastian Thiel
2015-03-10 10:04:47 +01:00
parent 6d2b0fc264
commit 874cfb6f68
2 changed files with 15 additions and 5 deletions

View File

@@ -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):

View File

@@ -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)}
clean-apis: ${space_join(1)}
cargo: ${space_join(2)}
apis: ${space_join(0)}