Skip to content

Commit

Permalink
Fix Makefile to support target/<target-id>/release as BUILD_DIR
Browse files Browse the repository at this point in the history
  • Loading branch information
JEnoch committed Oct 15, 2020
1 parent 1b270c1 commit d88f19e
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 7 deletions.
4 changes: 2 additions & 2 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ pipeline {
agent { label 'MacMini' }
steps {
sh '''
docker run --init --rm -v $(pwd):/workdir -w /workdir --env "CARGOFLAGS=--target=x86_64-unknown-linux-gnu" \
docker run --init --rm -v $(pwd):/workdir -w /workdir --env "TARGET=x86_64-unknown-linux-gnu" \
adlinktech/manylinux2010-x64-rust-nightly make all
'''
}
Expand All @@ -79,7 +79,7 @@ pipeline {
agent { label 'MacMini' }
steps {
sh '''
docker run --init --rm -v $(pwd):/workdir -w /workdir --env "CARGOFLAGS=--target=i686-unknown-linux-gnu" \
docker run --init --rm -v $(pwd):/workdir -w /workdir --env "TARGET=i686-unknown-linux-gnu" \
adlinktech/manylinux2010-i686-rust-nightly make all
'''
}
Expand Down
14 changes: 9 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,18 @@ else
endif
endif

ifneq ($(TARGET),)
TARGET_OPT=--target=$(TARGET)
endif

ifeq ($(BUILD_TYPE),Debug)
BUILD_DIR=target/debug
CARGOFLAGS+=
BUILD_DIR=target/${TARGET}/debug
CARGOFLAGS=
EXAMPLES=zn_sub zn_pub zn_write zn_query zn_eval zn_pull zn_info zn_scout
LDFLAGS=
else
BUILD_DIR=target/release
CARGOFLAGS+= --release
BUILD_DIR=target/${TARGET}/release
CARGOFLAGS=--release
EXAMPLES=zn_sub zn_pub zn_write zn_query zn_eval zn_pull zn_info zn_scout zn_sub_thr zn_pub_thr
LDFLAGS=-O3
endif
Expand All @@ -48,7 +52,7 @@ examples: $(addprefix $(BUILD_DIR)/examples/, $(EXAMPLES))
all: build examples

$(BUILD_DIR)/$(LIB_NAME): src/lib.rs src/net/mod.rs
cargo build ${CARGOFLAGS}
cargo build ${CARGOFLAGS} ${TARGET_OPT}

$(BUILD_DIR)/examples/%: examples/net/%.c include/zenoh/net.h $(BUILD_DIR)/$(LIB_NAME)
$(CC) -o $@ $< -I include -L $(BUILD_DIR) -lzenohc $(CFLAGS) $(LDFLAGS)
Expand Down

0 comments on commit d88f19e

Please sign in to comment.