Skip to content

Commit 0712e7a

Browse files
committed
Change extras to use configure.py
Previously extras relied on ../../src which only exists in the end user distributable. It's better to run tools/configure.py because the extras will then work both from the main repo and the distributable. Also the configure.py will be more apparent and maybe picked up by the user.
1 parent ab4d1fc commit 0712e7a

6 files changed

Lines changed: 48 additions & 6 deletions

File tree

extras/console/Makefile

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,17 @@
22

33
.PHONY: test
44
test:
5-
gcc -std=c99 -Wall -Wextra -o $@ -I../../src/ -I. ../../src/duktape.c duk_console.c test.c -lm
5+
-rm -rf ./prep
6+
python2 ../../tools/configure.py --quiet --output-directory ./prep
7+
gcc -std=c99 -Wall -Wextra -o $@ -I./prep -I. ./prep/duktape.c duk_console.c test.c -lm
68
./test 'console.assert(true, "not shown");'
79
./test 'console.assert(false, "shown", { foo: 123 });'
810
./test 'console.log(1, 2, 3, { foo: "bar" });'
911
./test 'a={}; b={}; a.ref=b; console.log(a,b); b.ref=a; console.log(a,b)' # circular ref
1012
./test 'console.trace(1, 2, 3)'
1113
./test 'console.dir({ foo: 123, bar: [ "foo", "bar" ]});'
14+
15+
.PHONY: clean
16+
clean:
17+
-rm -rf ./prep
18+
-rm -f test

extras/duk-v1-compat/Makefile

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,12 @@
22

33
.PHONY: test
44
test:
5-
gcc -std=c99 -Wall -Wextra -o $@ -I../../src/ -I. ../../src/duktape.c duk_v1_compat.c test.c -lm
5+
-rm -rf ./prep
6+
python2 ../../tools/configure.py --quiet --output-directory ./prep
7+
gcc -std=c99 -Wall -Wextra -o $@ -I./prep -I. ./prep/duktape.c duk_v1_compat.c test.c -lm
68
./test
9+
10+
.PHONY: clean
11+
clean:
12+
-rm -rf ./prep
13+
-rm -f test

extras/logging/Makefile

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
# For manual testing; say 'make' in extras/logging and run ./test.
22
.PHONY: test
33
test:
4-
gcc -std=c99 -Wall -Wextra -otest -I../../src ../../src/duktape.c duk_logging.c test.c -lm
4+
-rm -rf ./prep
5+
python2 ../../tools/configure.py --quiet --output-directory ./prep
6+
gcc -std=c99 -Wall -Wextra -otest -I./prep ./prep/duktape.c duk_logging.c test.c -lm
57
./test 'L = new Duktape.Logger(); L.trace("testing"); L.l = 0; L.trace("testing 2");'
68
./test 'L = new Duktape.Logger(); L.debug("testing"); L.l = 1; L.debug("testing 2");'
79
./test 'L = new Duktape.Logger(); L.info("testing");'
@@ -10,3 +12,8 @@ test:
1012
./test 'L = new Duktape.Logger(); L.fatal("testing");'
1113
./test 'L = new Duktape.Logger(); L.info("testing"); L.n = "loggerName"; L.info("new name");'
1214
./test 'L = new Duktape.Logger("argname"); L.info("testing");'
15+
16+
.PHONY: clean
17+
clean:
18+
-rm -rf ./prep
19+
-rm -f test

extras/module-duktape/Makefile

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,9 @@
33

44
.PHONY: test
55
test:
6-
gcc -std=c99 -Wall -Wextra -o $@ -I../../src/ -I. ../../src/duktape.c duk_module_duktape.c test.c -lm
6+
-rm -rf ./prep
7+
python2 ../../tools/configure.py --quiet --output-directory ./prep
8+
gcc -std=c99 -Wall -Wextra -o $@ -I./prep -I. ./prep/duktape.c duk_module_duktape.c test.c -lm
79
@printf '\n'
810
./test 'assert(typeof require === "function");'
911
./test 'assert(require.name === "require");'
@@ -12,3 +14,8 @@ test:
1214
./test 'Duktape.modSearch = function myModSearch(id) { return "exports.foo = 123;" }; assert(require("dummy").foo === 123);'
1315
./test 'Duktape.modSearch = function myModSearch(id) { return "exports.foo = 234;" }; delete Duktape; assert(typeof Duktape === "undefined"); assert(require("dummy").foo === 234);'
1416
./test 'Duktape.modSearch = function myModSearch(id) { return "exports.foo = 234; // comment" }; delete Duktape; assert(typeof Duktape === "undefined"); assert(require("dummy").foo === 234);'
17+
18+
.PHONY: clean
19+
clean:
20+
-rm -rf ./prep
21+
-rm -f test

extras/module-node/Makefile

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@
22

33
.PHONY: test
44
test:
5-
gcc -std=c99 -Wall -Wextra -o $@ -I../../src/ -I. ../../src/duktape.c duk_module_node.c test.c -lm
5+
-rm -rf ./prep
6+
python2 ../../tools/configure.py --quiet --output-directory ./prep
7+
gcc -std=c99 -Wall -Wextra -o $@ -I./prep -I. ./prep/duktape.c duk_module_node.c test.c -lm
68
@printf '\n'
79
./test 'assert(typeof require("pig") === "string", "basic require()");'
810
./test 'assert(require("cow").indexOf("pig") !== -1, "nested require()");'
@@ -17,3 +19,8 @@ test:
1719
./test 'var badger = require("badger"); assert(badger.foo === 123 && badger.bar === 234, "exports.foo assignment");'
1820
./test 'var comment = require("comment"); assert(comment.foo === 123 && comment.bar === 234, "last line with // comment");'
1921
./test 'var shebang = require("shebang"); assert(shebang.foo === 123 && shebang.bar === 234, "shebang");'
22+
23+
.PHONY: clean
24+
clean:
25+
-rm -rf ./prep
26+
-rm -f test

extras/print-alert/Makefile

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,13 @@
11
# For manual testing; say 'make' in extras/print-alert and run ./test.
22
.PHONY: test
33
test:
4-
gcc -std=c99 -Wall -Wextra -otest -I../../src ../../src/duktape.c duk_print_alert.c test.c -lm
4+
-rm -rf ./prep
5+
python2 ../../tools/configure.py --quiet --output-directory ./prep
6+
gcc -std=c99 -Wall -Wextra -otest -I./prep ./prep/duktape.c duk_print_alert.c test.c -lm
57
./test 'print("foo", "bar", 1, 2, 3)'
68
./test 'alert("foo", "bar", 1, 2, 3)'
9+
10+
.PHONY: clean
11+
clean:
12+
-rm -rf ./prep
13+
-rm -f test

0 commit comments

Comments
 (0)