Skip to content

Commit 279080c

Browse files
committed
Rename targets and add cross-language rules for running examples
1 parent ba7353e commit 279080c

File tree

2 files changed

+44
-4
lines changed

2 files changed

+44
-4
lines changed

tools/make/lib/examples/Makefile

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,3 +21,43 @@
2121
include $(TOOLS_MAKE_LIB_DIR)/examples/c.mk
2222
include $(TOOLS_MAKE_LIB_DIR)/examples/javascript.mk
2323
include $(TOOLS_MAKE_LIB_DIR)/examples/markdown.mk
24+
25+
26+
# RULES #
27+
28+
#/
29+
# Runs examples.
30+
#
31+
# @param {string} [EXAMPLES_FILTER] - file path pattern (e.g., `.*/blas/base/dasum/.*`)
32+
#
33+
# @example
34+
# make examples
35+
#
36+
# @example
37+
# make examples EXAMPLES_FILTER=.*/blas/base/dasum/.*
38+
#/
39+
examples: examples-javascript
40+
41+
.PHONY: examples
42+
43+
#/
44+
# Runs cross-language examples.
45+
#
46+
# ## Notes
47+
#
48+
# - This rule supports the environment variables supported by each language-specific (`examples-<lang>`) prerequisite.
49+
# - This rule is useful when wanting to glob for examples files, irrespective of language, for a particular package in order to compare cross-language example output.
50+
#
51+
#
52+
# @param {string} [EXAMPLES_FILTER] - file path pattern (e.g., `.*/blas/base/dasum/.*`)
53+
#
54+
# @example
55+
# make examples-lang
56+
#
57+
# @example
58+
# make examples-lang EXAMPLES_FILTER=.*/blas/base/dasum/.*
59+
#/
60+
examples-lang: examples-javascript examples-c
61+
62+
.PHONY: examples-lang
63+

tools/make/lib/examples/javascript.mk

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
#
2323
# This target runs a list of examples in sequential order. Note that we assume the examples can be run using Node.js.
2424

25-
examples: $(NODE_MODULES)
25+
examples-javascript: $(NODE_MODULES)
2626
$(QUIET) $(FIND_EXAMPLES_CMD) | grep '^[\/]\|^[a-zA-Z]:[/\]' | while read -r file; do \
2727
echo ""; \
2828
echo "Running example: $$file"; \
@@ -31,14 +31,14 @@ examples: $(NODE_MODULES)
3131
$(NODE) $$file || exit 1; \
3232
done
3333

34-
.PHONY: examples
34+
.PHONY: examples-javascript
3535

3636

3737
# Run examples.
3838
#
3939
# This target runs a specified list of examples in sequential order. Note that we assume the examples can be run using Node.js.
4040

41-
examples-files: $(NODE_MODULES)
41+
examples-javascript-files: $(NODE_MODULES)
4242
$(QUIET) for file in $(FILES); do \
4343
echo ""; \
4444
echo "Running example: $$file"; \
@@ -47,4 +47,4 @@ examples-files: $(NODE_MODULES)
4747
$(NODE) $$file || exit 1; \
4848
done
4949

50-
.PHONY: examples-files
50+
.PHONY: examples-javascript-files

0 commit comments

Comments
 (0)