summaryrefslogtreecommitdiffstats
path: root/rust/Makefile.am
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 17:39:49 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 17:39:49 +0000
commita0aa2307322cd47bbf416810ac0292925e03be87 (patch)
tree37076262a026c4b48c8a0e84f44ff9187556ca35 /rust/Makefile.am
parentInitial commit. (diff)
downloadsuricata-a0aa2307322cd47bbf416810ac0292925e03be87.tar.xz
suricata-a0aa2307322cd47bbf416810ac0292925e03be87.zip
Adding upstream version 1:7.0.3.upstream/1%7.0.3
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'rust/Makefile.am')
-rw-r--r--rust/Makefile.am105
1 files changed, 105 insertions, 0 deletions
diff --git a/rust/Makefile.am b/rust/Makefile.am
new file mode 100644
index 0000000..2857288
--- /dev/null
+++ b/rust/Makefile.am
@@ -0,0 +1,105 @@
+EXTRA_DIST = src derive \
+ .cargo/config.in \
+ cbindgen.toml \
+ dist/rust-bindings.h \
+ vendor
+
+if !DEBUG
+RELEASE = --release
+endif
+
+if RUST_BUILD_STD
+NIGHTLY_ARGS = -Z build-std
+endif
+
+if HAVE_LUA
+RUST_FEATURES += lua $(LUA_INT8)
+endif
+
+if DEBUG
+RUST_FEATURES += debug
+endif
+
+if DEBUG_VALIDATION
+RUST_FEATURES += debug-validate
+endif
+
+if RUST_CROSS_COMPILE
+RUST_TARGET = --target $(host_triplet)
+endif
+
+all-local: Cargo.toml
+if HAVE_CYGPATH
+ @rustup_home@ \
+ CARGO_HOME="$(CARGO_HOME)" \
+ CARGO_TARGET_DIR="$(e_rustdir)/target" \
+ $(CARGO) build $(RELEASE) \
+ --features "$(RUST_FEATURES)" $(RUST_TARGET)
+else
+ @rustup_home@ \
+ CARGO_HOME="$(CARGO_HOME)" \
+ CARGO_TARGET_DIR="$(abs_top_builddir)/rust/target" \
+ $(CARGO) build $(RELEASE) $(NIGHTLY_ARGS) \
+ --features "$(RUST_FEATURES)" $(RUST_TARGET)
+endif
+ if test -e $(RUST_SURICATA_LIBDIR)/suricata.lib; then \
+ cp -a $(RUST_SURICATA_LIBDIR)/suricata.lib \
+ $(RUST_SURICATA_LIBDIR)/${RUST_SURICATA_LIBNAME}; \
+ fi
+ if test -e $(RUST_SURICATA_LIBDIR)/libsuricata.a; then \
+ cp -a $(RUST_SURICATA_LIBDIR)/libsuricata.a \
+ $(RUST_SURICATA_LIBDIR)/${RUST_SURICATA_LIBNAME}; \
+ fi
+ $(MAKE) gen/rust-bindings.h
+
+install-library:
+ $(MKDIR_P) "$(DESTDIR)$(libdir)"
+ $(INSTALL_DATA) $(RUST_SURICATA_LIB) "$(DESTDIR)$(libdir)"
+
+uninstall-local:
+ rm -f "$(DESTDIR)$(libdir)/$(RUST_SURICATA_LIBNAME)"
+
+clean-local:
+ rm -rf target
+if HAVE_CBINDGEN
+ rm -rf gen dist
+endif
+
+distclean-local:
+ rm -f Cargo.lock
+
+maintainer-clean-local:
+ rm -rf vendor gen
+
+check:
+ CARGO_HOME="$(CARGO_HOME)" @rustup_home@ \
+ CARGO_TARGET_DIR="$(abs_top_builddir)/rust/target" \
+ $(CARGO) test --all $(RELEASE) --features "$(RUST_FEATURES)"
+
+vendor:
+ CARGO_HOME="$(CARGO_HOME)" @rustup_home@ $(CARGO) vendor
+
+if HAVE_CBINDGEN
+gen/rust-bindings.h: $(RUST_SURICATA_LIB)
+ cbindgen --config $(abs_top_srcdir)/rust/cbindgen.toml \
+ --quiet --verify --output $(abs_top_builddir)/rust/gen/rust-bindings.h || true
+else
+gen/rust-bindings.h:
+endif
+
+doc:
+ CARGO_HOME=$(CARGO_HOME) $(CARGO) doc --all-features --no-deps
+
+if HAVE_CBINDGEN
+dist/rust-bindings.h:
+ cbindgen --config $(abs_top_srcdir)/rust/cbindgen.toml \
+ --quiet --output $(abs_top_builddir)/rust/dist/rust-bindings.h
+else
+dist/rust-bindings.h:
+endif
+
+Cargo.toml: Cargo.toml.in
+
+update-lock: Cargo.toml
+ cargo update
+ mv Cargo.lock Cargo.lock.in