Skip to content

Commit

Permalink
Makefile: add install target
Browse files Browse the repository at this point in the history
  • Loading branch information
jcaesar committed Feb 22, 2021
1 parent 80ec06f commit a9537c9
Showing 1 changed file with 40 additions and 1 deletion.
41 changes: 40 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -323,11 +323,13 @@ $(info --------------)
$(info )
$(info )


############
# Building #
############

# Not really "all", just the default target that builds enough so make install will go through
all: build-wasmer build-capi

bench:
cargo bench $(compiler_features)

Expand Down Expand Up @@ -657,6 +659,43 @@ endif
tar -C package -zcvf wasmer.tar.gz bin lib include LICENSE ATTRIBUTIONS
mv wasmer.tar.gz dist/

########################
# (Distro-) Installing #
########################

DESTDIR ?= /usr/local

install: install-wasmer install-capi-headers install-capi-lib install-capi-staticlib install-pkgconfig install-misc

install-wasmer:
install -Dm755 target/release/wasmer $(DESTDIR)/bin/wasmer

install-capi-headers:
for header in lib/c-api/*.{h,hh}; do install -Dm644 "$$header" $(DESTDIR)/include/$$(basename $$header); done
install -Dm644 lib/c-api/doc/deprecated/index.md $(DESTDIR)/include/wasmer-README.md

install-capi-lib:
pkgver=$$(target/release/wasmer --version | cut -d\ -f2) && \
shortver="$${pkgver%.*}" && \
majorver="$${shortver%.*}" && \
install -Dm755 target/release/libwasmer_c_api.so "$(DESTDIR)/lib/libwasmer.so.$$pkgver" && \
ln -sf "libwasmer.so.$$pkgver" "$(DESTDIR)/lib/libwasmer.so.$$shortver" && \
ln -sf "libwasmer.so.$$pkgver" "$(DESTDIR)/lib/libwasmer.so.$$majorver" && \
ln -sf "libwasmer.so.$$pkgver" "$(DESTDIR)/lib/libwasmer.so"

install-capi-staticlib:
install -Dm644 target/release/libwasmer_c_api.a "$(DESTDIR)/lib/libwasmer.a"

install-misc:
install -Dm644 LICENSE "$(DESTDIR)"/share/licenses/wasmer/LICENSE

install-pkgconfig:
unset WASMER_DIR # Make sure WASMER_INSTALL_PREFIX is set during build
target/release/wasmer config --pkg-config | install -Dm644 /dev/stdin "$(DESTDIR)"/lib/pkgconfig/wasmer.pc

install-wasmer-headless-minimal:
install -Dm755 target/release/wasmer $(DESTDIR)/bin/wasmer-headless

#################
# Miscellaneous #
#################
Expand Down

0 comments on commit a9537c9

Please sign in to comment.