summaryrefslogtreecommitdiffhomepage
path: root/Makefile
diff options
context:
space:
mode:
authorAndrew Clayton <a.clayton@nginx.com>2023-08-02 17:03:48 +0100
committerAndrew Clayton <a.clayton@nginx.com>2023-08-21 23:24:12 +0100
commitd6ed6a219b31a58526721f96195c80061d41ce54 (patch)
tree17a1fd6ecf72a327916ff0f8bc7aaf85b981ceff /Makefile
downloadunit-wasm-c43c6b57d70ae3a2cb3a52f5f991cd68fd39b47d.tar.gz
unit-wasm-c43c6b57d70ae3a2cb3a52f5f991cd68fd39b47d.tar.bz2
Initial commitv0.1.0
libunit-wasm and example C and Rust WebAssembly modules for NGINX Unit. Co-developed-by: Timo Stark <t.stark@nginx.com> Co-developed-by: Liam Crilly <liam@nginx.com> Signed-off-by: Andrew Clayton <a.clayton@nginx.com>
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile73
1 files changed, 73 insertions, 0 deletions
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..1a56cb0
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,73 @@
+MAKE_OPTS = --no-print-directory
+
+.PHONY: libunit-wasm
+libunit-wasm:
+ @echo "Building: libunit-wasm"
+ @$(MAKE) $(MAKE_OPTS) -C src/c
+
+.PHONY: examples
+examples: libunit-wasm
+ @echo "Building: examples"
+ @$(MAKE) $(MAKE_OPTS) -C examples/c examples-luw
+
+.PHONY: examples-raw
+examples-raw: libunit-wasm
+ @echo "Building: raw examples"
+ @$(MAKE) $(MAKE_OPTS) -C examples/c examples-raw
+
+.PHONY: rust
+rust: libunit-wasm
+ @echo "Building: libunit-wasm-rust"
+ @$(MAKE) $(MAKE_OPTS) -C src/rust
+
+.PHONY: examples-rust
+examples-rust: rust
+ @echo "Building: rust examples"
+ @$(MAKE) $(MAKE_OPTS) -C examples/rust
+
+.PHONY: all
+all: libunit-wasm examples examples-raw rust examples-rust
+
+.PHONY: docker
+docker:
+ docker build -t unit:wasm -f examples/docker/unit-wasm.Dockerfile .
+ docker build -t unit:demo-wasm -f examples/docker/demo-wasm.Dockerfile .
+
+.PHONY: clean
+clean:
+ @echo "Cleaning: libunit-wasm"
+ @$(MAKE) $(MAKE_OPTS) -C src/c clean
+ @echo "Cleaning: rust"
+ @$(MAKE) $(MAKE_OPTS) -C src/rust clean
+ @echo "Cleaning: examples"
+ @$(MAKE) $(MAKE_OPTS) -C examples/c clean
+ @echo "Cleaning: rust examples"
+ @$(MAKE) $(MAKE_OPTS) -C examples/rust clean
+
+.PHONY: tags
+tags:
+ @echo "Generating ctags..."
+ @ctags -R src/ examples/
+
+.PHONY: help
+help:
+ @echo "Available Targets:"
+ @echo " default / "
+ @echo " libunit-wasm - Builds libunit-wasm C library"
+ @echo " examples - Builds the above as well as C examples"
+ @echo " examples-raw - Builds raw (non libunit-wasm) C examples"
+ @echo " rust - Builds the libunit-wasm rust crate"
+ @echo " examples-rust _ Builds the above and rust examples"
+ @echo " all - Builds all the above"
+ @echo " docker - Builds demo docker images"
+ @echo " clean - Removes auto generated artifacts"
+ @echo " tags - Generate ctags"
+ @echo
+ @echo "Variables:"
+ @echo " make CC= - Specify compiler to use"
+ @echo " Defaults to clang"
+ @echo " make WASI_SYSROOT= - Specify the path to the WASI sysroot"
+ @echo " Defaults to /usr/wasm32-wasi"
+ @echo " make V=1 - Enables verbose output"
+ @echo " make D=1 - Enables debug builds (-O0)"
+ @echo " make E=1 - Enables Werror"