Skip to content

Commit

Permalink
Merge pull request #245 from CosmWasm/makefile-cleanups
Browse files Browse the repository at this point in the history
Makefile cleanups
  • Loading branch information
webmaster128 committed Jul 15, 2021
2 parents 67c5f50 + 7578a91 commit 1a18672
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 17 deletions.
26 changes: 9 additions & 17 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,50 +4,42 @@ BUILDERS_PREFIX := cosmwasm/go-ext-builder:0007
USER_ID := $(shell id -u)
USER_GROUP = $(shell id -g)

DLL_EXT = ""
SHARED_LIB_EXT = "" # File extension of the shared library
ifeq ($(OS),Windows_NT)
DLL_EXT = dll
SHARED_LIB_EXT = dll
else
UNAME_S := $(shell uname -s)
ifeq ($(UNAME_S),Linux)
DLL_EXT = so
SHARED_LIB_EXT = so
endif
ifeq ($(UNAME_S),Darwin)
DLL_EXT = dylib
SHARED_LIB_EXT = dylib
endif
endif

all: build test

build: build-rust build-go

# don't strip for now, for better error reporting
# build-rust: build-rust-release strip
build-rust: build-rust-release

# Use debug build for quick testing.
# In order to use "--features backtraces" here we need a Rust nightly toolchain, which we don't have by default
build-rust-debug:
(cd libwasmvm && cargo build)
cp libwasmvm/target/debug/libwasmvm.$(DLL_EXT) api
cp libwasmvm/target/debug/libwasmvm.$(SHARED_LIB_EXT) api
make update-bindings

# use release build to actually ship - smaller and much faster
#
# See https://github.com/CosmWasm/wasmvm/issues/222#issuecomment-880616953 for two approaches to
# enable stripping through cargo (if that is desired).
build-rust-release:
(cd libwasmvm && cargo build --release)
cp libwasmvm/target/release/libwasmvm.$(DLL_EXT) api
cp libwasmvm/target/release/libwasmvm.$(SHARED_LIB_EXT) api
make update-bindings
@ #this pulls out ELF symbols, 80% size reduction!

# implement stripping based on os
ifeq ($(DLL_EXT),so)
strip:
strip api/libwasmvm.so
else
# TODO: add for windows and osx
strip:
endif

build-go:
go build ./...

Expand Down
3 changes: 3 additions & 0 deletions builders/guest/build_linux.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
#!/bin/bash

# See https://github.com/CosmWasm/wasmvm/issues/222#issuecomment-880616953 for two approaches to
# enable stripping through cargo (if that is desired).

cargo build --release
3 changes: 3 additions & 0 deletions builders/guest/build_macos.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,7 @@ export LIBZ_SYS_STATIC=1
export CC=o64-clang
export CXX=o64-clang++

# See https://github.com/CosmWasm/wasmvm/issues/222#issuecomment-880616953 for two approaches to
# enable stripping through cargo (if that is desired).

cargo build --release --target x86_64-apple-darwin
3 changes: 3 additions & 0 deletions builders/guest/build_muslc.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
#!/bin/sh

# See https://github.com/CosmWasm/wasmvm/issues/222#issuecomment-880616953 for two approaches to
# enable stripping through cargo (if that is desired).

cargo build --release --example muslc

0 comments on commit 1a18672

Please sign in to comment.