From fe3dcf3681bb8f55982fd2aec2e86e397ac710e2 Mon Sep 17 00:00:00 2001 From: Avril Date: Thu, 25 Jun 2020 11:18:01 +0100 Subject: [PATCH] added static library output --- Cargo.toml | 2 +- Makefile | 4 +++- README.org | 8 ++++---- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index a189ace..a74e834 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -8,7 +8,7 @@ license = "GPL-3.0-or-later" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [lib] -crate-type = ["cdylib"] +crate-type = ["cdylib", "staticlib"] [profile.release] opt-level = 3 diff --git a/Makefile b/Makefile index e38a1ec..4494a97 100644 --- a/Makefile +++ b/Makefile @@ -19,10 +19,12 @@ test: install: cp -f ./target/release/libkhash.so $(INSTALL)/libkhash.so + cp -f ./target/release/libkhash.a $(INSTALL)/libkhash.a cp -f $(CLI)/build/kana-hash $(INSTALL-BIN)/kana-hash cp -f include/khash.h $(INSTALL-INCLUDE)/khash.h uninstall: - rm -f $(INSTALL)/libkana_hash.so + rm -f $(INSTALL)/libkhash.so + rm -f $(INSTALL)/libkhash.a rm -f $(INSTALL-BIN)/kana-hash rm -f $(INSTALL-INCLUDE)/khash.h diff --git a/README.org b/README.org index 171968e..033c0b4 100644 --- a/README.org +++ b/README.org @@ -11,10 +11,10 @@ | SHA256 (truncated) | おシソまツアで | ** Installation - The dynamic library is built with ~Cargo~ and ~Rust~, and the cli example program is built with ~gcc~. + The dynamic library is built with ~Cargo~ and ~Rust~, and the CLI example program is built with ~gcc~. *** Build and install - The default build configuration builds both the dynamic library and the cli example program, and copies them to =/usr/lib/libkhash.so= and =/usr/bin/kana-hash= respectively. + The default build configuration builds both the dynamic library, static library, and the CLI example program and copies them to =/usr/local/lib/libkhash.so=, =/usr/local/lib/libkhash.a= and =/usr/local/bin/kana-hash= respectively. Also installed is the C header to =/usr/local/include/khash.h=. #+BEGIN_SRC shell $ make && sudo make install @@ -33,8 +33,8 @@ The Makefile contains some other build directives. **** Native code optimisations - By default =libkhash= builds the shared library with native architecture optimisations enabled. - If you are intending to move the binary to another architecture, this might not be desireable. + By default =libkhash= builds the shared and static library with native architecture optimisations enabled. + If you are intending to move the libraries to another architecture, this might not be desireable. To build without such optimisations, run: #+BEGIN_SRC shell