-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
56 lines (43 loc) · 1.15 KB
/
Copy pathMakefile
File metadata and controls
56 lines (43 loc) · 1.15 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
# php-quickjs — build & test
#
# The extension is a plain cargo cdylib (no phpize). Load the built .so by
# absolute path with `php -d extension=...`.
PROFILE ?= debug
ifeq ($(PROFILE),release)
CARGO_FLAGS := --release
else
CARGO_FLAGS :=
endif
EXT := $(CURDIR)/target/$(PROFILE)/libphp_quickjs.so
PHP := php -d extension=$(EXT)
.PHONY: all build release test test-rust test-php stubs example clean fmt
all: build
build:
cargo build $(CARGO_FLAGS)
release:
$(MAKE) build PROFILE=release
# Rust unit tests (marshaling, manifest, facade) + the PHP integration suite.
test: build test-rust test-php
test-rust:
cargo test --lib
test-php: build
@fail=0; \
for t in tests/php/[0-9]*.php; do \
printf '\n=== %s ===\n' "$$t"; \
$(PHP) "$$t" || fail=1; \
done; \
exit $$fail
# Regenerate the IDE stub for the PHP-facing classes (requires cargo-php:
# cargo install cargo-php).
stubs:
cargo php stubs --stdout > stubs/php_quickjs.stubs.php || \
echo "cargo-php not installed; run 'cargo install cargo-php'"
example: build
@for ex in examples/*.php; do \
printf '\n=== %s ===\n' "$$ex"; \
$(PHP) "$$ex"; \
done
fmt:
cargo fmt
clean:
cargo clean